Mercurial > treepkg
annotate bin/treepkgbuilder.py @ 440:383d23c6bfde
Merged revisions 346-386 via svnmerge from
svn+ssh://svn.wald.intevation.org/treepkg/branches/treepkg-status
........
r346 | bricks | 2010-07-07 17:40:48 +0200 (Mi, 07 Jul 2010) | 2 lines
added classed for treepkg status xml generation
........
r347 | bricks | 2010-07-08 12:07:39 +0200 (Do, 08 Jul 2010) | 10 lines
renamed new status dir to info because of a naming conflict with status.py
let the user specify a treepkg name in the config
the name is propagated to PackagerGroup
[treepkg]
name: <treepkgname>
becomes:
pg = PackagerGroup(...)
pg.name
........
r348 | bricks | 2010-07-08 15:25:07 +0200 (Do, 08 Jul 2010) | 3 lines
moved test file to test main dir
fixed missing : after def statement
........
r349 | bricks | 2010-07-08 17:59:52 +0200 (Do, 08 Jul 2010) | 2 lines
added treepkg_dir andd tracks_dir attributes to PackageGroup
........
r350 | bricks | 2010-07-08 18:00:32 +0200 (Do, 08 Jul 2010) | 2 lines
changed <millpath> to <trackspath>
........
r351 | bricks | 2010-07-08 18:08:39 +0200 (Do, 08 Jul 2010) | 2 lines
check if config file exists to get usefull error output
........
r352 | bricks | 2010-07-08 18:11:13 +0200 (Do, 08 Jul 2010) | 2 lines
write first info about tracks
........
r353 | bricks | 2010-07-09 12:20:49 +0200 (Fr, 09 Jul 2010) | 2 lines
get all log files
........
r354 | bricks | 2010-07-09 14:42:42 +0200 (Fr, 09 Jul 2010) | 2 lines
added md5sum function
........
r355 | bricks | 2010-07-09 15:15:15 +0200 (Fr, 09 Jul 2010) | 4 lines
implemented nearly all info
only arch and os info are missing
........
r356 | bricks | 2010-07-09 16:19:17 +0200 (Fr, 09 Jul 2010) | 2 lines
Bugfix: source was not defined
........
r357 | bricks | 2010-07-09 16:44:52 +0200 (Fr, 09 Jul 2010) | 3 lines
fixed some typos
added missing add_checksum methond
........
r358 | bricks | 2010-07-09 17:06:15 +0200 (Fr, 09 Jul 2010) | 2 lines
fixed status line for revision
........
r359 | bricks | 2010-07-12 14:10:34 +0200 (Mo, 12 Jul 2010) | 2 lines
let the user specify num revisions that should be shown in the info
........
r360 | bricks | 2010-07-12 14:21:39 +0200 (Mo, 12 Jul 2010) | 2 lines
missed in last commit
........
r361 | bricks | 2010-07-12 17:06:22 +0200 (Mo, 12 Jul 2010) | 2 lines
add os config statement
........
r362 | bricks | 2010-07-12 17:47:42 +0200 (Mo, 12 Jul 2010) | 3 lines
moved packages and logs to revision tag
implemented os and arch info
........
r363 | bricks | 2010-07-13 14:23:28 +0200 (Di, 13 Jul 2010) | 2 lines
updated test readconfig for os config variable
........
r364 | bricks | 2010-07-13 14:24:14 +0200 (Di, 13 Jul 2010) | 2 lines
moved common publish functions to a seperate module
........
r365 | bricks | 2010-07-13 16:26:11 +0200 (Di, 13 Jul 2010) | 2 lines
moved arch info to each package info
........
r366 | bricks | 2010-07-13 18:46:17 +0200 (Di, 13 Jul 2010) | 2 lines
inital checkin for new publishpackages processing
........
r367 | bricks | 2010-07-21 17:52:15 +0200 (Mi, 21 Jul 2010) | 2 lines
implemented parsing from xml string
........
r368 | bricks | 2010-07-22 12:17:42 +0200 (Do, 22 Jul 2010) | 2 lines
copy binary-all packages in all binary-xyz dirs
........
r369 | bricks | 2010-07-22 12:26:40 +0200 (Do, 22 Jul 2010) | 2 lines
fixed small bugs
........
r370 | bricks | 2010-07-22 13:02:36 +0200 (Do, 22 Jul 2010) | 2 lines
added a new root element which is called TreepkgRoot for Treepkg Info classes
........
r371 | bricks | 2010-07-22 13:09:52 +0200 (Do, 22 Jul 2010) | 3 lines
fixed some small issues
remember: run pychecker BEFORE the commit
........
r372 | bricks | 2010-07-22 18:01:43 +0200 (Do, 22 Jul 2010) | 2 lines
improved publishdebianpackages and fixed a lot of bugs in the xml info parsing part
........
r373 | bricks | 2010-07-23 18:40:38 +0200 (Fr, 23 Jul 2010) | 2 lines
implemented CacheDb to store copied Packages from build host
........
r374 | bricks | 2010-07-26 10:28:48 +0200 (Mo, 26 Jul 2010) | 2 lines
moved data handling in publishdebianpackages into seperate module
........
r375 | bricks | 2010-07-26 11:42:07 +0200 (Mo, 26 Jul 2010) | 2 lines
fixed some typos
........
r376 | bricks | 2010-07-26 12:12:40 +0200 (Mo, 26 Jul 2010) | 2 lines
first version of incremental copying debian packages to cachedir
........
r377 | bricks | 2010-07-26 14:58:50 +0200 (Mo, 26 Jul 2010) | 2 lines
incremental copying only changed debian packages
........
r378 | bricks | 2010-07-26 15:39:10 +0200 (Mo, 26 Jul 2010) | 3 lines
use md5 instead of hashlib module
(md5 is deprecated in favour of hashlib in python 2.5)
........
r379 | bricks | 2010-07-26 15:46:19 +0200 (Mo, 26 Jul 2010) | 2 lines
make treepkg compatible to python 2.4
........
r380 | bricks | 2010-07-26 15:50:49 +0200 (Mo, 26 Jul 2010) | 2 lines
fixed last commit (db instead of sqlite3)
........
r381 | bricks | 2010-07-27 10:54:15 +0200 (Di, 27 Jul 2010) | 2 lines
fixed wrong import statement
........
r382 | bricks | 2010-07-27 10:54:34 +0200 (Di, 27 Jul 2010) | 2 lines
removed unnecessary debug output
........
r383 | bricks | 2010-07-27 18:28:22 +0200 (Di, 27 Jul 2010) | 2 lines
check if upload hook is empty
........
r384 | bricks | 2010-07-28 09:35:21 +0200 (Mi, 28 Jul 2010) | 2 lines
run rsync only an arch dirs that are present in the current treepkg
........
r385 | bricks | 2010-07-28 09:35:54 +0200 (Mi, 28 Jul 2010) | 2 lines
add helper tool to list content of a cache db
........
r386 | bricks | 2010-07-28 10:33:48 +0200 (Mi, 28 Jul 2010) | 3 lines
fixed a typo
regex fails if option is empty
........
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 06 Aug 2010 13:28:47 +0000 |
parents | f06f707d9fda |
children |
rev | line source |
---|---|
287
1fcdffbeb9de
Make the #! line in the commands more portable. Use /usr/bin/python
Bernhard Herzog <bh@intevation.de>
parents:
245
diff
changeset
|
1 #! /usr/bin/python |
243
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
2 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH |
177
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
3 # Authors: |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
4 # Bernhard Herzog <bh@intevation.de> |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
5 # |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
6 # This program is free software under the GPL (>=v2) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
7 # Read the file COPYING coming with the software for details. |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
8 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
9 """Usage: treepkgbuilder COMMAND [options] |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
11 Manage the pbuilder environment for a tree packager installation. The |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 pbuilder settings are taken from the configuration file, either the |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 default treepkg.cfg or the one given with the --config-file option. |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 Also, this script assumes that there is only one pbuilder setting for |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 all packagers. Use treepkgbuilder COMMAND --help for more details about |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
16 the commands. |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
17 """ |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
18 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 import sys |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
20 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
21 import treepkgcmd |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
22 from treepkg.options import create_parser |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
23 from treepkg.packager import create_package_track, PackagerGroup |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
24 from treepkg.readconfig import read_config |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
25 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
26 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
27 class Command(object): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
28 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
29 names = () |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
30 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
31 def __init__(self, arguments): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
32 parser = self.create_parser() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 self.opts, self.rest = parser.parse_args(arguments) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
34 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
35 def create_parser(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
36 return create_parser() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
37 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
38 def read_config(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
39 self.treepkg_opts, self.packager_opts \ |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
40 = read_config(self.opts.config_file) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
41 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
42 def get_builder(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
43 self.read_config() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
44 group = PackagerGroup([create_package_track(**opts) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
45 for opts in self.packager_opts], |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
46 **self.treepkg_opts) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
47 track = group.get_package_tracks()[0] |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
48 return track.builder |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
49 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
50 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
51 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
52 class InitCommand(Command): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
53 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
54 names = ("init",) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
55 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
56 def __init__(self, arguments): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
57 super(InitCommand, self).__init__(arguments) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
58 if self.opts.mirrorsite is None: |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
59 print >>sys.stderr, "Missing required option --mirrorsite" |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
60 sys.exit(1) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
61 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
62 def create_parser(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
63 parser = super(InitCommand, self).create_parser() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
64 parser.set_defaults(distribution="etch") |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
65 parser.add_option("--mirrorsite", |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
66 help=("The debian mirror site" |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
67 " (pbuilder MIRRORSITE setting). Required.")) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
68 parser.add_option("--othermirror", |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
69 help=("Extra contents of the OTHERMIRROR setting." |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
70 " See the pbuilder documentation for the" |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
71 " format.")) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
72 parser.add_option("--distribution", |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
73 help=("The debian distribution for the pbuilder" |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
74 " chroot. Default is etch.")) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
75 return parser |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
76 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
77 def run(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
78 builder = self.get_builder() |
344
f06f707d9fda
merged branches/scratchbox into trunk
Bjoern Ricks <bricks@intevation.de>
parents:
296
diff
changeset
|
79 builder.init_builder(distribution=self.opts.distribution, |
177
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
80 mirrorsite=self.opts.mirrorsite, |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
81 extramirrors=self.opts.othermirror) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
82 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
83 |
192
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
84 class AddBinariesCommand(Command): |
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
85 |
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
86 names = ("add-binaries",) |
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
87 |
296
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
88 def create_parser(self): |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
89 parser = super(AddBinariesCommand, self).create_parser() |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
90 parser.set_defaults(subdir="manual") |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
91 parser.add_option("--subdir", |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
92 help=("The subdirectory of extra-pkg into which" |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
93 " the packages are to be copied" |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
94 " (default 'manual').")) |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
95 return parser |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
96 |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
97 |
192
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
98 def run(self): |
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
99 builder = self.get_builder() |
296
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
100 builder.add_binaries_to_extra_pkg(self.rest, |
ce7be2fb93ee
Make it easy to install extra binaries into subdirectories of extra-pkg.
Bernhard Herzog <bh@intevation.de>
parents:
287
diff
changeset
|
101 subdirectory=self.opts.subdir) |
192
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
102 |
eaadf5350a1a
Add the add-binaries command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
184
diff
changeset
|
103 |
177
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
104 class UpdateCommand(Command): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
105 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
106 names = ("update",) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
107 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
108 def run(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
109 builder = self.get_builder() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
110 builder.update(suppress_output=False, log_info=False) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
111 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
112 |
184
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
113 class AddKeyCommand(Command): |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
114 |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
115 names = ("addkey", "add-key") |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
116 |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
117 def __init__(self, arguments): |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
118 super(AddKeyCommand, self).__init__(arguments) |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
119 if not self.opts.key_id: |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
120 print >>sys.stderr, "No key id given" |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
121 sys.exit(1) |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
122 |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
123 def create_parser(self): |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
124 parser = super(AddKeyCommand, self).create_parser() |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
125 parser.add_option("--key-id", |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
126 help=("The id of the key to add. Required.")) |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
127 return parser |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
128 |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
129 def run(self): |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
130 builder = self.get_builder() |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
131 builder.add_apt_key(self.opts.key_id) |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
132 |
83c77307ffb1
Add the addkey command to bin/treepkgbuilder.py and a corresponding
Bernhard Herzog <bh@intevation.de>
parents:
177
diff
changeset
|
133 |
201
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
134 class LoginCommand(Command): |
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
135 |
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
136 names = ("login",) |
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
137 |
213
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
138 def create_parser(self): |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
139 parser = super(LoginCommand, self).create_parser() |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
140 parser.set_defaults(bind_mount=[]) |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
141 parser.add_option("--bind-mount", action="append", |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
142 help=("Directories to bind-mount in the chroot" |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
143 " environment.")) |
245
21da92cea416
Add --save-after-login option to bin/treepkgbuilder.py and corresponding
Bernhard Herzog <bh@intevation.de>
parents:
243
diff
changeset
|
144 parser.add_option("--save-after-login", action="store_true", |
21da92cea416
Add --save-after-login option to bin/treepkgbuilder.py and corresponding
Bernhard Herzog <bh@intevation.de>
parents:
243
diff
changeset
|
145 help="Copy changes back to the tarball.") |
213
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
146 return parser |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
147 |
98c5aab790bb
Add --bind-mount option to bin/treepkgbuilder.py's login command and a
Bernhard Herzog <bh@intevation.de>
parents:
210
diff
changeset
|
148 |
201
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
149 def run(self): |
245
21da92cea416
Add --save-after-login option to bin/treepkgbuilder.py and corresponding
Bernhard Herzog <bh@intevation.de>
parents:
243
diff
changeset
|
150 self.get_builder().login(bindmounts=self.opts.bind_mount, |
21da92cea416
Add --save-after-login option to bin/treepkgbuilder.py and corresponding
Bernhard Herzog <bh@intevation.de>
parents:
243
diff
changeset
|
151 save_after_login=self.opts.save_after_login) |
201
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
152 |
6624e731e218
Add login command to bin/treepkgbuilder.py and corresponding method in
Bernhard Herzog <bh@intevation.de>
parents:
192
diff
changeset
|
153 |
210
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
154 class BuildCommand(Command): |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
155 |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
156 names = ("build",) |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
157 |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
158 def create_parser(self): |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
159 parser = super(BuildCommand, self).create_parser() |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
160 parser.add_option("--logfile", help=("The file for the build log.")) |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
161 parser.add_option("--binary-dir", |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
162 help=("Directory for the binary packages.")) |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
163 return parser |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
164 |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
165 def run(self): |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
166 if len(self.rest) != 1: |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
167 print >>sys.stderr, "Exactly one .dsc file must be specified" |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
168 sys.exit(1) |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
169 dsc_file = self.rest[0] |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
170 self.get_builder().build(dsc_file, binary_dir=self.opts.binary_dir, |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
171 logfile=self.opts.logfile) |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
172 |
63f73bb9c459
Add build command to bin/treepkgbuilder.py
Bernhard Herzog <bh@intevation.de>
parents:
201
diff
changeset
|
173 |
243
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
174 class ExecuteCommand(Command): |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
175 |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
176 names = ("execute",) |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
177 |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
178 def create_parser(self): |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
179 parser = super(ExecuteCommand, self).create_parser() |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
180 parser.add_option("--logfile", help=("Log file.")) |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
181 parser.add_option("--bind-mount", action="append", |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
182 help=("Directories to bind-mount in the chroot" |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
183 " environment.")) |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
184 return parser |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
185 |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
186 def run(self): |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
187 if not self.rest: |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
188 print >>sys.stderr, "At least the script file must be specified" |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
189 sys.exit(1) |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
190 script = self.rest |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
191 self.get_builder().run_script(script, bindmounts=self.opts.bind_mount, |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
192 logfile=self.opts.logfile) |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
193 |
f4a636ed5d07
Add execute command to treepkgbuilder
Bernhard Herzog <bh@intevation.de>
parents:
213
diff
changeset
|
194 |
177
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
195 class HelpCommand(Command): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
196 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
197 names = ("help", "--help", "-h") |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
198 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
199 def run(self): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
200 print __doc__.rstrip() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
201 print "Supported commands:" |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
202 commands = sorted((cmd for cmd in iter_commands() if cmd.names), |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
203 key=lambda cmd: cmd.names[0]) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
204 for cmd in commands: |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
205 print " ", " ".join(cmd.names) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
206 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
207 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
208 def iter_commands(): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
209 for key, obj in globals().items(): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
210 if key.endswith("Command"): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
211 yield obj |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
212 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
213 def get_command_class(name): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
214 for obj in iter_commands(): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
215 if name in obj.names: |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
216 return obj |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
217 return None |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
218 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
219 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
220 def main(): |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
221 arguments = sys.argv[1:] |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
222 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
223 if len(arguments) < 1: |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
224 print >>sys.stderr, "Missing command" |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
225 sys.exit(1) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
226 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
227 command_name = arguments[0] |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
228 arguments = arguments[1:] |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
229 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
230 command_class = get_command_class(command_name) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
231 if command_class is None: |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
232 print >>sys.stderr, "Unknown command %r" % command_name |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
233 sys.exit(1) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
234 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
235 command = command_class(arguments) |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
236 command.run() |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
237 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
238 |
df7498d0bd9d
Add bin/treepkgbuilder.py, a script to manage treepkg's pbuilder instance
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
239 main() |