Package: piuparts
Version: 0.17-1
Severity: wishlist
Tags: patch

When -p option is used, piupats dont use the value of BASETGZ found in
/etc/pbuilderrc or ~/.pbuilderrc.
The attached patch add one function to use this value.

I am not a python programmer, but this works well for my :),
I tried to use logging.info, but dont get the expected results, and then
i commented the line. I hope you understand the idea and use this.
Anyway sorry for mi englsh

nueces...


-- System Information:
Debian Release: testing/unstable
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-1-powerpc
Locale: LANG=es_AR.UTF-8, LC_CTYPE=es_AR.UTF-8 (charmap=UTF-8)

Versions of packages piuparts depends on:
ii  apt                        0.6.45        Advanced front-end for dpkg
ii  debootstrap                0.3.3         Bootstrap a basic Debian system
ii  lsof                       4.77.dfsg.1-3 List open files
ii  python                     2.3.5-11      An interactive high-level object-o

piuparts recommends no packages.

-- no debconf information
--- /usr/sbin/piuparts  2006-06-25 14:03:46.000000000 -0300
+++ piuparts    2006-08-14 01:50:10.000000000 -0300
@@ -863,6 +863,27 @@
     return mirrors
 
 
+def find_pbuilder_basetgz():
+    """Find the base tarball used in the pbuilder configuration file."""
+    basetgz = "/var/cache/pbuilder/base.tgz" #value by default
+    files_config = ["/etc/pbuilderrc"]
+    if "HOME" in os.environ:
+        files_config.append(os.environ["HOME"]+"/.pbuilderrc")
+    for name in files_config:
+        try:
+           f = file(name, "r")
+           for line in f:
+               parts = str.split(line, "=", 1)
+               if len(parts) > 1 and parts[0] == "BASETGZ":
+                   basetgz = str.split(parts[1])[0]
+                   break
+           f.close()
+        except IOError:
+           #logging.info("file %s not found.\n" % name)
+           pass
+    return basetgz
+
+
 def parse_command_line():
     """Parse the command line, change global settings, return non-options."""
     (opts, args) = getopt.getopt(sys.argv[1:], "ab:B:d:hi:I:kl:m:nps:S:t:vV",
@@ -907,7 +928,7 @@
             settings.ignored_files = []
             settings.ignored_patterns = []
         elif opt in ["-p", "--pbuilder"]:
-            settings.basetgz = "/var/cache/pbuilder/base.tgz"
+            settings.basetgz = find_pbuilder_basetgz()
         elif opt in ["-s", "--save"]:
             settings.savetgz = optarg
         elif opt in ["-S", "--save-end-meta"]:

Reply via email to