summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-05-05 12:25:24 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-07 17:07:57 +0000
commit1e59fd509f54a41dbe042a61cae14ded7b3ebf4b (patch)
treefc2f5f71e175a1ea29085e7efef654d641356ef8
parent968810913aa9bcc22c218a0b3ac1342347972a37 (diff)
downloadpoky-1e59fd509f54a41dbe042a61cae14ded7b3ebf4b.tar.gz
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>
-rw-r--r--meta/classes/archiver.bbclass20
1 files changed, 15 insertions, 5 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index fb0c77d954..0938c992de 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -79,6 +79,11 @@ python () {
79 79
80 if ar_src == "original": 80 if ar_src == "original":
81 d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_original' % pn) 81 d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_original' % pn)
82 # 'patched' and 'configured' invoke do_unpack_and_patch because
83 # do_ar_patched resp. do_ar_configured depend on it, but for 'original'
84 # we have to add it explicitly.
85 if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1':
86 d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_unpack_and_patch' % pn)
82 elif ar_src == "patched": 87 elif ar_src == "patched":
83 d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn) 88 d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn)
84 elif ar_src == "configured": 89 elif ar_src == "configured":
@@ -285,11 +290,16 @@ def create_diff_gz(d, src_orig, src, ar_outdir):
285 290
286 dirname = os.path.dirname(src) 291 dirname = os.path.dirname(src)
287 basename = os.path.basename(src) 292 basename = os.path.basename(src)
288 os.chdir(dirname) 293 bb.utils.mkdirhier(ar_outdir)
289 out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF')) 294 cwd = os.getcwd()
290 diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, basename, out_file) 295 try:
291 subprocess.call(diff_cmd, shell=True) 296 os.chdir(dirname)
292 bb.utils.remove(src_patched, recurse=True) 297 out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF'))
298 diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, basename, out_file)
299 subprocess.check_call(diff_cmd, shell=True)
300 bb.utils.remove(src_patched, recurse=True)
301 finally:
302 os.chdir(cwd)
293 303
294# Run do_unpack and do_patch 304# Run do_unpack and do_patch
295python do_unpack_and_patch() { 305python do_unpack_and_patch() {