release.py: Use git-archive to create the tarballs and tag clean checkout

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-03-16 23:44:14 -04:00
parent d06335ca78
commit d2125f2b5b

View File

@ -93,43 +93,34 @@ if __name__ == '__main__':
print 'Tagging release.' print 'Tagging release.'
system('git tag %s -m "Release %s" %s' % (sign or '-a', v, v)) system('git tag %s -m "Release %s" %s' % (sign or '-a', v, v))
print 'Pushing release commits.'
system('git push origin master')
system('git push --tags')
print 'Removing test, sandbox.'
shutil.rmtree('test')
shutil.rmtree('sandbox')
shutil.rmtree('.git')
os.chdir('..')
dirname = 'Supybot-%s' % v
print 'Renaming directory to %s.' % dirname
if os.path.exists(dirname):
shutil.rmtree(dirname)
shutil.move('supybot', dirname)
print 'Creating tarball (gzip).'
system('tar czvf Supybot-%s.tar.gz %s' % (v, dirname))
print 'Creating tarball (bzip2).'
system('tar cjvf Supybot-%s.tar.bz2 %s' % (v, dirname))
print 'Creating zip.'
system('zip -r Supybot-%s.zip %s' % (v, dirname))
print 'Uploading package files to upload.sf.net.'
system('scp Supybot-%s.tar.gz Supybot-%s.tar.bz2 Supybot-%s.zip '
'%s@frs.sourceforge.net:uploads' % (v, v, v, u))
print 'Committing %s+git to version files.' % v print 'Committing %s+git to version files.' % v
system('git checkout master')
system('git pull')
for fn in versionFiles: for fn in versionFiles:
sh = 'perl -pi -e "s/^version\s*=.*/version = \'%s\'/" %s' % \ sh = 'perl -pi -e "s/^version\s*=.*/version = \'%s\'/" %s' % \
(v + '+git', fn) (v + '+git', fn)
system(sh, 'Error changing version in %s' % fn) system(sh, 'Error changing version in %s' % fn)
system('git commit %s -m \'Updated to %s.\' %s' system('git commit %s -m \'Updated to %s.\' %s'
% (sign, v, ' '.join(versionFiles))) % (sign, v, ' '.join(versionFiles)))
print 'Pushing commits.'
system('git push origin master') system('git push origin master')
system('git push --tags')
print 'Creating tarball (gzip).'
system('git archive --prefix=Supybot-%s/ --format=tar %s '
'| gzip -c >../Supybot-%s.tar.gz' % (v, v, v))
print 'Creating tarball (bzip2).'
system('git archive --prefix=Supybot-%s/ --format=tar %s '
'| bzip2 -c >../Supybot-%s.tar.bz2' % (v, v, v))
print 'Creating zip.'
system('git archive --prefix=Supybot-%s/ --format=zip %s '
'>../Supybot-%s.zip' % (v, v))
os.chdir('..')
shutil.rmtree('supybot')
print 'Uploading package files to upload.sf.net.'
system('scp Supybot-%s.tar.gz Supybot-%s.tar.bz2 Supybot-%s.zip '
'%s@frs.sourceforge.net:uploads' % (v, v, v, u))
print 'Copying new version.txt over to project webserver.' print 'Copying new version.txt over to project webserver.'
system('echo %s > version.txt' % v) system('echo %s > version.txt' % v)