New.html in RFC 822 format
Hi,
I plan to inject data about new queue into UDD to have simple access
to this data for rendering it on the Blends tasks pages. To acomplish
this I'm parsing
http://ftp-master.debian.org/new/<src>_<version>.html
but a
http://ftp-master.debian.org/new/<src>_<version>.822
format would be much more useful for this purpose. Gannef advised
me to send a patch to dak/show_new.py which does this. The attached
patch is completely untested - just because I have no idea how to
to a reasonable test. I'm just lacking the needed ftpmaster
insight. But I think the patch is in principle very simple and
you will most probably be able to apply it with a grain of salt
(or alternatively explain me what to do to test it). It adds
a command lin option
-r, --rfc822 output in RFC 822 format.
which just suppresses all the HTML magic.
Please let me know what you think about this.
Should I open a bug report about this issue?
Moreover I would like to repeat my observation about a problem with
new.822 I reported to Adeodato Simó in private. It's just for the
record because dato told me that he forewarded the problem to the
responsible persons:
* Andreas Tille [Mon, 16 Feb 2009 18:05:51 +0100]:
Well, the http://ftp-master.debian.org/new.822 in one of my browser tabs
which is open since this morning does contain zsh-beta but currently it
is vanished. My guess is that the new.822 file contains *everything*
which is in the queue (also the automatically processed packages which
are just in the queue and not yet processed). This explains perfectly
the behaviour I observed.
I tuned my scripts in that way that I query UDD for the existence of
a source package and do not try to download the according source_version.html
file. This works perfectly now. If you think that automatically
processed files should not show up in new.822 I might write a bug
report.
Kind regards
Andreas.
--
http://fam-tille.de
--- dak/show_new.py.orig 2009-01-20 22:15:09.000000000 +0100
+++ dak/show_new.py 2009-02-17 05:42:31.000000000 +0100
@@ -38,7 +38,7 @@
Upload = None
projectB = None
sources = set()
-
+use_html = 1
################################################################################
################################################################################
@@ -153,7 +153,10 @@
stdout_fd = sys.stdout
- htmlname = changes["source"] + "_" + changes["version"] + ".html"
+ if use_html:
+ htmlname = changes["source"] + "_" + changes["version"] + ".html"
+ else:
+ htmlname = changes["source"] + "_" + changes["version"] + ".822"
sources.add(htmlname)
# do not generate html output if that source/version already has one.
if not os.path.exists(os.path.join(Cnf["Show-New::HTMLPath"],htmlname)):
@@ -166,7 +169,8 @@
files[fn]["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2"] ):
filestoexamine.append(fn)
- html_header(changes["source"], filestoexamine)
+ if use_html:
+ html_header(changes["source"], filestoexamine)
queue.check_valid(new)
examine_package.display_changes( distribution, Upload.pkg.changes_file)
@@ -176,7 +180,8 @@
for fn in filter(lambda fn: fn.endswith(".deb") or fn.endswith(".udeb"), filestoexamine):
examine_package.check_deb(distribution, fn)
- html_footer()
+ if use_html:
+ html_footer()
if sys.stdout != stdout_fd:
sys.stdout.close()
sys.stdout = stdout_fd
@@ -187,18 +192,20 @@
print """Usage: dak show-new [OPTION]... [CHANGES]...
-h, --help show this help and exit.
-p, --html-path [path] override output directory.
+ -r, --rfc822 output in RFC 822 format.
"""
sys.exit(exit_code)
################################################################################
def init():
- global Cnf, Options, Upload, projectB
+ global Cnf, Options, Upload, projectB, use_html
Cnf = utils.get_conf()
Arguments = [('h',"help","Show-New::Options::Help"),
- ("p","html-path","Show-New::HTMLPath","HasArg")]
+ ("p","html-path","Show-New::HTMLPath","HasArg"),
+ ('r',"rfc822","Show-New::Options::Rfc822")]
for i in ["help"]:
if not Cnf.has_key("Show-New::Options::%s" % (i)):
@@ -210,6 +217,10 @@
if Options["help"]:
usage()
+ use_html = 1
+ if Options["rfc822"]:
+ use_html = 0
+
Upload = queue.Upload(Cnf)
projectB = Upload.projectB
@@ -223,7 +234,7 @@
def main():
changes_files = init()
- examine_package.use_html=1
+ examine_package.use_html=use_html
for changes_file in changes_files:
changes_file = utils.validate_changes_file_arg(changes_file, 0)
@@ -232,7 +243,10 @@
print "\n" + changes_file
do_pkg (changes_file)
files = set(os.listdir(Cnf["Show-New::HTMLPath"]))
- to_delete = filter(lambda x: x.endswith(".html"), files.difference(sources))
+ if use_html:
+ to_delete = filter(lambda x: x.endswith(".html"), files.difference(sources))
+ else:
+ to_delete = filter(lambda x: x.endswith(".822"), files.difference(sources))
for f in to_delete:
os.remove(os.path.join(Cnf["Show-New::HTMLPath"],f))
Reply to: