[Pkg-ocaml-maint-commits] r4047 - /trunk/tools/ocaml-debian-status/debian-ocaml-status.py
zack at users.alioth.debian.org
zack at users.alioth.debian.org
Mon Jul 16 07:49:44 UTC 2007
Author: zack
Date: Mon Jul 16 07:49:43 2007
New Revision: 4047
URL: http://svn.debian.org/wsvn/?sc=1&rev=4047
Log:
- added logging
- be more resilient to parse errors (ignore them and log errors to the logfile)
Modified:
trunk/tools/ocaml-debian-status/debian-ocaml-status.py
Modified: trunk/tools/ocaml-debian-status/debian-ocaml-status.py
URL: http://svn.debian.org/wsvn/trunk/tools/ocaml-debian-status/debian-ocaml-status.py?rev=4047&op=diff
==============================================================================
--- trunk/tools/ocaml-debian-status/debian-ocaml-status.py (original)
+++ trunk/tools/ocaml-debian-status/debian-ocaml-status.py Mon Jul 16 07:49:43 2007
@@ -92,7 +92,7 @@
# TODO
return status
-def ocaml_status(files):
+def ocaml_status(files, log):
sources = filter(lambda fname: re.search(r'-Sources\b', fname), files)
packages = filter(lambda fname: re.search(r'-Packages\b', fname), files)
distro_of_fname = lambda fname: os.path.basename(fname).split('-')[0]
@@ -118,26 +118,36 @@
# STEP 1: find names of source packages we are interested in
relevant_sources = set()
for fname in sources:
+ print >> log, 'I: processing Sources file %s ...' % fname
f = smart_open(fname)
srcfile = debian_support.PackageFile('', fileObj=f)
- for src, src_version, ocaml_version in grep_sources(srcfile):
- relevant_sources.add(src)
- if ocaml_version:
- add_status_entry(src_status, (src, src_version, ocaml_version))
+ try:
+ for src, src_version, ocaml_version in grep_sources(srcfile):
+ relevant_sources.add(src)
+ if ocaml_version:
+ add_status_entry(src_status, (src, src_version, ocaml_version))
+ except Exception, e:
+ print >> log, "E: error while parsing %s, ignoring it." % fname
+ print >> log, " exception: %s" % e
f.close()
# STEP 2: classify packages
for fname in packages:
+ print >> log, 'I: processing Packages file %s ...' % fname
f = smart_open(fname)
pkgfile = debian_support.PackageFile('', fileObj=f)
- for pkg in pkgfile:
- pkg = patch_pkg_dict(pkg)
- if not pkg.has_key('source'):
- pkg['source'] = pkg['package']
- if normalize_src(pkg['source']) in relevant_sources:
- pkg_entry = eval_status(pkg)
- if pkg_entry:
- add_status_entry(bin_status, pkg_entry)
+ try:
+ for pkg in pkgfile:
+ pkg = patch_pkg_dict(pkg)
+ if not pkg.has_key('source'):
+ pkg['source'] = pkg['package']
+ if normalize_src(pkg['source']) in relevant_sources:
+ pkg_entry = eval_status(pkg)
+ if pkg_entry:
+ add_status_entry(bin_status, pkg_entry)
+ except Exception, e:
+ print >> log, "E: error while parsing %s, ignoring it." % fname
+ print >> log, " exception: %s" % e
f.close()
# STEP 3: add guesses from incoming
@@ -186,8 +196,10 @@
return stream
if __name__ == '__main__':
- status = ocaml_status(sys.argv[1:])
+ log = file('debian-ocaml-status.log', 'w')
+ status = ocaml_status(sys.argv[1:], log)
out = render_status(status)
for chunk in out.serialize():
sys.stdout.write(chunk)
-
+ log.close()
+
More information about the Pkg-ocaml-maint-commits
mailing list