From: Thomas Viehmann Date: Sat, 20 Sep 2008 22:35:25 +0000 (+0200) Subject: add summary of deferred queue X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=c8f4bd41d2a06623368a2a86190617be3e59128f;p=dak.git add summary of deferred queue Signed-off-by: Thomas Viehmann --- diff --git a/tools/debianqueued-0.9/ChangeLog b/tools/debianqueued-0.9/ChangeLog index 4464d002..e50027c1 100644 --- a/tools/debianqueued-0.9/ChangeLog +++ b/tools/debianqueued-0.9/ChangeLog @@ -1,3 +1,7 @@ +2008-09-20 Thomas Viehmann + + * show-deferred: status page for deferred upload queue + 2008-09-20 Joerg Jaspert * Queue.README (Version): Update the text to match reality with diff --git a/tools/debianqueued-0.9/show-deferred b/tools/debianqueued-0.9/show-deferred new file mode 100755 index 00000000..0f70d42a --- /dev/null +++ b/tools/debianqueued-0.9/show-deferred @@ -0,0 +1,139 @@ +#!/usr/bin/env python + +# based on queue-report +# Copyright (C) 2001, 2002, 2003, 2005, 2006 James Troup +# Copyright (C) 2008 Thomas Viehmann + +# 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 = {'"':'"', '&':'&', '<':'<', '>':'>'} +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 """ + + Deferred uploads to Debian + + + + +
+ + + + Debian Project +
+
+ + + + + + + + + + +
+ Deferred uploads to Debian +
+ +
+ """ + +def footer(): + res = "

Timestamp: %s (UTC)

" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) + res += """ + Valid HTML 4.01! + + Valid CSS! + """ + res += "" + return res + +def table_header(): + return """

Deferred uploads

+
+ + + + + + + """ + return res + +def table_footer(): + return '
ChangeTime remainingUploaderCloses

\n' + +def table_row(changesname, delay, changed_by, closes): + global row_number + + res = ''%(['even','odd'][row_number %2]) + res += (3*'%s')%tuple(map(html_escape,(changesname,delay,changed_by))) + res += ('%s' % + ''.join(map(lambda close: '#%s
' % (close, close),closes))) + res += '\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 '

Currently no deferred uploads to Debian

' + print footer() + +list_uploads(sys.argv[1:])