~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/packagecopier.py

  • Committer: Curtis Hovey
  • Date: 2011-06-08 13:53:29 UTC
  • mfrom: (13176 devel)
  • mto: This revision was merged to the branch mainline in revision 13177.
  • Revision ID: curtis.hovey@canonical.com-20110608135329-5bd42r7afgzcl3lt
Merged devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from canonical.librarian.utils import copy_and_close
29
29
from lp.app.errors import NotFoundError
30
30
from lp.buildmaster.enums import BuildStatus
 
31
from lp.soyuz.adapters.notification import notify
31
32
from lp.soyuz.adapters.packagelocation import build_package_location
32
33
from lp.soyuz.enums import (
33
34
    ArchivePurpose,
509
510
 
510
511
 
511
512
def do_copy(sources, archive, series, pocket, include_binaries=False,
512
 
            allow_delayed_copies=True, person=None, check_permissions=True):
 
513
            allow_delayed_copies=True, person=None, check_permissions=True,
 
514
            send_email=False):
513
515
    """Perform the complete copy of the given sources incrementally.
514
516
 
515
517
    Verifies if each copy can be performed using `CopyChecker` and
534
536
    :param person: the requester `IPerson`.
535
537
    :param check_permissions: boolean indicating whether or not the
536
538
        requester's permissions to copy should be checked.
 
539
    :param send_email: Should we notify for the copy performed?
537
540
 
538
541
    :raise CannotCopy when one or more copies were not allowed. The error
539
542
        will contain the reason why each copy was denied.
569
572
            destination_series = series
570
573
        if source.delayed:
571
574
            delayed_copy = _do_delayed_copy(
572
 
                source, archive, destination_series, pocket, include_binaries)
 
575
                source, archive, destination_series, pocket,
 
576
                include_binaries)
573
577
            sub_copies = [delayed_copy]
574
578
        else:
575
579
            sub_copies = _do_direct_copy(
576
 
                source, archive, destination_series, pocket, include_binaries)
 
580
                source, archive, destination_series, pocket,
 
581
                include_binaries)
 
582
            if send_email:
 
583
                notify(
 
584
                    person, source.sourcepackagerelease, [], [], archive,
 
585
                    destination_series, pocket, changes=None,
 
586
                    action='accepted')
577
587
 
578
588
        copies.extend(sub_copies)
579
589