~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/archiveuploader/uploadprocessor.py

  • Committer: Steve Kowalik
  • Date: 2011-08-07 04:05:52 UTC
  • mto: This revision was merged to the branch mainline in revision 13626.
  • Revision ID: stevenk@ubuntu.com-20110807040552-mwnxo0flmhvl35e8
Correct the notification based on review comments, and remove request{,ed}
from the function names, switching to create{,d}.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
from sqlobject import SQLObjectNotFound
57
57
from zope.component import getUtility
58
58
 
 
59
from canonical.launchpad.webapp.errorlog import (
 
60
    ErrorReportingUtility,
 
61
    ScriptRequest,
 
62
    )
59
63
from lp.app.errors import NotFoundError
60
64
from lp.archiveuploader.nascentupload import (
61
65
    EarlyReturnUploadError,
 
66
    FatalUploadError,
62
67
    NascentUpload,
63
 
    UploadError,
64
68
    )
65
69
from lp.archiveuploader.uploadpolicy import (
66
70
    BuildDaemonUploadPolicy,
67
71
    UploadPolicyError,
68
72
    )
69
 
from lp.buildmaster.enums import BuildStatus
 
73
from lp.buildmaster.enums import (
 
74
    BuildStatus,
 
75
    )
70
76
from lp.buildmaster.interfaces.buildfarmjob import ISpecificBuildFarmJobSource
71
77
from lp.code.interfaces.sourcepackagerecipebuild import (
72
78
    ISourcePackageRecipeBuild,
74
80
from lp.registry.interfaces.distribution import IDistributionSet
75
81
from lp.registry.interfaces.person import IPersonSet
76
82
from lp.services.log.logger import BufferLogger
77
 
from lp.services.webapp.errorlog import (
78
 
    ErrorReportingUtility,
79
 
    ScriptRequest,
80
 
    )
81
83
from lp.soyuz.interfaces.archive import (
82
84
    IArchiveSet,
83
85
    NoSuchPPA,
368
370
        # The path we want for NascentUpload is the path to the folder
369
371
        # containing the changes file (and the other files referenced by it).
370
372
        changesfile_path = os.path.join(self.upload_path, changes_file)
371
 
        try:
372
 
            upload = NascentUpload.from_changesfile_path(
373
 
                changesfile_path, policy, self.processor.log)
374
 
        except UploadError as e:
375
 
            # We failed to parse the changes file, so we have no key or
376
 
            # Changed-By to notify of the rejection. Just log it and
377
 
            # move on.
378
 
            # XXX wgrant 2011-09-29 bug=499438: With some refactoring we
379
 
            # could do better here: if we have a signature then we have
380
 
            # somebody to email, even if the rest of the file is
381
 
            # corrupt.
382
 
            logger.info(
383
 
                "Failed to parse changes file '%s': %s" % (
384
 
                    os.path.join(self.upload_path, changes_file),
385
 
                    str(e)))
386
 
            return UploadStatusEnum.REJECTED
 
373
        upload = NascentUpload.from_changesfile_path(
 
374
            changesfile_path, policy, self.processor.log)
387
375
 
388
376
        # Reject source upload to buildd upload paths.
389
377
        first_path = relative_path.split(os.path.sep)[0]
413
401
                              "%s " % e)
414
402
                logger.debug(
415
403
                    "UploadPolicyError escaped upload.process", exc_info=True)
 
404
            except FatalUploadError, e:
 
405
                upload.reject("UploadError escaped upload.process: %s" % e)
 
406
                logger.debug(
 
407
                    "UploadError escaped upload.process", exc_info=True)
416
408
            except (KeyboardInterrupt, SystemExit):
417
409
                raise
418
410
            except EarlyReturnUploadError: