[Pkg-ocaml-maint-commits] r5360 - /trunk/tools/gen-binNMU-request/gen-binNMU-request.py

glondu-guest at users.alioth.debian.org glondu-guest at users.alioth.debian.org
Sat Mar 22 11:09:59 UTC 2008


Author: glondu-guest
Date: Sat Mar 22 11:09:59 2008
New Revision: 5360

URL: http://svn.debian.org/wsvn/?sc=1&rev=5360
Log:
Various improvements to gen-binNMU-request.py
 * Use urllib (which is http_proxy-aware) instead of httplib.
 * Separate output for packages that have at least one ABI-dependent,
   arch-independent binary package.

Modified:
    trunk/tools/gen-binNMU-request/gen-binNMU-request.py

Modified: trunk/tools/gen-binNMU-request/gen-binNMU-request.py
URL: http://svn.debian.org/wsvn/trunk/tools/gen-binNMU-request/gen-binNMU-request.py?rev=5360&op=diff
==============================================================================
--- trunk/tools/gen-binNMU-request/gen-binNMU-request.py (original)
+++ trunk/tools/gen-binNMU-request/gen-binNMU-request.py Sat Mar 22 11:09:59 2008
@@ -12,12 +12,13 @@
 from commands import getoutput, getstatusoutput
 from debian_bundle.debian_support import version_compare
 from xml.dom.minidom import parseString
-from httplib import HTTPConnection
+from urllib import urlopen
 
 node_re = sre.compile('^node[ "]*([^ "]+)[ "]*[0-9.]+ *([0-9.]+).*$')
 edge_re = sre.compile('^edge[ "]*([^ "]+)[ "]*([^ "]+).*$')
 rmadison_re = sre.compile("[ |,\n]+")
 binNMU_re = sre.compile("\+b([0-9]+)$")
+ocamlABI_re = sre.compile(r">ocaml-[a-z-]*\d[0-9.]*\d</a>")
 
 excluded_archs = ("source", "all", "hurd-i386", "kfreebsd-i386", "kfreebsd-amd64")
 reference_arch = "i386"
@@ -30,6 +31,13 @@
         return 1
     else:
         return int(max(x))+1
+
+def abi_dependent(pkg):
+    """Checks whether pkg is ocaml-ABI-dependent."""
+    c = urlopen("http://packages.debian.org/sid/%s" % pkg)
+    r = c.read()
+    c.close()
+    return bool(ocamlABI_re.search(r))
 
 def rmadison(pkg):
     """Returns source_version, numNMU, some_binary_package, archs, archall_binary_packages"""
@@ -44,7 +52,7 @@
         binary_package_name = l[0]
         version = l[1]
         available_archs = l[3:]
-        if "all" in available_archs:
+        if "all" in available_archs and abi_dependent(binary_package_name):
             indep_packages.append(binary_package_name)
         elif reference_arch in available_archs:
             binary_package = binary_package_name
@@ -57,13 +65,13 @@
             if arch == "source" and version_compare(version, source_version) > 0:
                 source_version = version
     archs.sort()
-    if numNMU and archs:
+    if (numNMU and archs) or indep_packages:
         return source_version, numNMU, binary_package, archs, indep_packages
     else:
         return None
 
 def get_up_to_date(status):
-    """Takes DOM, returns last_version_of_ocaml, list_of_up_to_date_packages"""
+    """Takes DOM, returns last_version_of_ocaml, dict_of_up_to_date_packages"""
     # Takes only run-time dependencies
     # All packages with build-time only dependencies will be asked for binNMU
     deps = status.getElementsByTagName("table")[0]
@@ -72,19 +80,18 @@
     if last_version_elt.attributes["class"].value != "version":
         raise ValueError("Unexpected Error. Check html file.")
     last_version = last_version_elt.firstChild.nodeValue
-    up_to_date = []
+    up_to_date = {}
     for line in lines[1:]:
         cols = line.getElementsByTagName("td")
         pkg = cols[0].getElementsByTagName("span")[0].firstChild.nodeValue
         if cols[-1].attributes["class"].value != "none":
-            up_to_date.append(pkg)
+            up_to_date[pkg] = True
     return last_version, up_to_date
 
 def download(f):
     """Returns the contents of http://pkg-ocaml-maint.alioth.debian.org/f"""
-    c = HTTPConnection("pkg-ocaml-maint.alioth.debian.org")
-    c.request("GET", "/%s" % f)
-    r = c.getresponse().read()
+    c = urlopen("http://pkg-ocaml-maint.alioth.debian.org/%s" % f)
+    r = c.read()
     c.close()
     return r
 
@@ -124,21 +131,24 @@
 
     next_dict = {}
     indep_dict = {}
+    print "= Packages that can be binNMU'ed =\n"
     for pkg, deps in pkg_list:
         x = None
-        if pkg not in up_to_date:
+        if not up_to_date.get(pkg, False):
             x = rmadison(pkg)
         if x:
             source_version, numNMU, binary_package, archs, indep_packages = x
-            print "%s_%s, Rebuild with ocaml %s, %d, %s" % \
-                  (pkg, source_version, last_version, numNMU, " ".join(archs))
-            for dep in deps:
-                binpkg, dep_ver = next_dict.get(dep, (None, None))
-                if dep_ver:
-                    print "%s dep-wait %s (>= %s)" % (pkg, binpkg, dep_ver)
-            next_dict[pkg] = (binary_package, source_version + "+b%d" % numNMU)
             if indep_packages:
                 indep_dict[pkg] = indep_packages
-    print "\nBinary packages that need special attention:"
+            else:
+                # This package has no binary-indep, ABI-dep package
+                print "%s_%s, Rebuild with ocaml %s, %d, %s" % \
+                    (pkg, source_version, last_version, numNMU, " ".join(archs))
+                for dep in deps:
+                    binpkg, dep_ver = next_dict.get(dep, (None, None))
+                    if dep_ver:
+                        print "%s dep-wait %s (>= %s)" % (pkg, binpkg, dep_ver)
+                next_dict[pkg] = (binary_package, source_version + "+b%d" % numNMU)
+    print "\n\n= Packages that need a sourceful upload =\n"
     for pkg in indep_dict:
-        print "  in %s: %s" % (pkg, ' '.join(indep_dict[pkg]))
+        print "%s (because of %s)" % (pkg, ' '.join(indep_dict[pkg]))




More information about the Pkg-ocaml-maint-commits mailing list