From: Luis R. Rodriguez Date: Mon, 21 Oct 2013 09:08:25 +0000 (+0200) Subject: lib/bpgit.py: enable extra arguments on git describe X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ea70308d746325654d44851be602fe02492b59f9;p=openwrt%2Fstaging%2Fblogic.git lib/bpgit.py: enable extra arguments on git describe This lets us throw at it whatever extra stuff we want. Signed-off-by: Luis R. Rodriguez --- diff --git a/gentree.py b/gentree.py index c480c98be681..24514723d012 100755 --- a/gentree.py +++ b/gentree.py @@ -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) diff --git a/lib/bpgit.py b/lib/bpgit.py index 31b7de36b6cd..9a3f430ba108 100644 --- a/lib/bpgit.py +++ b/lib/bpgit.py @@ -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]