lib/bpgit.py: enable extra arguments on git describe
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>
Mon, 21 Oct 2013 09:08:25 +0000 (11:08 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 21 Oct 2013 19:50:38 +0000 (21:50 +0200)
This lets us throw at it whatever extra stuff we want.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
gentree.py
lib/bpgit.py

index c480c98be6816f7c63da91f2295acc3893bb5ad1..24514723d012846e0b7f424281d9b2fee6b4e759 100755 (executable)
@@ -468,9 +468,10 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
         backports_version = "(see git)"
         kernel_version = "(see git)"
     else:
-        backports_version = git.describe(tree=source_dir)
+        backports_version = git.describe(tree=source_dir, extra_args=['--long'])
         kernel_version = git.describe(rev=args.git_revision or 'HEAD',
-                                      tree=args.kerneldir)
+                                      tree=args.kerneldir,
+                                      extra_args=['--long'])
     f = open(os.path.join(args.outdir, 'versions'), 'w')
     f.write('BACKPORTS_VERSION="%s"\n' % backports_version)
     f.write('BACKPORTED_KERNEL_VERSION="%s"\n' % kernel_version)
index 31b7de36b6cd23921674e5b88d989020d231d094..9a3f430ba108b0125c328090b2a6fbfe71f82cc3 100644 (file)
@@ -27,8 +27,14 @@ def rev_parse(rev='HEAD', tree=None):
         raise SHAError()
     return sha
 
-def describe(rev='HEAD', tree=None):
-    process = subprocess.Popen(['git', 'describe', '--always', '--long', rev],
+def describe(rev='HEAD', tree=None, extra_args=[]):
+    cmd = ['git', 'describe', '--always']
+
+    cmd.extend(extra_args)
+    if rev is not None:
+        cmd.append(rev)
+
+    process = subprocess.Popen(cmd,
                                stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                                close_fds=True, universal_newlines=True, cwd=tree)
     stdout = process.communicate()[0]