~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

Merged bug-824435-failure-reporting-2 into bug-824435-failure-reporting-3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from lp.registry.interfaces.pocket import PackagePublishingPocket
42
42
from lp.registry.interfaces.sourcepackage import SourcePackageFileType
43
43
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
 
44
from lp.soyuz.adapters.overrides import UnknownOverridePolicy
44
45
from lp.soyuz.interfaces.archive import MAIN_ARCHIVE_PURPOSES
45
46
from lp.soyuz.interfaces.queue import QueueInconsistentStateError
46
47
 
720
721
    def processUnknownFile(self, uploaded_file):
721
722
        """Apply a set of actions for newly-uploaded (unknown) files.
722
723
 
723
 
        Newly-uploaded files have a default set of overrides to be applied.
724
 
        This reduces the amount of work that archive admins have to do
725
 
        since they override the majority of new uploads with the same
726
 
        values.  The rules for overriding are: (See bug #120052)
727
 
            'contrib' -> 'multiverse'
728
 
            'non-free' -> 'multiverse'
729
 
            everything else -> 'universe'
730
 
        This mainly relates to Debian syncs, where the default component
731
 
        is 'main' but should not be in main for Ubuntu.
 
724
        Here we use the override policy defined in UnknownOverridePolicy.
732
725
 
733
726
        In the case of a PPA, files are not touched.  They are always
734
727
        overridden to 'main' at publishing time, though.
751
744
            # Don't override partner uploads.
752
745
            return
753
746
 
754
 
        component_override_map = {
755
 
            'contrib': 'multiverse',
756
 
            'non-free': 'multiverse',
757
 
            }
758
 
 
759
747
        # Apply the component override and default to universe.
760
 
        uploaded_file.component_name = component_override_map.get(
761
 
            uploaded_file.component_name, 'universe')
 
748
        component_name_override = UnknownOverridePolicy.getComponentOverride(
 
749
            uploaded_file.component_name)
 
750
        uploaded_file.component_name = component_name_override
762
751
 
763
752
    def find_and_apply_overrides(self):
764
753
        """Look for ancestry and overrides information.