Mercurial > treepkg > treepkg
comparison treepkg/packager.py @ 41:f7ec40638a06
use the enums for the status field of RevisionStatus
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Thu, 15 Mar 2007 21:12:23 +0100 |
parents | 086c68ca51d2 |
children | 3e610233ccfe 38d66dc6a1e5 |
comparison
equal
deleted
inserted
replaced
40:c544903eeced | 41:f7ec40638a06 |
---|---|
152 do_package method to do the actual packaging. Afterwards the | 152 do_package method to do the actual packaging. Afterwards the |
153 work directory is removed. | 153 work directory is removed. |
154 """ | 154 """ |
155 util.ensure_directory(self.work_dir) | 155 util.ensure_directory(self.work_dir) |
156 try: | 156 try: |
157 self.status.status = "creating_source_package" | 157 self.status.creating_source_package() |
158 self.do_package() | 158 self.do_package() |
159 self.status.status = "source_package_created" | 159 self.status.source_package_created() |
160 finally: | 160 finally: |
161 logging.info("Removing workdir %r", self.work_dir) | 161 logging.info("Removing workdir %r", self.work_dir) |
162 shutil.rmtree(self.work_dir) | 162 shutil.rmtree(self.work_dir) |
163 | 163 |
164 def do_package(self): | 164 def do_package(self): |
180 self.binary_dir = binary_dir | 180 self.binary_dir = binary_dir |
181 self.dsc_file = dsc_file | 181 self.dsc_file = dsc_file |
182 self.logfile = logfile | 182 self.logfile = logfile |
183 | 183 |
184 def package(self): | 184 def package(self): |
185 self.status.status = "creating_binary_package" | 185 self.status.creating_binary_package() |
186 util.ensure_directory(self.binary_dir) | 186 util.ensure_directory(self.binary_dir) |
187 logging.info("Building binary package; loging to %r", self.logfile) | 187 logging.info("Building binary package; loging to %r", self.logfile) |
188 cmd = ["/usr/sbin/pbuilder", "build", "--logfile", self.logfile, | 188 cmd = ["/usr/sbin/pbuilder", "build", "--logfile", self.logfile, |
189 "--buildresult", self.binary_dir, self.dsc_file] | 189 "--buildresult", self.binary_dir, self.dsc_file] |
190 run.call(self.pkg_line.root_cmd + cmd, suppress_output=True) | 190 run.call(self.pkg_line.root_cmd + cmd, suppress_output=True) |
191 self.status.status = "binary_package_created" | 191 self.status.binary_package_created() |
192 | 192 |
193 | 193 |
194 class RevisionPackager(object): | 194 class RevisionPackager(object): |
195 | 195 |
196 source_packager_cls = SourcePackager | 196 source_packager_cls = SourcePackager |
234 self.binary_dir, dsc_file, | 234 self.binary_dir, dsc_file, |
235 self.build_log) | 235 self.build_log) |
236 bin_packager.package() | 236 bin_packager.package() |
237 self.status.stop = datetime.datetime.utcnow() | 237 self.status.stop = datetime.datetime.utcnow() |
238 except: | 238 except: |
239 self.status.status = "error" | 239 self.status.error() |
240 self.status.stop = datetime.datetime.utcnow() | 240 self.status.stop = datetime.datetime.utcnow() |
241 raise | 241 raise |
242 | 242 |
243 def remove_package_dir(self): | 243 def remove_package_dir(self): |
244 logging.info("Removing pkgdir %r", self.base_dir) | 244 logging.info("Removing pkgdir %r", self.base_dir) |