~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Colin Watson
  • Date: 2011-08-19 00:25:11 UTC
  • mfrom: (7675.1045.728 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13909.
  • Revision ID: cjwatson@canonical.com-20110819002511-0x8hrqs1ckiqk53g
merge db-devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    )
54
54
from lp.soyuz.scripts.processaccepted import close_bugs_for_sourcepublication
55
55
 
56
 
 
57
56
# XXX cprov 2009-06-12: This function could be incorporated in ILFA,
58
57
# I just don't see a clear benefit in doing that right now.
59
58
def re_upload_file(libraryfile, restricted=False):
525
524
 
526
525
def do_copy(sources, archive, series, pocket, include_binaries=False,
527
526
            allow_delayed_copies=True, person=None, check_permissions=True,
528
 
            overrides=None, send_email=False, strict_binaries=True):
 
527
            overrides=None, send_email=False, strict_binaries=True,
 
528
            close_bugs=True, create_dsd_job=True, announce_from_person=None):
529
529
    """Perform the complete copy of the given sources incrementally.
530
530
 
531
531
    Verifies if each copy can be performed using `CopyChecker` and
557
557
        override must be for the corresponding source in the sources list.
558
558
        Overrides will be ignored for delayed copies.
559
559
    :param send_email: Should we notify for the copy performed?
 
560
    :param announce_from_person: If send_email is True,
 
561
        then send announcement emails with this person as the From:
560
562
    :param strict_binaries: If 'include_binaries' is True then setting this
561
563
        to True will make the copy fail if binaries cannot be also copied.
 
564
    :param close_bugs: A boolean indicating whether or not bugs on the
 
565
        copied publications should be closed.
 
566
    :param create_dsd_job: A boolean indicating whether or not a dsd job
 
567
         should be created for the new source publication.
 
568
 
562
569
 
563
570
    :raise CannotCopy when one or more copies were not allowed. The error
564
571
        will contain the reason why each copy was denied.
605
612
                override = overrides[overrides_index]
606
613
            sub_copies = _do_direct_copy(
607
614
                source, archive, destination_series, pocket,
608
 
                include_binaries, override)
 
615
                include_binaries, override, close_bugs=close_bugs,
 
616
                create_dsd_job=create_dsd_job)
609
617
            if send_email:
610
618
                notify(
611
619
                    person, source.sourcepackagerelease, [], [], archive,
612
620
                    destination_series, pocket, changes=None,
613
 
                    action='accepted')
 
621
                    action='accepted',
 
622
                    announce_from_person=announce_from_person)
614
623
 
615
624
        overrides_index += 1
616
625
        copies.extend(sub_copies)
619
628
 
620
629
 
621
630
def _do_direct_copy(source, archive, series, pocket, include_binaries,
622
 
                    override=None):
 
631
                    override=None, close_bugs=True, create_dsd_job=True):
623
632
    """Copy publishing records to another location.
624
633
 
625
634
    Copy each item of the given list of `SourcePackagePublishingHistory`
638
647
        not the published binaries for each given source should be also
639
648
        copied along with the source.
640
649
    :param override: An `IOverride` as per do_copy().
 
650
    :param close_bugs: A boolean indicating whether or not bugs on the
 
651
        copied publication should be closed.
 
652
    :param create_dsd_job: A boolean indicating whether or not a dsd job
 
653
         should be created for the new source publication.
641
654
 
642
655
    :return: a list of `ISourcePackagePublishingHistory` and
643
656
        `BinaryPackagePublishingHistory` corresponding to the copied
666
679
            assert len(overrides) == 1, (
667
680
                "More than one override encountered, something is wrong.")
668
681
            override = overrides[0]
669
 
        source_copy = source.copyTo(series, pocket, archive, override)
670
 
        close_bugs_for_sourcepublication(source_copy)
 
682
        source_copy = source.copyTo(
 
683
            series, pocket, archive, override, create_dsd_job=create_dsd_job)
 
684
        if close_bugs:
 
685
            close_bugs_for_sourcepublication(source_copy)
671
686
        copies.append(source_copy)
672
687
    else:
673
688
        source_copy = source_in_destination.first()