Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-06-28 23:53:57 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-06-28 23:53:57 (GMT)
commitc1ecedeb7995dd16ae638ef0d017243530a5ef22 (patch)
tree66abd2b013143822f18561cd5dc861a42a19ddfe /sugar
parent0d6760b1944fae7326ceb5aa181bf78109d20fcf (diff)
Add a command to automatically do releases.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/bundlebuilder.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/sugar/activity/bundlebuilder.py b/sugar/activity/bundlebuilder.py
index 54a6cee..16fd4f2 100644
--- a/sugar/activity/bundlebuilder.py
+++ b/sugar/activity/bundlebuilder.py
@@ -113,6 +113,7 @@ setup.py uninstall [dirname] - uninstall the bundle \n\
setup.py genpot - generate the gettext pot file \n\
setup.py genmo - compile gettext po files in mo \n\
setup.py clean - clean the directory \n\
+setup.py release - do a new release of the bundle \n\
setup.py help - print this message \n\
'
@@ -227,6 +228,58 @@ def cmd_genmo(bundle_name, manifest):
if retcode:
print 'ERROR - msgfmt failed with return code %i.' % retcode
+def cmd_release(bundle_name, manifest):
+ if not os.path.isdir('.git'):
+ print 'ERROR - this command works only for git repositories'
+
+ print 'Bumping activity version...'
+
+ info_path = os.path.join(_get_source_path(), 'activity', 'activity.info')
+ f = open(info_path,'r')
+ info = f.read()
+ f.close()
+
+ exp = re.compile('activity_version\s?=\s?([1-9]*)')
+ match = re.search(exp, info)
+ version = int(match.group(1)) + 1
+ info = re.sub(exp, 'activity_version = %d' % version, info)
+
+ f = open(info_path, 'w')
+ f.write(info)
+ f.close()
+
+ print 'Committing to git...'
+
+ changelog = 'Release version %d.' % version
+ retcode = subprocess.call(['git', 'commit', '-a', '-m % s' % changelog])
+ if retcode:
+ print 'ERROR - cannot commit to git'
+
+ retcode = subprocess.call(['git', 'push'])
+ if retcode:
+ print 'ERROR - cannot push to git'
+
+ print 'Creating the bundle...'
+ cmd_dist(bundle_name, manifest)
+
+ if os.environ.has_key('ACTIVITIES_REPOSITORY'):
+ print 'Uploading to the activities repository...'
+ repo = os.environ['ACTIVITIES_REPOSITORY']
+
+ server, path = repo.split(':')
+ cmd = '"rm %s/%s*"' % (path, bundle_name)
+ retcode = subprocess.call(['ssh', server, cmd])
+ if retcode:
+ print 'ERROR - cannot remove old bundles from the repository.'
+
+ bundle_path = os.path.join(_get_source_path(),
+ _get_package_name(bundle_name))
+ retcode = subprocess.call(['scp', bundle_path, repo])
+ if retcode:
+ print 'ERROR - cannot upload the bundle to the repository.'
+
+ print 'Done.'
+
def cmd_clean():
os.path.walk('.', _delete_backups, None)
@@ -252,6 +305,8 @@ def start(bundle_name=None, manifest='MANIFEST'):
cmd_genmo(bundle_name, manifest)
elif sys.argv[1] == 'clean':
cmd_clean()
+ elif sys.argv[1] == 'release':
+ cmd_release(bundle_name, manifest)
else:
cmd_help()