]> git.decadent.org.uk Git - dak.git/blob - dak/new_security_install.py
get bootstrap working again
[dak.git] / dak / new_security_install.py
1 #!/usr/bin/env python
2
3 """ Wrapper for Debian Security team """
4 # Copyright (C) 2006  Anthony Towns <ajt@debian.org>
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 # USA
20
21 ################################################################################
22
23 import apt_pkg, os, sys, pwd, time, commands
24
25 from daklib import queue
26 from daklib import logging
27 from daklib import utils
28 from daklib import database
29 from daklib.regexes import re_taint_free
30
31 Cnf = None
32 Options = None
33 Upload = None
34 Logger = None
35
36 advisory = None
37 changes = []
38 srcverarches = {}
39
40 def init():
41     global Cnf, Upload, Options, Logger
42
43     Cnf = utils.get_conf()
44     Cnf["Dinstall::Options::No-Mail"] = "y"
45     Arguments = [('h', "help", "Security-Install::Options::Help"),
46                  ('a', "automatic", "Security-Install::Options::Automatic"),
47                  ('n', "no-action", "Security-Install::Options::No-Action"),
48                  ('s', "sudo", "Security-Install::Options::Sudo"),
49                  (' ', "no-upload", "Security-Install::Options::No-Upload"),
50                  ('u', "fg-upload", "Security-Install::Options::Foreground-Upload"),
51                  (' ', "drop-advisory", "Security-Install::Options::Drop-Advisory"),
52                  ('A', "approve", "Security-Install::Options::Approve"),
53                  ('R', "reject", "Security-Install::Options::Reject"),
54                  ('D', "disembargo", "Security-Install::Options::Disembargo") ]
55
56     for i in Arguments:
57         Cnf[i[2]] = ""
58
59     arguments = apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
60
61     Options = Cnf.SubTree("Security-Install::Options")
62
63     whoami = os.getuid()
64     whoamifull = pwd.getpwuid(whoami)
65     username = whoamifull[0]
66     if username != "dak":
67         print "Non-dak user: %s" % username
68         Options["Sudo"] = "y"
69
70     if Options["Help"]:
71         print "help yourself"
72         sys.exit(0)
73
74     if len(arguments) == 0:
75         utils.fubar("Process what?")
76
77     Upload = queue.Upload(Cnf)
78     if Options["No-Action"]:
79         Options["Sudo"] = ""
80     if not Options["Sudo"] and not Options["No-Action"]:
81         Logger = Upload.Logger = logging.Logger(Cnf, "new-security-install")
82
83     return arguments
84
85 def quit():
86     if Logger:
87         Logger.close()
88     sys.exit(0)
89
90 def load_args(arguments):
91     global advisory, changes
92
93     adv_ids = {}
94     if not arguments[0].endswith(".changes"):
95         adv_ids [arguments[0]] = 1
96         arguments = arguments[1:]
97
98     null_adv_changes = []
99
100     changesfiles = {}
101     for a in arguments:
102         if "/" in a:
103             utils.fubar("can only deal with files in the current directory")
104         if not a.endswith(".changes"):
105             utils.fubar("not a .changes file: %s" % (a))
106         Upload.init_vars()
107         Upload.pkg.changes_file = a
108         Upload.update_vars()
109         if "adv id" in Upload.pkg.changes:
110             changesfiles[a] = 1
111             adv_ids[Upload.pkg.changes["adv id"]] = 1
112         else:
113             null_adv_changes.append(a)
114
115     adv_ids = adv_ids.keys()
116     if len(adv_ids) > 1:
117         utils.fubar("multiple advisories selected: %s" % (", ".join(adv_ids)))
118     if adv_ids == []:
119         advisory = None
120     else:
121         advisory = adv_ids[0]
122
123     changes = changesfiles.keys()
124     return null_adv_changes
125
126 def load_adv_changes():
127     global srcverarches, changes
128
129     for c in os.listdir("."):
130         if not c.endswith(".changes"): continue
131         Upload.init_vars()
132         Upload.pkg.changes_file = c
133         Upload.update_vars()
134         if "adv id" not in Upload.pkg.changes:
135             continue
136         if Upload.pkg.changes["adv id"] != advisory:
137             continue
138
139         if c not in changes: changes.append(c)
140         srcver = "%s %s" % (Upload.pkg.changes["source"],
141                             Upload.pkg.changes["version"])
142         srcverarches.setdefault(srcver, {})
143         for arch in Upload.pkg.changes["architecture"].keys():
144             srcverarches[srcver][arch] = 1
145
146 def advisory_info():
147     if advisory != None:
148         print "Advisory: %s" % (advisory)
149     print "Changes:"
150     for c in changes:
151         print " %s" % (c)
152
153     print "Packages:"
154     svs = srcverarches.keys()
155     svs.sort()
156     for sv in svs:
157         as = srcverarches[sv].keys()
158         as.sort()
159         print " %s (%s)" % (sv, ", ".join(as))
160
161 def prompt(opts, default):
162     p = ""
163     v = {}
164     for o in opts:
165         v[o[0].upper()] = o
166         if o[0] == default:
167             p += ", [%s]%s" % (o[0], o[1:])
168         else:
169             p += ", " + o
170     p = p[2:] + "? "
171     a = None
172
173     if Options["Automatic"]:
174         a = default
175
176     while a not in v:
177         a = utils.our_raw_input(p) + default
178         a = a[:1].upper()
179
180     return v[a]
181
182 def add_changes(extras):
183     for c in extras:
184         changes.append(c)
185         Upload.init_vars()
186         Upload.pkg.changes_file = c
187         Upload.update_vars()
188         srcver = "%s %s" % (Upload.pkg.changes["source"], Upload.pkg.changes["version"])
189         srcverarches.setdefault(srcver, {})
190         for arch in Upload.pkg.changes["architecture"].keys():
191             srcverarches[srcver][arch] = 1
192         Upload.pkg.changes["adv id"] = advisory
193         Upload.dump_vars(os.getcwd())
194
195 def yes_no(prompt):
196     if Options["Automatic"]: return True
197     while 1:
198         answer = utils.our_raw_input(prompt + " ").lower()
199         if answer in "yn":
200             return answer == "y"
201         print "Invalid answer; please try again."
202
203 def do_upload():
204     if Options["No-Upload"]:
205         print "Not uploading as requested"
206     elif Options["Foreground-Upload"]:
207         actually_upload(changes)
208     else:
209         child = os.fork()
210         if child == 0:
211             actually_upload(changes)
212             os._exit(0)
213         print "Uploading in the background"
214
215 def actually_upload(changes_files):
216     file_list = ""
217     suites = {}
218     component_mapping = {}
219     for component in Cnf.SubTree("Security-Install::ComponentMappings").List():
220         component_mapping[component] = Cnf["Security-Install::ComponentMappings::%s" % (component)]
221     uploads = {}; # uploads[uri] = file_list
222     changesfiles = {}; # changesfiles[uri] = file_list
223     package_list = {} # package_list[source_name][version]
224     changes_files.sort(utils.changes_compare)
225     for changes_file in changes_files:
226         changes_file = utils.validate_changes_file_arg(changes_file)
227         # Reset variables
228         components = {}
229         upload_uris = {}
230         file_list = []
231         Upload.init_vars()
232         # Parse the .dak file for the .changes file
233         Upload.pkg.changes_file = changes_file
234         Upload.update_vars()
235         files = Upload.pkg.files
236         changes = Upload.pkg.changes
237         dsc = Upload.pkg.dsc
238         # Build the file list for this .changes file
239         for file in files.keys():
240             poolname = os.path.join(Cnf["Dir::Root"], Cnf["Dir::PoolRoot"],
241                                     utils.poolify(changes["source"], files[file]["component"]),
242                                     file)
243             file_list.append(poolname)
244             orig_component = files[file].get("original component", files[file]["component"])
245             components[orig_component] = ""
246         # Determine the upload uri for this .changes file
247         for component in components.keys():
248             upload_uri = component_mapping.get(component)
249             if upload_uri:
250                 upload_uris[upload_uri] = ""
251         num_upload_uris = len(upload_uris.keys())
252         if num_upload_uris == 0:
253             utils.fubar("%s: No valid upload URI found from components (%s)."
254                         % (changes_file, ", ".join(components.keys())))
255         elif num_upload_uris > 1:
256             utils.fubar("%s: more than one upload URI (%s) from components (%s)."
257                         % (changes_file, ", ".join(upload_uris.keys()),
258                            ", ".join(components.keys())))
259         upload_uri = upload_uris.keys()[0]
260         # Update the file list for the upload uri
261         if not uploads.has_key(upload_uri):
262             uploads[upload_uri] = []
263         uploads[upload_uri].extend(file_list)
264         # Update the changes list for the upload uri
265         if not changesfiles.has_key(upload_uri):
266             changesfiles[upload_uri] = []
267         changesfiles[upload_uri].append(changes_file)
268         # Remember the suites and source name/version
269         for suite in changes["distribution"].keys():
270             suites[suite] = ""
271         # Remember the source name and version
272         if changes["architecture"].has_key("source") and \
273            changes["distribution"].has_key("testing"):
274             if not package_list.has_key(dsc["source"]):
275                 package_list[dsc["source"]] = {}
276             package_list[dsc["source"]][dsc["version"]] = ""
277
278     for uri in uploads.keys():
279         uploads[uri].extend(changesfiles[uri])
280         (host, path) = uri.split(":")
281         #        file_list = " ".join(uploads[uri])
282         print "Moving files to UploadQueue"
283         for filename in uploads[uri]:
284             utils.copy(filename, Cnf["Dir::Upload"])
285             # .changes files have already been moved to queue/done by p-a
286             if not filename.endswith('.changes'):
287                 remove_from_buildd(suites, filename)
288         #spawn("lftp -c 'open %s; cd %s; put %s'" % (host, path, file_list))
289
290     if not Options["No-Action"]:
291         filename = "%s/testing-processed" % (Cnf["Dir::Log"])
292         file = utils.open_file(filename, 'a')
293         for source in package_list.keys():
294             for version in package_list[source].keys():
295                 file.write(" ".join([source, version])+'\n')
296         file.close()
297
298 def remove_from_buildd(suites, filename):
299     """Check the buildd dir for each suite and remove the file if needed"""
300     builddbase = Cnf["Dir::QueueBuild"]
301     filebase = os.path.basename(filename)
302     for s in suites:
303         try:
304             os.unlink(os.path.join(builddbase, s, filebase))
305         except OSError, e:
306             utils.warn("Problem removing %s from buildd queue %s [%s]" % (filebase, s, str(e)))
307
308
309 def generate_advisory(template):
310     global changes, advisory
311
312     adv_packages = []
313     updated_pkgs = {};  # updated_pkgs[distro][arch][file] = {path,md5,size}
314
315     for arg in changes:
316         arg = utils.validate_changes_file_arg(arg)
317         Upload.pkg.changes_file = arg
318         Upload.init_vars()
319         Upload.update_vars()
320
321         src = Upload.pkg.changes["source"]
322         src_ver = "%s (%s)" % (src, Upload.pkg.changes["version"])
323         if src_ver not in adv_packages:
324             adv_packages.append(src_ver)
325
326         suites = Upload.pkg.changes["distribution"].keys()
327         for suite in suites:
328             if not updated_pkgs.has_key(suite):
329                 updated_pkgs[suite] = {}
330
331         files = Upload.pkg.files
332         for file in files.keys():
333             arch = files[file]["architecture"]
334             md5 = files[file]["md5sum"]
335             size = files[file]["size"]
336             poolname = Cnf["Dir::PoolRoot"] + \
337                 utils.poolify(src, files[file]["component"])
338             if arch == "source" and file.endswith(".dsc"):
339                 dscpoolname = poolname
340             for suite in suites:
341                 if not updated_pkgs[suite].has_key(arch):
342                     updated_pkgs[suite][arch] = {}
343                 updated_pkgs[suite][arch][file] = {
344                     "md5": md5, "size": size, "poolname": poolname }
345
346         dsc_files = Upload.pkg.dsc_files
347         for file in dsc_files.keys():
348             arch = "source"
349             if not dsc_files[file].has_key("files id"):
350                 continue
351
352             # otherwise, it's already in the pool and needs to be
353             # listed specially
354             md5 = dsc_files[file]["md5sum"]
355             size = dsc_files[file]["size"]
356             for suite in suites:
357                 if not updated_pkgs[suite].has_key(arch):
358                     updated_pkgs[suite][arch] = {}
359                 updated_pkgs[suite][arch][file] = {
360                     "md5": md5, "size": size, "poolname": dscpoolname }
361
362     if os.environ.has_key("SUDO_UID"):
363         whoami = long(os.environ["SUDO_UID"])
364     else:
365         whoami = os.getuid()
366     whoamifull = pwd.getpwuid(whoami)
367     username = whoamifull[4].split(",")[0]
368
369     Subst = {
370         "__ADVISORY__": advisory,
371         "__WHOAMI__": username,
372         "__DATE__": time.strftime("%B %d, %Y", time.gmtime(time.time())),
373         "__PACKAGE__": ", ".join(adv_packages),
374         "__DAK_ADDRESS__": Cnf["Dinstall::MyEmailAddress"]
375         }
376
377     if Cnf.has_key("Dinstall::Bcc"):
378         Subst["__BCC__"] = "Bcc: %s" % (Cnf["Dinstall::Bcc"])
379
380     adv = ""
381     archive = Cnf["Archive::%s::PrimaryMirror" % (utils.where_am_i())]
382     for suite in updated_pkgs.keys():
383         ver = Cnf["Suite::%s::Version" % suite]
384         if ver != "": ver += " "
385         suite_header = "%s %s(%s)" % (Cnf["Dinstall::MyDistribution"],
386                                        ver, suite)
387         adv += "%s\n%s\n\n" % (suite_header, "-"*len(suite_header))
388
389         arches = database.get_suite_architectures(suite)
390         if "source" in arches:
391             arches.remove("source")
392         if "all" in arches:
393             arches.remove("all")
394         arches.sort()
395
396         adv += "%s updates are available for %s.\n\n" % (
397                 suite.capitalize(), utils.join_with_commas_and(arches))
398
399         for a in ["source", "all"] + arches:
400             if not updated_pkgs[suite].has_key(a):
401                 continue
402
403             if a == "source":
404                 adv += "Source archives:\n\n"
405             elif a == "all":
406                 adv += "Architecture independent packages:\n\n"
407             else:
408                 adv += "%s architecture (%s)\n\n" % (a,
409                         Cnf["Architectures::%s" % a])
410
411             for file in updated_pkgs[suite][a].keys():
412                 adv += "  http://%s/%s%s\n" % (
413                                 archive, updated_pkgs[suite][a][file]["poolname"], file)
414                 adv += "    Size/MD5 checksum: %8s %s\n" % (
415                         updated_pkgs[suite][a][file]["size"],
416                         updated_pkgs[suite][a][file]["md5"])
417             adv += "\n"
418     adv = adv.rstrip()
419
420     Subst["__ADVISORY_TEXT__"] = adv
421
422     adv = utils.TemplateSubst(Subst, template)
423     return adv
424
425 def spawn(command):
426     if not re_taint_free.match(command):
427         utils.fubar("Invalid character in \"%s\"." % (command))
428
429     if Options["No-Action"]:
430         print "[%s]" % (command)
431     else:
432         (result, output) = commands.getstatusoutput(command)
433         if (result != 0):
434             utils.fubar("Invocation of '%s' failed:\n%s\n" % (command, output), result)
435
436
437 ##################### ! ! ! N O T E ! ! !  #####################
438 #
439 # These functions will be reinvoked by semi-priveleged users, be careful not
440 # to invoke external programs that will escalate privileges, etc.
441 #
442 ##################### ! ! ! N O T E ! ! !  #####################
443
444 def sudo(arg, fn, exit):
445     if Options["Sudo"]:
446         if advisory == None:
447             utils.fubar("Must set advisory name")
448         os.spawnl(os.P_WAIT, "/usr/bin/sudo", "/usr/bin/sudo", "-u", "dak", "-H",
449                   "/usr/local/bin/dak", "new-security-install", "-"+arg, "--", advisory)
450     else:
451         fn()
452     if exit:
453         quit()
454
455 def do_Approve(): sudo("A", _do_Approve, True)
456 def _do_Approve():
457     # 1. dump advisory in drafts
458     draft = "/org/security.debian.org/advisories/drafts/%s" % (advisory)
459     print "Advisory in %s" % (draft)
460     if not Options["No-Action"]:
461         adv_file = "./advisory.%s" % (advisory)
462         if not os.path.exists(adv_file):
463             adv_file = Cnf["Dir::Templates"]+"/security-install.advisory"
464         adv_fd = os.open(draft, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0664)
465         os.write(adv_fd, generate_advisory(adv_file))
466         os.close(adv_fd)
467         adv_fd = None
468
469     # 2. run dak process-accepted on changes
470     print "Accepting packages..."
471     spawn("dak process-accepted -pa %s" % (" ".join(changes)))
472
473     # 3. run dak make-suite-file-list / apt-ftparchve / dak generate-releases
474     print "Updating file lists for apt-ftparchive..."
475     spawn("dak make-suite-file-list")
476     print "Updating Packages and Sources files..."
477     spawn("/org/security.debian.org/dak/config/debian-security/map.sh")
478     spawn("apt-ftparchive generate %s" % (utils.which_apt_conf_file()))
479     print "Updating Release files..."
480     spawn("dak generate-releases")
481     print "Triggering security mirrors..."
482     spawn("sudo -u archvsync -H /home/archvsync/signal_security")
483
484     # 4. chdir to done - do upload
485     if not Options["No-Action"]:
486         os.chdir(Cnf["Dir::Queue::Done"])
487     do_upload()
488
489 def do_Disembargo(): sudo("D", _do_Disembargo, True)
490 def _do_Disembargo():
491     if os.getcwd() != Cnf["Dir::Queue::Embargoed"].rstrip("/"):
492         utils.fubar("Can only disembargo from %s" % Cnf["Dir::Queue::Embargoed"])
493
494     dest = Cnf["Dir::Queue::Unembargoed"]
495     emb_q = database.get_or_set_queue_id("embargoed")
496     une_q = database.get_or_set_queue_id("unembargoed")
497
498     for c in changes:
499         print "Disembargoing %s" % (c)
500
501         Upload.init_vars()
502         Upload.pkg.changes_file = c
503         Upload.update_vars()
504
505         if "source" in Upload.pkg.changes["architecture"].keys():
506             print "Adding %s %s to disembargo table" % (Upload.pkg.changes["source"], Upload.pkg.changes["version"])
507             Upload.projectB.query("INSERT INTO disembargo (package, version) VALUES ('%s', '%s')" % (Upload.pkg.changes["source"], Upload.pkg.changes["version"]))
508
509         files = {}
510         for suite in Upload.pkg.changes["distribution"].keys():
511             if suite not in Cnf.ValueList("Dinstall::QueueBuildSuites"):
512                 continue
513             dest_dir = Cnf["Dir::QueueBuild"]
514             if Cnf.FindB("Dinstall::SecurityQueueBuild"):
515                 dest_dir = os.path.join(dest_dir, suite)
516             for file in Upload.pkg.files.keys():
517                 files[os.path.join(dest_dir, file)] = 1
518
519         files = files.keys()
520         Upload.projectB.query("BEGIN WORK")
521         for f in files:
522             Upload.projectB.query("UPDATE queue_build SET queue = %s WHERE filename = '%s' AND queue = %s" % (une_q, f, emb_q))
523         Upload.projectB.query("COMMIT WORK")
524
525         for file in Upload.pkg.files.keys():
526             utils.copy(file, os.path.join(dest, file))
527             os.unlink(file)
528
529     for c in changes:
530         utils.copy(c, os.path.join(dest, c))
531         os.unlink(c)
532         k = c[:-8] + ".dak"
533         utils.copy(k, os.path.join(dest, k))
534         os.unlink(k)
535
536 def do_Reject(): sudo("R", _do_Reject, True)
537 def _do_Reject():
538     global changes
539     for c in changes:
540         print "Rejecting %s..." % (c)
541         Upload.init_vars()
542         Upload.pkg.changes_file = c
543         Upload.update_vars()
544         files = {}
545         for suite in Upload.pkg.changes["distribution"].keys():
546             if suite not in Cnf.ValueList("Dinstall::QueueBuildSuites"):
547                 continue
548             dest_dir = Cnf["Dir::QueueBuild"]
549             if Cnf.FindB("Dinstall::SecurityQueueBuild"):
550                 dest_dir = os.path.join(dest_dir, suite)
551             for file in Upload.pkg.files.keys():
552                 files[os.path.join(dest_dir, file)] = 1
553
554         files = files.keys()
555
556         aborted = Upload.do_reject()
557         if not aborted:
558             os.unlink(c[:-8]+".dak")
559             for f in files:
560                 Upload.projectB.query(
561                     "DELETE FROM queue_build WHERE filename = '%s'" % (f))
562                 os.unlink(f)
563
564     print "Updating buildd information..."
565     spawn("/org/security.debian.org/dak/config/debian-security/cron.buildd")
566
567     adv_file = "./advisory.%s" % (advisory)
568     if os.path.exists(adv_file):
569         os.unlink(adv_file)
570
571 def do_DropAdvisory():
572     for c in changes:
573         Upload.init_vars()
574         Upload.pkg.changes_file = c
575         Upload.update_vars()
576         del Upload.pkg.changes["adv id"]
577         Upload.dump_vars(os.getcwd())
578     quit()
579
580 def do_Edit():
581     adv_file = "./advisory.%s" % (advisory)
582     if not os.path.exists(adv_file):
583         utils.copy(Cnf["Dir::Templates"]+"/security-install.advisory", adv_file)
584     editor = os.environ.get("EDITOR", "vi")
585     result = os.system("%s %s" % (editor, adv_file))
586     if result != 0:
587         utils.fubar("%s invocation failed for %s." % (editor, adv_file))
588
589 def do_Show():
590     adv_file = "./advisory.%s" % (advisory)
591     if not os.path.exists(adv_file):
592         adv_file = Cnf["Dir::Templates"]+"/security-install.advisory"
593     print "====\n%s\n====" % (generate_advisory(adv_file))
594
595 def do_Quit():
596     quit()
597
598 def main():
599     global changes
600
601     args = init()
602     extras = load_args(args)
603     if advisory:
604         load_adv_changes()
605     if extras:
606         if not advisory:
607             changes = extras
608         else:
609             if srcverarches == {}:
610                 if not yes_no("Create new advisory %s?" % (advisory)):
611                     print "Not doing anything, then"
612                     quit()
613             else:
614                 advisory_info()
615                 doextras = []
616                 for c in extras:
617                     if yes_no("Add %s to %s?" % (c, advisory)):
618                         doextras.append(c)
619                 extras = doextras
620             add_changes(extras)
621
622     if not advisory:
623         utils.fubar("Must specify an advisory id")
624
625     if not changes:
626         utils.fubar("No changes specified")
627
628     if Options["Approve"]:
629         advisory_info()
630         do_Approve()
631     elif Options["Reject"]:
632         advisory_info()
633         do_Reject()
634     elif Options["Disembargo"]:
635         advisory_info()
636         do_Disembargo()
637     elif Options["Drop-Advisory"]:
638         advisory_info()
639         do_DropAdvisory()
640     else:
641         while 1:
642             default = "Q"
643             opts = ["Approve", "Edit advisory"]
644             if os.path.exists("./advisory.%s" % advisory):
645                 default = "A"
646             else:
647                 default = "E"
648             if os.getcwd() == Cnf["Dir::Queue::Embargoed"].rstrip("/"):
649                 opts.append("Disembargo")
650             opts += ["Show advisory", "Reject", "Quit"]
651
652             advisory_info()
653             what = prompt(opts, default)
654
655             if what == "Quit":
656                 do_Quit()
657             elif what == "Approve":
658                 do_Approve()
659             elif what == "Edit advisory":
660                 do_Edit()
661             elif what == "Show advisory":
662                 do_Show()
663             elif what == "Disembargo":
664                 do_Disembargo()
665             elif what == "Reject":
666                 do_Reject()
667             else:
668                 utils.fubar("Impossible answer '%s', wtf?" % (what))
669
670 ################################################################################
671
672 if __name__ == '__main__':
673     main()
674
675 ################################################################################