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"),
93 ("import-ldap-fingerprints",
94 "Syncs fingerprint and uid tables with Debian LDAP db"),
95 ("import-users-from-passwd",
96 "Sync PostgreSQL users with passwd file"),
98 "Update the database to match the conf file"),
100 "Initial setup of the archive"),
102 "Generates Maintainers file for BTS etc"),
104 "Generates override files"),
106 "Split the pool/ by architecture groups"),
108 "Move packages from dists/ to pool/"),
109 ("reject-proposed-updates",
110 "Manually reject from proposed-updates"),
112 "Install a security upload into the archive"),
113 ("new-security-install",
114 "New way to install a security upload into the archive"),
116 "Split queue/done into a date-based hierarchy"),
118 "Generate statistics"),
120 "Generate compatability symlinks from dists/ into pool/"),
124 ################################################################################
126 def usage(functionality, exit_code=0):
127 """Print a usage message and exit with 'exit_code'."""
129 print """Usage: dak COMMAND [...]
130 Run DAK commands. (Will also work if invoked as COMMAND.)
132 Availble commands:"""
133 for (command, description) in functionality:
134 print " %-23s %s" % (command, description)
137 ################################################################################
140 """Launch dak functionality."""
142 functionality = init()
143 modules = [ command for (command, _) in functionality ]
145 if len(sys.argv) == 0:
146 daklib.utils.fubar("err, argc == 0? how is that possible?")
147 elif (len(sys.argv) == 1
148 or (len(sys.argv) == 2 and
149 (sys.argv[1] == "--help" or sys.argv[1] == "-h"))):
152 # First see if we were invoked with/as the name of a module
153 cmdname = sys.argv[0]
154 cmdname = cmdname[cmdname.rfind("/")+1:]
155 if cmdname in modules:
157 # Otherwise the argument is the module
159 cmdname = sys.argv[1]
160 sys.argv = [sys.argv[0] + " " + sys.argv[1]] + sys.argv[2:]
161 if cmdname not in modules:
164 if name.startswith(cmdname):
169 daklib.utils.warn("ambiguous command '%s' - could be %s" \
170 % (cmdname, ", ".join(match)))
171 usage(functionality, 1)
173 daklib.utils.warn("unknown command '%s'" % (cmdname))
174 usage(functionality, 1)
177 module = __import__(cmdname.replace("-","_"))
180 ################################################################################
182 if __name__ == "__main__":