copy setHelpers.py changes from debian/ branch

This commit is contained in:
Luke Campagnola 2014-01-22 14:23:10 -05:00
parent 2f1cb26549
commit d81998461f

View File

@ -49,7 +49,7 @@ def getGitVersion(tagPrefix):
lastTag = gitCommit(lastTagName) lastTag = gitCommit(lastTagName)
head = gitCommit('HEAD') head = gitCommit('HEAD')
if head != lastTag: if head != lastTag:
branch = re.search(r'\* (.*)', check_output(['git', 'branch'], universal_newlines=True)).group(1) branch = getGitBranch()
gitVersion = gitVersion + "-%s-%s" % (branch, head[:10]) gitVersion = gitVersion + "-%s-%s" % (branch, head[:10])
# any uncommitted modifications? # any uncommitted modifications?
@ -65,6 +65,13 @@ def getGitVersion(tagPrefix):
return gitVersion return gitVersion
def getGitBranch():
m = re.search(r'\* (.*)', check_output(['git', 'branch'], universal_newlines=True))
if m is None:
return ''
else:
return m.group(1)
def getVersionStrings(pkg): def getVersionStrings(pkg):
""" """
Returns 4 version strings: Returns 4 version strings:
@ -102,10 +109,11 @@ def getVersionStrings(pkg):
forcedVersion = sys.argv[i].replace('--force-version=', '') forcedVersion = sys.argv[i].replace('--force-version=', '')
sys.argv.pop(i) sys.argv.pop(i)
## Finally decide on a version string to use: ## Finally decide on a version string to use:
if forcedVersion is not None: if forcedVersion is not None:
version = forcedVersion version = forcedVersion
elif gitVersion is not None: elif gitVersion is not None and getGitBranch() != 'debian': # ignore git version if this is debian branch
version = gitVersion version = gitVersion
sys.stderr.write("Detected git commit; will use version string: '%s'\n" % version) sys.stderr.write("Detected git commit; will use version string: '%s'\n" % version)
else: else:
@ -121,7 +129,7 @@ from generateChangelog import generateDebianChangelog
class DebCommand(Command): class DebCommand(Command):
description = "build .deb package using `debuild -us -uc`" description = "build .deb package using `debuild -us -uc`"
maintainer = "Luke Campagnola <luke.campagnola@gmail.com>" maintainer = "Luke Campagnola <luke.campagnola@gmail.com>"
debTemplate = "tools/debian" debTemplate = "debian"
debDir = "deb_build" debDir = "deb_build"
user_options = [] user_options = []