2
# Copyright 2009-2015 Canonical, Ltd
3
# Author: Kees Cook, Jamie Strandboge
5
# Reports source packages in a given seed.
7
# DAPPER_EXCLUDE="--src-exclude xorg"
8
# HARDY_EXCLUDE="--src-exclude xorg"
9
# LUCID_EXCLUDE="--src-exclude xorg,libsdl1.2,pulseaudio,libsndfile,libogg,libvorbis,hal,hal-info"
12
# EXCLUDE="$LUCID_EXCLUDE"
14
# ### initial setup for a given release
15
# sudo apt-get install -y germinate
19
# bzr co lp:~ubuntu-core-dev/ubuntu-seeds/ubuntu.$RELEASE
20
# bzr co lp:~ubuntu-core-dev/ubuntu-seeds/platform.$RELEASE
21
# mkdir -p germinate-output/ubuntu.$RELEASE
23
# ### seed output and supported source package generation
24
# cd /scratch/ubuntu/seeds/germinate-output-adjusted/ubuntu.$RELEASE/
26
# germinate -S file:///scratch/ubuntu/seeds/ -s ubuntu.$RELEASE -m http://us.archive.ubuntu.com/ubuntu/ -d $RELEASE,$RELEASE-updates,$RELEASE-security -a i386 -c main,universe,restricted,multiverse
27
# $UCT/scripts/seed-report --debug --release $RELEASE --seed-uri file:///scratch/ubuntu/seeds --germinate-uri file:///scratch/ubuntu/seeds/germinate-output-adjusted $EXCLUDE supported-server,server-ship > /tmp/supported.srcs2
28
# diff -u /tmp/supported.srcs /tmp/supported.srcs2
29
# cp /tmp/supported.srcs2 /tmp/supported.srcs
30
# ### modify seeds and repeat if needed
32
# ### how to search details for doing a seed modify...
33
# cd /scratch/ubuntu/seeds/germinate-output-adjusted/ubuntu.$RELEASE/rdepends
34
# ### for each unwanted source, cd to $SOURCE/ and check seeds:
35
# grep ' seed' * | egrep -v '(Desktop|Extra|Education|Documentation|Dvd|Mobile)'
36
# cd /scratch/ubuntu/seeds/ubuntu.$RELEASE
37
# ### re-arrange seeds
39
# ### specifying a different flavor
40
# germinate -S file:///scratch/ubuntu/seeds/ -s ubuntu-core.$RELEASE -m http://us.archive.ubuntu.com/ubuntu -d $RELEASE -a i386 -c main,restricted,universe,multiverse
41
# $UCT/scripts/seed-report --debug --release $RELEASE --flavor ubuntu-core
42
# --seed-uri file:///scratch/ubuntu/seeds --germinate-uri
43
# file:///scratch/ubuntu/seeds/germinate-output-adjusted $EXCLUDE standard >
44
# /tmp/supported-core.srcs
48
# ubuntu trusty live,server,server-ship,supported
49
# ubuntu trusty minimal (original Ubuntu Core)
50
# ubuntu utopic live,server,server-ship,supported
51
# ubuntu-core utopic minimal
52
# ubuntu-core vivid system-image
53
# ubuntu-touch trusty-vivid touch
55
# * Everything on the server CD
56
# --flavor ubuntu --release <release> server-ship
57
# * Everything in the default install (excluded seeds may need to be updated)
58
# --flavor ubuntu --release trusty server-ship dns-server,lamp-server,print-server,samba-server,postgresql-server,mail-server,tomcat-server,virt-host
59
# * Everything in the default install plus openssh-server
60
# --flavor ubuntu --release trusty server-ship dns-server,lamp-server,print-server,samba-server,postgresql-server,mail-server,tomcat-server,virt-host,openssh-server
66
default_release = 'dapper'
67
default_flavor = 'ubuntu'
68
default_seed_uri = 'http://people.canonical.com/~ubuntu-archive/seeds'
69
default_germinate_uri = 'http://people.canonical.com/~ubuntu-archive/germinate-output'
71
parser = optparse.OptionParser('''%prog [OPTIONS] seed-wanted [seed-excluded]
74
# See all source packages on server CD for trusty
75
$ seed-report ... --release trusty server-ship
77
# See all source packages in default install + openssh on trusty (server-ship
78
# excluding all optional package sets except openssh-server)
79
$ seed-report ... --release trusty server-ship dns-server,lamp-server,print-server,samba-server,postgresql-server,mail-server,tomcat-server,virt-host
81
Note: specified seeds to exclude do not recurse
83
parser.add_option("--binaries", help="Show binary packages instead of source packages", action='store_true')
84
parser.add_option("--debug", help="Show debugging details", action='store_true')
85
parser.add_option("--release", help="Which release to examine (default: %s)" % (default_release), action='store', default=default_release)
86
parser.add_option("--flavor", help="Which flavor to examine (default: %s)" % (default_flavor), action='store', default=default_flavor)
87
parser.add_option("--src-exclude", help="Exclude a specific source package from the report", action='store')
88
parser.add_option("--seed-uri", help="Where to load seed STRUCTURE from (default: %s)" % (default_seed_uri), action='store', metavar="URI", default=default_seed_uri)
89
parser.add_option("--germinate-uri", help="Where to load germinate output from (default: %s)" % (default_germinate_uri), action='store', metavar="URI", default=default_germinate_uri)
90
(opt, args) = parser.parse_args()
98
excluded = args[1].split(',')
103
opt.src_exclude = opt.src_exclude.split(',')
105
def load_structure(structure, path):
106
for line in urllib2.urlopen(os.path.join(path,"STRUCTURE")):
108
if line.startswith('#'):
110
elif line.startswith('include '):
111
load_structure(structure, os.path.join(os.path.dirname(path),line.split(' ',1)[1]))
112
elif line.startswith('feature '):
116
name, values = line.split(':',1)
118
print >>sys.stderr, "Failed to process '%s'" % (line)
122
structure.setdefault(name, [])
123
for item in values.strip().split():
124
structure[name].append(item)
127
def get_germinate(seed_name, depth=0, skip=[], recurse=True):
128
def read_seed_file(fn):
130
for line in urllib2.urlopen(fn):
131
if line.startswith('-'):
137
bin, src, otherstuff = line.split('|',2)
141
if opt.src_exclude and src in opt.src_exclude:
143
print >>sys.stderr, 'excluded src %s (binary %s)' % (src, bin)
152
if seed_name in skip:
154
print >>sys.stderr, 'skipped seed %s' % (seed_name)
158
print >>sys.stderr, "%swant '%s'" % (" " * depth, seed_name)
159
if seed_name not in loaded:
160
filename = '%s/%s.%s/%s' % (opt.germinate_uri, opt.flavor, opt.release, seed_name)
162
print >>sys.stderr, "%s reading '%s'" % (" " * depth, seed_name)
163
read_seed_file(filename)
164
loaded.add(seed_name)
167
for seed in structure[seed_name]:
170
recursive_bins, recursive_srcs = get_germinate(seed, depth+1)
171
bins = bins.union(recursive_bins)
172
srcs = srcs.union(recursive_srcs)
176
# Track which seeds we've already fetched
179
load_structure(structure, '%s/%s.%s' % (opt.seed_uri, opt.flavor, opt.release))
185
for seed in wanted.split(','):
186
bins, srcs = get_germinate(seed)
187
wanted_bins = wanted_bins.union(bins)
188
wanted_srcs = wanted_srcs.union(srcs)
192
excluded_bins = set()
193
excluded_srcs = set()
194
for exclude in excluded:
195
bins, srcs = get_germinate(exclude, recurse=False)
196
excluded_bins = excluded_bins.union(bins)
197
excluded_srcs = excluded_srcs.union(srcs)
199
for src in excluded_srcs:
200
print >>sys.stderr, '\texcluded src %s (from %s)' % (src, exclude)
201
for bin in excluded_bins:
202
print >>sys.stderr, '\texcluded bin %s (from %s)' % (bin, exclude)
204
out_bins = wanted_bins.difference(excluded_bins)
205
out_srcs = wanted_srcs.difference(excluded_srcs)
207
for bin in sorted(out_bins):
210
for src in sorted(out_srcs):