From b4d3faf23bcd90432480afbed12a5ef2412251a2 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 16 Feb 2012 10:41:56 +0100 Subject: [PATCH] populate GIT_COMMIT_ID environment variable, so it can be used in debian/rules --- debian_build.py | 7 +++++-- lib/git_buildpackage.py | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/debian_build.py b/debian_build.py index dbe9ebe..3a1565b 100755 --- a/debian_build.py +++ b/debian_build.py @@ -349,10 +349,12 @@ if __name__ == '__main__': DPUT_OPTIONS = DPUT_OPTIONS_DEFAULT + # get the current commit id + current_commit = git_helper.git_get_commit_id() + if options.distribution in ('testing', 'staging', 'unstable', 'pre-staging','experimental') or GIT_BRANCH_NAME.startswith('release/'): daily_date = datetime.datetime.now().strftime('%Y%m%d%H%M%S') - current_commit = git_helper.git_get_commit_id() if GIT_BRANCH_NAME.startswith('release/'): version = '%s~rc%s+%s+%s' %(version, daily_date, BUILD_NUMBER, current_commit[0:7]) @@ -430,7 +432,8 @@ if __name__ == '__main__': debian_branch=GIT_DEBIAN_BRANCH, dist='squeeze', arch='amd64', - pb_suite=pb_suite + pb_suite=pb_suite, + git_commit_id=current_commit ) logger.info('used to start git-buildpackage here...') diff --git a/lib/git_buildpackage.py b/lib/git_buildpackage.py index 3f97d5a..e03e48e 100644 --- a/lib/git_buildpackage.py +++ b/lib/git_buildpackage.py @@ -11,17 +11,15 @@ logger = logging.getLogger(__file__) BIN_GIT_BUILDPACKAGE = '/usr/bin/git-buildpackage' BIN_SUDO = '/usr/bin/sudo' -# sudo DIST=squeeze git-buildpackage --git-upstream-branch=master -# --git-debian-branch=debian --git-tag class GitBuildPackage(object): def __init__(self, upstream_branch=None, - debian_branch=None, dist=None, arch=None, pb_suite=None): + debian_branch=None, dist=None, arch=None, pb_suite=None, git_commit_id=None): self.upstream_branch = upstream_branch self.debian_branch = debian_branch self.dist = dist self.arch = arch self.pb_suite = pb_suite - + self.git_commit_id = git_commit_id def build(self): cmd = [ @@ -45,6 +43,7 @@ class GitBuildPackage(object): env = os.environ env['DIST'] = self.dist env['PB_SUITE'] = self.pb_suite + env['GIT_COMMIT_ID'] = self.git_commit_id logger.debug( 'Trying to call "%s" with environment export %s' -- 2.39.5