]> git.decadent.org.uk Git - dak.git/commitdiff
Merge klecker changes from mainline.
authorArchive Administrator <ftpmaster@debian.org>
Fri, 16 Jun 2006 04:47:57 +0000 (21:47 -0700)
committerArchive Administrator <ftpmaster@debian.org>
Fri, 16 Jun 2006 04:47:57 +0000 (21:47 -0700)
12 files changed:
ChangeLog
config/debian-security/apt.conf
config/debian-security/apt.conf.buildd
config/debian-security/cron.unchecked
config/debian-security/dak.conf
config/debian-security/vars
dak/dak.py
dak/decode_dot_dak.py
dak/new_security_install.py [new file with mode: 0755]
dak/process_unchecked.py
dak/security_install.py
daklib/queue.py

index 1cce754897bc0e7d993bdf0307f666739d0adb48..f903de146c9fabd84a7b73f4e243445615336413 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2006-06-16  James Troup  <james@nocrew.org>
+
+       * dak/dak.py (init): add new-security-install.
+
+       * dak/new_security_install.py: cleanups and adapt for new naming
+       scheme and other changes.
+
+2006-06-16  Anthony Towns  <ajt@debian.org>
+
+       * dak/new_security_install.py: initial version imported from
+       klecker.
+
+2006-06-16  James Troup  <james@nocrew.org>
+
+       [Merged changes from klecker - original author unknown.]
+
+       * daklib/queue.py (Upload.dump_vars): also save changes["adv id"].
+
+       * dak/security_install.py (do_upload): fix check for oldstable and
+       upload file list handling.
+
+       * dak/process_unchecked.py (check_files): update "check for
+       source" code to also look in Embargoed and Unembargoed queues.
+       (is_unembargo): fix handling of Dir::Queue::Disembargo.
+
+       * dak/decode_dot_dak.py (main): add support for changes["adv id"].
+
+       * config/debian-security/vars (disembargo): add.
+
+       * config/debian-security/dak.conf (Dinstall::SigningKeyIds):
+       update.
+       (Process-Unchecked::AcceptedLockFile): add.
+       (Suite::Testing): clean up Version and Description.
+       (SuiteMappings): add silent map from etch-secure to testing.
+
+       * config/debian-security/cron.unchecked: add support for
+       disembargoed queues.
+
+       * config/debian-security/apt.conf.buildd: add bzip2ed Packages
+       files too.
+
+       * config/debian-security/apt.conf: add amd64 to architectures for
+       testing-security.
+
 2006-06-11  James Troup  <troup@spohr.debian.org>
 
        * config/debian/cron.daily: invoke process-accepted not
index 2d70b42201f5c340fec7f3943b314ac062846849..6d286cd18fac687e4bcf0ec53435622061768783 100644 (file)
@@ -42,7 +42,7 @@ tree "dists/testing/updates"
    FileList "/org/security.debian.org/dak-database/dists/testing_updates/$(SECTION)_binary-$(ARCH).list";
    SourceFileList "/org/security.debian.org/dak-database/dists/testing_updates/$(SECTION)_source.list";
    Sections "main contrib non-free";
-   Architectures "alpha arm hppa i386 ia64 mips mipsel m68k powerpc s390 sparc source";
+   Architectures "alpha amd64 arm hppa i386 ia64 mips mipsel m68k powerpc s390 sparc source";
    BinOverride "override.etch.$(SECTION)";
    ExtraOverride "override.etch.extra.$(SECTION)";
    SrcOverride "override.etch.$(SECTION).src";
index 94d2aa3d79206aad57815d28f867bc8ae3acbe98..e021791f700028233f2b0dfb87286576c8a9703a 100644 (file)
@@ -7,8 +7,8 @@ Dir
 
 Default
 {
-   Packages::Compress ". gzip";
-   Sources::Compress ". gzip";
+   Packages::Compress ". gzip bzip2";
+   Sources::Compress ". gzip bzip2";
    DeLinkLimit 0;
    FileMode 0664;
 }
index 5b2800865c7daa1091e20cc5c73cc16cf9f387b9..9f91e68827b41c2cfd39ee6d6cdcfd92102f38b2 100755 (executable)
@@ -4,19 +4,33 @@ set -e
 export SCRIPTVARS=/org/security.debian.org/dak/config/debian-security/vars
 . $SCRIPTVARS
 
+report=$queuedir/REPORT
+reportdis=$queuedir/REPORT.disembargo
+timestamp=$(date "+%Y-%m-%d %H:%M")
+doanything=false
+
 cd $unchecked
+changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
+if [ -n "$changes" ]; then
+  doanything=true
+  echo "$timestamp": "$changes"  >> $report
+  dak process-unchecked -a $changes >> $report
+  echo "--" >> $report
+fi
 
+cd $disembargo
 changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
-report=$queuedir/REPORT
-timestamp=$(date "+%Y-%m-%d %H:%M")
 
-if [ -z "$changes" ]; then
-  echo "$timestamp": Nothing to do >> $report
-  exit 0;
-fi;
+if [ -n "$changes" ]; then
+  doanything=true
+  echo "$timestamp": "$changes"  >> $reportdis
+  dak process-unchecked -a $changes >> $reportdis
+  echo "--" >> $reportdis
+fi
 
-echo "$timestamp": "$changes"  >> $report
-dak process-unchecked -a $changes >> $report
-echo "--" >> $report
+if ! $doanything; then
+  echo "$timestamp": Nothing to do >> $report
+  exit 0
+fi
 
 sh $masterdir/cron.buildd-security
index dd3564d19746980f2983ae8d44ac01ec19ffddf1..3462467be5e1ee5dcdcac4b7bdc607a5883aacca 100644 (file)
@@ -4,7 +4,7 @@ Dinstall
    GPGKeyring "/org/keyring.debian.org/keyrings/debian-keyring.gpg";
    SigningKeyring "/org/non-us.debian.org/s3kr1t/dot-gnupg/secring.gpg";
    SigningPubKeyring "/org/non-us.debian.org/s3kr1t/dot-gnupg/pubring.gpg";
-   SigningKeyIds "4F368D5D";
+   SigningKeyIds "2D230C5F";
    SendmailCommand "/usr/sbin/sendmail -odq -oi -t";
    MyEmailAddress "Debian Installer <installer@ftp-master.debian.org>";
    MyAdminAddress "ftpmaster@debian.org";
@@ -36,6 +36,11 @@ Dinstall
    LegacyStableHasNoSections "false";
 };
 
+Process-Unchecked
+{
+  AcceptedLockFile "/org/security.debian.org/lock/unchecked.lock";
+};
+
 Import-Users-From-Passwd
 {
   ValidGID "800";
@@ -200,10 +205,10 @@ Suite
          sparc;
        };
        Announce "dak@security.debian.org";
-       Version "x.y";
+       Version "";
        Origin "Debian";
        Label "Debian-Security";
-       Description "Debian x.y Security Updates";
+       Description "Debian testing Security Updates";
        CodeName "etch";
        OverrideCodeName "etch";
        CopyDotDak "/org/security.debian.org/queue/done/";
@@ -217,6 +222,7 @@ SuiteMappings
  "silent-map stable-security stable";
  // JT - FIXME, hackorama
  // "silent-map testing-security stable";
+  "silent-map etch-secure testing";
   "silent-map testing-security testing";
 };
 
index d5ff7e75768bd16a59d7491ad953afbfc0c80a8b..2add99ea8016e57d71d24b870920e4a1e5296944 100644 (file)
@@ -6,6 +6,7 @@ masterdir=$base/dak/config/debian-security/
 overridedir=$base/override
 queuedir=$base/queue/
 unchecked=$queuedir/unchecked/
+disembargo=$queuedir/unchecked-disembargo/
 accepted=$queuedir/accepted/
 done=$queuedir/done/
 
index abea91ac672c5c292d073fb366aa419256e8d3f5..c4d76be89db1626cf3e9bd3f46348dfa96d272ad 100755 (executable)
@@ -110,6 +110,8 @@ def init():
          "Manually reject from proposed-updates"),
         ("security-install",
          "Install a security upload into the archive"),
+        ("new-security-install",
+         "New way to install a security upload into the archive"),
         ("split-done",
          "Split queue/done into a date-based hierarchy"),
         ("stats",
index 528aeccc710b5b0e86496003e800b4dcff97f2c3..00b0d1173ad8d8996a39cc3fc757d4a094620cc7 100755 (executable)
@@ -77,7 +77,7 @@ def main():
             print "  %s: %s" % (i.capitalize(), " ".join(changes[i].keys()))
             del changes[i]
         # Optional changes fields
-        for i in [ "changed-by", "filecontents", "format" ]:
+        for i in [ "changed-by", "filecontents", "format", "adv id" ]:
             if changes.has_key(i):
                 print "  %s: %s" % (i.capitalize(), changes[i])
                 del changes[i]
diff --git a/dak/new_security_install.py b/dak/new_security_install.py
new file mode 100755 (executable)
index 0000000..a350846
--- /dev/null
@@ -0,0 +1,570 @@
+#!/usr/bin/env python
+
+# Wrapper for Debian Security team
+# Copyright (C) 2006  Anthony Towns <ajt@debian.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+################################################################################
+
+import daklib.queue, daklib.logging, daklib.utils, daklib.database
+import apt_pkg, os, sys, pwd, time, re, commands
+
+re_taint_free = re.compile(r"^['/;\-\+\.\s\w]+$");
+
+Cnf = None
+Options = None
+Upload = None
+Logger = None
+
+advisory = None
+changes = []
+srcverarches = {}
+
+def init():
+    global Cnf, Upload, Options, Logger
+
+    Cnf = daklib.utils.get_conf()
+    Cnf["Dinstall::Options::No-Mail"] = "y"
+    Arguments = [('h', "help", "Security-Install::Options::Help"),
+                 ('a', "automatic", "Security-Install::Options::Automatic"),
+                 ('n', "no-action", "Security-Install::Options::No-Action"),
+                 ('s', "sudo", "Security-Install::Options::Sudo"),
+                 (' ', "no-upload", "Security-Install::Options::No-Upload"),
+                 (' ', "drop-advisory", "Security-Install::Options::Drop-Advisory"),
+                 ('A', "approve", "Security-Install::Options::Approve"),
+                 ('R', "reject", "Security-Install::Options::Reject"),
+                 ('D', "disembargo", "Security-Install::Options::Disembargo") ]
+
+    for i in Arguments:
+        Cnf[i[2]] = ""
+
+    arguments = apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
+
+    Options = Cnf.SubTree("Security-Install::Options")
+
+    whoami = os.getuid()
+    whoamifull = pwd.getpwuid(whoami)
+    username = whoamifull[0]
+    if username != "dak":
+        print "Non-dak user: %s" % username
+        Options["Sudo"] = "y"
+
+    if Options["Help"]:
+        print "help yourself"
+        sys.exit(0)
+
+    if len(arguments) == 0:
+        daklib.utils.fubar("Process what?")
+
+    Upload = daklib.queue.Upload(Cnf)
+    if not Options["Sudo"] and not Options["No-Action"]:
+        Logger = Upload.Logger = daklib.logging.Logger(Cnf, "new-security-install")
+
+    return arguments
+
+def quit():
+    if Logger:
+        Logger.close()
+    sys.exit(0)
+
+def load_args(arguments):
+    global advisory, changes
+
+    adv_ids = {}
+    if not arguments[0].endswith(".changes"):
+        adv_ids [arguments[0]] = 1
+        arguments = arguments[1:]
+
+    null_adv_changes = []
+
+    changesfiles = {}
+    for a in arguments:
+        if "/" in a:
+            daklib.utils.fubar("can only deal with files in the current directory")
+        if not a.endswith(".changes"):
+            daklib.utils.fubar("not a .changes file: %s" % (a))
+        Upload.init_vars()
+        Upload.pkg.changes_file = a
+        Upload.update_vars()
+        if "adv id" in Upload.pkg.changes:
+            changesfiles[a] = 1
+            adv_ids[Upload.pkg.changes["adv id"]] = 1
+        else:
+            null_adv_changes.append(a)
+
+    adv_ids = adv_ids.keys()
+    if len(adv_ids) > 1:
+        daklib.utils.fubar("multiple advisories selected: %s" % (", ".join(adv_ids)))
+    if adv_ids == []:
+        advisory = None
+    else:
+        advisory = adv_ids[0]
+
+    changes = changesfiles.keys()
+    return null_adv_changes
+
+def load_adv_changes():
+    global srcverarches, changes
+
+    for c in os.listdir("."):
+        if not c.endswith(".changes"): continue
+        Upload.init_vars()
+        Upload.pkg.changes_file = c
+        Upload.update_vars()
+        if "adv id" not in Upload.pkg.changes:
+            continue
+        if Upload.pkg.changes["adv id"] != advisory:
+            continue
+
+        if c not in changes: changes.append(c)
+        srcver = "%s %s" % (Upload.pkg.changes["source"], 
+                            Upload.pkg.changes["version"])
+        srcverarches.setdefault(srcver, {})
+        for arch in Upload.pkg.changes["architecture"].keys():
+            srcverarches[srcver][arch] = 1
+
+def advisory_info():
+    if advisory != None:
+        print "Advisory: %s" % (advisory)
+    print "Changes:"
+    for c in changes:
+        print " %s" % (c)
+
+    print "Packages:"
+    svs = srcverarches.keys()
+    svs.sort()
+    for sv in svs:
+        as = srcverarches[sv].keys()
+        as.sort()
+        print " %s (%s)" % (sv, ", ".join(as))
+
+def prompt(opts, default):
+    p = ""
+    v = {}
+    for o in opts:
+        v[o[0].upper()] = o
+        if o[0] == default:
+            p += ", [%s]%s" % (o[0], o[1:])
+        else:
+            p += ", " + o
+    p = p[2:] + "? "
+    a = None
+
+    if Options["Automatic"]:
+        a = default
+
+    while a not in v:
+        a = daklib.utils.our_raw_input(p) + default
+        a = a[:1].upper()
+        
+    return v[a]
+
+def add_changes(extras):
+    for c in extras:
+        changes.append(c)
+        Upload.init_vars()
+        Upload.pkg.changes_file = c
+        Upload.update_vars()
+        srcver = "%s %s" % (Upload.pkg.changes["source"], Upload.pkg.changes["version"])
+        srcverarches.setdefault(srcver, {})
+        for arch in Upload.pkg.changes["architecture"].keys():
+            srcverarches[srcver][arch] = 1
+        Upload.pkg.changes["adv id"] = advisory
+        Upload.dump_vars(os.getcwd())
+
+def yes_no(prompt):
+    if Options["Automatic"]: return True
+    while 1:
+        answer = daklib.utils.our_raw_input(prompt + " ").lower()
+        if answer in "yn":
+            return answer == "y"
+        print "Invalid answer; please try again."
+
+def do_upload():
+    if Options["No-Upload"]:
+        print "Not uploading as requested"
+        return
+
+    print "Would upload to ftp-master" # XXX
+
+def generate_advisory(template):
+    global changes, advisory
+
+    adv_packages = []
+    updated_pkgs = {};  # updated_pkgs[distro][arch][file] = {path,md5,size}
+
+    for arg in changes:
+        arg = daklib.utils.validate_changes_file_arg(arg)
+        Upload.pkg.changes_file = arg
+        Upload.init_vars()
+        Upload.update_vars()
+
+        src = Upload.pkg.changes["source"]
+        src_ver = "%s (%s)" % (src, Upload.pkg.changes["version"])
+        if src_ver not in adv_packages:
+            adv_packages.append(src_ver)
+
+        suites = Upload.pkg.changes["distribution"].keys()
+        for suite in suites:
+            if not updated_pkgs.has_key(suite):
+                updated_pkgs[suite] = {}
+
+        files = Upload.pkg.files
+        for file in files.keys():
+            arch = files[file]["architecture"]
+            md5 = files[file]["md5sum"]
+            size = files[file]["size"]
+            poolname = Cnf["Dir::PoolRoot"] + \
+                daklib.utils.poolify(src, files[file]["component"])
+            if arch == "source" and file.endswith(".dsc"):
+                dscpoolname = poolname
+            for suite in suites:
+                if not updated_pkgs[suite].has_key(arch):
+                    updated_pkgs[suite][arch] = {}
+                updated_pkgs[suite][arch][file] = {
+                    "md5": md5, "size": size, "poolname": poolname }
+
+        dsc_files = Upload.pkg.dsc_files
+        for file in dsc_files.keys():
+            arch = "source"
+            if not dsc_files[file].has_key("files id"):
+                continue
+
+            # otherwise, it's already in the pool and needs to be
+            # listed specially
+            md5 = dsc_files[file]["md5sum"]
+            size = dsc_files[file]["size"]
+            for suite in suites:
+                if not updated_pkgs[suite].has_key(arch):
+                    updated_pkgs[suite][arch] = {}
+                updated_pkgs[suite][arch][file] = {
+                    "md5": md5, "size": size, "poolname": dscpoolname }
+
+    if os.environ.has_key("SUDO_UID"):
+        whoami = long(os.environ["SUDO_UID"])
+    else:
+        whoami = os.getuid()
+    whoamifull = pwd.getpwuid(whoami)
+    username = whoamifull[4].split(",")[0]
+
+    Subst = {
+        "__ADVISORY__": advisory,
+        "__WHOAMI__": username,
+        "__DATE__": time.strftime("%B %d, %Y", time.gmtime(time.time())),
+        "__PACKAGE__": ", ".join(adv_packages),
+        "__DAK_ADDRESS__": Cnf["Dinstall::MyEmailAddress"]
+        }
+
+    if Cnf.has_key("Dinstall::Bcc"):
+        Subst["__BCC__"] = "Bcc: %s" % (Cnf["Dinstall::Bcc"])
+
+    adv = ""
+    archive = Cnf["Archive::%s::PrimaryMirror" % (daklib.utils.where_am_i())]
+    for suite in updated_pkgs.keys():
+        ver = Cnf["Suite::%s::Version" % suite]
+        if ver != "": ver += " "
+        suite_header = "%s %s(%s)" % (Cnf["Dinstall::MyDistribution"],
+                                       ver, suite)
+        adv += "%s\n%s\n\n" % (suite_header, "-"*len(suite_header))
+
+        arches = Cnf.ValueList("Suite::%s::Architectures" % suite)
+        if "source" in arches:
+            arches.remove("source")
+        if "all" in arches:
+            arches.remove("all")
+        arches.sort()
+
+        adv += "%s updates are available for %s.\n\n" % (
+                suite.capitalize(), daklib.utils.join_with_commas_and(arches))
+
+        for a in ["source", "all"] + arches:
+            if not updated_pkgs[suite].has_key(a):
+                continue
+
+            if a == "source":
+                adv += "Source archives:\n\n"
+            elif a == "all":
+                adv += "Architecture independent packages:\n\n"
+            else:
+                adv += "%s architecture (%s)\n\n" % (a,
+                        Cnf["Architectures::%s" % a])
+
+            for file in updated_pkgs[suite][a].keys():
+                adv += "  http://%s/%s%s\n" % (
+                                archive, updated_pkgs[suite][a][file]["poolname"], file)
+                adv += "    Size/MD5 checksum: %8s %s\n" % (
+                        updated_pkgs[suite][a][file]["size"],
+                        updated_pkgs[suite][a][file]["md5"])
+            adv += "\n"
+    adv = adv.rstrip()
+
+    Subst["__ADVISORY_TEXT__"] = adv
+
+    adv = daklib.utils.TemplateSubst(Subst, template)
+    return adv
+
+
+def spawn(command):
+    if not re_taint_free.match(command):
+        daklib.utils.fubar("Invalid character in \"%s\"." % (command))
+
+    if Options["No-Action"]:
+        print "[%s]" % (command)
+    else:
+        (result, output) = commands.getstatusoutput(command)
+        if (result != 0):
+            daklib.utils.fubar("Invocation of '%s' failed:\n%s\n" % (command, output), result)
+
+
+##################### ! ! ! N O T E ! ! !  #####################
+#
+# These functions will be reinvoked by semi-priveleged users, be careful not
+# to invoke external programs that will escalate privileges, etc.
+#
+##################### ! ! ! N O T E ! ! !  #####################
+
+def sudo(arg, fn, exit):
+    if Options["Sudo"]:
+        if advisory == None:
+            daklib.utils.fubar("Must set advisory name")
+        os.spawnl(os.P_WAIT, "/usr/bin/sudo", "/usr/bin/sudo", "-u", "dak", "-H", 
+                  "/usr/local/bin/dak new-security-install", "-"+arg, "--", advisory)
+    else:
+        fn()
+    if exit:
+        quit()
+
+def do_Approve(): sudo("A", _do_Approve, True)
+def _do_Approve():
+    # 1. dump advisory in drafts
+    draft = "/org/security.debian.org/advisories/drafts/%s" % (advisory)
+    print "Advisory in %s" % (draft)
+    if not Options["No-Action"]:
+        adv_file = "./advisory.%s" % (advisory)
+        if not os.path.exists(adv_file):
+            adv_file = Cnf["Dir::Templates"]+"/security-install.advisory"
+        adv_fd = os.open(draft, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0664)
+        os.write(adv_fd, generate_advisory(adv_file))
+        os.close(adv_fd)
+        adv_fd = None
+
+    # 2. run dak process-accepted on changes
+    print "Accepting packages..."
+    spawn("dak process-accepted -pa %s" % (" ".join(changes)))
+
+    # 3. run dak make-suite-file-list / apt-ftparchve / dak generate-releases
+    print "Updating file lists for apt-ftparchive..."
+    spawn("dak make-suite-file-list")
+    print "Updating Packages and Sources files..."
+    spawn("apt-ftparchive generate %s" % (daklib.utils.which_apt_conf_file()))
+    print "Updating Release files..."
+    spawn("dak generate-releases")
+    print "Triggering security mirrors..."
+    spawn("sudo -u archvsync /home/archvsync/signal_security")
+
+    # 4. chdir to done - do upload
+    if not Options["No-Action"]:
+        os.chdir(Cnf["Dir::Queue::Done"])
+    do_upload()
+
+def do_Disembargo(): sudo("D", _do_Disembargo, True)
+def _do_Disembargo():
+    if os.getcwd() != Cnf["Dir::Queue::Embargoed"].rstrip("/"):
+        daklib.utils.fubar("Can only disembargo from %s" % Cnf["Dir::Queue::Embargoed"])
+
+    dest = Cnf["Dir::Queue::Unembargoed"]
+    emb_q = daklib.database.get_or_set_queue_id("embargoed")
+    une_q = daklib.database.get_or_set_queue_id("unembargoed")
+
+    for c in changes:
+        print "Disembargoing %s" % (c)
+
+        Upload.init_vars()
+        Upload.pkg.changes_file = c
+        Upload.update_vars()
+
+        if "source" in Upload.pkg.changes["architecture"].keys():
+            print "Adding %s %s to disembargo table" % (Upload.pkg.changes["source"], Upload.pkg.changes["version"])
+            Upload.projectB.query("INSERT INTO disembargo (package, version) VALUES ('%s', '%s')" % (Upload.pkg.changes["source"], Upload.pkg.changes["version"]))
+
+        files = {}
+        for suite in Upload.pkg.changes["distribution"].keys():
+            if suite not in Cnf.ValueList("Dinstall::QueueBuildSuites"):
+                continue
+            dest_dir = Cnf["Dir::QueueBuild"]
+            if Cnf.FindB("Dinstall::SecurityQueueBuild"):
+                dest_dir = os.path.join(dest_dir, suite)
+            for file in Upload.pkg.files.keys():
+                files[os.path.join(dest_dir, file)] = 1
+
+        files = files.keys()
+        Upload.projectB.query("BEGIN WORK")
+        for f in files:
+            Upload.projectB.query("UPDATE queue_build SET queue = %s WHERE filename = '%s' AND queue = %s" % (une_q, f, emb_q))
+        Upload.projectB.query("COMMIT WORK")
+
+        for file in Upload.pkg.files.keys():
+            daklib.utils.copy(file, os.path.join(dest, file))
+            os.unlink(file)
+
+    for c in changes:
+        daklib.utils.copy(c, os.path.join(dest, c))
+        os.unlink(c)
+        k = c[:8] + ".dak"
+        daklib.utils.copy(k, os.path.join(dest, k))
+        os.unlink(k)
+
+def do_Reject(): sudo("R", _do_Reject, True)
+def _do_Reject():
+    global changes
+    for c in changes:
+        print "Rejecting %s..." % (c)
+        Upload.init_vars()
+        Upload.pkg.changes_file = c
+        Upload.update_vars()
+        files = {}
+        for suite in Upload.pkg.changes["distribution"].keys():
+            if suite not in Cnf.ValueList("Dinstall::QueueBuildSuites"):
+                continue
+            dest_dir = Cnf["Dir::QueueBuild"]
+            if Cnf.FindB("Dinstall::SecurityQueueBuild"):
+                dest_dir = os.path.join(dest_dir, suite)
+            for file in Upload.pkg.files.keys():
+                files[os.path.join(dest_dir, file)] = 1
+
+        files = files.keys()
+
+        aborted = Upload.do_reject()
+        if not aborted:
+            os.unlink(c[:-8]+".katie")
+            for f in files:
+                Upload.projectB.query(
+                    "DELETE FROM queue_build WHERE filename = '%s'" % (f))
+                os.unlink(f)
+
+    print "Updating buildd information..."
+    spawn("/org/security.debian.org/katie/cron.buildd-security")
+
+    adv_file = "./advisory.%s" % (advisory)
+    if os.path.exists(adv_file):
+        os.unlink(adv_file)
+
+def do_DropAdvisory():
+    for c in changes:
+        Upload.init_vars()
+        Upload.pkg.changes_file = c
+        Upload.update_vars()
+        del Upload.pkg.changes["adv id"]
+        Upload.dump_vars(os.getcwd())
+    quit()
+
+def do_Edit():
+    adv_file = "./advisory.%s" % (advisory)
+    if not os.path.exists(adv_file):
+        daklib.utils.copy(Cnf["Dir::Templates"]+"/security-install.advisory", adv_file)
+    editor = os.environ.get("EDITOR", "vi")
+    result = os.system("%s %s" % (editor, adv_file))
+    if result != 0:
+        daklib.utils.fubar("%s invocation failed for %s." % (editor, adv_file))
+
+def do_Show():
+    adv_file = "./advisory.%s" % (advisory)
+    if not os.path.exists(adv_file):
+        adv_file = Cnf["Dir::Templates"]+"/security-install.advisory"
+    print "====\n%s\n====" % (generate_advisory(adv_file))
+
+def do_Quit():
+    quit()
+
+def main():
+    global changes
+
+    args = init()
+    extras = load_args(args)
+    if advisory:
+        load_adv_changes()
+    if extras:
+        if not advisory:
+            changes = extras
+        else:
+            if srcverarches == {}:
+                if not yes_no("Create new advisory %s?" % (advisory)):
+                    print "Not doing anything, then"
+                    quit()
+            else:
+                advisory_info()
+                doextras = []
+                for c in extras:
+                    if yes_no("Add %s to %s?" % (c, advisory)):
+                        doextras.append(c)
+                extras = doextras
+            add_changes(extras)
+
+    if not advisory:
+        daklib.utils.fubar("Must specify an advisory id")
+
+    if not changes:
+        daklib.utils.fubar("No changes specified")
+
+    if Options["Approve"]:
+        advisory_info()
+        do_Approve()
+    elif Options["Reject"]:
+        advisory_info()
+        do_Reject()
+    elif Options["Disembargo"]:
+        advisory_info()
+        do_Disembargo()
+    elif Options["Drop-Advisory"]:
+        advisory_info()
+        do_DropAdvisory()
+    else:
+        while 1:
+            default = "Q"
+            opts = ["Approve", "Edit advisory"]
+            if os.path.exists("./advisory.%s" % advisory):
+                default = "A"
+            else:
+                default = "E"
+            if os.getcwd() == Cnf["Dir::Queue::Embargoed"].rstrip("/"):
+                opts.append("Disembargo")
+            opts += ["Show advisory", "Reject", "Quit"]
+        
+            advisory_info()
+            what = prompt(opts, default)
+
+            if what == "Quit":
+                do_Quit()
+            elif what == "Approve":
+                do_Approve()
+            elif what == "Edit advisory":
+                do_Edit()
+            elif what == "Show advisory":
+                do_Show()
+            elif what == "Disembargo":
+                do_Disembargo()
+            elif what == "Reject":
+                do_Reject()
+            else:
+                daklib.utils.fubar("Impossible answer '%s', wtf?" % (what))
+
+################################################################################
+
+if __name__ == '__main__':
+    main()
+
+################################################################################
index 1cf2234ecd2f10a4a0f6b132980e25e40f175f67..36b091f298ba42083407a12e713a972d0c54f403 100755 (executable)
@@ -529,8 +529,14 @@ def check_files():
                         files[file]["byhand"] = 1
                     elif os.path.exists(Cnf["Dir::Queue::New"] + '/' + dsc_filename):
                         files[file]["new"] = 1
-                    elif not os.path.exists(Cnf["Dir::Queue::Accepted"] + '/' + dsc_filename):
-                        reject("no source found for %s %s (%s)." % (source_package, source_version, file))
+                    else:
+                       dsc_file_exists = 0
+                        for myq in ["Accepted", "Embargoed", "Unembargoed"]:
+                            if os.path.exists(Cnf["Dir::Queue::"+myq] + '/' + dsc_filename):
+                               dsc_file_exists = 1
+                               break
+                       if not dsc_file_exists:
+                            reject("no source found for %s %s (%s)." % (source_package, source_version, file))
             # Check the version and for file overwrites
             reject(Upload.check_binary_against_db(file),"")
 
@@ -1134,7 +1140,12 @@ def is_unembargo ():
     if ql:
         return 1
 
-    if pkg.directory == Cnf["Dir::Queue::Disembargo"].rstrip("/"):
+    oldcwd = os.getcwd()
+    os.chdir(Cnf["Dir::Queue::Disembargo"])
+    disdir = os.getcwd()
+    os.chdir(oldcwd)
+
+    if pkg.directory == disdir:
         if changes["architecture"].has_key("source"):
             if Options["No-Action"]: return 1
 
index 1bb5780f14ac64b1a3813f81637c2eff916cff74..46c861b5b37499180f16ba5f75f6c11c6e89741a 100755 (executable)
@@ -84,7 +84,7 @@ def do_upload(changes_files):
         if changes["architecture"].has_key("amd64"):
             print "Not uploading amd64 part to ftp-master\n"
             continue
-        if changes["distribution"].has_key("oldstable-security"):
+        if changes["distribution"].has_key("oldstable"):
             print "Not uploading oldstable-security changes to ftp-master\n"
             continue
         # Build the file list for this .changes file
@@ -114,7 +114,7 @@ def do_upload(changes_files):
             uploads[upload_uri] = []
         uploads[upload_uri].extend(file_list)
         # Update the changes list for the upload uri
-        if not changes.has_key(upload_uri):
+        if not changesfiles.has_key(upload_uri):
             changesfiles[upload_uri] = []
         changesfiles[upload_uri].append(changes_file)
         # Remember the suites and source name/version
index 3194e19c87bce1321859ec5abc58a530623c1e29..e8d569bc7fa6f1898ae5f25fc6ac32dd89f9cbbc 100644 (file)
@@ -31,6 +31,7 @@ re_isanum = re.compile (r"^\d+$")
 re_default_answer = re.compile(r"\[(.*)\]")
 re_fdnic = re.compile(r"\n\n")
 re_bin_only_nmu = re.compile(r"\+b\d+$")
+
 ###############################################################################
 
 # Convenience wrapper to carry around all the package information in
@@ -174,7 +175,7 @@ class Upload:
                    "closes", "changes" ]:
             d_changes[i] = changes[i]
         # Optional changes fields
-        for i in [ "changed-by", "filecontents", "format", "process-new note", "distribution-version" ]:
+        for i in [ "changed-by", "filecontents", "format", "process-new note", "adv id", "distribution-version" ]:
             if changes.has_key(i):
                 d_changes[i] = changes[i]
         ## dsc