[Pkg-mozext-commits] [adblock-plus] 29/52: Issue 1778 - Generate proper build numbers when working with Git repositories

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:43:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 021b78c35e9e19a81f6a3eb1449d868b4cfb828a
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Jan 12 19:43:18 2015 +0100

    Issue 1778 - Generate proper build numbers when working with Git repositories
---
 packager.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/packager.py b/packager.py
index 934b0ea..4dee3a2 100644
--- a/packager.py
+++ b/packager.py
@@ -24,10 +24,17 @@ def readMetadata(baseDir, type):
 
 def getBuildNum(baseDir):
   try:
-    result = subprocess.check_output(['hg', 'id', '-R', baseDir, '-n'])
-    return re.sub(r'\D', '', result)
-  except:
-    return '0'
+    from buildtools.ensure_dependencies import Mercurial, Git
+    if Mercurial().istype(baseDir):
+      result = subprocess.check_output(['hg', 'id', '-R', baseDir, '-n'])
+      return re.sub(r'\D', '', result)
+    elif Git().istype(baseDir):
+      result = subprocess.check_output(['git', 'rev-list', 'HEAD'], cwd=baseDir)
+      return len(result.splitlines())
+  except subprocess.CalledProcessError:
+    pass
+
+  return '0'
 
 def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None):
   version = metadata.get('general', 'version')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list