diff options
author | 2012-03-09 08:31:36 +0100 | |
---|---|---|
committer | 2012-03-09 08:31:36 +0100 | |
commit | b95113ab4b205b9de68b13ec8f30a8f6c5f1415e (patch) | |
tree | 079b353e1eaf94e3192dc55eceb99db8fb1b8415 | |
parent | Working implementation of maintainer-timeout. (diff) | |
download | arch-tools-b95113ab4b205b9de68b13ec8f30a8f6c5f1415e.tar.gz arch-tools-b95113ab4b205b9de68b13ec8f30a8f6c5f1415e.tar.bz2 arch-tools-b95113ab4b205b9de68b13ec8f30a8f6c5f1415e.zip |
Improved handling of CVS conflicts.
-rwxr-xr-x | batch-stabilize.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/batch-stabilize.py b/batch-stabilize.py index e2c4976..db869bb 100755 --- a/batch-stabilize.py +++ b/batch-stabilize.py @@ -2,10 +2,12 @@ # Copyright 2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import glob import itertools import optparse import os import re +import shutil import subprocess import sys @@ -23,7 +25,10 @@ def print_and_log(message, log): def run_command(args, cwd, log): try: - log.write("Running %r in %s...\n" % (args, cwd)) + message = "Running %r in %s...\n" % (args, cwd) + sys.stdout.write(message) + log.write(message) + cmd = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = cmd.communicate()[0] log.write("Finished with exit code %d\n" % cmd.returncode) @@ -111,13 +116,15 @@ if __name__ == "__main__": cvs_path = os.path.join(options.repo, pn) print_and_log('Working in %s...' % cvs_path, log_file) - # Remove existing changelog to avoid adding duplicate entries. - try: - os.remove(os.path.join(cvs_path, 'ChangeLog')) - except OSError: - pass + # Remove whole directory to prevent problems with conflicts. + if os.path.exists(cvs_path): + try: + shutil.rmtree(cvs_path) + except OSError: + print '!!! rmtree %s failed' % cvs_path + sys.exit(1) - if run_command(["cvs", "up"], cvs_path, log_file)[0] != 0: + if run_command(["cvs", "up", pn], options.repo, log_file)[0] != 0: print '!!! cvs up failed' sys.exit(1) if run_command(["ekeyword", options.arch, ebuild_name], cvs_path, log_file)[0] != 0: |