diff options
author | niko.mauno@vaisala.com <niko.mauno@vaisala.com> | 2019-11-19 08:46:24 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-19 23:33:03 -0800 |
commit | 6e3ba47f8cf3e89977fe8288ecdbb1c79896272b (patch) | |
tree | b41f8d702200d5fc47253f868bcba0f33a146144 /meta-oe/classes | |
parent | c3cf73c62136eb31710069bd6d0c58eebb72ca41 (diff) | |
download | meta-openembedded-6e3ba47f8cf3e89977fe8288ecdbb1c79896272b.tar.gz |
gitpkgv.bbclass: Use --git-dir option
Avoid redundant shell working directory change by resorting to
'--git-dir' option for git command instead.
Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r-- | meta-oe/classes/gitpkgv.bbclass | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass index 2d9680a35..22609f584 100644 --- a/meta-oe/classes/gitpkgv.bbclass +++ b/meta-oe/classes/gitpkgv.bbclass | |||
@@ -87,10 +87,8 @@ def get_git_pkgv(d, use_tags): | |||
87 | 87 | ||
88 | if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0: | 88 | if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0: |
89 | commits = bb.fetch2.runfetchcmd( | 89 | commits = bb.fetch2.runfetchcmd( |
90 | "cd %(repodir)s && " | 90 | "git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l" |
91 | "git rev-list %(rev)s -- 2> /dev/null " | 91 | % vars, d, quiet=True).strip().lstrip('0') |
92 | "| wc -l" % vars, | ||
93 | d, quiet=True).strip().lstrip('0') | ||
94 | 92 | ||
95 | if commits != "": | 93 | if commits != "": |
96 | oe.path.remove(rev_file, recurse=False) | 94 | oe.path.remove(rev_file, recurse=False) |
@@ -105,9 +103,8 @@ def get_git_pkgv(d, use_tags): | |||
105 | if use_tags: | 103 | if use_tags: |
106 | try: | 104 | try: |
107 | output = bb.fetch2.runfetchcmd( | 105 | output = bb.fetch2.runfetchcmd( |
108 | "cd %(repodir)s && " | 106 | "git --git-dir=%(repodir)s describe %(rev)s 2>/dev/null" |
109 | "git describe %(rev)s 2>/dev/null" % vars, | 107 | % vars, d, quiet=True).strip() |
110 | d, quiet=True).strip() | ||
111 | ver = gitpkgv_drop_tag_prefix(output) | 108 | ver = gitpkgv_drop_tag_prefix(output) |
112 | except Exception: | 109 | except Exception: |
113 | ver = "0.0-%s-g%s" % (commits, vars['rev'][:7]) | 110 | ver = "0.0-%s-g%s" % (commits, vars['rev'][:7]) |