> except (KeyboardInterrupt, SystemExit):
> raise
> @@ -398,7 +473,7 @@
> # the new exception will be handled by the caller just like
> # the one we caught would have been, by failing the upload
> # with no email.
> - self.log.exception("Unhandled exception processing upload")
> + logger.exception("Unhandled exception processing upload")
> upload.reject("Unhandled exception processing upload: %s" % e)
>
> # XXX julian 2007-05-25 bug=29744:
> @@ -416,20 +491,20 @@
> successful = upload.do_accept(notify=notify)
> if not successful:
> result = UploadStatusEnum.REJECTED
> - self.log.info("Rejection during accept. "
> + logger.info("Rejection during accept. "
> "Aborting partial accept.")
...and here
> self.ztm.abort()
>
> if upload.is_rejected:
> - self.log.warn("Upload was rejected:")
> + logger.warn("Upload was rejected:")
> for msg in upload.rejections:
> - self.log.warn("\t%s" % msg)
> + logger.warn("\t%s" % msg)
>
> if self.dry_run:
> - self.log.info("Dry run, aborting transaction.")
> + logger.info("Dry run, aborting transaction.")
> self.ztm.abort()
> else:
> - self.log.info("Committing the transaction and any mails "
> + logger.info("Committing the transaction and any mails "
> "associated with this upload.")
Hi Jelmer,
a nice branch! I have just a few formal nitpicks, see below.
> === modified file 'lib/lp/ archiveuploader /tests/ test_uploadproc essor.py' archiveuploader /tests/ test_uploadproc essor.py 2010-08-06 13:52:46 +0000 archiveuploader /tests/ test_uploadproc essor.py 2010-08-12 21:09:28 +0000
> --- lib/lp/
> +++ lib/lp/
[...]
> + def testSuccess(self): d("bar_ 1.0-1") oad(self. uploadprocessor , upload_dir) kage('bar' , '1.0-1') pub.createMissi ngBuilds( ) getQueueItems( PackageUploadSt atus.ACCEPTED, setDone( ) makeBuilder( ) rmtree( upload_ dir) txn.commit( ) d("bar_ 1.0-1_binary" , leaf_name) context = 'buildd' essor.processBu ildUpload( self.incoming_ folder, leaf_name) txn.commit( ) ls(BuildStatus. FULLYBUILT, build.status) log.read( ).splitlines( ) 1_i386. changes' in log_lines)
> + # Upload a source package
> + upload_dir = self.queueUploa
> + self.processUpl
> + source_pub = self.publishPac
> + [build] = source_
> +
> + # Move the source from the accepted queue.
> + [queue_item] = self.breezy.
> + status=
> + version="1.0-1", name="bar")
> + queue_item.
> +
> + build.jobStarted()
> + build.builder = self.factory.
> +
> + # Upload and accept a binary for the primary archive source.
> + shutil.
> + self.layer.
> + leaf_name = "%d-%d" % (build.id, 60)
> + upload_dir = self.queueUploa
> + queue_entry=
> + self.options.
> + self.options.builds = True
> + self.uploadproc
> + self.layer.
> + self.assertEqua
> + log_lines = build.upload_
> + self.assertTrue(
> + 'INFO: Processing upload bar_1.0-
> + self.assertTrue(
> + 'INFO: Committing the transaction and any mails associated with'
> + 'this upload.')
As already mentioned on IRC, this should be something like
assertTrue( 'INFO.. .' in log_lines)
(And I assume that a ' ' is missing after 'with'.)
> === modified file 'lib/lp/ archiveuploader /uploadprocesso r.py' archiveuploader /uploadprocesso r.py 2010-08-12 17:54:00 +0000 archiveuploader /uploadprocesso r.py 2010-08-12 21:09:28 +0000
> --- lib/lp/
> +++ lib/lp/
[...]
> @@ -184,7 +257,8 @@ debug(" Considering changefile %s" % changes_file) ngesFile( upload_ path, changes_file) ngesFile( upload_ path, changes_file,
> for changes_file in changes_files:
> self.log.
> try:
> - result = self.processCha
> + result = self.processCha
> + self.log)
Our style guide says that we should put all parameters into the second
(and following) line if they don't fit completely into the first line.
[...]
> @@ -376,11 +451,11 @@ reject( "UploadPolicyEr ror escaped upload.process: " debug(" UploadPolicyErr or escaped upload.process", debug(" UploadPolicyErr or escaped upload.process",
> except UploadPolicyError, e:
> upload.
> "%s " % e)
> - self.log.
> + logger.
> exc_info=True)
Again, please move all parameters to the second line.
> except FatalUploadError, e: reject( "UploadError escaped upload.process: %s" % e) debug(" UploadError escaped upload.process", debug(" UploadError escaped upload.process",
> upload.
> - self.log.
> + logger.
> exc_info=True)
...and here too
> except (KeyboardInterrupt, SystemExit): exception( "Unhandled exception processing upload") exception( "Unhandled exception processing upload") reject( "Unhandled exception processing upload: %s" % e) do_accept( notify= notify) m.REJECTED info("Rejection during accept. " info("Rejection during accept. "
> raise
> @@ -398,7 +473,7 @@
> # the new exception will be handled by the caller just like
> # the one we caught would have been, by failing the upload
> # with no email.
> - self.log.
> + logger.
> upload.
>
> # XXX julian 2007-05-25 bug=29744:
> @@ -416,20 +491,20 @@
> successful = upload.
> if not successful:
> result = UploadStatusEnu
> - self.log.
> + logger.
> "Aborting partial accept.")
...and here
> self.ztm.abort() warn("Upload was rejected:") warn("\ t%s" % msg) info("Committin g the transaction and any mails " info("Committin g the transaction and any mails "
>
> if upload.is_rejected:
> - self.log.
> + logger.warn("Upload was rejected:")
> for msg in upload.rejections:
> - self.log.
> + logger.warn("\t%s" % msg)
>
> if self.dry_run:
> - self.log.info("Dry run, aborting transaction.")
> + logger.info("Dry run, aborting transaction.")
> self.ztm.abort()
> else:
> - self.log.
> + logger.
> "associated with this upload.")
...and here.