3 """Wrapper to launch dak functionality"""
4 # Copyright (C) 2005, 2006 Anthony Towns <ajt@debian.org>
5 # Copyright (C) 2006 James Troup <james@nocrew.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ################################################################################
23 # well I don't know where you're from but in AMERICA, there's a little
24 # thing called "abstinent until proven guilty."
25 # -- http://harrietmiers.blogspot.com/2005/10/wow-i-feel-loved.html
27 # (if James had a blog, I bet I could find a funny quote in it to use!)
29 ################################################################################
34 ################################################################################
37 """Setup the list of modules and brief explanation of what they
42 "Show which suites packages are in"),
44 "Query/change the overrides"),
46 "Archive sanity checks"),
48 "Produce a report on NEW and BYHAND packages"),
51 "Remove packages from suites"),
54 "Process NEW and BYHAND packages"),
56 "Process packages in queue/unchecked"),
58 "Install packages into the pool"),
60 ("make-suite-file-list",
61 "Generate lists of packages per suite for apt-ftparchive"),
63 "Generate Release files"),
64 ("generate-index-diffs",
65 "Generate .diff/Index files"),
67 "Clean unused/superseded packages from the archive"),
69 "Clean cruft from incoming"),
70 ("clean-proposed-updates",
71 "Remove obsolete .changes from proposed-updates"),
74 "Override cruft checks"),
75 ("check-proposed-updates",
76 "Dependency checking for proposed-updates"),
78 "Show fixable discrepencies between suites"),
80 "Manipulate/list override entries in bulk"),
82 "Manipulate suites in bulk"),
84 "Check for obsolete or duplicated packages"),
86 "Display contents of a .dak file"),
88 "Show information useful for NEW processing"),
89 ("find-null-maintainers",
90 "Check for users with no packages in the archive"),
92 "Populate SQL database based from an archive tree"),
94 "Populate fingerprint/uid table based on a new/updated keyring"),
95 ("import-ldap-fingerprints",
96 "Syncs fingerprint and uid tables with Debian LDAP db"),
97 ("import-users-from-passwd",
98 "Sync PostgreSQL users with passwd file"),
100 "Update the database to match the conf file"),
102 "Initial setup of the archive"),
104 "Generates Maintainers file for BTS etc"),
106 "Generates override files"),
108 "Split the pool/ by architecture groups"),
110 "Move packages from dists/ to pool/"),
111 ("reject-proposed-updates",
112 "Manually reject from proposed-updates"),
114 "Install a security upload into the archive"),
115 ("new-security-install",
116 "New way to install a security upload into the archive"),
118 "Split queue/done into a date-based hierarchy"),
120 "Generate statistics"),
122 "Generate compatability symlinks from dists/ into pool/"),
126 ################################################################################
128 def usage(functionality, exit_code=0):
129 """Print a usage message and exit with 'exit_code'."""
131 print """Usage: dak COMMAND [...]
132 Run DAK commands. (Will also work if invoked as COMMAND.)
134 Availble commands:"""
135 for (command, description) in functionality:
136 print " %-23s %s" % (command, description)
139 ################################################################################
142 """Launch dak functionality."""
144 functionality = init()
145 modules = [ command for (command, _) in functionality ]
147 if len(sys.argv) == 0:
148 daklib.utils.fubar("err, argc == 0? how is that possible?")
149 elif (len(sys.argv) == 1
150 or (len(sys.argv) == 2 and
151 (sys.argv[1] == "--help" or sys.argv[1] == "-h"))):
154 # First see if we were invoked with/as the name of a module
155 cmdname = sys.argv[0]
156 cmdname = cmdname[cmdname.rfind("/")+1:]
157 if cmdname in modules:
159 # Otherwise the argument is the module
161 cmdname = sys.argv[1]
162 sys.argv = [sys.argv[0] + " " + sys.argv[1]] + sys.argv[2:]
163 if cmdname not in modules:
166 if name.startswith(cmdname):
171 daklib.utils.warn("ambiguous command '%s' - could be %s" \
172 % (cmdname, ", ".join(match)))
173 usage(functionality, 1)
175 daklib.utils.warn("unknown command '%s'" % (cmdname))
176 usage(functionality, 1)
179 module = __import__(cmdname.replace("-","_"))
182 ################################################################################
184 if __name__ == "__main__":