diff options
-rw-r--r-- | AUTHORS | 4 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | libbe/command/assign.py | 2 | ||||
-rw-r--r-- | libbe/command/help.py | 1 | ||||
-rw-r--r-- | libbe/command/html.py | 1 | ||||
-rw-r--r-- | libbe/command/set.py | 2 | ||||
-rw-r--r-- | libbe/command/severity.py | 2 | ||||
-rw-r--r-- | libbe/command/target.py | 2 | ||||
-rw-r--r-- | libbe/storage/vcs/bzr.py | 2 | ||||
-rw-r--r-- | libbe/util/plugin.py | 2 | ||||
-rwxr-xr-x | release.py | 110 | ||||
-rw-r--r-- | test.py | 2 | ||||
-rwxr-xr-x | update_copyright.py | 3 |
13 files changed, 80 insertions, 58 deletions
@@ -10,10 +10,12 @@ Gianluca Montecchi <gian@grys.it> Gour <gour@gour-nitai.com> James Rowe <jnrowe@ukfsn.org> Jelmer Vernooij <jelmer@samba.org> -Marien Zwart <marienz@gentoo.org> +Marien Zwart <marien.zwart@gmail.com> +Mathieu Clabaut <mathieu.clabaut@gmail.com> Moritz Barsnick (at dot) <moritzbarsnicknet> Oleg Romanyshyn <oromanyshyn@panoramicfeedback.com> Steve Losh <steve@stevelosh.com> Thomas Gerigk <tgerigk@gmx.de> Thomas Habets <thomas@habets.pp.se> +Thomas Keller <me@thomaskeller.biz> W. Trevor King <wking@drexel.edu> @@ -42,7 +42,8 @@ DOC_DIR := doc MAN_DIR := ${DOC_DIR}/man MANPAGES = be.1 -GENERATED_FILES := build libbe/_version.py +LIBBE_VERSION := libbe/_version.py +GENERATED_FILES := build $(LIBBE_VERSION) MANPAGE_FILES = $(patsubst %,${MAN_DIR}/%,${MANPAGES}) GENERATED_FILES += ${MANPAGE_FILES} @@ -53,7 +54,7 @@ all: build .PHONY: build -build: libbe/_version.py +build: $(LIBBE_VERSION) python setup.py build .PHONY: doc diff --git a/libbe/command/assign.py b/libbe/command/assign.py index 9d6e0b0..7632abf 100644 --- a/libbe/command/assign.py +++ b/libbe/command/assign.py @@ -1,6 +1,6 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Gianluca Montecchi <gian@grys.it> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # Thomas Gerigk <tgerigk@gmx.de> # W. Trevor King <wking@drexel.edu> # diff --git a/libbe/command/help.py b/libbe/command/help.py index 01824fa..fee71c7 100644 --- a/libbe/command/help.py +++ b/libbe/command/help.py @@ -1,5 +1,6 @@ # Copyright (C) 2006-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Gianluca Montecchi <gian@grys.it> +# Marien Zwart <marien.zwart@gmail.com> # Thomas Gerigk <tgerigk@gmx.de> # W. Trevor King <wking@drexel.edu> # diff --git a/libbe/command/html.py b/libbe/command/html.py index c61d6d8..0c5cad1 100644 --- a/libbe/command/html.py +++ b/libbe/command/html.py @@ -1,4 +1,5 @@ # Copyright (C) 2009-2010 Gianluca Montecchi <gian@grys.it> +# Mathieu Clabaut <mathieu.clabaut@gmail.com> # W. Trevor King <wking@drexel.edu> # # This file is part of Bugs Everywhere. diff --git a/libbe/command/set.py b/libbe/command/set.py index b41a731..ac580d9 100644 --- a/libbe/command/set.py +++ b/libbe/command/set.py @@ -1,6 +1,6 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Gianluca Montecchi <gian@grys.it> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # Thomas Gerigk <tgerigk@gmx.de> # W. Trevor King <wking@drexel.edu> # diff --git a/libbe/command/severity.py b/libbe/command/severity.py index db9e9fd..fd4482f 100644 --- a/libbe/command/severity.py +++ b/libbe/command/severity.py @@ -1,6 +1,6 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Gianluca Montecchi <gian@grys.it> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # Thomas Gerigk <tgerigk@gmx.de> # W. Trevor King <wking@drexel.edu> # diff --git a/libbe/command/target.py b/libbe/command/target.py index 3617b67..a2911be 100644 --- a/libbe/command/target.py +++ b/libbe/command/target.py @@ -1,7 +1,7 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Chris Ball <cjb@laptop.org> # Gianluca Montecchi <gian@grys.it> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # Thomas Gerigk <tgerigk@gmx.de> # W. Trevor King <wking@drexel.edu> # diff --git a/libbe/storage/vcs/bzr.py b/libbe/storage/vcs/bzr.py index 45a6cd2..616a486 100644 --- a/libbe/storage/vcs/bzr.py +++ b/libbe/storage/vcs/bzr.py @@ -1,7 +1,7 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Ben Finney <benf@cybersource.com.au> # Gianluca Montecchi <gian@grys.it> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # W. Trevor King <wking@drexel.edu> # # This file is part of Bugs Everywhere. diff --git a/libbe/util/plugin.py b/libbe/util/plugin.py index eae7ca9..f673f14 100644 --- a/libbe/util/plugin.py +++ b/libbe/util/plugin.py @@ -1,6 +1,6 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> # Gianluca Montecchi <gian@grys.it> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # W. Trevor King <wking@drexel.edu> # # This file is part of Bugs Everywhere. @@ -23,9 +23,13 @@ import shutil import string import sys -from libbe.subproc import Pipe, invoke +from libbe.util.subproc import Pipe, invoke from update_copyright import update_authors, update_files + +INITIAL_COMMIT = '1bf1ec598b436f41ff27094eddf0b28c797e359d' + + def validate_tag(tag): """ >>> validate_tag('1.0.0') @@ -52,77 +56,84 @@ def validate_tag(tag): continue raise Exception("Invalid character '%s' in tag '%s'" % (char, tag)) -def bzr_pending_changes(): - """Use `bzr diff`s exit status to detect change: - 1 - changed - 2 - unrepresentable changes - 3 - error - 0 - no change +def pending_changes(): + """Use `git diff`s output to detect change. """ - p = Pipe([['bzr', 'diff']]) - if p.status == 0: + status,stdout,stderr = invoke(['git', 'diff', 'HEAD']) + if len(stdout) == 0: return False - elif p.status in [1,2]: - return True - raise Exception("Error in bzr diff %d\n%s" % (p.status, p.stderrs[-1])) + return True def set_release_version(tag): print "set libbe.version._VERSION = '%s'" % tag - p = Pipe([['sed', '-i', "s/^# *_VERSION *=.*/_VERSION = '%s'/" % tag, - os.path.join('libbe', 'version.py')]]) - assert p.status == 0, p.statuses + invoke(['sed', '-i', "s/^# *_VERSION *=.*/_VERSION = '%s'/" % tag, + os.path.join('libbe', 'version.py')]) -def bzr_commit(commit_message): +def remove_makefile_libbe_version_dependencies(filename): + print "set %s LIBBE_VERSION :=" % filename + invoke(['sed', '-i', "s/^LIBBE_VERSION *:=.*/LIBBE_VERSION :=/", + filename]) + +def commit(commit_message): print 'commit current status:', commit_message - p = Pipe([['bzr', 'commit', '-m', commit_message]]) - assert p.status == 0, p.statuses + invoke(['git', 'commit', '-a', '-m', commit_message]) -def bzr_tag(tag): +def tag(tag): print 'tag current revision', tag - p = Pipe([['bzr', 'tag', tag]]) - assert p.status == 0, p.statuses + invoke(['git', 'tag', tag]) -def bzr_export(target_dir): +def export(target_dir): + if not target_dir.endswith(os.path.sep): + target_dir += os.path.sep print 'export current revision to', target_dir - p = Pipe([['bzr', 'export', target_dir]]) + p = Pipe([['git', 'archive', '--prefix', target_dir, 'HEAD'], + ['tar', '-xv']]) assert p.status == 0, p.statuses def make_version(): print 'generate libbe/_version.py' - p = Pipe([['make', os.path.join('libbe', '_version.py')]]) - assert p.status == 0, p.statuses + invoke(['make', os.path.join('libbe', '_version.py')]) def make_changelog(filename, tag): + """Generate a ChangeLog from the git history. + + Not the most ChangeLog-esque format, but iterating through commits + by hand is just too slow. + """ print 'generate ChangeLog file', filename, 'up to tag', tag - p = invoke(['bzr', 'log', '--gnu-changelog', '-n1', '-r', - '..tag:%s' % tag], stdout=file(filename, 'w')) - status = p.wait() - assert status == 0, status + invoke(['git', 'log', '--no-merges', + '%s..%s' % (INITIAL_COMMIT, tag)], + stdout=open(filename, 'w')), -def set_vcs_name(filename, vcs_name='None'): - """Exported directory is not a bzr repository, so set vcs_name to +def set_vcs_name(be_dir, vcs_name='None'): + """Exported directory is not a git repository, so set vcs_name to something that will work. vcs_name: new_vcs_name """ - print 'set vcs_name in', filename, 'to', vcs_name - p = Pipe([['sed', '-i', "s/^vcs_name:.*/vcs_name: %s/" % vcs_name, - filename]]) - assert p.status == 0, p.statuses + for directory in os.listdir(be_dir): + if not os.path.isdir(os.path.join(be_dir, directory)): + continue + filename = os.path.join(be_dir, directory, 'settings') + if os.path.exists(filename): + print 'set vcs_name in', filename, 'to', vcs_name + invoke(['sed', '-i', "s/^vcs_name:.*/vcs_name: %s/" % vcs_name, + filename]) def create_tarball(tag): release_name='be-%s' % tag export_dir = release_name - bzr_export(export_dir) + export(export_dir) make_version() + remove_makefile_libbe_version_dependencies( + os.path.join(export_dir, 'Makefile')) print 'copy libbe/_version.py to %s/libbe/_version.py' % export_dir shutil.copy(os.path.join('libbe', '_version.py'), os.path.join(export_dir, 'libbe', '_version.py')) make_changelog(os.path.join(export_dir, 'ChangeLog'), tag) - set_vcs_name(os.path.join(export_dir, '.be', 'settings')) + set_vcs_name(os.path.join(export_dir, '.be')) tarball_file = '%s.tar.gz' % release_name print 'create tarball', tarball_file - p = Pipe([['tar', '-czf', tarball_file, export_dir]]) - assert p.status == 0, p.statuses + invoke(['tar', '-czf', tarball_file, export_dir]) print 'remove', export_dir shutil.rmtree(export_dir) @@ -134,9 +145,13 @@ if __name__ == '__main__': import optparse usage = """%prog [options] TAG -Create a bzr tag and a release tarball from the current revision. +Create a git tag and a release tarball from the current revision. For example %prog 1.0.0 + +If you don't like what got committed, you can undo the release with + $ git tag -d 1.0.0 + $ git reset --hard HEAD^ """ p = optparse.OptionParser(usage) p.add_option('--test', dest='test', default=False, @@ -148,15 +163,16 @@ For example sys.exit(0) assert len(args) == 1, '%d (!= 1) arguments: %s' % (len(args), args) - tag = args[0] - validate_tag(tag) + _tag = args[0] + validate_tag(_tag) - if bzr_pending_changes() == True: + if pending_changes() == True: print "Handle pending changes before releasing." sys.exit(1) - set_release_version(tag) + set_release_version(_tag) + print "Update copyright information..." update_authors() update_files() - bzr_commit("Bumped to version %s" % tag) - bzr_tag(tag) - create_tarball(tag) + commit("Bumped to version %s" % _tag) + tag(_tag) + create_tarball(_tag) @@ -1,5 +1,5 @@ # Copyright (C) 2005-2010 Aaron Bentley <abentley@panoramicfeedback.com> -# Marien Zwart <marienz@gentoo.org> +# Marien Zwart <marien.zwart@gmail.com> # W. Trevor King <wking@drexel.edu> # # This file is part of Bugs Everywhere. diff --git a/update_copyright.py b/update_copyright.py index 7dc38a9..86b26b2 100755 --- a/update_copyright.py +++ b/update_copyright.py @@ -83,10 +83,11 @@ ALIASES = { 'Chris Ball <cjb@thunk.printf.net>'], 'Gianluca Montecchi <gian@grys.it>': ['Gianluca <gian@grys.it>', + 'gian <gian@grys.it>', 'gian <gian@li82-39>', 'gianluca <gian@galactica>'], 'Marien Zwart <marien.zwart@gmail.com>': - ['Marian Zwart <marienz@gentoo.org>'], + ['Marien Zwart <marienz@gentoo.org>'], 'W. Trevor King <wking@drexel.edu>': ['wking <wking@mjolnir>', 'wking <wking@thialfi>'], |