[Treepkg-commits] r159 - trunk/bin

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 13 16:03:21 CET 2009


Author: bh
Date: 2009-01-13 16:03:21 +0100 (Tue, 13 Jan 2009)
New Revision: 159

Modified:
   trunk/bin/updatetreepkg.py
Log:
Extend bin/updatetreepkg.py to rename the revision directories if they
still all end in -1 instead of using the rules revision as that second
number in the directory names.


Modified: trunk/bin/updatetreepkg.py
===================================================================
--- trunk/bin/updatetreepkg.py	2009-01-13 15:01:22 UTC (rev 158)
+++ trunk/bin/updatetreepkg.py	2009-01-13 15:03:21 UTC (rev 159)
@@ -1,5 +1,5 @@
 #! /usr/bin/python2.4
-# Copyright (C) 2007, 2008 by Intevation GmbH
+# Copyright (C) 2007, 2008, 2009 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -13,6 +13,12 @@
  - Rename the build log from build.log to log/build_log.txt
 
  - Rename the build log from build_log.txt to log/build_log.txt
+
+ - Rename the directory name of the revision from <revision>-1 to <revision>-0
+
+   The second number is now the revision of the packaging rules if
+   they're managed by SVN and always 0 for manual management of the
+   rules.
 """
 
 import os
@@ -33,6 +39,15 @@
         if not dry_run:
             os.rename(old_name, new_name)
 
+def update_rules_revision_in_directory_names(track, dry_run):
+    revisions = track.get_revisions()
+    rules_revisions = set(revision.rules_revision for revision in revisions)
+    if rules_revisions == set([1]):
+        for revision in revisions:
+            rename_file(revision.base_dir,
+                        revision.base_dir[:-2] + "-0",
+                        dry_run)
+
 def update_treepkg(config_file, dry_run):
     treepkg_opts, packager_opts = read_config(config_file)
     for opts in packager_opts:
@@ -50,6 +65,11 @@
             # still were in the base directory
             rename_file(os.path.join(revision.base_dir, "build_log.txt"),
                         revision.build_log, dry_run)
+        # Revision directories used to end with "-1".  Now that number
+        # is the revision of the packaging rules which default to 0 for
+        # the traditional manual rules management without a version
+        # control system.  Rename those directories if necessary
+        update_rules_revision_in_directory_names(track, dry_run)
 
 def parse_commandline():
     parser = create_parser()



More information about the Treepkg-commits mailing list