[Pkg-ocaml-maint-commits] r5165 - in /trunk/tools/gen-binNMU-request: ./ gen-binNMU-request.py

glondu-guest at users.alioth.debian.org glondu-guest at users.alioth.debian.org
Sun Feb 10 22:16:36 UTC 2008


Author: glondu-guest
Date: Sun Feb 10 22:16:36 2008
New Revision: 5165

URL: http://svn.debian.org/wsvn/?sc=1&rev=5165
Log:
Adding a script to generate the binNMU request for OCaml transition.

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

Added: 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=5165&op=file
==============================================================================
--- trunk/tools/gen-binNMU-request/gen-binNMU-request.py (added)
+++ trunk/tools/gen-binNMU-request/gen-binNMU-request.py Sun Feb 10 22:16:36 2008
@@ -1,0 +1,79 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008, Stephane Glondu <steph at glondu.net>
+#
+# 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 3 of the License, or (at your option) any later
+# version.
+
+import sys, os, sre
+from commands import getoutput, getstatusoutput
+from debian_bundle.debian_support import version_compare
+
+redep = sre.compile("[][ ;\n]+")
+madep = sre.compile("[ |,\n]+")
+nxdep = sre.compile("\+b([0-9]+)$")
+
+excluded_archs = ("source", "hurd-i386", "kfreebsd-i386", "kfreebsd-amd64")
+
+def next_binNMU(v):
+    x = nxdep.findall(v)
+    if x == []:
+        return 1
+    else:
+        return int(max(x))+1
+
+def rmadison(pkg):
+    """Returns a triple source_version, numNMU, archs"""
+    r = getoutput("rmadison -s unstable -S %s" % pkg)
+    source_version = "0"
+    numNMU = 0
+    archs = []
+    for x in filter(None, r.split("\n")):
+        y = x.replace("all", "alpha, amd64, arm, armel, hppa, i386, ia64, m68k, mips, mipsel, powerpc, s390, sparc")
+        l = madep.split(y.strip())
+        version = l[1]
+        next = next_binNMU(version)
+        if version_compare(version, source_version) > 0:
+            source_version = version
+        if next > numNMU:
+            numNMU = next
+        for arch in l[3:]:
+            if arch not in archs and arch not in excluded_archs:
+                archs.append(arch)
+    if numNMU:
+        return source_version, numNMU, archs
+    else:
+        return None
+
+
+if __name__ == "__main__":
+    # Expects something like:
+    # http://pkg-ocaml-maint.alioth.debian.org/build_order.txt
+    f = file(sys.argv[1],"r")
+    raw_list = f.readlines()[1:]
+    f.close()
+    pkg_list = []
+
+    for x in raw_list:
+       l = redep.split(x)
+       pkg = l[2]
+       deps = l[3:-1]
+       deps.remove("ocaml")
+       pkg_list.append((pkg, deps))
+
+    next_dict = {}
+
+    for pkg, deps in pkg_list:
+        x = rmadison(pkg)
+        if not x: continue
+        source_version, numNMU, archs = x
+        print "%s_%s, Rebuild with ocaml 3.10.1, %d, %s" % \
+          (pkg, source_version, numNMU, " ".join(archs))
+        for dep in deps:
+            dep_ver = next_dict.get(dep)
+            if dep_ver:
+                print "%s dep-wait %s (>= %s)" % (pkg, dep, dep_ver)
+        next_dict[pkg] = source_version + "+%d" % numNMU




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