[Pkg-ocaml-maint-commits] r5875 - /trunk/tools/svn2git/glondu_svn2git.py

glondu-guest at users.alioth.debian.org glondu-guest at users.alioth.debian.org
Wed Jul 23 17:50:44 UTC 2008


Author: glondu-guest
Date: Wed Jul 23 17:50:44 2008
New Revision: 5875

URL: http://svn.debian.org/wsvn/?sc=1&rev=5875
Log:
Parametrize shellscript generation

Modified:
    trunk/tools/svn2git/glondu_svn2git.py

Modified: trunk/tools/svn2git/glondu_svn2git.py
URL: http://svn.debian.org/wsvn/trunk/tools/svn2git/glondu_svn2git.py?rev=5875&op=diff
==============================================================================
--- trunk/tools/svn2git/glondu_svn2git.py (original)
+++ trunk/tools/svn2git/glondu_svn2git.py Wed Jul 23 17:50:44 2008
@@ -17,15 +17,21 @@
 from getopt import getopt
 
 
-# For extracting tgz names from svn-log output
+# Extract tag name from svn-buildpackage log message
 svntag_re = re.compile(r"^\[svn-buildpackage\][^(]+\(([^)]+)\)$")
 
-# For extracting working dir from svn-log output
-svnwdir_re = re.compile(r"^(/packages/ocaml/([0-9.beta]+|trunk)|/trunk/packages/ocaml/(trunk))(/.*|)$")
-svnignore_re = re.compile(r"^/packages/ocaml(|/tags(/.*|))$")
-
-# For extracting tag names
-svntag_path_re = re.compile(r"^/(packages/ocaml/tags|tags/packages/ocaml)/([^/]+)")
+# Extract tag name from path
+svntag_path_re = r"^/(packages/%(pkg)s/tags|tags/packages/%(pkg)s)/([^/]+)"
+
+# Extract local tarball path
+svntgz_re = r"^/(packages/%(pkg)s/trunk|trunk/packages/%(pkg)s)/((upstream/|tarballs/|).*)$"
+
+# Extract working dir from svn-log output (to handle properly old and new layouts)
+svnwdir_re = r"^(/packages/%(pkg)s/([0-9.beta]+|trunk)|/trunk/packages/%(pkg)s/(trunk))(/.*|)$"
+
+# Ignore these paths (for old layouts)
+svnignore_re = r"^/packages/%(pkg)s(|/tags(/.*|))$"
+
 
 # Mapping from alioth login to name and email (could be queried...)
 users_dict = {
@@ -149,7 +155,11 @@
                     else:
                         print "# cannot recognize working dir in (%s) %s" % (action, file)
                 if file.endswith(".tar.gz"):
-                    print "# deal with (%s) %s manually" % (action, file)
+                    m = svntgz_re.match(file)
+                    if tgz or not m:
+                        print "# deal with (%s) %s manually" % (action, file)
+                    else:
+                        print "git-import-orig --pristine-tar --no-dch ../svn/%s" % m.group(2)
                     nb_files -= 1
                     tgz.append(file)
         if working_dir:
@@ -169,7 +179,7 @@
         print "popd\n"
 
     def find_commit(self):
-        s, o = getstatusoutput("git log --date=iso | grep -B2 '%s'" % self.date)
+        s, o = getstatusoutput("git log --all --date=iso | grep -B2 '%s'" % self.date)
         nb_sha = 0
         for line in o.split("\n"):
             if line.startswith("commit "):
@@ -386,6 +396,16 @@
         elif x == "-d": dict_mode = True
         elif x == "-e": dico_file = y
 
+    if package_name:
+        d = { "pkg": package_name }
+        svnwdir_re = re.compile(svnwdir_re % d)
+        svnignore_re = re.compile(svnignore_re % d)
+        svntag_path_re = re.compile(svntag_path_re % d)
+        svntgz_re = re.compile(svntgz_re % d)
+    else:
+        print >>sys.stderr, "A package name must be supplied!"
+        sys.exit(1)
+
     if (xml or xml_tags) and not dict_mode:
         print "#!/bin/zsh -e"
         print "export GIT_AUTHOR_NAME"




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