Mercurial > treepkg > treepkg
comparison treepkg/packager.py @ 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 | 7bde59aa611e |
children | e83db4482aab |
comparison
equal
deleted
inserted
replaced
178:b2fa3b0926d0 | 179:952d366f7b14 |
---|---|
152 for filename in [filename for filename in os.listdir(self.work_dir) | 152 for filename in [filename for filename in os.listdir(self.work_dir) |
153 if filename.startswith(pkgbasename)]: | 153 if filename.startswith(pkgbasename)]: |
154 os.rename(os.path.join(self.work_dir, filename), | 154 os.rename(os.path.join(self.work_dir, filename), |
155 os.path.join(self.src_dir, filename)) | 155 os.path.join(self.src_dir, filename)) |
156 | 156 |
157 def sign_package(self): | |
158 """Signs the .dsc file created buy the instance""" | |
159 self.track.sign_file(util.listdir_abs(self.src_dir, "*.dsc")[0]) | |
160 | |
157 def package(self): | 161 def package(self): |
158 """Creates a source package from a subversion checkout. | 162 """Creates a source package from a subversion checkout. |
159 | 163 |
160 After setting up the working directory, this method calls the | 164 After setting up the working directory, this method calls the |
161 do_package method to do the actual packaging. Afterwards the | 165 do_package method to do the actual packaging. Afterwards the |
163 """ | 167 """ |
164 util.ensure_directory(self.work_dir) | 168 util.ensure_directory(self.work_dir) |
165 try: | 169 try: |
166 self.status.creating_source_package() | 170 self.status.creating_source_package() |
167 self.do_package() | 171 self.do_package() |
172 self.sign_package() | |
168 self.status.source_package_created() | 173 self.status.source_package_created() |
169 finally: | 174 finally: |
170 logging.info("Removing workdir %r", self.work_dir) | 175 logging.info("Removing workdir %r", self.work_dir) |
171 shutil.rmtree(self.work_dir) | 176 shutil.rmtree(self.work_dir) |
172 | 177 |
197 self.status.creating_binary_package() | 202 self.status.creating_binary_package() |
198 util.ensure_directory(self.binary_dir) | 203 util.ensure_directory(self.binary_dir) |
199 util.ensure_directory(self.log_dir) | 204 util.ensure_directory(self.log_dir) |
200 logging.info("Building binary package; logging to %r", self.logfile) | 205 logging.info("Building binary package; logging to %r", self.logfile) |
201 self.track.builder.build(self.dsc_file, self.binary_dir, self.logfile) | 206 self.track.builder.build(self.dsc_file, self.binary_dir, self.logfile) |
207 self.sign_package() | |
202 self.status.binary_package_created() | 208 self.status.binary_package_created() |
209 | |
210 def sign_package(self): | |
211 """Signs the .changes file created buy the instance""" | |
212 self.track.sign_file(util.listdir_abs(self.binary_dir, "*.changes")[0]) | |
203 | 213 |
204 | 214 |
205 class RevisionPackager(object): | 215 class RevisionPackager(object): |
206 | 216 |
207 source_packager_cls = SourcePackager | 217 source_packager_cls = SourcePackager |
442 | 452 |
443 def get_revisions(self): | 453 def get_revisions(self): |
444 """Returns RevisionPackager objects for each packaged revision""" | 454 """Returns RevisionPackager objects for each packaged revision""" |
445 return [self.revision_packager_cls(self, revision) | 455 return [self.revision_packager_cls(self, revision) |
446 for revision in self.get_revision_numbers()] | 456 for revision in self.get_revision_numbers()] |
457 | |
458 def sign_file(self, filename): | |
459 """Signs a file using the debian.sign_file function. | |
460 The file is signed with the key indicated by the track's | |
461 signing_key_id attribute. If that is empty, the file is not | |
462 signed. | |
463 """ | |
464 if self.signing_key_id: | |
465 logging.info("Signing %r with key %r", filename, | |
466 self.signing_key_id) | |
467 debian.sign_file(filename, self.signing_key_id) | |
447 | 468 |
448 | 469 |
449 def import_packager_module(packager_class): | 470 def import_packager_module(packager_class): |
450 """Import the packager module named by packager_class. | 471 """Import the packager module named by packager_class. |
451 | 472 |