diff bin/updatetreepkg.py @ 233:757e5504f46a

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.
author Bernhard Herzog <bh@intevation.de>
date Tue, 13 Jan 2009 15:03:21 +0000
parents dd54ef8a9244
children 1fcdffbeb9de
line wrap: on
line diff
--- a/bin/updatetreepkg.py	Tue Jan 13 15:01:22 2009 +0000
+++ b/bin/updatetreepkg.py	Tue Jan 13 15:03:21 2009 +0000
@@ -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@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()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)