~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=adeuring][bug=808680] Fix a permission error happening when
        initializing a series from multiple parents with publications.

Show diffs side-by-side

added added

removed removed

Lines of Context:
525
525
 
526
526
def do_copy(sources, archive, series, pocket, include_binaries=False,
527
527
            allow_delayed_copies=True, person=None, check_permissions=True,
528
 
            overrides=None, send_email=False, strict_binaries=True):
 
528
            overrides=None, send_email=False, strict_binaries=True,
 
529
            create_dsd_job=True):
529
530
    """Perform the complete copy of the given sources incrementally.
530
531
 
531
532
    Verifies if each copy can be performed using `CopyChecker` and
559
560
    :param send_email: Should we notify for the copy performed?
560
561
    :param strict_binaries: If 'include_binaries' is True then setting this
561
562
        to True will make the copy fail if binaries cannot be also copied.
 
563
    :param create_dsd_job: A boolean indicating whether or not dsd jobs
 
564
        should be created for the copied source publications.
562
565
 
563
566
    :raise CannotCopy when one or more copies were not allowed. The error
564
567
        will contain the reason why each copy was denied.
605
608
                override = overrides[overrides_index]
606
609
            sub_copies = _do_direct_copy(
607
610
                source, archive, destination_series, pocket,
608
 
                include_binaries, override)
 
611
                include_binaries, override, create_dsd_job=create_dsd_job)
609
612
            if send_email:
610
613
                notify(
611
614
                    person, source.sourcepackagerelease, [], [], archive,
619
622
 
620
623
 
621
624
def _do_direct_copy(source, archive, series, pocket, include_binaries,
622
 
                    override=None):
 
625
                    override=None, create_dsd_job=True):
623
626
    """Copy publishing records to another location.
624
627
 
625
628
    Copy each item of the given list of `SourcePackagePublishingHistory`
638
641
        not the published binaries for each given source should be also
639
642
        copied along with the source.
640
643
    :param override: An `IOverride` as per do_copy().
 
644
    :param create_dsd_job: A boolean indicating whether or not a dsd job
 
645
        should be created for the copied source publication.
641
646
 
642
647
    :return: a list of `ISourcePackagePublishingHistory` and
643
648
        `BinaryPackagePublishingHistory` corresponding to the copied
666
671
            assert len(overrides) == 1, (
667
672
                "More than one override encountered, something is wrong.")
668
673
            override = overrides[0]
669
 
        source_copy = source.copyTo(series, pocket, archive, override)
 
674
        source_copy = source.copyTo(
 
675
            series, pocket, archive, override, create_dsd_job)
670
676
        close_bugs_for_sourcepublication(source_copy)
671
677
        copies.append(source_copy)
672
678
    else: