Merge lp:~cjwatson/launchpad/do-not-expire-phone-overlay into lp:launchpad

Proposed by Colin Watson on 2015-06-08
Status: Merged
Merged at revision: 17553
Proposed branch: lp:~cjwatson/launchpad/do-not-expire-phone-overlay
Merge into: lp:launchpad
Diff against target: 110 lines (+33/-13)
2 files modified
lib/lp/soyuz/scripts/expire_archive_files.py (+20/-11)
lib/lp/soyuz/scripts/tests/test_expire_archive_files.py (+13/-2)
To merge this branch: bzr merge lp:~cjwatson/launchpad/do-not-expire-phone-overlay
Reviewer Review Type Date Requested Status
William Grant code 2015-06-08 Approve on 2015-06-08
Review via email: mp+261438@code.launchpad.net

Commit Message

Don't expire files from ppa:ci-train-ppa-service/ubuntu/stable-phone-overlay, because the Ubuntu phone product is currently released from it.

Description of the Change

Don't expire files from ppa:ci-train-ppa-service/ubuntu/stable-phone-overlay, because the Ubuntu phone product is currently released from it.

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/scripts/expire_archive_files.py'
2--- lib/lp/soyuz/scripts/expire_archive_files.py 2013-06-20 05:50:00 +0000
3+++ lib/lp/soyuz/scripts/expire_archive_files.py 2015-06-08 19:17:23 +0000
4@@ -9,10 +9,11 @@
5 from lp.soyuz.enums import ArchivePurpose
6 from lp.soyuz.model.archive import Archive
7
8-# PPA owners that we never want to expire.
9+# PPA owners or particular PPAs that we never want to expire.
10 BLACKLISTED_PPAS = """
11 adobe-isv
12 chelsea-team
13+ci-train-ppa-service/stable-phone-overlay
14 dennis-team
15 elvis-team
16 fluendo-isv
17@@ -79,9 +80,10 @@
18 AND spr.id = sprf.sourcepackagerelease
19 AND spph.sourcepackagerelease = spr.id
20 AND spph.dateremoved < (
21- CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - interval %s)
22+ CURRENT_TIMESTAMP AT TIME ZONE 'UTC' -
23+ interval %(stay_of_execution)s)
24 AND spph.archive = archive.id
25- AND archive.purpose IN %s
26+ AND archive.purpose IN %(archive_types)s
27 AND lfa.expires IS NULL
28 EXCEPT
29 SELECT sprf.libraryfile
30@@ -97,17 +99,22 @@
31 AND spph.archive = a.id
32 AND p.id = a.owner
33 AND (
34- (p.name IN %s AND a.purpose = %s)
35+ ((p.name IN %(blacklist)s
36+ OR (p.name || '/' || a.name) IN %(blacklist)s)
37+ AND a.purpose = %(ppa)s)
38 OR (a.private IS TRUE
39- AND (p.name || '/' || a.name) NOT IN %s)
40- OR a.purpose NOT IN %s
41+ AND (p.name || '/' || a.name) NOT IN %(whitelist)s)
42+ OR a.purpose NOT IN %(archive_types)s
43 OR dateremoved >
44- CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - interval %s
45+ CURRENT_TIMESTAMP AT TIME ZONE 'UTC' -
46+ interval %(stay_of_execution)s
47 OR dateremoved IS NULL);
48 """ % sqlvalues(
49- stay_of_execution, archive_types, self.blacklist,
50- ArchivePurpose.PPA, self.whitelist, archive_types,
51- stay_of_execution))
52+ stay_of_execution=stay_of_execution,
53+ archive_types=archive_types,
54+ blacklist=self.blacklist,
55+ whitelist=self.whitelist,
56+ ppa=ArchivePurpose.PPA))
57
58 lfa_ids = results.get_all()
59 return lfa_ids
60@@ -152,7 +159,9 @@
61 AND bpph.archive = a.id
62 AND p.id = a.owner
63 AND (
64- (p.name IN %(blacklist)s AND a.purpose = %(ppa)s)
65+ ((p.name IN %(blacklist)s
66+ OR (p.name || '/' || a.name) IN %(blacklist)s)
67+ AND a.purpose = %(ppa)s)
68 OR (a.private IS TRUE
69 AND (p.name || '/' || a.name) NOT IN %(whitelist)s)
70 OR a.purpose NOT IN %(archive_types)s
71
72=== modified file 'lib/lp/soyuz/scripts/tests/test_expire_archive_files.py'
73--- lib/lp/soyuz/scripts/tests/test_expire_archive_files.py 2014-07-08 06:34:37 +0000
74+++ lib/lp/soyuz/scripts/tests/test_expire_archive_files.py 2015-06-08 19:17:23 +0000
75@@ -14,7 +14,6 @@
76 from lp.registry.interfaces.distribution import IDistributionSet
77 from lp.services.config import config
78 from lp.services.log.logger import BufferLogger
79-from lp.soyuz.enums import ArchivePurpose
80 from lp.soyuz.scripts.expire_archive_files import ArchiveExpirer
81 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
82 from lp.testing import TestCaseWithFactory
83@@ -241,7 +240,7 @@
84 self.archive2 = self.factory.makeArchive()
85
86 def testBlacklistingWorks(self):
87- """Test that blacklisted PPAs are not expired."""
88+ """Test that blacklisted PPA owners are not expired."""
89 source, binary = self._setUpExpirablePublications(
90 archive=self.archive)
91 script = self.getScript()
92@@ -251,6 +250,18 @@
93 self.assertSourceNotExpired(source)
94 self.assertBinaryNotExpired(binary)
95
96+ def testBlacklistingArchivesWorks(self):
97+ """Test that blacklisted individual PPAs are not expired."""
98+ source, binary = self._setUpExpirablePublications(
99+ archive=self.archive)
100+ script = self.getScript()
101+ script.blacklist = [
102+ '%s/%s' % (self.archive.owner.name, self.archive.name)]
103+ switch_dbuser(self.dbuser)
104+ script.main()
105+ self.assertSourceNotExpired(source)
106+ self.assertBinaryNotExpired(binary)
107+
108 def testWhitelistingWorks(self):
109 """Test that whitelisted private PPAs are expired anyway."""
110 p3a = self.factory.makeArchive(private=True)