summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r--meta/classes/externalsrc.bbclass33
1 files changed, 22 insertions, 11 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 1d7300d65b..9c9451e528 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -60,7 +60,7 @@ python () {
60 if externalsrcbuild: 60 if externalsrcbuild:
61 d.setVar('B', externalsrcbuild) 61 d.setVar('B', externalsrcbuild)
62 else: 62 else:
63 d.setVar('B', '${WORKDIR}/${BPN}-${PV}/') 63 d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
64 64
65 local_srcuri = [] 65 local_srcuri = []
66 fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d) 66 fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
@@ -108,6 +108,15 @@ python () {
108 if local_srcuri and task in fetch_tasks: 108 if local_srcuri and task in fetch_tasks:
109 continue 109 continue
110 bb.build.deltask(task, d) 110 bb.build.deltask(task, d)
111 if bb.data.inherits_class('reproducible_build', d) and task == 'do_unpack':
112 # The reproducible_build's create_source_date_epoch_stamp function must
113 # be run after the source is available and before the
114 # do_deploy_source_date_epoch task. In the normal case, it's attached
115 # to do_unpack as a postfuncs, but since we removed do_unpack (above)
116 # we need to move the function elsewhere. The easiest thing to do is
117 # move it into the prefuncs of the do_deploy_source_date_epoch task.
118 # This is safe, as externalsrc runs with the source already unpacked.
119 d.prependVarFlag('do_deploy_source_date_epoch', 'prefuncs', 'create_source_date_epoch_stamp ')
111 120
112 d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ") 121 d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
113 d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ") 122 d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ")
@@ -198,8 +207,8 @@ def srctree_hash_files(d, srcdir=None):
198 try: 207 try:
199 git_dir = os.path.join(s_dir, 208 git_dir = os.path.join(s_dir,
200 subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) 209 subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
201 top_git_dir = os.path.join(s_dir, subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], 210 top_git_dir = os.path.join(d.getVar("TOPDIR"),
202 stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) 211 subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
203 if git_dir == top_git_dir: 212 if git_dir == top_git_dir:
204 git_dir = None 213 git_dir = None
205 except subprocess.CalledProcessError: 214 except subprocess.CalledProcessError:
@@ -216,14 +225,16 @@ def srctree_hash_files(d, srcdir=None):
216 env['GIT_INDEX_FILE'] = tmp_index.name 225 env['GIT_INDEX_FILE'] = tmp_index.name
217 subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env) 226 subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
218 git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8") 227 git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
219 submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8") 228 if os.path.exists(os.path.join(s_dir, ".gitmodules")) and os.path.getsize(os.path.join(s_dir, ".gitmodules")) > 0:
220 for line in submodule_helper.splitlines(): 229 submodule_helper = subprocess.check_output(["git", "config", "--file", ".gitmodules", "--get-regexp", "path"], cwd=s_dir, env=env).decode("utf-8")
221 module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) 230 for line in submodule_helper.splitlines():
222 proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 231 module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
223 proc.communicate() 232 if os.path.isdir(module_dir):
224 proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) 233 proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
225 stdout, _ = proc.communicate() 234 proc.communicate()
226 git_sha1 += stdout.decode("utf-8") 235 proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
236 stdout, _ = proc.communicate()
237 git_sha1 += stdout.decode("utf-8")
227 sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest() 238 sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
228 with open(oe_hash_file, 'w') as fobj: 239 with open(oe_hash_file, 'w') as fobj:
229 fobj.write(sha1) 240 fobj.write(sha1)