diff options
author | Guido Guenther <agx@sigxcpu.org> | 2006-09-11 15:40:40 +0200 |
---|---|---|
committer | Guido Guenther <agx@bogon.sigxcpu.org> | 2006-09-11 15:40:40 +0200 |
commit | e4138a607c371f7c297fd50db7cc9e3dee5d3935 (patch) | |
tree | c7b4b429e9f8a7ea7ac779a1b6e369f48a48896d /git-debuild | |
download | git-buildpackage-e4138a607c371f7c297fd50db7cc9e3dee5d3935.tar.gz git-buildpackage-e4138a607c371f7c297fd50db7cc9e3dee5d3935.tar.bz2 git-buildpackage-e4138a607c371f7c297fd50db7cc9e3dee5d3935.zip |
first version
Diffstat (limited to 'git-debuild')
-rwxr-xr-x | git-debuild | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/git-debuild b/git-debuild new file mode 100755 index 00000000..cc139515 --- /dev/null +++ b/git-debuild @@ -0,0 +1,48 @@ +#!/usr/bin/python +# +# run debuild in a git repository +# +# (c) 2006 Guido Guenther <agx@sigxcpu.org> +# License: GPLv2 + +import sys,os,commands,re +import optparse + +def get_version(): + versionre=re.compile('^Version:\s+(?P<version>[\d\w~\-\.]+)$') + (status, out) = commands.getstatusoutput('dpkg-parsechangelog') + for line in out.split('\n'): + m=versionre.match(line) + if m: + return m.group('version') + +def main(argv): + args = [ arg for arg in argv[1:] if arg.find('--git-') == 0 ] + dpkg_args = [ arg for arg in argv[1:] if arg.find('--git-') == -1 ] + + parser=optparse.OptionParser() + parser.add_option("--git-ignore-new", action="store_true", dest="ignore_new", default=False, + help="build with incommited changes in the source tree") + parser.add_option("--git-tag", action="store_true", dest="tag", default=False, + help="build with uncommited changes in the source tree") + (options, args) = parser.parse_args(args) + + (status, out) = commands.getstatusoutput('git status') + msgs=out.split('\n') + if msgs[0] != 'nothing to commit' and not options.ignore_new: + print out + sys.exit(1) + cmd='debuild -i.git '+" ".join(dpkg_args) + print "Running:", cmd + os.system('debuild -i.git '+" ".join(dpkg_args)) + version=get_version() + if version and options.tag: + print "Tagging", version + os.system('git-tag %s' % version) + else: + print >>sys.stderr,"Can't parse version from changes file" + +if __name__ == '__main__': + sys.exit(main(sys.argv)) + +# vim:et:ts=4:sw=4: |