summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-07-28 16:14:26 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-29 10:37:31 (GMT)
commit20e9df57217c5f37817653d2c3d492f2d4d37623 (patch)
tree07f0f79a3671d62ca57b3d232292c33d0a0b8dde
parent4e3240220bf8fc159ba5e797cb6040a3c74db222 (diff)
downloadpoky-20e9df57217c5f37817653d2c3d492f2d4d37623.tar.gz
lib/oe/reproducible.py: Fix git HEAD check3.2_M2
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: cdbd47dd7e1657b91b65a0940b7cbf119764240f) Signed-off-by: Joshua Watt <JPEWhacker@gmail.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 f4f58dd..421bb12 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):