diff options
Diffstat (limited to 'meta/lib/oe/reproducible.py')
-rw-r--r-- | meta/lib/oe/reproducible.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py index a9f717159e..0270024a83 100644 --- a/meta/lib/oe/reproducible.py +++ b/meta/lib/oe/reproducible.py | |||
@@ -47,7 +47,7 @@ import bb | |||
47 | # 2. If there is a git checkout, use the last git commit timestamp. | 47 | # 2. If there is a git checkout, use the last git commit timestamp. |
48 | # Git does not preserve file timestamps on checkout. | 48 | # Git does not preserve file timestamps on checkout. |
49 | # | 49 | # |
50 | # 3. Use the mtime of "known" files such as NEWS, CHANGLELOG, ... | 50 | # 3. Use the mtime of "known" files such as NEWS, CHANGELOG, ... |
51 | # This works for well-kept repositories distributed via tarball. | 51 | # This works for well-kept repositories distributed via tarball. |
52 | # | 52 | # |
53 | # 4. Use the modification time of the youngest file in the source tree, if | 53 | # 4. Use the modification time of the youngest file in the source tree, if |
@@ -75,10 +75,11 @@ def get_source_date_epoch_from_known_files(d, sourcedir): | |||
75 | return source_date_epoch | 75 | return source_date_epoch |
76 | 76 | ||
77 | def find_git_folder(d, sourcedir): | 77 | def find_git_folder(d, sourcedir): |
78 | # First guess: WORKDIR/git | 78 | # First guess: UNPACKDIR/BB_GIT_DEFAULT_DESTSUFFIX |
79 | # This is the default git fetcher unpack path | 79 | # This is the default git fetcher unpack path |
80 | workdir = d.getVar('WORKDIR') | 80 | unpackdir = d.getVar('UNPACKDIR') |
81 | gitpath = os.path.join(workdir, "git/.git") | 81 | default_destsuffix = d.getVar('BB_GIT_DEFAULT_DESTSUFFIX') |
82 | gitpath = os.path.join(unpackdir, default_destsuffix, ".git") | ||
82 | if os.path.isdir(gitpath): | 83 | if os.path.isdir(gitpath): |
83 | return gitpath | 84 | return gitpath |
84 | 85 | ||
@@ -88,15 +89,16 @@ def find_git_folder(d, sourcedir): | |||
88 | return gitpath | 89 | return gitpath |
89 | 90 | ||
90 | # Perhaps there was a subpath or destsuffix specified. | 91 | # Perhaps there was a subpath or destsuffix specified. |
91 | # Go looking in the WORKDIR | 92 | # Go looking in the UNPACKDIR |
92 | exclude = set(["build", "image", "license-destdir", "patches", "pseudo", | 93 | for root, dirs, files in os.walk(unpackdir, topdown=True): |
93 | "recipe-sysroot", "recipe-sysroot-native", "sysroot-destdir", "temp"]) | ||
94 | for root, dirs, files in os.walk(workdir, topdown=True): | ||
95 | dirs[:] = [d for d in dirs if d not in exclude] | ||
96 | if '.git' in dirs: | 94 | if '.git' in dirs: |
97 | return os.path.join(root, ".git") | 95 | return os.path.join(root, ".git") |
98 | 96 | ||
99 | bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir) | 97 | for root, dirs, files in os.walk(sourcedir, topdown=True): |
98 | if '.git' in dirs: | ||
99 | return os.path.join(root, ".git") | ||
100 | |||
101 | bb.warn("Failed to find a git repository in UNPACKDIR: %s" % unpackdir) | ||
100 | return None | 102 | return None |
101 | 103 | ||
102 | def get_source_date_epoch_from_git(d, sourcedir): | 104 | def get_source_date_epoch_from_git(d, sourcedir): |