summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-07-28 11:14:26 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-22 13:27:37 +0000
commita0a4838076388720eef88ad98776bba6a3e12566 (patch)
treeac6c37bbb2d7a91d7fa4bcb4e274e3e0e576c77b
parent0d4dea01892734417264757ca5fd5a85874bb514 (diff)
downloadpoky-a0a4838076388720eef88ad98776bba6a3e12566.tar.gz
lib/oe/reproducible.py: Fix git HEAD check
The check for a git HEAD still wasn't quite correct because it was using the .git directory as the current working directory. Instead, it should be passed as the --git-dir argument when running git. Running `git rev-parse HEAD` in a .git directory with no HEAD reports 'HEAD' and exits with success but then 'git log' will fail, which is not what we want. (From OE-Core rev: 31f00ec9c6ab5fe74f1ba59f79322497ef8f4dc7) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit cdbd47dd7e1657b91b65a0940b7cbf119764240f) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/reproducible.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py
index f4f58dd952..421bb12f54 100644
--- a/meta/lib/oe/reproducible.py
+++ b/meta/lib/oe/reproducible.py
@@ -56,13 +56,13 @@ def get_source_date_epoch_from_git(d, sourcedir):
56 56
57 # Check that the repository has a valid HEAD; it may not if subdir is used 57 # Check that the repository has a valid HEAD; it may not if subdir is used
58 # in SRC_URI 58 # in SRC_URI
59 p = subprocess.run(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=gitpath) 59 p = subprocess.run(['git', '--git-dir', gitpath, 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
60 if p.returncode != 0: 60 if p.returncode != 0:
61 bb.debug(1, "%s does not have a valid HEAD: %s" % (gitpath, p.stdout.decode('utf-8'))) 61 bb.debug(1, "%s does not have a valid HEAD: %s" % (gitpath, p.stdout.decode('utf-8')))
62 return None 62 return None
63 63
64 bb.debug(1, "git repository: %s" % gitpath) 64 bb.debug(1, "git repository: %s" % gitpath)
65 p = subprocess.run(['git','log','-1','--pretty=%ct'], check=True, stdout=subprocess.PIPE, cwd=gitpath) 65 p = subprocess.run(['git', '--git-dir', gitpath, 'log', '-1', '--pretty=%ct'], check=True, stdout=subprocess.PIPE)
66 return int(p.stdout.decode('utf-8')) 66 return int(p.stdout.decode('utf-8'))
67 67
68def get_source_date_epoch_from_youngest_file(d, sourcedir): 68def get_source_date_epoch_from_youngest_file(d, sourcedir):