3 # Launch dak functionality
4 # Copyright (c) 2005 Anthony Towns <ajt@debian.org>
5 # $Id: dak,v 1.1 2005-11-17 08:47:31 ajt Exp $
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 ################################################################################
33 ################################################################################
35 # maps a command name to a module name
37 ("ls", "Show which suites packages are in",
38 ("madison", "main"), ["madison"]),
39 ("rm", "Remove packages from suites", "melanie"),
41 ("decode-dot-dak", "Display contents of a .katie file", "ashley"),
42 ("override", "Query/change the overrides", "alicia"),
44 ("install", "Install a package from accepted (security only)",
45 "amber"), # XXX - hmm (ajt)
46 ("reject-proposed-updates", "Manually reject from proposed-updates", "lauren"),
47 ("process-new", "Process NEW and BYHAND packages", "lisa"),
49 ("control-overrides", "Manipulate/list override entries in bulk",
51 ("control-suite", "Manipulate suites in bulk", "heidi"),
53 ("stats", "Generate stats pr0n", "saffron"),
54 ("cruft-report", "Check for obsolete or duplicated packages",
56 ("queue-report", "Produce a report on NEW and BYHAND packages",
58 ("compare-suites", "Show fixable discrepencies between suites",
61 ("check-archive", "Archive sanity checks", "tea"),
62 ("check-overrides", "Override cruft checks", "cindy"),
63 ("check-proposed-updates", "Dependency checking for proposed-updates",
66 ("examine-package", "Show information useful for NEW processing",
69 ("init-db", "Update the database to match the conf file",
71 ("init-dirs", "Initial setup of the archive", "rose"),
72 ("import-archive", "Populate SQL database based from an archive tree",
75 ("poolize", "Move packages from dists/ to pool/", "catherine"),
76 ("symlink-dists", "Generate compatability symlinks from dists/",
79 ("process-unchecked", "Process packages in queue/unchecked", "jennifer"),
81 ("process-accepted", "Install packages into the pool", "kelly"),
82 ("generate-releases", "Generate Release files", "ziyi"),
83 ("generate-index-diffs", "Generate .diff/Index files", "tiffani"),
85 ("make-suite-file-list",
86 "Generate lists of packages per suite for apt-ftparchive", "jenna"),
87 ("make-maintainers", "Generates Maintainers file for BTS etc",
89 ("make-overrides", "Generates override files", "denise"),
91 ("mirror-split", "Split the pool/ by architecture groups",
94 ("clean-proposed-updates", "Remove obsolete .changes from proposed-updates",
96 ("clean-queues", "Clean cruft from incoming", "shania"),
98 "Clean unused/superseded packages from the archive", "rhona"),
100 ("split-done", "Split queue/done into a data-based hierarchy",
103 ("import-ldap-fingerprints",
104 "Syncs fingerprint and uid tables with Debian LDAP db", "emilie"),
105 ("import-users-from-passwd",
106 "Sync PostgreSQL users with passwd file", "julia"),
107 ("find-null-maintainers",
108 "Check for users with no packages in the archive", "rosamund"),
112 for f in functionality:
113 if isinstance(f[2], str):
114 names[f[2]] = names[f[0]] = (f[2], "main")
117 for a in f[3]: names[a] = f[2]
119 ################################################################################
122 if len(sys.argv) == 0:
123 print "err, argc == 0? how is that possible?"
125 elif len(sys.argv) == 1 or (len(sys.argv) == 2 and sys.argv[1] == "--help"):
126 print "Sub commands:"
127 for f in functionality:
128 print " %-23s %s" % (f[0], f[1])
131 # should set PATH based on sys.argv[0] maybe
132 # possibly should set names based on sys.argv[0] too
133 sys.path = [sys.path[0]+"/py-symlinks"] + sys.path
135 cmdname = sys.argv[0]
136 cmdname = cmdname[cmdname.rfind("/")+1:]
138 pass # invoke directly
140 cmdname = sys.argv[1]
141 sys.argv = [sys.argv[0] + " " + sys.argv[1]] + sys.argv[2:]
142 if cmdname not in names:
145 if f.startswith(cmdname):
150 print "ambiguous command: %s" % ", ".join(match)
153 print "unknown command \"%s\"" % (cmdname)
156 func = names[cmdname]
157 x = __import__(func[0])
158 x.__getattribute__(func[1])()
160 if __name__ == "__main__":