Mercurial > treepkg
changeset 179:952d366f7b14
Implement optional signing of .dsc and .changes files
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 24 Jun 2008 18:08:31 +0000 |
parents | b2fa3b0926d0 |
children | 12e4efd5cc74 |
files | treepkg/packager.py |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/treepkg/packager.py Tue Jun 24 17:59:49 2008 +0000 +++ b/treepkg/packager.py Tue Jun 24 18:08:31 2008 +0000 @@ -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,8 +204,13 @@ 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): @@ -445,6 +455,17 @@ 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.