[Treepkg-commits] r104 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jun 24 20:08:32 CEST 2008


Author: bh
Date: 2008-06-24 20:08:31 +0200 (Tue, 24 Jun 2008)
New Revision: 104

Modified:
   trunk/treepkg/packager.py
Log:
Implement optional signing of .dsc and .changes files


Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2008-06-24 17:59:49 UTC (rev 103)
+++ trunk/treepkg/packager.py	2008-06-24 18:08:31 UTC (rev 104)
@@ -154,6 +154,10 @@
             os.rename(os.path.join(self.work_dir, filename),
                       os.path.join(self.src_dir, filename))
 
+    def sign_package(self):
+        """Signs the .dsc file created buy the instance"""
+        self.track.sign_file(util.listdir_abs(self.src_dir, "*.dsc")[0])
+
     def package(self):
         """Creates a source package from a subversion checkout.
 
@@ -165,6 +169,7 @@
         try:
             self.status.creating_source_package()
             self.do_package()
+            self.sign_package()
             self.status.source_package_created()
         finally:
             logging.info("Removing workdir %r", self.work_dir)
@@ -199,9 +204,14 @@
         util.ensure_directory(self.log_dir)
         logging.info("Building binary package; logging to %r", self.logfile)
         self.track.builder.build(self.dsc_file, self.binary_dir, self.logfile)
+        self.sign_package()
         self.status.binary_package_created()
 
+    def sign_package(self):
+        """Signs the .changes file created buy the instance"""
+        self.track.sign_file(util.listdir_abs(self.binary_dir, "*.changes")[0])
 
+
 class RevisionPackager(object):
 
     source_packager_cls = SourcePackager
@@ -445,7 +455,18 @@
         return [self.revision_packager_cls(self, revision)
                 for revision in self.get_revision_numbers()]
 
+    def sign_file(self, filename):
+        """Signs a file using the debian.sign_file function.
+        The file is signed with the key indicated by the track's
+        signing_key_id attribute.  If that is empty, the file is not
+        signed.
+        """
+        if self.signing_key_id:
+            logging.info("Signing %r with key %r", filename,
+                         self.signing_key_id)
+            debian.sign_file(filename, self.signing_key_id)
 
+
 def import_packager_module(packager_class):
     """Import the packager module named by packager_class.
 



More information about the Treepkg-commits mailing list