Merge lp:~delqn/merge-o-matic/augmented-config into lp:merge-o-matic
- augmented-config
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~delqn/merge-o-matic/augmented-config |
Merge into: | lp:merge-o-matic |
Diff against target: |
1363 lines (+294/-167) (has conflicts) 21 files modified
config.sh (+7/-0) cron.daily (+9/-7) deb/version.py (+1/-1) expire-pool.py (+4/-4) generate-diffs.py (+5/-5) generate-dpatches.py (+4/-4) generate-patches.py (+6/-6) grab-merge.sh (+5/-3) mail-bugs.py (+12/-23) manual-status.py (+9/-18) merge-status.py (+11/-16) mom.conf (+41/-0) momlib.py (+101/-30) pack-archive.sh (+3/-1) produce-merges.py (+10/-10) publish-patches.py (+7/-7) stats-graphs.py (+13/-4) stats.py (+6/-6) syndicate.py (+21/-12) update-pool.py (+12/-8) update-sources.py (+7/-2) Text conflict in momlib.py Text conflict in stats-graphs.py Text conflict in syndicate.py Text conflict in update-sources.py |
To merge this branch: | bzr merge lp:~delqn/merge-o-matic/augmented-config |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Core Development Team | Pending | ||
Review via email: mp+22471@code.launchpad.net |
Commit message
Created an additional file to hold all distro-specific parameters. momlib.py will now depend on the configuration file for proper server names, emal addresses etc.
Description of the change
Augmented hard-coded distribution specific values into a python configuration file. Added mom.config and config.sh
With these changes other GNU/Linux distributions would be able to quickly and easily adapt merge-o-matic to their needs.
- 172. By Delyan Raychev
-
Rename config.py to mom.conf
- 173. By Delyan Raychev
-
Committing newly added files
- 174. By Delyan Raychev
-
Committing newly added files - mom.conf, config.sh
- 175. By Delyan Raychev
-
Switching mom.conf to maverick
Unmerged revisions
- 175. By Delyan Raychev
-
Switching mom.conf to maverick
- 174. By Delyan Raychev
-
Committing newly added files - mom.conf, config.sh
- 173. By Delyan Raychev
-
Committing newly added files
- 172. By Delyan Raychev
-
Rename config.py to mom.conf
- 171. By Delyan Raychev <de@pelin>
-
Augmenting hardcoded distro-specific values to a config file; adding config.py and config.sh
Preview Diff
1 | === added file 'config.sh' |
2 | --- config.sh 1970-01-01 00:00:00 +0000 |
3 | +++ config.sh 2010-06-22 18:57:26 +0000 |
4 | @@ -0,0 +1,7 @@ |
5 | +# Config file for cron jobs/shell scripts |
6 | +workingdir="/srv/patches.ubuntu.com/" |
7 | +publichost="https://merges.ubuntu.com/" |
8 | +blacklisturi="http://people.ubuntu.com/~ubuntu-archive/sync-blacklist.txt" |
9 | +dist_upstream="debian" |
10 | +dist_ours="ubuntu" |
11 | +rsync_remote="casey.ubuntu.com" |
12 | |
13 | === modified file 'cron.daily' |
14 | --- cron.daily 2009-12-22 17:54:08 +0000 |
15 | +++ cron.daily 2010-06-22 18:57:26 +0000 |
16 | @@ -19,28 +19,30 @@ |
17 | set -e |
18 | umask 002 |
19 | |
20 | +. config.sh |
21 | + |
22 | if [ "$DEBUG" = "y" ]; then |
23 | QUIET="" |
24 | else |
25 | QUIET="-q" |
26 | |
27 | - if ! mkdir /srv/patches.ubuntu.com/.lock 2>/dev/null; then |
28 | + if ! mkdir $workingdir/.lock 2>/dev/null; then |
29 | echo "LOCKED (another one running?)" |
30 | exit 1 |
31 | fi |
32 | - trap "rmdir /srv/patches.ubuntu.com/.lock" 0 |
33 | + trap "rmdir $workingdir/.lock" 0 |
34 | fi |
35 | |
36 | -cd /srv/patches.ubuntu.com/code |
37 | +cd $workingdir/code |
38 | #bzr update |
39 | |
40 | -cp addcomment.py /srv/patches.ubuntu.com/merges |
41 | +cp addcomment.py $workingdir/merges |
42 | |
43 | # Update the blacklist |
44 | -wget -q -O/srv/patches.ubuntu.com/sync-blacklist.txt http://people.ubuntu.com/~ubuntu-archive/sync-blacklist.txt |
45 | +wget -q -O$workingdir/sync-blacklist.txt $blacklisturi |
46 | |
47 | # Download new packages |
48 | -./update-pool.py $QUIET debian ubuntu |
49 | +./update-pool.py $QUIET $distro_upstream $dist_ours |
50 | |
51 | # Update the Sources files against new packages that have been downloaded. |
52 | ./update-sources.py $QUIET |
53 | @@ -71,4 +73,4 @@ |
54 | ./expire-pool.py $QUIET |
55 | |
56 | # ?! untidy |
57 | -rm -rf /srv/patches.ubuntu.com/unpacked/* |
58 | +rm -rf $workingdir/unpacked/* |
59 | |
60 | === modified file 'deb/version.py' |
61 | --- deb/version.py 2010-05-17 12:48:51 +0000 |
62 | +++ deb/version.py 2010-06-22 18:57:26 +0000 |
63 | @@ -127,7 +127,7 @@ |
64 | |
65 | |
66 | def strcut(str, idx, accept): |
67 | - """Cut characters from str that are entirely in accept.""" |
68 | + """Cut characters from string that are entirely in accept.""" |
69 | ret = "" |
70 | while idx < len(str) and str[idx] in accept: |
71 | ret += str[idx] |
72 | |
73 | === modified file 'expire-pool.py' |
74 | --- expire-pool.py 2009-05-29 07:14:15 +0000 |
75 | +++ expire-pool.py 2010-06-22 18:57:26 +0000 |
76 | @@ -31,14 +31,14 @@ |
77 | |
78 | # Run through our default distribution and use that for the base |
79 | # package names. Expire from all distributions. |
80 | - for component in DISTROS[OUR_DISTRO]["components"]: |
81 | - for source in get_sources(OUR_DISTRO, OUR_DIST, component): |
82 | + for component in config.get("downstream", "components").split(): |
83 | + for source in get_sources(config.get("downstream", "name"), config.get("downstream", "dist"), component): |
84 | base = get_base(source) |
85 | logging.debug("%s %s", source["Package"], source["Version"]) |
86 | logging.debug("base is %s", base) |
87 | |
88 | for distro in distros: |
89 | - if DISTROS[distro]["expire"]: |
90 | + if config.get(distro, "expire"): |
91 | expire_pool_sources(distro, source["Package"], base) |
92 | |
93 | |
94 | @@ -96,7 +96,7 @@ |
95 | logging.debug("Not removing %s/%s", pooldir, name) |
96 | continue |
97 | |
98 | - tree.remove("%s/%s/%s" % (ROOT, pooldir, name)) |
99 | + tree.remove("%s/%s/%s" % (config.get("filesystem", "workingroot"), pooldir, name)) |
100 | logging.debug("Removed %s/%s", pooldir, name) |
101 | |
102 | update_pool_sources(distro, package) |
103 | |
104 | === modified file 'generate-diffs.py' |
105 | --- generate-diffs.py 2009-12-02 01:38:43 +0000 |
106 | +++ generate-diffs.py 2010-06-22 18:57:26 +0000 |
107 | @@ -43,8 +43,8 @@ |
108 | # For each package in the given distributions, iterate the pool in order |
109 | # and generate a diff from the previous version and a changes file |
110 | for distro in distros: |
111 | - for dist in DISTROS[distro]["dists"]: |
112 | - for component in DISTROS[distro]["components"]: |
113 | + for dist in config.get(distro, "dists").split(): |
114 | + for component in config.get(distro, "components").split(): |
115 | if options.component is not None \ |
116 | and component not in options.component: |
117 | continue |
118 | @@ -80,10 +80,10 @@ |
119 | try: |
120 | save_changes_file(changes_filename, this, last) |
121 | logging.info("Saved changes file: %s", |
122 | - tree.subdir(ROOT, changes_filename)) |
123 | + tree.subdir(config.get("filesystem", "workingroot"), changes_filename)) |
124 | except (ValueError, OSError): |
125 | logging.error("dpkg-genchanges for %s failed", |
126 | - tree.subdir(ROOT, changes_filename)) |
127 | + tree.subdir(config.get("filesystem", "workingroot"), changes_filename)) |
128 | |
129 | if last is None: |
130 | return |
131 | @@ -95,7 +95,7 @@ |
132 | unpack_source(last) |
133 | save_patch_file(diff_filename, last, this) |
134 | save_basis(diff_filename, last["Version"]) |
135 | - logging.info("Saved diff file: %s", tree.subdir(ROOT, diff_filename)) |
136 | + logging.info("Saved diff file: %s", tree.subdir(config.get("filesystem", "workingroot"), diff_filename)) |
137 | |
138 | |
139 | if __name__ == "__main__": |
140 | |
141 | === modified file 'generate-dpatches.py' |
142 | --- generate-dpatches.py 2009-12-02 01:38:43 +0000 |
143 | +++ generate-dpatches.py 2010-06-22 18:57:26 +0000 |
144 | @@ -43,8 +43,8 @@ |
145 | # For each package in the given distributions, iterate the pool in order |
146 | # and extract patches from debian/patches |
147 | for distro in distros: |
148 | - for dist in DISTROS[distro]["dists"]: |
149 | - for component in DISTROS[distro]["components"]: |
150 | + for dist in config.get(distro, "dists").split(): |
151 | + for component in config.get(distro, "components").split(): |
152 | if options.component is not None \ |
153 | and component not in options.component: |
154 | continue |
155 | @@ -67,7 +67,7 @@ |
156 | logging.debug("%s: %s %s", distro, source["Package"], source["Version"]) |
157 | |
158 | stamp = "%s/%s/dpatch-stamp-%s" \ |
159 | - % (ROOT, source["Directory"], source["Version"]) |
160 | + % (config.get("filesystem", "workingroot"), source["Directory"], source["Version"]) |
161 | |
162 | if not os.path.isfile(stamp): |
163 | open(stamp, "w").close() |
164 | @@ -76,7 +76,7 @@ |
165 | try: |
166 | dirname = dpatch_directory(distro, source) |
167 | extract_dpatches(dirname, source) |
168 | - logging.info("Saved dpatches: %s", tree.subdir(ROOT, dirname)) |
169 | + logging.info("Saved dpatches: %s", tree.subdir(config.get("filesystem", "workingroot"), dirname)) |
170 | finally: |
171 | cleanup_source(source) |
172 | |
173 | |
174 | === modified file 'generate-patches.py' |
175 | --- generate-patches.py 2009-12-02 01:38:43 +0000 |
176 | +++ generate-patches.py 2010-06-22 18:57:26 +0000 |
177 | @@ -31,17 +31,17 @@ |
178 | help="Force creation of patches") |
179 | |
180 | parser.add_option("-D", "--source-distro", type="string", metavar="DISTRO", |
181 | - default=SRC_DISTRO, |
182 | + default=config.get("upstream", "name"), |
183 | help="Source distribution") |
184 | parser.add_option("-S", "--source-suite", type="string", metavar="SUITE", |
185 | - default=SRC_DIST, |
186 | + default=config.get("upstream", "dist"), |
187 | help="Source suite (aka distrorelease)") |
188 | |
189 | parser.add_option("-d", "--dest-distro", type="string", metavar="DISTRO", |
190 | - default=OUR_DISTRO, |
191 | + default=config.get("downstream", "name"), |
192 | help="Destination distribution") |
193 | parser.add_option("-s", "--dest-suite", type="string", metavar="SUITE", |
194 | - default=OUR_DIST, |
195 | + default=config.get("downstream", "dist"), |
196 | help="Destination suite (aka distrorelease)") |
197 | |
198 | parser.add_option("-p", "--package", type="string", metavar="PACKAGE", |
199 | @@ -63,7 +63,7 @@ |
200 | # For each package in the destination distribution, locate the latest in |
201 | # the source distribution; calculate the base from the destination and |
202 | # create patches from that to both |
203 | - for our_component in DISTROS[our_distro]["components"]: |
204 | + for our_component in config.get("downstream", "components").split(): |
205 | if options.component is not None \ |
206 | and our_component not in options.component: |
207 | continue |
208 | @@ -165,7 +165,7 @@ |
209 | ensure(filename) |
210 | save_patch_file(filename, base_source, our_source) |
211 | save_basis(filename, base_version) |
212 | - logging.info("Saved patch file: %s", tree.subdir(ROOT, filename)) |
213 | + logging.info("Saved patch file: %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
214 | |
215 | |
216 | if __name__ == "__main__": |
217 | |
218 | === modified file 'grab-merge.sh' |
219 | --- grab-merge.sh 2009-02-27 12:05:36 +0000 |
220 | +++ grab-merge.sh 2010-06-22 18:57:26 +0000 |
221 | @@ -16,6 +16,8 @@ |
222 | # You should have received a copy of the GNU General Public License |
223 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
224 | |
225 | +. config.sh |
226 | + |
227 | # Uncomment if you have an account on casey |
228 | #RSYNC=y |
229 | |
230 | @@ -49,14 +51,14 @@ |
231 | |
232 | if [ "$RSYNC" = "y" ]; then |
233 | rsync --verbose --archive --progress --compress --delete \ |
234 | - casey.ubuntu.com:/srv/patches.ubuntu.com/merges/$HASH/$MERGE/ . |
235 | + $rsync_remote:$workingdir/merges/$HASH/$MERGE/ . |
236 | else |
237 | rm -rf * |
238 | - wget -q https://merges.ubuntu.com/$HASH/$MERGE/REPORT |
239 | + wget -q $publichost$HASH/$MERGE/REPORT |
240 | |
241 | for NAME in $(sed -n -e "/^ /p" REPORT); do |
242 | echo "Getting $NAME..." |
243 | - [ -f $NAME ] || wget -q https://merges.ubuntu.com/$HASH/$MERGE/$NAME |
244 | + [ -f $NAME ] || wget -q $publichost$HASH/$MERGE/$NAME |
245 | done |
246 | fi |
247 | echo |
248 | |
249 | === modified file 'mail-bugs.py' |
250 | --- mail-bugs.py 2008-02-12 17:26:46 +0000 |
251 | +++ mail-bugs.py 2010-06-22 18:57:26 +0000 |
252 | @@ -34,21 +34,12 @@ |
253 | from deb.version import Version |
254 | |
255 | |
256 | -# Order of severities |
257 | -SEVERITY = [ "unknown", "critical", "grave", "serious", "important", "normal", |
258 | - "minor", "wishlist" ] |
259 | - |
260 | -# Who to send to |
261 | -RECIPIENTS = [ "ubuntu-archive@lists.ubuntu.com", |
262 | - "ubuntu-devel@lists.ubuntu.com" ] |
263 | - |
264 | - |
265 | def options(parser): |
266 | parser.add_option("-d", "--distro", type="string", metavar="DISTRO", |
267 | - default=SRC_DISTRO, |
268 | + default=config.get("upstream", "name"), |
269 | help="Distribution to mail bug closures for") |
270 | parser.add_option("-s", "--suite", type="string", metavar="SUITE", |
271 | - default=SRC_DIST, |
272 | + default=config.get("upstream", "dist"), |
273 | help="Suite (aka distrorelease)") |
274 | |
275 | def main(options, args): |
276 | @@ -59,7 +50,7 @@ |
277 | |
278 | # For each package in the distribution, iterate the pool and read each |
279 | # changes file to obtain the list of closed bugs. |
280 | - for component in DISTROS[distro]["components"]: |
281 | + for component in config.get("upstream", "components").split(): |
282 | for source in get_sources(distro, dist, component): |
283 | package = source["Package"] |
284 | |
285 | @@ -142,9 +133,7 @@ |
286 | severity = "unknown" |
287 | |
288 | logging.debug("Severity: %s", severity) |
289 | - if severity in SEVERITY: |
290 | - severity = SEVERITY.index(severity) |
291 | - else: |
292 | + if not severity in config.get("misc", "severity"): |
293 | severity = 0 |
294 | |
295 | return (severity, package, bug, title) |
296 | @@ -163,7 +152,7 @@ |
297 | if len(str(bug)) > max_bug: |
298 | max_bug = len(str(bug)) |
299 | |
300 | - for idx, severity in enumerate(SEVERITY): |
301 | + for idx, severity in enumerate(config.get("misc", "severity")): |
302 | closures = [ bug for bug in bugs if bug[0] == idx ] |
303 | if not len(closures): |
304 | continue |
305 | @@ -178,13 +167,13 @@ |
306 | text += "\n" |
307 | |
308 | message = MIMEText(text) |
309 | - message.add_header("From", "Ubuntu Merge-o-Matic <mom@ubuntu.com>") |
310 | - message.add_header("To", "Ubuntu Merge-o-Matic <mom@ubuntu.com>") |
311 | + message.add_header("From", config.get("email", "fromheader")) |
312 | + message.add_header("To", config.get("email", "toheader")) |
313 | message.add_header("Date", formatdate()) |
314 | - message.add_header("Subject", "Bugs closed in Debian") |
315 | + message.add_header("Subject", config.get("email", "subject")) |
316 | message.add_header("Message-ID", make_msgid()) |
317 | |
318 | - send_message(message, RECIPIENTS) |
319 | + send_message(message, config.get("email", "recipients")) |
320 | |
321 | def send_message(message, recipients): |
322 | """Send out a message to everyone subscribed to it.""" |
323 | @@ -194,7 +183,7 @@ |
324 | logging.debug("Sending to %s", addr) |
325 | message.replace_header("To", addr) |
326 | |
327 | - smtp.sendmail("mom@ubuntu.com", addr , message.as_string()) |
328 | + smtp.sendmail(config.get("email", "smtphost"), addr , message.as_string()) |
329 | |
330 | smtp.quit() |
331 | |
332 | @@ -202,7 +191,7 @@ |
333 | def read_watermark(distro, package): |
334 | """Read the watermark for a given package.""" |
335 | mark_file = "%s/%s/bugs-watermark" \ |
336 | - % (ROOT, pool_directory(distro, package)) |
337 | + % (config.get("filesystem", "workingroot"), pool_directory(distro, package)) |
338 | if not os.path.isfile(mark_file): |
339 | return Version("0") |
340 | |
341 | @@ -215,7 +204,7 @@ |
342 | def save_watermark(distro, package, version): |
343 | """Save the watermark for a given packagesource.""" |
344 | mark_file = "%s/%s/bugs-watermark" \ |
345 | - % (ROOT, pool_directory(distro, package)) |
346 | + % (config.get("filesystem", "workingroot"), pool_directory(distro, package)) |
347 | mark = open(mark_file, "w") |
348 | try: |
349 | print >>mark, "%s" % version |
350 | |
351 | === modified file 'manual-status.py' |
352 | --- manual-status.py 2009-03-02 15:33:48 +0000 |
353 | +++ manual-status.py 2010-06-22 18:57:26 +0000 |
354 | @@ -25,28 +25,19 @@ |
355 | from momlib import * |
356 | |
357 | |
358 | -# Order of priorities |
359 | -PRIORITY = [ "unknown", "required", "important", "standard", "optional", |
360 | - "extra" ] |
361 | -COLOURS = [ "#ff8080", "#ffb580", "#ffea80", "#dfff80", "#abff80", "#80ff8b" ] |
362 | - |
363 | -# Sections |
364 | -SECTIONS = [ "new", "updated" ] |
365 | - |
366 | - |
367 | def options(parser): |
368 | parser.add_option("-D", "--source-distro", type="string", metavar="DISTRO", |
369 | - default=SRC_DISTRO, |
370 | + default=config.get("upstream", "name"), |
371 | help="Source distribution") |
372 | parser.add_option("-S", "--source-suite", type="string", metavar="SUITE", |
373 | - default=SRC_DIST, |
374 | + default=config.get("upstream", "dist"), |
375 | help="Source suite (aka distrorelease)") |
376 | |
377 | parser.add_option("-d", "--dest-distro", type="string", metavar="DISTRO", |
378 | - default=OUR_DISTRO, |
379 | + default=config.get("downstream", "name"), |
380 | help="Destination distribution") |
381 | parser.add_option("-s", "--dest-suite", type="string", metavar="SUITE", |
382 | - default=OUR_DIST, |
383 | + default=config.get("downstream", "dist"), |
384 | help="Destination suite (aka distrorelease)") |
385 | |
386 | parser.add_option("-c", "--component", type="string", metavar="COMPONENT", |
387 | @@ -62,7 +53,7 @@ |
388 | |
389 | # For each package in the destination distribution, find out whether |
390 | # there's an open merge, and if so add an entry to the table for it. |
391 | - for our_component in DISTROS[our_distro]["components"]: |
392 | + for our_component in config.get("downstream", "components").split(): |
393 | if options.component is not None \ |
394 | and our_component not in options.component: |
395 | continue |
396 | @@ -114,7 +105,7 @@ |
397 | multi_para=False, signed=False).para |
398 | |
399 | user = info["Changed-By"] |
400 | - uploaded = info["Distribution"] == OUR_DIST |
401 | + uploaded = info["Distribution"] == config.get("downstream", "dist") |
402 | else: |
403 | user = None |
404 | uploaded = False |
405 | @@ -131,7 +122,7 @@ |
406 | |
407 | write_status_page(our_component, merges, our_distro, src_distro) |
408 | |
409 | - status_file = "%s/merges/tomerge-%s-manual" % (ROOT, our_component) |
410 | + status_file = "%s/merges/tomerge-%s-manual" % (config.get("filesystem", "workingroot"), our_component) |
411 | remove_old_comments(status_file, merges) |
412 | write_status_file(status_file, merges) |
413 | |
414 | @@ -140,7 +131,7 @@ |
415 | """Write out the manual merge status page.""" |
416 | merges.sort() |
417 | |
418 | - status_file = "%s/merges/%s-manual.html" % (ROOT, component) |
419 | + status_file = "%s/merges/%s-manual.html" % (config.get("filesystem", "workingroot"), component) |
420 | status = open(status_file + ".new", "w") |
421 | try: |
422 | print >>status, "<html>" |
423 | @@ -214,7 +205,7 @@ |
424 | return None |
425 | |
426 | filename = "%s/pool/%s/%s/%s/%s" \ |
427 | - % (ROOT, distro, pathhash(source["Package"]), source["Package"], |
428 | + % (config.get("filesystem", "workingroot"), distro, pathhash(source["Package"]), source["Package"], |
429 | dsc_file) |
430 | |
431 | (a, b, c) = os.popen3("gpg --verify %s" % filename) |
432 | |
433 | === modified file 'merge-status.py' |
434 | --- merge-status.py 2010-03-03 07:30:07 +0000 |
435 | +++ merge-status.py 2010-06-22 18:57:26 +0000 |
436 | @@ -27,28 +27,23 @@ |
437 | from momlib import * |
438 | |
439 | |
440 | -# Order of priorities |
441 | -PRIORITY = [ "unknown", "required", "important", "standard", "optional", |
442 | - "extra" ] |
443 | -COLOURS = [ "#ff8080", "#ffb580", "#ffea80", "#dfff80", "#abff80", "#80ff8b" ] |
444 | - |
445 | # Sections |
446 | SECTIONS = [ "outstanding", "new", "updated" ] |
447 | |
448 | |
449 | def options(parser): |
450 | parser.add_option("-D", "--source-distro", type="string", metavar="DISTRO", |
451 | - default=SRC_DISTRO, |
452 | + default=config.get("upstream", "name"), |
453 | help="Source distribution") |
454 | parser.add_option("-S", "--source-suite", type="string", metavar="SUITE", |
455 | - default=SRC_DIST, |
456 | + default=config.get("upstream", "dist"), |
457 | help="Source suite (aka distrorelease)") |
458 | |
459 | parser.add_option("-d", "--dest-distro", type="string", metavar="DISTRO", |
460 | - default=OUR_DISTRO, |
461 | + default=config.get("downstream", "name"), |
462 | help="Destination distribution") |
463 | parser.add_option("-s", "--dest-suite", type="string", metavar="SUITE", |
464 | - default=OUR_DIST, |
465 | + default=config.get("downstream", "dist"), |
466 | help="Destination suite (aka distrorelease)") |
467 | |
468 | parser.add_option("-c", "--component", type="string", metavar="COMPONENT", |
469 | @@ -63,10 +58,10 @@ |
470 | our_dist = options.dest_suite |
471 | |
472 | outstanding = [] |
473 | - if os.path.isfile("%s/outstanding-merges.txt" % ROOT): |
474 | + if os.path.isfile("%s/outstanding-merges.txt" % config.get("filesystem", "workingroot")): |
475 | after_uvf = True |
476 | |
477 | - f = open("%s/outstanding-merges.txt" % ROOT) |
478 | + f = open("%s/outstanding-merges.txt" % config.get("filesystem", "workingroot")) |
479 | try: |
480 | for line in f: |
481 | outstanding.append(line.strip()) |
482 | @@ -78,7 +73,7 @@ |
483 | |
484 | # For each package in the destination distribution, find out whether |
485 | # there's an open merge, and if so add an entry to the table for it. |
486 | - for our_component in DISTROS[our_distro]["components"]: |
487 | + for our_component in config.get("downstream", "components").split(): |
488 | if options.component is not None \ |
489 | and our_component not in options.component: |
490 | continue |
491 | @@ -116,7 +111,7 @@ |
492 | except KeyError: |
493 | user = None |
494 | try: |
495 | - uploaded = info["Distribution"] == OUR_DIST |
496 | + uploaded = info["Distribution"] == config.get("downstream", "dist") |
497 | except KeyError: |
498 | uploaded = False |
499 | else: |
500 | @@ -142,7 +137,7 @@ |
501 | |
502 | write_status_page(our_component, merges, our_distro, src_distro) |
503 | |
504 | - status_file = "%s/merges/tomerge-%s" % (ROOT, our_component) |
505 | + status_file = "%s/merges/tomerge-%s" % (config.get("filesystem", "workingroot"), our_component) |
506 | remove_old_comments(status_file, merges) |
507 | write_status_file(status_file, merges) |
508 | |
509 | @@ -157,7 +152,7 @@ |
510 | return None |
511 | |
512 | filename = "%s/pool/%s/%s/%s/%s" \ |
513 | - % (ROOT, distro, pathhash(source["Package"]), source["Package"], |
514 | + % (config.get("filesystem", "workingroot"), distro, pathhash(source["Package"]), source["Package"], |
515 | dsc_file) |
516 | |
517 | (a, b, c) = os.popen3("gpg --verify %s" % filename) |
518 | @@ -170,7 +165,7 @@ |
519 | |
520 | def write_status_page(component, merges, left_distro, right_distro): |
521 | """Write out the merge status page.""" |
522 | - status_file = "%s/merges/%s.html" % (ROOT, component) |
523 | + status_file = "%s/merges/%s.html" % (config.get("filesystem", "workingroot"), component) |
524 | status = open(status_file + ".new", "w") |
525 | try: |
526 | print >>status, "<html>" |
527 | |
528 | === added file 'mom.conf' |
529 | --- mom.conf 1970-01-01 00:00:00 +0000 |
530 | +++ mom.conf 2010-06-22 18:57:26 +0000 |
531 | @@ -0,0 +1,41 @@ |
532 | +[filesystem] |
533 | +workingroot: /srv/patches.ubuntu.com |
534 | + |
535 | +# Distribution definitions |
536 | +[upstream] |
537 | +name: debian |
538 | +mirror: http://ftp.uk.debian.org/debian |
539 | +dist: unstable |
540 | +dists: unstable testing testing-proposed-updates experimental |
541 | +components: main contrib non-free |
542 | +expire: True |
543 | + |
544 | +[downstream] |
545 | +name: ubuntu |
546 | +mirror: http://archive.ubuntu.com/ubuntu |
547 | +dist: maverick |
548 | +dists: maverick |
549 | +components: main restricted universe multiverse |
550 | +expire: True |
551 | + |
552 | +[email] |
553 | +# Who to send to |
554 | +recipients: ubuntu-archive@lists.ubuntu.com ubuntu-devel@lists.ubuntu.com |
555 | +fromheader: "Ubuntu Merge-o-Matic <mom@ubuntu.com>" |
556 | +toheader: "Ubuntu Merge-o-Matic <mom@ubuntu.com>" |
557 | +subject: "Bugs closed in Debian" |
558 | +smtphost: mom@ubuntu.com |
559 | + |
560 | +[misc] |
561 | +# Time format for RSS feeds |
562 | +rss_time_format: "%a, %d %b %Y %H:%M:%S %Z" |
563 | + |
564 | +severity: unknown critical grave serious important normal minor wishlist |
565 | + |
566 | +priority: unknown required important standard optional extra |
567 | + |
568 | +sections: new updated |
569 | + |
570 | +colours: #ff8080 #ffb580 #ffea80 #dfff80 #abff80 #80ff8b |
571 | + |
572 | + |
573 | |
574 | === modified file 'momlib.py' |
575 | --- momlib.py 2010-05-17 12:48:51 +0000 |
576 | +++ momlib.py 2010-06-22 18:57:26 +0000 |
577 | @@ -34,12 +34,14 @@ |
578 | from deb.controlfile import ControlFile |
579 | from deb.version import Version |
580 | from util import shell, tree |
581 | +from ConfigParser import ConfigParser |
582 | |
583 | try: |
584 | from xml.etree import ElementTree |
585 | except ImportError: |
586 | from elementtree import ElementTree |
587 | |
588 | +<<<<<<< TREE |
589 | |
590 | # Output root |
591 | ROOT = "/srv/patches.ubuntu.com" |
592 | @@ -96,6 +98,66 @@ |
593 | # Time format for RSS feeds |
594 | RSS_TIME_FORMAT = "%a, %d %b %Y %H:%M:%S %Z" |
595 | |
596 | +======= |
597 | +# Setup our config reading |
598 | +config = ConfigParser() |
599 | +momConfigFile = 'mom.conf' |
600 | +config.read(momConfigFile) |
601 | + |
602 | +# Check whether the config file has everything necessary for merge-o-matic |
603 | +if not config.has_section("filesystem"): |
604 | + print momConfigFile + ' is missing section [filesystem]' |
605 | +else: |
606 | + if not config.has_option("filesystem", "workingroot"): |
607 | + print momConfigFile + ' is missing option "workingroot" in section [filesystem]' |
608 | + sys.exit() |
609 | + |
610 | +if not config.has_section("upstream"): |
611 | + print momConfigFile + ' is missing section [upstream]' |
612 | + sys.exit() |
613 | +else: |
614 | + if not config.has_option("upstream", "name"): |
615 | + print momConfigFile + ' is missing option "name" in section [upstream]' |
616 | + sys.exit() |
617 | + if not config.has_option("upstream", "mirror"): |
618 | + print momConfigFile + ' is missing option "mirror" in section [upstream]' |
619 | + sys.exit() |
620 | + if not config.has_option("upstream", "dist"): |
621 | + print momConfigFile + ' is missing option "dist" in section [upstream]' |
622 | + sys.exit() |
623 | + if not config.has_option("upstream", "dists"): |
624 | + print momConfigFile + ' is missing option "dists" in section [upstream]' |
625 | + sys.exit() |
626 | + if not config.has_option("upstream", "components"): |
627 | + print momConfigFile + ' is missing option "components" in section [upstream]' |
628 | + sys.exit() |
629 | + if not config.has_option("upstream", "expire"): |
630 | + print momConfigFile + ' is missing option "expire" in section [upstream]' |
631 | + sys.exit() |
632 | + |
633 | +if not config.has_section("downstream"): |
634 | + print momConfigFile + ' is missing section [downstream]' |
635 | + sys.exit() |
636 | +else: |
637 | + if not config.has_option("downstream", "name"): |
638 | + print momConfigFile + ' is missing option "name" in section [downstream]' |
639 | + sys.exit() |
640 | + if not config.has_option("downstream", "mirror"): |
641 | + print momConfigFile + ' is missing option "mirror" in section [downstream]' |
642 | + sys.exit() |
643 | + if not config.has_option("downstream", "dist"): |
644 | + print momConfigFile + ' is missing option "dist" in section [downstream]' |
645 | + sys.exit() |
646 | + if not config.has_option("downstream", "dists"): |
647 | + print momConfigFile + ' is missing option "dists" in section [downstream]' |
648 | + sys.exit() |
649 | + if not config.has_option("downstream", "components"): |
650 | + print momConfigFile + ' is missing option "components" in section [downstream]' |
651 | + sys.exit() |
652 | + if not config.has_option("downstream", "expire"): |
653 | + print momConfigFile + ' is missing option "expire" in section [downstream]' |
654 | + sys.exit() |
655 | +>>>>>>> MERGE-SOURCE |
656 | |
657 | # Cache of parsed sources files |
658 | SOURCES_CACHE = {} |
659 | @@ -131,6 +193,7 @@ |
660 | """Ensure that the parent directories for path exist.""" |
661 | dirname = os.path.dirname(path) |
662 | if not os.path.isdir(dirname): |
663 | +<<<<<<< TREE |
664 | try: |
665 | os.makedirs(dirname) |
666 | except IOError, e: |
667 | @@ -139,6 +202,16 @@ |
668 | print e |
669 | finally: |
670 | exit(1) |
671 | +======= |
672 | + try: |
673 | + os.makedirs(dirname) |
674 | + except OSError, e: |
675 | + print e |
676 | + exit(1) |
677 | + except IOError, e: |
678 | + print e |
679 | + exit(1) |
680 | +>>>>>>> MERGE-SOURCE |
681 | |
682 | def pathhash(path): |
683 | """Return the path hash component for path.""" |
684 | @@ -148,11 +221,11 @@ |
685 | return path[:1] |
686 | |
687 | def cleanup(path): |
688 | - """Remove the path and any empty directories up to ROOT.""" |
689 | + """Remove the path and any empty directories up to workingroot.""" |
690 | tree.remove(path) |
691 | |
692 | (dirname, basename) = os.path.split(path) |
693 | - while dirname != ROOT: |
694 | + while dirname != config.get("filesystem", "workingroot"): |
695 | try: |
696 | os.rmdir(dirname) |
697 | except OSError, e: |
698 | @@ -173,7 +246,7 @@ |
699 | |
700 | def sources_file(distro, dist, component): |
701 | """Return the location of a local Sources file.""" |
702 | - return "%s/dists/%s-%s/%s/source/Sources.gz" % (ROOT, distro, dist, |
703 | + return "%s/dists/%s-%s/%s/source/Sources.gz" % (config.get("filesystem", "workingroot"), distro, dist, |
704 | component) |
705 | |
706 | def pool_directory(distro, package): |
707 | @@ -183,29 +256,29 @@ |
708 | def pool_sources_file(distro, package): |
709 | """Return the location of a pool Sources file for a source.""" |
710 | pooldir = pool_directory(distro, package) |
711 | - return "%s/%s/Sources" % (ROOT, pooldir) |
712 | + return "%s/%s/Sources" % (config.get("filesystem", "workingroot"), pooldir) |
713 | |
714 | def unpack_directory(source): |
715 | """Return the location of a local unpacked source.""" |
716 | - return "%s/unpacked/%s/%s/%s" % (ROOT, pathhash(source["Package"]), |
717 | + return "%s/unpacked/%s/%s/%s" % (config.get("filesystem", "workingroot"), pathhash(source["Package"]), |
718 | source["Package"], source["Version"]) |
719 | |
720 | def changes_file(distro, source): |
721 | """Return the location of a local changes file.""" |
722 | return "%s/changes/%s/%s/%s/%s_%s_source.changes" \ |
723 | - % (ROOT, distro, pathhash(source["Package"]), |
724 | + % (config.get("filesystem", "workingroot"), distro, pathhash(source["Package"]), |
725 | source["Package"], source["Package"], source["Version"]) |
726 | |
727 | def dpatch_directory(distro, source): |
728 | """Return the directory where we put dpatches.""" |
729 | return "%s/dpatches/%s/%s/%s/%s" \ |
730 | - % (ROOT, distro, pathhash(source["Package"]), source["Package"], |
731 | + % (config.get("filesystem", "workingroot"), distro, pathhash(source["Package"]), source["Package"], |
732 | source["Version"]) |
733 | |
734 | def diff_directory(distro, source): |
735 | """Return the directory where we can find diffs.""" |
736 | return "%s/diffs/%s/%s/%s" \ |
737 | - % (ROOT, distro, pathhash(source["Package"]), source["Package"]) |
738 | + % (config.get("filesystem", "workingroot"), distro, pathhash(source["Package"]), source["Package"]) |
739 | |
740 | def diff_file(distro, source): |
741 | """Return the location of a local diff file.""" |
742 | @@ -215,7 +288,7 @@ |
743 | def patch_directory(distro, source): |
744 | """Return the directory where we can find local patch files.""" |
745 | return "%s/patches/%s/%s/%s" \ |
746 | - % (ROOT, distro, pathhash(source["Package"]), source["Package"]) |
747 | + % (config.get("filesystem", "workingroot"), distro, pathhash(source["Package"]), source["Package"]) |
748 | |
749 | def patch_file(distro, source, slipped=False): |
750 | """Return the location of a local patch file.""" |
751 | @@ -229,34 +302,34 @@ |
752 | def published_file(distro, source): |
753 | """Return the location where published patches should be placed.""" |
754 | return "%s/published/%s/%s/%s_%s.patch" \ |
755 | - % (ROOT, pathhash(source["Package"]), source["Package"], |
756 | + % (config.get("filesystem", "workingroot"), pathhash(source["Package"]), source["Package"], |
757 | source["Package"], source["Version"]) |
758 | |
759 | def patch_list_file(): |
760 | """Return the location of the patch list.""" |
761 | - return "%s/published/PATCHES" % ROOT |
762 | + return "%s/published/PATCHES" % config.get("filesystem", "workingroot") |
763 | |
764 | def patch_rss_file(distro=None, source=None): |
765 | """Return the location of the patch rss feed.""" |
766 | if distro is None or source is None: |
767 | - return "%s/published/patches.xml" % ROOT |
768 | + return "%s/published/patches.xml" % config.get("filesystem", "workingroot") |
769 | else: |
770 | return "%s/patches.xml" % patch_directory(distro, source) |
771 | |
772 | def diff_rss_file(distro=None, source=None): |
773 | """Return the location of the diff rss feed.""" |
774 | if distro is None or source is None: |
775 | - return "%s/diffs/patches.xml" % ROOT |
776 | + return "%s/diffs/patches.xml" % config.get("filesystem", "workingroot") |
777 | else: |
778 | return "%s/patches.xml" % diff_directory(distro, source) |
779 | |
780 | def work_dir(package, version): |
781 | """Return the directory to produce the merge result.""" |
782 | - return "%s/work/%s/%s/%s" % (ROOT, pathhash(package), package, version) |
783 | + return "%s/work/%s/%s/%s" % (config.get("filesystem", "workingroot"), pathhash(package), package, version) |
784 | |
785 | def result_dir(package): |
786 | """Return the directory to store the result in.""" |
787 | - return "%s/merges/%s/%s" % (ROOT, pathhash(package), package) |
788 | + return "%s/merges/%s/%s" % (config.get("filesystem", "workingroot"), pathhash(package), package) |
789 | |
790 | |
791 | # --------------------------------------------------------------------------- # |
792 | @@ -290,19 +363,17 @@ |
793 | |
794 | def pool_name(distro): |
795 | """Return the name of the pool for the given distro.""" |
796 | - if "pool" in DISTROS[distro]: |
797 | - return DISTROS[distro]["pool"] |
798 | - else: |
799 | - return distro |
800 | + if distro == "pool": |
801 | + return config.get(distro, "pool") |
802 | + return distro |
803 | |
804 | def get_pool_distros(): |
805 | """Return the list of distros with pools.""" |
806 | distros = [] |
807 | - for distro in DISTROS.keys(): |
808 | + for distro in ("upstream", "downstream"): |
809 | pool = pool_name(distro) |
810 | if pool not in distros: |
811 | distros.append(pool) |
812 | - |
813 | return distros |
814 | |
815 | def update_pool_sources(distro, package): |
816 | @@ -310,10 +381,10 @@ |
817 | pooldir = pool_directory(distro, package) |
818 | filename = pool_sources_file(distro, package) |
819 | |
820 | - logging.info("Updating %s", tree.subdir(ROOT, filename)) |
821 | + logging.info("Updating %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
822 | sources = open(filename, "w") |
823 | try: |
824 | - shell.run(("apt-ftparchive", "sources", pooldir), chdir=ROOT, |
825 | + shell.run(("apt-ftparchive", "sources", pooldir), chdir=config.get("filesystem", "workingroot"), |
826 | stdout=sources) |
827 | finally: |
828 | sources.close() |
829 | @@ -340,7 +411,7 @@ |
830 | def get_nearest_source(package, base): |
831 | """Return the base source or nearest to it.""" |
832 | try: |
833 | - sources = get_pool_sources(SRC_DISTRO, package) |
834 | + sources = get_pool_sources(config.get("upstream", "name"), package) |
835 | except IOError: |
836 | sources = [] |
837 | |
838 | @@ -352,14 +423,14 @@ |
839 | bases.append(source) |
840 | else: |
841 | try: |
842 | - return get_pool_source(OUR_DISTRO, package, base) |
843 | + return get_pool_source(config.get("downstream", "name"), package, base) |
844 | except (IOError, IndexError): |
845 | version_sort(bases) |
846 | return bases.pop() |
847 | |
848 | def get_same_source(distro, dist, package): |
849 | """Find the same source in another distribution.""" |
850 | - for component in DISTROS[distro]["components"]: |
851 | + for component in config.get(distro, "components").split(): |
852 | try: |
853 | source = get_source(distro, dist, component, package) |
854 | version = Version(source["Version"]) |
855 | @@ -443,7 +514,7 @@ |
856 | if os.path.isdir(destdir): |
857 | return destdir |
858 | |
859 | - srcdir = "%s/%s" % (ROOT, source["Directory"]) |
860 | + srcdir = "%s/%s" % (config.get("filesystem", "workingroot"), source["Directory"]) |
861 | for md5sum, size, name in files(source): |
862 | if name.endswith(".dsc"): |
863 | dsc_file = name |
864 | @@ -476,7 +547,7 @@ |
865 | """Save a changes file for the given source.""" |
866 | srcdir = unpack_directory(source) |
867 | |
868 | - filesdir = "%s/%s" % (ROOT, source["Directory"]) |
869 | + filesdir = "%s/%s" % (config.get("filesystem", "workingroot"), source["Directory"]) |
870 | |
871 | ensure(filename) |
872 | changes = open(filename, "w") |
873 | @@ -552,7 +623,7 @@ |
874 | |
875 | def read_blacklist(): |
876 | """Read the blacklist file.""" |
877 | - filename = "%s/sync-blacklist.txt" % ROOT |
878 | + filename = "%s/sync-blacklist.txt" % config.get("filesystem", "workingroot") |
879 | if not os.path.isfile(filename): |
880 | return [] |
881 | |
882 | @@ -661,7 +732,7 @@ |
883 | |
884 | def comments_file(): |
885 | """Return the location of the comments.""" |
886 | - return "%s/comments.txt" % ROOT |
887 | + return "%s/comments.txt" % config.get("filesystem", "workingroot") |
888 | |
889 | def get_comments(): |
890 | """Extract the comments from file, and return a dictionary |
891 | |
892 | === modified file 'pack-archive.sh' |
893 | --- pack-archive.sh 2008-04-28 19:05:17 +0000 |
894 | +++ pack-archive.sh 2010-06-22 18:57:26 +0000 |
895 | @@ -3,7 +3,9 @@ |
896 | set -e |
897 | umask 002 |
898 | |
899 | -cd /srv/patches.ubuntu.com |
900 | +. config.sh |
901 | + |
902 | +cd $workingdir |
903 | |
904 | find changes -name "*.changes" -mtime +182 -print0 | xargs -0r bzip2 |
905 | find diffs -name "*.patch" -mtime +182 -print0 | xargs -0r bzip2 |
906 | |
907 | === modified file 'produce-merges.py' |
908 | --- produce-merges.py 2010-01-26 13:49:00 +0000 |
909 | +++ produce-merges.py 2010-06-22 18:57:26 +0000 |
910 | @@ -42,17 +42,17 @@ |
911 | help="Force creation of merges") |
912 | |
913 | parser.add_option("-D", "--source-distro", type="string", metavar="DISTRO", |
914 | - default=SRC_DISTRO, |
915 | + default=config.get("upstream", "name"), |
916 | help="Source distribution") |
917 | parser.add_option("-S", "--source-suite", type="string", metavar="SUITE", |
918 | - default=SRC_DIST, |
919 | + default=config.get("upstream", "dist"), |
920 | help="Source suite (aka distrorelease)") |
921 | |
922 | parser.add_option("-d", "--dest-distro", type="string", metavar="DISTRO", |
923 | - default=OUR_DISTRO, |
924 | + default=config.get("downstream", "name"), |
925 | help="Destination distribution") |
926 | parser.add_option("-s", "--dest-suite", type="string", metavar="SUITE", |
927 | - default=OUR_DIST, |
928 | + default=config.get("downstream", "dist"), |
929 | help="Destination suite (aka distrorelease)") |
930 | |
931 | parser.add_option("-p", "--package", type="string", metavar="PACKAGE", |
932 | @@ -93,7 +93,7 @@ |
933 | # For each package in the destination distribution, locate the latest in |
934 | # the source distribution; calculate the base from the destination and |
935 | # produce a merge combining both sets of changes |
936 | - for our_component in DISTROS[our_distro]["components"]: |
937 | + for our_component in config.get("downstream", "components").split(): |
938 | if options.component is not None \ |
939 | and our_component not in options.component: |
940 | continue |
941 | @@ -228,7 +228,7 @@ |
942 | def do_merge(left_dir, left_name, left_distro, base_dir, |
943 | right_dir, right_name, right_distro, merged_dir): |
944 | """Do the heavy lifting of comparing and merging.""" |
945 | - logging.debug("Producing merge in %s", tree.subdir(ROOT, merged_dir)) |
946 | + logging.debug("Producing merge in %s", tree.subdir(config.get("filesystem", "workingroot"), merged_dir)) |
947 | conflicts = [] |
948 | po_files = [] |
949 | |
950 | @@ -719,7 +719,7 @@ |
951 | def copy_in(output_dir, source, distro=None): |
952 | """Make a copy of the source files.""" |
953 | for md5sum, size, name in files(source): |
954 | - src = "%s/%s/%s" % (ROOT, source["Directory"], name) |
955 | + src = "%s/%s/%s" % (config.get("filesystem", "workingroot"), source["Directory"], name) |
956 | dest = "%s/%s" % (output_dir, name) |
957 | if os.path.isfile(dest): |
958 | os.unlink(dest) |
959 | @@ -754,7 +754,7 @@ |
960 | |
961 | shell.run(("tar", "czf", filename, contained), chdir=parent) |
962 | |
963 | - logging.info("Created %s", tree.subdir(ROOT, filename)) |
964 | + logging.info("Created %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
965 | return os.path.basename(filename) |
966 | finally: |
967 | tree.remove(parent) |
968 | @@ -794,7 +794,7 @@ |
969 | |
970 | return os.path.basename(filename) |
971 | else: |
972 | - logging.warning("Dropped dsc %s", tree.subdir(ROOT, filename)) |
973 | + logging.warning("Dropped dsc %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
974 | return create_tarball(package, version, output_dir, merged_dir) |
975 | finally: |
976 | tree.remove(parent) |
977 | @@ -814,7 +814,7 @@ |
978 | shell.run(("diff", "-pruN", |
979 | right_source["Version"], "%s" % version), |
980 | chdir=parent, stdout=diff, okstatus=(0, 1, 2)) |
981 | - logging.info("Created %s", tree.subdir(ROOT, filename)) |
982 | + logging.info("Created %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
983 | finally: |
984 | diff.close() |
985 | |
986 | |
987 | === modified file 'publish-patches.py' |
988 | --- publish-patches.py 2010-02-26 09:48:57 +0000 |
989 | +++ publish-patches.py 2010-06-22 18:57:26 +0000 |
990 | @@ -26,10 +26,10 @@ |
991 | |
992 | def options(parser): |
993 | parser.add_option("-d", "--distro", type="string", metavar="DISTRO", |
994 | - default=OUR_DISTRO, |
995 | + default=config.get("downstream", "name"), |
996 | help="Distribution to publish") |
997 | parser.add_option("-s", "--suite", type="string", metavar="SUITE", |
998 | - default=OUR_DIST, |
999 | + default=config.get("downstream", "dist"), |
1000 | help="Suite (aka distrorelease) to publish") |
1001 | |
1002 | def main(options, args): |
1003 | @@ -48,8 +48,8 @@ |
1004 | try: |
1005 | # For each package in the distribution, check for a patch for the |
1006 | # current version; publish if it exists, clean up if not |
1007 | - for component in DISTROS[distro]["components"]: |
1008 | - for source in get_sources(distro, dist, component): |
1009 | + for component in config.get(distro, "components").split(): |
1010 | + for source in get_sources(distro, dist, component).split(): |
1011 | package = source["Package"] |
1012 | |
1013 | if package in blacklist: |
1014 | @@ -81,9 +81,9 @@ |
1015 | os.unlink(publish_filename) |
1016 | os.link(filename, publish_filename) |
1017 | |
1018 | - logging.info("Published %s", tree.subdir(ROOT, publish_filename)) |
1019 | + logging.info("Published %s", tree.subdir(config.get("filesystem", "workingroot"), publish_filename)) |
1020 | print >>list_file, "%s %s" % (source["Package"], |
1021 | - tree.subdir("%s/published" % ROOT, |
1022 | + tree.subdir("%s/published" % config.get("filesystem", "workingroot"), |
1023 | publish_filename)) |
1024 | |
1025 | # Remove older patches |
1026 | @@ -107,7 +107,7 @@ |
1027 | src_filename = "%s/%s" % (dpatch_dir, dpatch) |
1028 | dest_filename = "%s/%s" % (output, dpatch) |
1029 | |
1030 | - logging.info("Published %s", tree.subdir(ROOT, dest_filename)) |
1031 | + logging.info("Published %s", tree.subdir(config.get("filesystem", "workingroot"), dest_filename)) |
1032 | ensure(dest_filename) |
1033 | tree.copyfile(src_filename, dest_filename) |
1034 | |
1035 | |
1036 | === modified file 'stats-graphs.py' |
1037 | --- stats-graphs.py 2010-02-26 09:50:21 +0000 |
1038 | +++ stats-graphs.py 2010-06-22 18:57:26 +0000 |
1039 | @@ -64,7 +64,7 @@ |
1040 | |
1041 | def options(parser): |
1042 | parser.add_option("-d", "--distro", type="string", metavar="DISTRO", |
1043 | - default=OUR_DISTRO, |
1044 | + default=config.get("downstream", "name"), |
1045 | help="Distribution to generate stats for") |
1046 | |
1047 | def main(options, args): |
1048 | @@ -84,7 +84,7 @@ |
1049 | |
1050 | # Iterate the components and calculate the peaks over the last six |
1051 | # months, as well as the current stats |
1052 | - for component in DISTROS[distro]["components"]: |
1053 | + for component in config.get(distro, "components").split(): |
1054 | # Extract current and historical stats for this component |
1055 | current = get_current(stats[component]) |
1056 | history = get_history(stats[component], start) |
1057 | @@ -127,12 +127,21 @@ |
1058 | """Read the stats history file.""" |
1059 | stats = {} |
1060 | |
1061 | +<<<<<<< TREE |
1062 | stats_file = "%s/stats.txt" % ROOT |
1063 | try: |
1064 | stf = open(stats_file, "r"); |
1065 | except IOError, e: |
1066 | print e |
1067 | exit(1) |
1068 | +======= |
1069 | + stats_file = "%s/stats.txt" % config.get("filesystem", "workingroot") |
1070 | + try: |
1071 | + stf = open(stats_file, "r"); |
1072 | + except IOError, e: |
1073 | + print e |
1074 | + exit(1) |
1075 | +>>>>>>> MERGE-SOURCE |
1076 | try: |
1077 | for line in stf: |
1078 | (date, time, component, info) = line.strip().split(" ", 3) |
1079 | @@ -214,7 +223,7 @@ |
1080 | data = zip([ LABELS[key] for key in ORDER ], |
1081 | info_to_data(None, current)) |
1082 | |
1083 | - filename = "%s/merges/%s-now.png" % (ROOT, component) |
1084 | + filename = "%s/merges/%s-now.png" % (config.get("filesystem", "workingroot"), component) |
1085 | c = canvas.init(filename, format="png") |
1086 | try: |
1087 | ar = area.T(size=(300,250), legend=None, |
1088 | @@ -246,7 +255,7 @@ |
1089 | (y_tic_interval, y_minor_tic_interval) = \ |
1090 | sources_intervals(max(d[-1] for d in data)) |
1091 | |
1092 | - filename = "%s/merges/%s-trend.png" % (ROOT, component) |
1093 | + filename = "%s/merges/%s-trend.png" % (config.get("filesystem", "workingroot"), component) |
1094 | c = canvas.init(filename, format="png") |
1095 | try: |
1096 | ar = area.T(size=(450,225), legend=legend.T(), |
1097 | |
1098 | === modified file 'stats.py' |
1099 | --- stats.py 2008-01-10 13:19:44 +0000 |
1100 | +++ stats.py 2010-06-22 18:57:26 +0000 |
1101 | @@ -27,17 +27,17 @@ |
1102 | |
1103 | def options(parser): |
1104 | parser.add_option("-D", "--source-distro", type="string", metavar="DISTRO", |
1105 | - default=SRC_DISTRO, |
1106 | + default="upstream", |
1107 | help="Source distribution") |
1108 | parser.add_option("-S", "--source-suite", type="string", metavar="SUITE", |
1109 | - default=SRC_DIST, |
1110 | + default=config.get("upstream", "dist"), |
1111 | help="Source suite (aka distrorelease)") |
1112 | |
1113 | parser.add_option("-d", "--dest-distro", type="string", metavar="DISTRO", |
1114 | - default=OUR_DISTRO, |
1115 | + default="downstream", |
1116 | help="Destination distribution") |
1117 | parser.add_option("-s", "--dest-suite", type="string", metavar="SUITE", |
1118 | - default=OUR_DIST, |
1119 | + default=config.get("downstream", "dist"), |
1120 | help="Destination suite (aka distrorelease)") |
1121 | |
1122 | parser.add_option("-p", "--package", type="string", metavar="PACKAGE", |
1123 | @@ -58,7 +58,7 @@ |
1124 | |
1125 | # For each package in the destination distribution, locate the latest in |
1126 | # the source distribution; calculate the base from the destination |
1127 | - for our_component in DISTROS[our_distro]["components"]: |
1128 | + for our_component in config.get(our_distro, "components").split(): |
1129 | stats = {} |
1130 | stats["total"] = 0 |
1131 | stats["local"] = 0 |
1132 | @@ -122,7 +122,7 @@ |
1133 | |
1134 | def write_stats(component, stats): |
1135 | """Write out the collected stats.""" |
1136 | - stats_file = "%s/stats.txt" % ROOT |
1137 | + stats_file = "%s/stats.txt" % config.get("filesystem", "workingroot") |
1138 | stf = open(stats_file, "a"); |
1139 | try: |
1140 | stamp = time.strftime("%Y-%m-%d %H:%M", time.gmtime()) |
1141 | |
1142 | === modified file 'syndicate.py' |
1143 | --- syndicate.py 2010-02-26 09:52:33 +0000 |
1144 | +++ syndicate.py 2010-06-22 18:57:26 +0000 |
1145 | @@ -69,8 +69,8 @@ |
1146 | # For each package in the given distributions, iterate the pool in order |
1147 | # and select various interesting files for syndication |
1148 | for distro in distros: |
1149 | - for dist in DISTROS[distro]["dists"]: |
1150 | - for component in DISTROS[distro]["components"]: |
1151 | + for dist in config.get(distro, "dists").split: |
1152 | + for component in config.get(distro, "components").split: |
1153 | if options.component is not None \ |
1154 | and component not in options.component: |
1155 | continue |
1156 | @@ -87,7 +87,7 @@ |
1157 | this_patch_rss = read_rss(patch_rss_file(distro, source), |
1158 | title="Ubuntu Patches from Debian for %s" % source["Package"], |
1159 | link=("http://patches.ubuntu.com/by-release/" + |
1160 | - tree.subdir("%s/patches" % ROOT, |
1161 | + tree.subdir("%s/patches" % config.get("filesystem", "workingroot"), |
1162 | patch_directory(distro, source))), |
1163 | description="This feed announces new patches from " |
1164 | "Ubuntu to Debian for %s, each patch filename contains " |
1165 | @@ -96,7 +96,7 @@ |
1166 | this_diff_rss = read_rss(diff_rss_file(distro, source), |
1167 | title="Ubuntu Uploads for %s" % source["Package"], |
1168 | link=("http://patches.ubuntu.com/by-release/atomic/" + |
1169 | - tree.subdir("%s/diffs" % ROOT, |
1170 | + tree.subdir("%s/diffs" % config.get("filesystem", "workingroot"), |
1171 | diff_directory(distro, source))), |
1172 | description="This feed announces new changes in " |
1173 | "Ubuntu for %s, each patch filename contains the " |
1174 | @@ -160,14 +160,14 @@ |
1175 | if not len(recipients): |
1176 | return |
1177 | |
1178 | - if distro == SRC_DISTRO: |
1179 | + if distro == config.get("upstream", "name"): |
1180 | # Debian uploads always just have a diff |
1181 | subject = "Debian %s %s" % (this["Package"], this["Version"]) |
1182 | intro = MIMEText("""\ |
1183 | This e-mail has been sent due to an upload to Debian, and contains the |
1184 | difference between the new version and the previous one.""") |
1185 | payload = diff_part(distro, this) |
1186 | - elif distro != OUR_DISTRO: |
1187 | + elif distro != config.get("downstream", "name"): |
1188 | # Other uploads always just have a diff |
1189 | subject = "%s %s %s" % (distro, this["Package"], this["Version"]) |
1190 | intro = MIMEText("""\ |
1191 | @@ -333,14 +333,14 @@ |
1192 | append_rss(patch_rss, |
1193 | title=os.path.basename(patch_filename), |
1194 | link=("http://patches.ubuntu.com/by-release/" + |
1195 | - tree.subdir("%s/patches" % ROOT, patch_filename)), |
1196 | + tree.subdir("%s/patches" % config.get("filesystem", "workingroot"), patch_filename)), |
1197 | author=uploader, |
1198 | filename=patch_filename) |
1199 | |
1200 | append_rss(this_patch_rss, |
1201 | title=os.path.basename(patch_filename), |
1202 | link=("http://patches.ubuntu.com/by-release/" + |
1203 | - tree.subdir("%s/patches" % ROOT, patch_filename)), |
1204 | + tree.subdir("%s/patches" % config.get("filesystem", "workingroot"), patch_filename)), |
1205 | author=uploader, |
1206 | filename=patch_filename) |
1207 | |
1208 | @@ -356,14 +356,14 @@ |
1209 | append_rss(diff_rss, |
1210 | title=os.path.basename(diff_filename), |
1211 | link=("http://patches.ubuntu.com/by-release/atomic/" + |
1212 | - tree.subdir("%s/diffs" % ROOT, diff_filename)), |
1213 | + tree.subdir("%s/diffs" % config.get("filesystem", "workingroot"), diff_filename)), |
1214 | author=uploader, |
1215 | filename=diff_filename) |
1216 | |
1217 | append_rss(this_diff_rss, |
1218 | title=os.path.basename(diff_filename), |
1219 | link=("http://patches.ubuntu.com/by-release/atomic/" + |
1220 | - tree.subdir("%s/diffs" % ROOT, diff_filename)), |
1221 | + tree.subdir("%s/diffs" % config.get("filesystem", "workingroot"), diff_filename)), |
1222 | author=uploader, |
1223 | filename=diff_filename) |
1224 | |
1225 | @@ -372,12 +372,21 @@ |
1226 | """Read the subscriptions file.""" |
1227 | subscriptions = [] |
1228 | |
1229 | +<<<<<<< TREE |
1230 | try: |
1231 | f = open("%s/subscriptions.txt" % ROOT) |
1232 | except IOError, e: |
1233 | print e |
1234 | exit(1) |
1235 | |
1236 | +======= |
1237 | + try: |
1238 | + f = open("%s/subscriptions.txt" % config.get("filesystem", "workingroot")) |
1239 | + except IOError, e: |
1240 | + print e |
1241 | + exit(1) |
1242 | + |
1243 | +>>>>>>> MERGE-SOURCE |
1244 | try: |
1245 | fcntl.flock(f.fileno(), fcntl.LOCK_SH) |
1246 | |
1247 | @@ -395,7 +404,7 @@ |
1248 | def read_watermark(distro, source): |
1249 | """Read the watermark for a given source.""" |
1250 | mark_file = "%s/%s/watermark" \ |
1251 | - % (ROOT, pool_directory(distro, source["Package"])) |
1252 | + % (config.get("filesystem", "workingroot"), pool_directory(distro, source["Package"])) |
1253 | if not os.path.isfile(mark_file): |
1254 | return Version("0") |
1255 | |
1256 | @@ -408,7 +417,7 @@ |
1257 | def save_watermark(distro, source, version): |
1258 | """Save the watermark for a given source.""" |
1259 | mark_file = "%s/%s/watermark" \ |
1260 | - % (ROOT, pool_directory(distro, source["Package"])) |
1261 | + % (config.get("filesystem", "workingroot"), pool_directory(distro, source["Package"])) |
1262 | mark = open(mark_file, "w") |
1263 | try: |
1264 | print >>mark, "%s" % version |
1265 | |
1266 | === modified file 'update-pool.py' |
1267 | --- update-pool.py 2010-02-27 05:57:13 +0000 |
1268 | +++ update-pool.py 2010-06-22 18:57:26 +0000 |
1269 | @@ -41,8 +41,8 @@ |
1270 | # Download the current sources for the given distributions and download |
1271 | # any new contents into our pool |
1272 | for distro in distros: |
1273 | - for dist in DISTROS[distro]["dists"]: |
1274 | - for component in DISTROS[distro]["components"]: |
1275 | + for dist in config.get(distro, "dists").split(): |
1276 | + for component in config.get(distro, "components").split(): |
1277 | update_sources(distro, dist, component) |
1278 | |
1279 | sources = get_sources(distro, dist, component) |
1280 | @@ -59,7 +59,7 @@ |
1281 | |
1282 | def sources_url(distro, dist, component): |
1283 | """Return a URL for a remote Sources.gz file.""" |
1284 | - mirror = DISTROS[distro]["mirror"] |
1285 | + mirror = config.get(distro, "mirror") |
1286 | return "%s/dists/%s/%s/source/Sources.gz" % (mirror, dist, component) |
1287 | |
1288 | def update_sources(distro, dist, component): |
1289 | @@ -72,7 +72,11 @@ |
1290 | urlfile = urllib.URLopener() |
1291 | |
1292 | gzfilename = tempfile.mktemp() |
1293 | - urllib.URLopener().retrieve(url, gzfilename) |
1294 | + try: |
1295 | + urllib.URLopener().retrieve(url, gzfilename) |
1296 | + except IOError, e: |
1297 | + print e |
1298 | + exit(1) |
1299 | try: |
1300 | gzfile = gzip.GzipFile(gzfilename) |
1301 | try: |
1302 | @@ -87,19 +91,19 @@ |
1303 | finally: |
1304 | os.unlink(gzfilename) |
1305 | |
1306 | - logging.info("Saved %s", tree.subdir(ROOT, filename)) |
1307 | + logging.info("Saved %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
1308 | return filename |
1309 | |
1310 | def update_pool(distro, source): |
1311 | """Download a source package into our pool.""" |
1312 | - mirror = DISTROS[distro]["mirror"] |
1313 | + mirror = config.get(distro, "mirror") |
1314 | sourcedir = source["Directory"] |
1315 | |
1316 | pooldir = pool_directory(distro, source["Package"]) |
1317 | |
1318 | for md5sum, size, name in files(source): |
1319 | url = "%s/%s/%s" % (mirror, sourcedir, name) |
1320 | - filename = "%s/%s/%s" % (ROOT, pooldir, name) |
1321 | + filename = "%s/%s/%s" % (config.get("filesystem", "workingroot"), pooldir, name) |
1322 | |
1323 | if os.path.isfile(filename): |
1324 | if os.path.getsize(filename) == int(size): |
1325 | @@ -108,7 +112,7 @@ |
1326 | logging.debug("Downloading %s", url) |
1327 | ensure(filename) |
1328 | urllib.URLopener().retrieve(url, filename) |
1329 | - logging.info("Saved %s", tree.subdir(ROOT, filename)) |
1330 | + logging.info("Saved %s", tree.subdir(config.get("filesystem", "workingroot"), filename)) |
1331 | |
1332 | |
1333 | if __name__ == "__main__": |
1334 | |
1335 | === modified file 'update-sources.py' |
1336 | --- update-sources.py 2010-02-26 09:54:47 +0000 |
1337 | +++ update-sources.py 2010-06-22 18:57:26 +0000 |
1338 | @@ -22,7 +22,6 @@ |
1339 | |
1340 | from momlib import * |
1341 | |
1342 | - |
1343 | def main(options, args): |
1344 | if len(args): |
1345 | distros = args |
1346 | @@ -32,12 +31,18 @@ |
1347 | # Iterate the pool directory of the given distributions |
1348 | for distro in distros: |
1349 | try: |
1350 | +<<<<<<< TREE |
1351 | hparts = os.listdir("%s/pool/%s" % (ROOT, distro)) |
1352 | except OSError, e: |
1353 | print e |
1354 | +======= |
1355 | + hparts = os.listdir("%s/pool/%s" % (config.get("filesystem", "workingroot"), distro)) |
1356 | + except OSError, e: |
1357 | + print e |
1358 | +>>>>>>> MERGE-SOURCE |
1359 | continue |
1360 | for hpart in hparts: |
1361 | - for package in os.listdir("%s/pool/%s/%s" % (ROOT, distro, hpart)): |
1362 | + for package in os.listdir("%s/pool/%s/%s" % (config.get("filesystem", "workingroot"), distro, hpart)): |
1363 | update_pool_sources(distro, package) |
1364 | |
1365 |