Mercurial > treepkg
comparison 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 |
comparison
equal
deleted
inserted
replaced
232:e3cda08d2619 | 233:757e5504f46a |
---|---|
1 #! /usr/bin/python2.4 | 1 #! /usr/bin/python2.4 |
2 # Copyright (C) 2007, 2008 by Intevation GmbH | 2 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH |
3 # Authors: | 3 # Authors: |
4 # Bernhard Herzog <bh@intevation.de> | 4 # Bernhard Herzog <bh@intevation.de> |
5 # | 5 # |
6 # This program is free software under the GPL (>=v2) | 6 # This program is free software under the GPL (>=v2) |
7 # Read the file COPYING coming with the software for details. | 7 # Read the file COPYING coming with the software for details. |
11 for the individual revisions in the following ways: | 11 for the individual revisions in the following ways: |
12 | 12 |
13 - Rename the build log from build.log to log/build_log.txt | 13 - Rename the build log from build.log to log/build_log.txt |
14 | 14 |
15 - Rename the build log from build_log.txt to log/build_log.txt | 15 - Rename the build log from build_log.txt to log/build_log.txt |
16 | |
17 - Rename the directory name of the revision from <revision>-1 to <revision>-0 | |
18 | |
19 The second number is now the revision of the packaging rules if | |
20 they're managed by SVN and always 0 for manual management of the | |
21 rules. | |
16 """ | 22 """ |
17 | 23 |
18 import os | 24 import os |
19 | 25 |
20 import treepkgcmd | 26 import treepkgcmd |
31 os.mkdir(new_dir) | 37 os.mkdir(new_dir) |
32 print "mv %s %s" % (old_name, new_name) | 38 print "mv %s %s" % (old_name, new_name) |
33 if not dry_run: | 39 if not dry_run: |
34 os.rename(old_name, new_name) | 40 os.rename(old_name, new_name) |
35 | 41 |
42 def update_rules_revision_in_directory_names(track, dry_run): | |
43 revisions = track.get_revisions() | |
44 rules_revisions = set(revision.rules_revision for revision in revisions) | |
45 if rules_revisions == set([1]): | |
46 for revision in revisions: | |
47 rename_file(revision.base_dir, | |
48 revision.base_dir[:-2] + "-0", | |
49 dry_run) | |
50 | |
36 def update_treepkg(config_file, dry_run): | 51 def update_treepkg(config_file, dry_run): |
37 treepkg_opts, packager_opts = read_config(config_file) | 52 treepkg_opts, packager_opts = read_config(config_file) |
38 for opts in packager_opts: | 53 for opts in packager_opts: |
39 opts["handle_dependencies"] = False | 54 opts["handle_dependencies"] = False |
40 group = PackagerGroup([create_package_track(**opts) | 55 group = PackagerGroup([create_package_track(**opts) |
48 revision.build_log, dry_run) | 63 revision.build_log, dry_run) |
49 # for a while, the build logs were called build_log.txt but | 64 # for a while, the build logs were called build_log.txt but |
50 # still were in the base directory | 65 # still were in the base directory |
51 rename_file(os.path.join(revision.base_dir, "build_log.txt"), | 66 rename_file(os.path.join(revision.base_dir, "build_log.txt"), |
52 revision.build_log, dry_run) | 67 revision.build_log, dry_run) |
68 # Revision directories used to end with "-1". Now that number | |
69 # is the revision of the packaging rules which default to 0 for | |
70 # the traditional manual rules management without a version | |
71 # control system. Rename those directories if necessary | |
72 update_rules_revision_in_directory_names(track, dry_run) | |
53 | 73 |
54 def parse_commandline(): | 74 def parse_commandline(): |
55 parser = create_parser() | 75 parser = create_parser() |
56 parser.set_defaults(dry_run=False) | 76 parser.set_defaults(dry_run=False) |
57 parser.add_option("-n", "--dry-run", action="store_true", | 77 parser.add_option("-n", "--dry-run", action="store_true", |