archiver.bbclass: various fixes for original+diff mode
The diff.gz gets created in do_unpack_and_patch, but do_deploy_archives did not depend on it, so there was a race condition. For example, "bitbake linux-intel:do_deploy_archives" without a prior "bitbake linux-intel:do_kernel_configme" did not deploy the diff.gz. When do_unpack_and_patch ran first, it failed because the output directory didn't exist yet and the error was not detected because the result of the diff command wasn't checked. Changing the current working directory in create_diff_gz() without returning to the original directory caused warnings like this: WARNING: linux-intel-... do_unpack_and_patch: Task do_unpack_and_patch changed cwd to .../tmp-glibc/work-shared/intel-corei7-64 (From OE-Core rev: 18aac553ca35049c80b6cc82ff0e69ce8a7a03a9) (From OE-Core rev: 58ae2be68c2eb4153c09386eebefe9b57400c777) (From OE-Core rev: 497795c5a9db8ddb29302780a94eabf6f9b05c9d) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
968810913a
commit
1e59fd509f
|
@ -79,6 +79,11 @@ python () {
|
||||||
|
|
||||||
if ar_src == "original":
|
if ar_src == "original":
|
||||||
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_original' % pn)
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_original' % pn)
|
||||||
|
# 'patched' and 'configured' invoke do_unpack_and_patch because
|
||||||
|
# do_ar_patched resp. do_ar_configured depend on it, but for 'original'
|
||||||
|
# we have to add it explicitly.
|
||||||
|
if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1':
|
||||||
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_unpack_and_patch' % pn)
|
||||||
elif ar_src == "patched":
|
elif ar_src == "patched":
|
||||||
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn)
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn)
|
||||||
elif ar_src == "configured":
|
elif ar_src == "configured":
|
||||||
|
@ -285,11 +290,16 @@ def create_diff_gz(d, src_orig, src, ar_outdir):
|
||||||
|
|
||||||
dirname = os.path.dirname(src)
|
dirname = os.path.dirname(src)
|
||||||
basename = os.path.basename(src)
|
basename = os.path.basename(src)
|
||||||
os.chdir(dirname)
|
bb.utils.mkdirhier(ar_outdir)
|
||||||
out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF'))
|
cwd = os.getcwd()
|
||||||
diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, basename, out_file)
|
try:
|
||||||
subprocess.call(diff_cmd, shell=True)
|
os.chdir(dirname)
|
||||||
bb.utils.remove(src_patched, recurse=True)
|
out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF'))
|
||||||
|
diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, basename, out_file)
|
||||||
|
subprocess.check_call(diff_cmd, shell=True)
|
||||||
|
bb.utils.remove(src_patched, recurse=True)
|
||||||
|
finally:
|
||||||
|
os.chdir(cwd)
|
||||||
|
|
||||||
# Run do_unpack and do_patch
|
# Run do_unpack and do_patch
|
||||||
python do_unpack_and_patch() {
|
python do_unpack_and_patch() {
|
||||||
|
|
Loading…
Reference in New Issue