diff options
Diffstat (limited to 'meta/classes/archiver.bbclass')
-rw-r--r-- | meta/classes/archiver.bbclass | 71 |
1 files changed, 58 insertions, 13 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 2c04557f79..18c5b96689 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -67,6 +67,12 @@ python () { else: bb.debug(1, 'archiver: %s is included: %s' % (pn, reason)) + + # glibc-locale: do_fetch, do_unpack and do_patch tasks have been deleted, + # so avoid archiving source here. + if pn.startswith('glibc-locale'): + return + # We just archive gcc-source for all the gcc related recipes if d.getVar('BPN') in ['gcc', 'libgcc'] \ and not pn.startswith('gcc-source'): @@ -79,6 +85,11 @@ python () { if ar_src == "original": 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": d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn) elif ar_src == "configured": @@ -166,12 +177,18 @@ python do_ar_original() { # to be set when using the git fetcher, otherwise SRCREV cannot # be set separately for each URL. params = bb.fetch2.decodeurl(url)[5] + type = bb.fetch2.decodeurl(url)[0] + location = bb.fetch2.decodeurl(url)[2] name = params.get('name', '') - if name in tarball_suffix: - if not name: - bb.fatal("Cannot determine archive names for original source because 'name' URL parameter is unset in more than one URL. Add it to at least one of these: %s %s" % (tarball_suffix[name], url)) - else: - bb.fatal("Cannot determine archive names for original source because 'name=' URL parameter '%s' is used twice. Make it unique in: %s %s" % (tarball_suffix[name], url)) + if type.lower() == 'file': + name_tmp = location.rstrip("*").rstrip("/") + name = os.path.basename(name_tmp) + else: + if name in tarball_suffix: + if not name: + bb.fatal("Cannot determine archive names for original source because 'name' URL parameter is unset in more than one URL. Add it to at least one of these: %s %s" % (tarball_suffix[name], url)) + else: + bb.fatal("Cannot determine archive names for original source because 'name=' URL parameter '%s' is used twice. Make it unique in: %s %s" % (tarball_suffix[name], url)) tarball_suffix[name] = url create_tarball(d, tmpdir + '/.', name, ar_outdir) @@ -205,6 +222,10 @@ python do_ar_patched() { python do_ar_configured() { import shutil + # Forcibly expand the sysroot paths as we're about to change WORKDIR + d.setVar('RECIPE_SYSROOT', d.getVar('RECIPE_SYSROOT')) + d.setVar('RECIPE_SYSROOT_NATIVE', d.getVar('RECIPE_SYSROOT_NATIVE')) + ar_outdir = d.getVar('ARCHIVER_OUTDIR') if d.getVarFlag('ARCHIVER_MODE', 'src') == 'configured': bb.note('Archiving the configured source...') @@ -285,11 +306,16 @@ def create_diff_gz(d, src_orig, src, ar_outdir): dirname = os.path.dirname(src) basename = os.path.basename(src) - os.chdir(dirname) - 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.call(diff_cmd, shell=True) - bb.utils.remove(src_patched, recurse=True) + bb.utils.mkdirhier(ar_outdir) + cwd = os.getcwd() + try: + os.chdir(dirname) + 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 python do_unpack_and_patch() { @@ -299,12 +325,15 @@ python do_unpack_and_patch() { return ar_outdir = d.getVar('ARCHIVER_OUTDIR') ar_workdir = d.getVar('ARCHIVER_WORKDIR') + ar_sysroot_native = d.getVar('STAGING_DIR_NATIVE') pn = d.getVar('PN') # The kernel class functions require it to be on work-shared, so we dont change WORKDIR if not (bb.data.inherits_class('kernel-yocto', d) or pn.startswith('gcc-source')): # Change the WORKDIR to make do_unpack do_patch run in another dir. d.setVar('WORKDIR', ar_workdir) + # Restore the original path to recipe's native sysroot (it's relative to WORKDIR). + d.setVar('STAGING_DIR_NATIVE', ar_sysroot_native) # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the # possibly requiring of the following tasks (such as some recipes's @@ -330,6 +359,19 @@ python do_unpack_and_patch() { bb.utils.remove(src_orig, recurse=True) } +# BBINCLUDED is special (excluded from basehash signature +# calculation). Using it in a task signature can cause "basehash +# changed" errors. +# +# Depending on BBINCLUDED also causes do_ar_recipe to run again +# for unrelated changes, like adding or removing buildhistory.bbclass. +# +# For these reasons we ignore the dependency completely. The versioning +# of the output file ensures that we create it each time the recipe +# gets rebuilt, at least as long as a PR server is used. We also rely +# on that mechanism to catch changes in the file content, because the +# file content is not part of of the task signature either. +do_ar_recipe[vardepsexclude] += "BBINCLUDED" python do_ar_recipe () { """ archive the recipe, including .bb and .inc. @@ -349,8 +391,8 @@ python do_ar_recipe () { bbappend_files = d.getVar('BBINCLUDED').split() # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded. - bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn) - bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn) + bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" % re.escape(pn)) + bbappend_re1 = re.compile( r".*/%s\.bbappend$" % re.escape(pn)) for file in bbappend_files: if bbappend_re.match(file) or bbappend_re1.match(file): shutil.copy(file, outdir) @@ -419,7 +461,10 @@ do_deploy_all_archives() { } python () { - # Add tasks in the correct order, specifically for linux-yocto to avoid race condition + # Add tasks in the correct order, specifically for linux-yocto to avoid race condition. + # sstatesig.py:sstate_rundepfilter has special support that excludes this dependency + # so that do_kernel_configme does not need to run again when do_unpack_and_patch + # gets added or removed (by adding or removing archiver.bbclass). if bb.data.inherits_class('kernel-yocto', d): bb.build.addtask('do_kernel_configme', 'do_configure', 'do_unpack_and_patch', d) } |