]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'master' of /org/ftp.debian.org/dak//
authorThomas Viehmann <tv@beamnet.de>
Tue, 7 Oct 2008 19:59:17 +0000 (19:59 +0000)
committerThomas Viehmann <tv@beamnet.de>
Tue, 7 Oct 2008 19:59:17 +0000 (19:59 +0000)
ChangeLog
dak/dak.py
dak/show_deferred.py [new file with mode: 0755]
daklib/database.py
tools/debianqueued-0.9/ChangeLog
tools/debianqueued-0.9/show-deferred [deleted file]

index 519c6c9c50641788630cebb5bd7ee718de9aee09..b3034433de3fc8ea5b830ecf643762ebbe03169b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
        * config/debian/cron.dinstall: Only keep the last 60 days of
        dinstall logfiles on disc.
 
+2008-10-05  Thomas Viehmann <tv@beamnet.de>
+
+        * daklib/database.py: added get_suites
+       * dak/dak.py, dak/show_deferred.py: add show-deferred to dak.
+       
 2008-09-23  Joerg Jaspert  <joerg@debian.org>
 
        * config/debian/dak.conf: Add the validtime fields, set to 7
index 5a986d55ef39cb11b20bef0246c97a36d9d43967..c987c1e708601db9442b8ac9d1ba240915bc9f05 100755 (executable)
@@ -88,6 +88,8 @@ def init():
          "Produce a report on NEW and BYHAND packages"),
         ("show-new",
          "Output html for packages in NEW"),
+        ("show-deferred",
+         "Output html and symlinks for packages in DEFERRED"),
 
         ("rm",
          "Remove packages from suites"),
diff --git a/dak/show_deferred.py b/dak/show_deferred.py
new file mode 100755 (executable)
index 0000000..6952922
--- /dev/null
@@ -0,0 +1,209 @@
+#!/usr/bin/env python
+
+# based on queue-report
+#    Copyright (C) 2001, 2002, 2003, 2005, 2006  James Troup <james@nocrew.org>
+# Copyright (C) 2008 Thomas Viehmann <tv@beamnet.de>
+
+# 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 sys, os, re, time
+import apt_pkg
+from debian_bundle import deb822
+from daklib import database
+from daklib import queue
+from daklib import utils
+
+################################################################################
+
+row_number = 1
+
+html_escaping = {'"':'&quot;', '&':'&amp;', '<':'&lt;', '>':'&gt;'}
+re_html_escaping = re.compile('|'.join(map(re.escape, html_escaping.keys())))
+def html_escape(s):
+    return re_html_escaping.sub(lambda x: html_escaping.get(x.group(0)), s)
+
+################################################################################
+
+def header():
+  return  """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+        <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+        <title>Deferred uploads to Debian</title>
+        <link type="text/css" rel="stylesheet" href="style.css">
+        <link rel="shortcut icon" href="http://www.debian.org/favicon.ico">
+        </head>
+        <body>
+        <div align="center">
+        <a href="http://www.debian.org/">
+     <img src="http://www.debian.org/logos/openlogo-nd-50.png" border="0" hspace="0" vspace="0" alt=""></a>
+        <a href="http://www.debian.org/">
+     <img src="http://www.debian.org/Pics/debian.png" border="0" hspace="0" vspace="0" alt="Debian Project"></a>
+        </div>
+        <br />
+        <table class="reddy" width="100%">
+        <tr>
+        <td class="reddy">
+    <img src="http://www.debian.org/Pics/red-upperleft.png" align="left" border="0" hspace="0" vspace="0"
+     alt="" width="15" height="16"></td>
+        <td rowspan="2" class="reddy">Deferred uploads to Debian</td>
+        <td class="reddy">
+    <img src="http://www.debian.org/Pics/red-upperright.png" align="right" border="0" hspace="0" vspace="0"
+     alt="" width="16" height="16"></td>
+        </tr>
+        <tr>
+        <td class="reddy">
+    <img src="http://www.debian.org/Pics/red-lowerleft.png" align="left" border="0" hspace="0" vspace="0"
+     alt="" width="16" height="16"></td>
+        <td class="reddy">
+    <img src="http://www.debian.org/Pics/red-lowerright.png" align="right" border="0" hspace="0" vspace="0"
+     alt="" width="15" height="16"></td>
+        </tr>
+        </table>
+        """
+
+def footer():
+    res = "<p class=\"validate\">Timestamp: %s (UTC)</p>" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime()))
+    res += """<a href="http://validator.w3.org/check?uri=referer">
+    <img border="0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"></a>
+        <a href="http://jigsaw.w3.org/css-validator/check/referer">
+    <img border="0" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"
+     height="31" width="88"></a>
+    """
+    res += "</body></html>"
+    return res
+
+def table_header():
+    return """<h1>Deferred uploads</h1>
+      <center><table border="0">
+        <tr>
+          <th align="center">Change</th>
+          <th align="center">Time remaining</th>
+          <th align="center">Uploader</th>
+          <th align="center">Closes</th>
+        </tr>
+        """
+    return res
+
+def table_footer():
+    return '</table><br/><p>non-NEW uploads are <a href="/deferred/">available</a>, see the <a href="ftp://ftp-master.debian.org/pub/UploadQueue/README">UploadQueue-README</a> for more information.</p></center><br/>\n'
+
+def table_row(changesname, delay, changed_by, closes):
+    global row_number
+
+    res = '<tr class="%s">'%((row_number%2) and 'odd' or 'even')
+    res += (3*'<td valign="top">%s</td>')%tuple(map(html_escape,(changesname,delay,changed_by)))
+    res += ('<td valign="top">%s</td>' % 
+             ''.join(map(lambda close:  '<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s">#%s</a><br>' % (close, close),closes)))
+    res += '</tr>\n'
+    row_number+=1
+    return res
+
+def get_upload_data(changesfn):
+    achanges = deb822.Changes(file(changesfn))
+    changesname = os.path.basename(changesfn)
+    delay = os.path.basename(os.path.dirname(changesfn))
+    m = re.match(r'([0-9]+)-day', delay)
+    if m:
+        delaydays = int(m.group(1))
+        remainingtime = (delaydays>0)*max(0,24*60*60+os.stat(changesfn).st_mtime-time.time())
+        delay = "%d days %02d:%02d" %(max(delaydays-1,0), int(remainingtime/3600),int(remainingtime/60)%60)
+    else:
+        remainingtime = 0
+
+    uploader = achanges.get('changed-by')
+    uploader = re.sub(r'^\s*(\S.*)\s+<.*>',r'\1',uploader)
+    if Cnf.has_key("Show-Deferred::LinkPath"):
+        isnew = 0
+        suites = database.get_suites(achanges['source'],src=1)
+        if 'unstable' not in suites and 'experimental' not in suites:
+            isnew = 1
+        for b in achanges['binary'].split():
+            suites = database.get_suites(b)
+            if 'unstable' not in suites and 'experimental' not in suites:
+                isnew = 1
+        if not isnew:
+            # we don't link .changes because we don't want other people to
+            # upload it with the existing signature.
+            for afn in map(lambda x: x['name'],achanges['files']):
+                lfn = os.path.join(Cnf["Show-Deferred::LinkPath"],afn)
+                qfn = os.path.join(os.path.dirname(changesfn),afn)
+                if os.path.islink(lfn):
+                    os.unlink(lfn)
+                if os.path.exists(qfn):
+                    os.symlink(qfn,lfn)
+                    os.chmod(qfn, 0644)
+    return (delaydays*24*60*60+remainingtime, changesname, delay, uploader, achanges.get('closes').split())
+
+def list_uploads(filelist):
+    uploads = map(get_upload_data, filelist)
+    uploads.sort()
+    print header()
+    if uploads:
+        print table_header()
+        print ''.join(map(lambda x: table_row(*x[1:]), uploads))
+        print table_footer()
+    else:
+        print '<h1>Currently no deferred uploads to Debian</h1>'
+    print footer()
+
+def usage (exit_code=0):
+    if exit_code:
+        f = sys.stderr
+    else:
+        f = sys.stdout
+    print >> f, """Usage: dak show-deferred /path/to/DEFERRED
+  -h, --help                show this help and exit.
+  -p, --html-path [path]    override output directory.
+  """
+    sys.exit(exit_code)
+   
+def init():
+    global Cnf, Options, Upload, projectB
+    Cnf = utils.get_conf()
+    Arguments = [('h',"help","Show-Deferred::Options::Help"),
+                 ("p","link-path","Show-Deferred::LinkPath","HasArg")]
+    for i in ["help"]:
+        if not Cnf.has_key("Show-Deferred::Options::LinkPath"):
+            Cnf["Show-Deferred::Options::LinkPath"] = "/org/ftp.debian.org/web/deferred/"
+    if not Cnf.has_key("Show-Deferred::Options::%s" % (i)):
+          Cnf["Show-Deferred::Options::%s" % (i)] = ""
+    args = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
+    Options = Cnf.SubTree("Show-Deferred::Options")
+    if Options["help"]:
+        usage()
+    Upload = queue.Upload(Cnf)
+    projectB = Upload.projectB
+    return args
+
+def main():
+    args = init()
+    if len(args)!=1:
+        usage(1)
+    
+    filelist = []
+    for r,d,f  in os.walk(args[0]):
+        filelist += map (lambda x: os.path.join(r,x),
+                         filter(lambda x: x.endswith('.changes'), f))
+    list_uploads(filelist)
+
+    if Cnf.has_key("Show-Deferred::LinkPath"):
+        # remove dead links
+        for r,d,f in os.walk(Cnf["Show-Deferred::LinkPath"]):
+            for af in f:
+                af = os.path.join(r,af)
+                if not os.path.exists(af):
+                    print >> sys.stderr, "obsolete",af
+                    os.unlink(af)
index 9185d0a3f54fd0c77e16df1e0dba623ebbc3bff6..1d9f3c0bc9bf052f638dff9be43a08a451ae6904 100755 (executable)
@@ -389,3 +389,12 @@ def get_maintainer (maintainer_id):
     return maintainer_cache[maintainer_id]
 
 ################################################################################
+
+def get_suites(pkgname, src=False):
+    if src:
+        sql = "select suite_name from source, src_associations,suite where source.id=src_associations.source and source.source='%s' and src_associations.suite = suite.id"%pkgname
+    else:
+        sql = "select suite_name from binaries, bin_associations,suite where binaries.id=bin_associations.bin and  package='%s' and bin_associations.suite = suite.id"%pkgname
+    q = projectB.query(sql)
+    return map(lambda x: x[0], q.getresult())
+
index 0d9da28a152ae81a50ec780397aa366922275d2f..42e62ea9e5d6b89d29b6a232fc9ac530cc3e397b 100644 (file)
@@ -1,3 +1,11 @@
+2008-10-05  Thomas Viehmann  <tv@beamnet.de>
+
+       * show-deferred: make non-new uploads in deferred accessible
+
+2008-09-22  Thomas Viehmann  <tv@beamnet.de>
+
+       * show-deferred: minor fixes
+
 2008-09-21  Joerg Jaspert  <joerg@debian.org>
 
        * debianqueued: Use perltidy
diff --git a/tools/debianqueued-0.9/show-deferred b/tools/debianqueued-0.9/show-deferred
deleted file mode 100755 (executable)
index 9cb093d..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env python
-
-# based on queue-report
-#    Copyright (C) 2001, 2002, 2003, 2005, 2006  James Troup <james@nocrew.org>
-# Copyright (C) 2008 Thomas Viehmann <tv@beamnet.de>
-
-# 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 sys, os, re, time
-from debian_bundle import deb822
-
-################################################################################
-
-row_number = 0
-
-html_escaping = {'"':'&quot;', '&':'&amp;', '<':'&lt;', '>':'&gt;'}
-re_html_escaping = re.compile('|'.join(map(re.escape, html_escaping.keys())))
-def html_escape(s):
-    return re_html_escaping.sub(lambda x: html_escaping.get(x.group(0)), s)
-
-################################################################################
-
-def header():
-  return  """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-        <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-        <title>Deferred uploads to Debian</title>
-        <link type="text/css" rel="stylesheet" href="style.css">
-        <link rel="shortcut icon" href="http://www.debian.org/favicon.ico">
-        </head>
-        <body>
-        <div align="center">
-        <a href="http://www.debian.org/">
-     <img src="http://www.debian.org/logos/openlogo-nd-50.png" border="0" hspace="0" vspace="0" alt=""></a>
-        <a href="http://www.debian.org/">
-     <img src="http://www.debian.org/Pics/debian.png" border="0" hspace="0" vspace="0" alt="Debian Project"></a>
-        </div>
-        <br />
-        <table class="reddy" width="100%">
-        <tr>
-        <td class="reddy">
-    <img src="http://www.debian.org/Pics/red-upperleft.png" align="left" border="0" hspace="0" vspace="0"
-     alt="" width="15" height="16"></td>
-        <td rowspan="2" class="reddy">Deferred uploads to Debian</td>
-        <td class="reddy">
-    <img src="http://www.debian.org/Pics/red-upperright.png" align="right" border="0" hspace="0" vspace="0"
-     alt="" width="16" height="16"></td>
-        </tr>
-        <tr>
-        <td class="reddy">
-    <img src="http://www.debian.org/Pics/red-lowerleft.png" align="left" border="0" hspace="0" vspace="0"
-     alt="" width="16" height="16"></td>
-        <td class="reddy">
-    <img src="http://www.debian.org/Pics/red-lowerright.png" align="right" border="0" hspace="0" vspace="0"
-     alt="" width="15" height="16"></td>
-        </tr>
-        </table>
-        """
-
-def footer():
-    res = "<p class=\"validate\">Timestamp: %s (UTC)</p>" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime()))
-    res += """<a href="http://validator.w3.org/check?uri=referer">
-    <img border="0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"></a>
-        <a href="http://jigsaw.w3.org/css-validator/check/referer">
-    <img border="0" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"
-     height="31" width="88"></a>
-    """
-    res += "</body></html>"
-    return res
-
-def table_header():
-    return """<h1>Deferred uploads</h1>
-      <center><table border="0">
-        <tr>
-          <th align="center">Change</th>
-          <th align="center">Time remaining</th>
-          <th align="center">Uploader</th>
-          <th align="center">Closes</th>
-        </tr>
-        """
-    return res
-
-def table_footer():
-    return '</table></center><br>\n'
-
-def table_row(changesname, delay, changed_by, closes):
-    global row_number
-
-    res = '<tr class="%s">'%(['even','odd'][row_number %2])
-    res += (3*'<td valign="top">%s</td>')%tuple(map(html_escape,(changesname,delay,changed_by)))
-    res += ('<td valign="top">%s</td>' % 
-             ''.join(map(lambda close:  '<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s">#%s</a><br>' % (close, close),closes)))
-    res += '</tr>\n'
-    row_number+=1
-    return res
-
-def get_upload_data(changesfn):
-    achanges = deb822.Changes(file(changesfn))
-    changesname = os.path.basename(changesfn)
-    delay = os.path.basename(os.path.dirname(changesfn))
-    m = re.match(r'([0-9]+)-day', delay)
-    if m:
-        delaydays = int(m.group(1))
-        remainingtime = max(0,24*60*60+os.stat(changesfn).st_mtime-time.time())
-        delay = "%d days %02d:%02d" %(delaydays, int(remainingtime/3600),int(remainingtime/60)%60)
-    else:
-        remainingtime = 0
-    #print dir(achanges)
-    #print achanges.keys()
-    uploader = achanges.get('changed-by')
-    uploader = re.sub(r'^\s*(\S.*)\s+<.*>',r'\1',uploader)
-    return (delaydays*24*60*60+remainingtime, changesname, delay, uploader, achanges.get('closes').split())
-
-def list_uploads(filelist):
-    uploads = map(get_upload_data, filelist)
-    uploads.sort()
-    print header()
-    if uploads:
-        print table_header()
-        print ''.join(map(lambda x: table_row(*x[1:]), uploads))
-        print table_footer()
-    else:
-        print '<h1>Currently no deferred uploads to Debian</h1>'
-    print footer()
-
-if len(sys.argv)!=2:
-    print >> sys.stderr, """Error! Invoke %s /path/to/DEFERRED"""%sys.argv[0]
-    sys.exit(1)
-    
-filelist = []
-for r,d,f  in os.walk(sys.argv[1]):
-    filelist += map (lambda x: os.path.join(r,x),
-                     filter(lambda x: x.endswith('.changes'), f))
-
-list_uploads(filelist)