]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
populate GIT_COMMIT_ID environment variable, so it can be used in debian/rules
authorHolger Levsen <holger@layer-acht.org>
Thu, 16 Feb 2012 09:41:56 +0000 (10:41 +0100)
committerHolger Levsen <holger@layer-acht.org>
Thu, 16 Feb 2012 10:11:18 +0000 (11:11 +0100)
debian_build.py
lib/git_buildpackage.py

index dbe9ebe34d8a1dbe65d0e8fddec6d1bfb5df49fa..3a1565b028a660335b4e16c3670b3a214e9cca92 100755 (executable)
@@ -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...')
index 3f97d5a9b9820e67bda8579910e5d5220432bcc4..e03e48e3eb24901b9fe1000649a2a432e46d4d5a 100644 (file)
@@ -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'