changeset 176:7bde59aa611e

Make PBuilder.update_extra_pkg_dir create Release and Release.gpg files
author Bernhard Herzog <bh@intevation.de>
date Tue, 24 Jun 2008 15:10:39 +0000
parents e4512f045999
children df7498d0bd9d
files test/test_builder.py treepkg/builder.py treepkg/packager.py
diffstat 3 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_builder.py	Tue Jun 24 10:20:12 2008 +0000
+++ b/test/test_builder.py	Tue Jun 24 15:10:39 2008 +0000
@@ -339,6 +339,6 @@
         builder.add_binaries_to_extra_pkg([self.minimal_package_deb])
 
         self.assertEquals(sorted(os.listdir(self.extra_pkg_dir)),
-                          ["Packages", "minimal_1.0-1_i386.deb"])
+                          ["Packages", "Release", "minimal_1.0-1_i386.deb"])
         self.check_command_line(['/usr/sbin/pbuilder', 'update',
                                  '--configfile', self.pbuilderrc])
--- a/treepkg/builder.py	Tue Jun 24 10:20:12 2008 +0000
+++ b/treepkg/builder.py	Tue Jun 24 15:10:39 2008 +0000
@@ -46,7 +46,7 @@
     aptcache_dir = util.filenameproperty("aptcache")
     extra_pkg_dir = util.filenameproperty("extra-pkg")
 
-    def __init__(self, pbuilderrc, root_cmd):
+    def __init__(self, pbuilderrc, root_cmd, release_signing_keyid=None):
         """Initialize the PBuilder instance with the configuration file.
         The root_cmd parameter should be a list with a command that can
         be used to get root permissions to run pbuilder.  It may be an
@@ -56,6 +56,7 @@
         """
         self.pbuilderrc = pbuilderrc
         self.root_cmd = root_cmd
+        self.release_signing_keyid = release_signing_keyid
         self.base_dir = os.path.dirname(self.pbuilderrc)
 
     def init_pbuilder(self, distribution, mirrorsite, extramirrors):
@@ -106,6 +107,15 @@
         run.call(cmdexpand("apt-ftparchive packages ."),
                  stdout=open(os.path.join(self.extra_pkg_dir, "Packages"), "w"),
                  cwd=self.extra_pkg_dir)
+        release_filename = os.path.join(self.extra_pkg_dir, "Release")
+        run.call(cmdexpand("apt-ftparchive release ."),
+                 stdout=open(release_filename, "w"), cwd=self.extra_pkg_dir)
+        if self.release_signing_keyid:
+            run.call(cmdexpand("gpg --detach-sign --armor --local-user=$keyid"
+                               " -o $sig $release",
+                               keyid=self.release_signing_keyid,
+                               sig=release_filename + ".gpg",
+                               release=release_filename)),
 
     def build(self, dsc_file, binary_dir, logfile, bindmounts=(),
               extra_packages=(), extra_env=None):
--- a/treepkg/packager.py	Tue Jun 24 10:20:12 2008 +0000
+++ b/treepkg/packager.py	Tue Jun 24 15:10:39 2008 +0000
@@ -300,7 +300,8 @@
         self.name = name
         self.base_dir = base_dir
         self.svn_url = svn_url
-        self.builder = PBuilder(pbuilderrc, root_cmd)
+        self.builder = PBuilder(pbuilderrc, root_cmd,
+                                release_signing_keyid=signing_key_id)
         self.deb_email = deb_email
         self.deb_fullname = deb_fullname
         self.debrevision_prefix = debrevision_prefix
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)