192
by Ubuntu Archive
Add auto-accept |
1 |
#!/usr/bin/python
|
2 |
import subprocess |
|
3 |
import sys |
|
4 |
import time |
|
5 |
||
6 |
from launchpadlib.launchpad import Launchpad |
|
7 |
||
334
by Colin Watson
kinetic → lunar |
8 |
SERIES = "lunar" |
192
by Ubuntu Archive
Add auto-accept |
9 |
POCKET = "Proposed" |
10 |
QUEUE = "Unapproved" |
|
321.1.1
by Brian Murray
remove obsolete packages and packagesets from the allow lists |
11 |
SEED_WHITELIST = [] |
12 |
PACKAGESET_WHITELIST = {"i386-excludes", "i386-whitelist"} |
|
192
by Ubuntu Archive
Add auto-accept |
13 |
SEEDED_IN_UBUNTU = "/home/ubuntu-archive/ubuntu-dev-tools/seeded-in-ubuntu" |
321.1.1
by Brian Murray
remove obsolete packages and packagesets from the allow lists |
14 |
PACKAGE_WHITELIST = [] |
192
by Ubuntu Archive
Add auto-accept |
15 |
|
16 |
DEBUG = 0 |
|
17 |
if len(sys.argv) > 1 and sys.argv[1] == "debug": |
|
18 |
DEBUG = 1 |
|
19 |
||
20 |
# Connect to Launchpad
|
|
21 |
lp = Launchpad.login_with("auto-accept", "production", version="devel") |
|
22 |
ubuntu = lp.distributions['ubuntu'] |
|
23 |
||
24 |
# Get the primary archive
|
|
25 |
archive = ubuntu.getArchive(name="primary") |
|
26 |
||
27 |
# Get the series
|
|
28 |
series = ubuntu.getSeries(name_or_version=SERIES) |
|
29 |
||
322
by Łukasz 'sil2100' Zemczak
Also auto-accept packages when in pre-release freeze (as this is when it's also useful) |
30 |
if series.status not in ('Active Development', 'Pre-release Freeze'): |
313
by Steve Langasek
Don't auto-accept packages if this is no longer the development release |
31 |
print("Series no longer in active development; not accepting packages") |
32 |
sys.exit(1) |
|
192
by Ubuntu Archive
Add auto-accept |
33 |
|
34 |
# Process the packages
|
|
35 |
for pkg in series.getPackageUploads(status=QUEUE, pocket=POCKET, |
|
36 |
archive=archive): |
|
37 |
||
38 |
# Whitelisted packages
|
|
39 |
if pkg.package_name in PACKAGE_WHITELIST: |
|
40 |
if DEBUG: |
|
41 |
print("%s: Accepting due to whitelist: %s (%s)" % |
|
42 |
(time.asctime(), pkg.package_name, pkg.package_version)) |
|
43 |
pkg.acceptFromQueue() |
|
44 |
||
45 |
# Extract all the packagesets and skip if in any
|
|
46 |
package_sets = set() |
|
47 |
for pkgset in lp.packagesets.setsIncludingSource( |
|
48 |
distroseries=series, sourcepackagename=pkg.package_name): |
|
49 |
package_sets.add(pkgset.name) |
|
50 |
||
252
by Steve Langasek
i386-excludes is a packageset, not a seed, so it needs to be in a different list. Land Iain's local modifications to support this. |
51 |
package_sets -= PACKAGESET_WHITELIST |
192
by Ubuntu Archive
Add auto-accept |
52 |
if package_sets: |
53 |
if DEBUG: |
|
54 |
print("Skipping '%s' because it's in the following packagesets: %s" % |
|
55 |
(pkg.package_name, ", ".join(package_sets))) |
|
56 |
continue
|
|
57 |
||
58 |
# Extract all the seeds and skip if in any
|
|
59 |
seed = subprocess.Popen([SEEDED_IN_UBUNTU, pkg.package_name], |
|
60 |
universal_newlines=True, stdout=subprocess.PIPE, |
|
61 |
stderr=subprocess.PIPE) |
|
62 |
if seed.wait() != 0 or seed.stderr.read(): |
|
63 |
if DEBUG: |
|
64 |
print("Skipping '%s' due to Invalid output from seeded-in-ubuntu: %s" % |
|
65 |
(pkg.package_name, seed.stderr.read().strip())) |
|
66 |
continue
|
|
67 |
||
68 |
seeds = set() |
|
69 |
for line in seed.stdout: |
|
70 |
if not line.startswith(" "): |
|
71 |
continue
|
|
72 |
||
73 |
line = line.strip() |
|
74 |
seed = line.split(":")[0] |
|
75 |
if seed in SEED_WHITELIST: |
|
76 |
continue
|
|
77 |
seeds.add(seed) |
|
78 |
||
79 |
if seeds: |
|
80 |
if DEBUG: |
|
81 |
print("Skipping '%s' because it's seeded on: %s" % |
|
82 |
(pkg.package_name, ", ".join(seeds))) |
|
83 |
continue
|
|
84 |
||
85 |
print("%s: Accepting: %s (%s)" % (time.asctime(), pkg.package_name, |
|
86 |
pkg.package_version)) |
|
87 |
pkg.acceptFromQueue() |