summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
AgeCommit message (Collapse)Author
2024-01-24externalsrc: fix task dependency for do_populate_licJulien Stephan
do_populate_lic dependencies are defined inside license.bbclass such as: addtask populate_lic after do_patch before do_build but externalsrc deletes the do_patch task, so the only dependency left for do_populate_lic is "before do_build" On a devtool context, when doing devtool modify, sources are extracted inside build/workspace/sources/${BPN}/ and local files inside build/workspace/sources/${BPN}/oe-local-files When building the recipe after a devtool modify, do_unpack is called again to unpack (possibly modified) local files from build/workspace/sources/${BPN}/oe-local-files into ${WORKDIR}. Since the only left dependency for do_populate_lic is do_build, the do_populate_lic can be called BEFORE do_unpack. Most of the time this is not a problem, because license files are generally located inside ${S}, which corresponds to build/workspace/sources/${BPN} (and is already unpacked), but this can lead to an issue if recipe sets LIC_FILES_CHKSUM to look for files in ${WORKDIR} (example from init-ifupdown_1.0.bb): LIC_FILES_CHKSUM = "file://${WORKDIR}/copyright;md5=3dd6192d306f582dee7687da3d8748ab" So devtool modify init-ifupdown && bitbake init-ifupdown gives the following error: WARNING: init-ifupdown-1.0-r0 do_populate_lic: Could not copy license file <...>/build/tmp/work/qemux86_64-poky-linux/init-ifupdown/1.0/copyright to <...>/build/tmp/work/qemux86_64-poky-linux/init-ifupdown/1.0/license-destdir/qemux86_64/init-ifupdown/copyright: [Errno 2] No such file or directory: '<...>/build/tmp/work/qemux86_64-poky-linux/init-ifupdown/1.0/copyright' ERROR: init-ifupdown-1.0-r0 do_populate_lic: QA Issue: init-ifupdown: LIC_FILES_CHKSUM points to an invalid file: <...>/build/tmp/work/qemux86_64-poky-linux/init-ifupdown/1.0/copyright [license-checksum] ERROR: init-ifupdown-1.0-r0 do_populate_lic: Fatal QA errors were found, failing task. ERROR: Logfile of failure stored in: <...>/build/tmp/work/qemux86_64-poky-linux/init-ifupdown/1.0/temp/log.do_populate_lic.838584 ERROR: Task (<...>/poky/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb:do_populate_lic) failed with exit code '1' Fix this by forcing the do_populate_lic task to run after do_unpack Signed-off-by: Julien Stephan <jstephan@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-06externalsrc.bbclass: Support specifying patterns in CONFIGURE_FILESPeter Kjellerstedt
This allows, e.g., *.cmake to be added to CONFIGURE_FILES to make the do_configure task depend on changes to any cmake file. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-24recipes/classes/scripts: Drop SRCPV usage in OE-CoreRichard Purdie
Now that SRCPV isn't needed we can simplify things in a few places... Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-24base/package: Move source revision information from PV to PKGVRichard Purdie
Source control information being present in PV used to be a hard requirement for bitbake to operate correctly. Now that hashes are a required part of task stamps, this requirement no longer exists. This means we can defer the hash pieces to PKGV and simplify PV. Use new bitbake fetcher API to inject the source revisions directly into the hash allowing removal of some horrible code from base.bbclass and avoiding any hardcoding about how SRCREV may or may not be used. Use that API to object the string to append to PKGV and append that directly. The user visible effect of this change is that PV will no longer have revision information in it and this will now be appended to PV through PKGV when the packages are written. Since PV is used in STAMP and WORKDIR, users will see small directory naming and stamp naming changes. This will mean that sstate reuse through hash equivalence where the source revision changes but the output does not will become possible as the sstate naming will become less specific and no longer contain the revision. The SRCPV variable will no longer be needed in PV and is effectively now just a null operation. Usage can be removed over time. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-11externalsrc: fix dependency chain issuesPeter Suti
Instead of deleting setscene tasks, now SSTATE_SKIP_CREATION is set instead. This seems to fix the compile issues where the populate_sysroot task was not run when an externalsrc recipe was built as a dependency. [YOCTO #15164] [RP addition: The deltask was added by me in 2012 when the class was created. The trouble is bitbake assumes 'sstate' tasks have a setscene task and by deleting the setscene task, bitbake stops thinking the task can be accelerated. There is other code in the sysroot code which assumes some tasks are always sstate tasks. We cannot delete the task without changes to the way bitbake learns about 'setscene' tasks so the patch is correct, avoiding creating files is the better approach given the way the world works now. There would be concerns about exisitng sstate reuse however this shouldn't occur since SRC_URI changes and that will change the underlying hashes. Hash equivalency could potentially cause issues by joining hashes together again however if the output matches, that shouldn't in theory cause any issue.] Signed-off-by: Peter Suti <peter.suti@streamunlimited.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-04-01devtool: add support for multiple git url inside a cargo based recipeFrederic Martinsons
Without that, the possible git urls that are in SRC_URI of a recipe are removed from SRC_URI during devtool process and so the cargo_common_do_patch_paths in cargo_common.bbclass cannot patch these packages to fetch them locally. I use a generic type name because I foresee this change will be useful for recipe that used a package manager (cargo but also npm) see https://bugzilla.yoctoproject.org/show_bug.cgi?id=11015 Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-18devtool: fix devtool finish when gitmodules file is emptyThomas Roos
When a .gitmodules file exists but is empty then devtool finish fails. Add an additional check for this. [YOCTO #14999] Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-12-08externalsrc: fix lookup for .gitmodulesPeter Marko
Commit 0533edac277080e1bd130c14df0cbac61ba01a0c broke bitbake parsing when bitbake is executed from directory with existing .gitmodules and the recipe in externalsrc does not have .gitmodules The check needs to search for .gitmodules in sources path, not cwd. iParsing recipes...ERROR: ExpansionError during parsing <path to recipe> ... bb.data_smart.ExpansionError: Failure expanding variable do_compile[file-checksums], expression was ${@srctree_hash_files(d)} which triggered exception CalledProcessError: Command '['git', 'config', '--file', '.gitmodules', '--get-regexp', 'path']' returned non-zero exit status 1. Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-10-26externalsrc.bbclass: Remove a trailing slash from ${B}Peter Kjellerstedt
The trailing slash in ${B} caused -fdebug-prefix-map=${B}=... to not match as intended, resulting in ${TMPDIR} ending up in files in ${PN}-dbg when externalsrc was in use, which in turn triggered buildpath QA warnings. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-10-26externalsrc.bbclass: fix git repo detectionMartin Jansa
* fix issue introduced in: https://git.openembedded.org/openembedded-core/commit/?id=95fbac8dcad6c93f4c9737e9fe13e92ab6befa09 * it added check for s_dir + git-dir (typically '.git') isn't the same as ${TOPDIR} + git-dir, but due to copy-paste issue it was just comparing it with s_dir + git-dir again, resulting in most external repos (where git-dir is '.git') to be processed as regular directory (not taking advantage of git write-tree). * normally this wouldn't be an issue, but for big repo with a lot of files this added a lot of checksums in: d.setVarFlag('do_compile', 'file-checksums', '${@srctree_hash_files(d)}') and I mean *a lot, e.g. in chromium build it was 380227 paths which still wouldn't that bad, but the checksum processing in siggen.py isn't trivial and just looping through all these checksums takes very long time (over 1000sec on fast NVME drive with warm cache) and then https://git.openembedded.org/bitbake/commit/?id=b4975d2ecf615ac4c240808fbc5a3f879a93846b made the processing a bit more complicated and the loop in get_taskhash() function took 6448sec and to make things worse there was no output from bitbake during that time, so even with -DDD it looks like this: DEBUG: virtual/libgles2 resolved to: mesa (langdale/oe-core/meta/recipes-graphics/mesa/mesa_22.2.0.bb) Bitbake still alive (no events for 600s). Active tasks: Bitbake still alive (no events for 1200s). Active tasks: Bitbake still alive (no events for 1800s). Active tasks: Bitbake still alive (no events for 2400s). Active tasks: Bitbake still alive (no events for 3000s). Active tasks: Bitbake still alive (no events for 3600s). Active tasks: Bitbake still alive (no events for 4200s). Active tasks: Bitbake still alive (no events for 4800s). Active tasks: Bitbake still alive (no events for 5400s). Active tasks: Bitbake still alive (no events for 6000s). Active tasks: DEBUG: Starting bitbake-worker without -DDD it will get stuck for almost 2 hours in: "Initialising tasks..." before it finally writes sstate summary like: "Sstate summary: Wanted 3102 Local 0 Mirrors 0 Missed 3102 Current 1483 (0% match, 32% complete)" * fix the copy&paste typo to use git work-tree in most cases, but be aware that this issue still exists for huge local source trees not in git [YOCTO #14942] Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-10-25externalsrc: move back to classesRoss Burton
The externalsrc class was moved to classes-recipe as part of oe-core f5c1280, but it can be used in both recipe and global contexts so move it back to classes/. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Update classes to match new bitbake class scope functionalityRichard Purdie
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12classes: Add SPDX license identifiersRichard Purdie
As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-20externalsrc.bbclass: support crate fetcher on externalsrcChanho Park
To support crate:// fetcher on externalsrc, we need to make pass-through the URIs in SRC_URI. Signed-off-by: Chanho Park <chanho61.park@samsung.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-14externalsrc/devtool: Fix to work with fixed export funcition flags handlingRichard Purdie
If we fix bitbake to correctly handle the cleandirs and fakeroot flags for tasks handled by EXPORT_FUNCTIONS, we break devtool since it only considers these for top level functions. Add in extra code to intercept the cleandirs flags for commonly used sub functions too. [YOCTO #8621] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-16reproducible: Merge code into base.bbclassRichard Purdie
Reproducibility is here to stay and needs to be part of our default workflow. Move the remaining code to base.bbclass so it is always a first class citizen and it is clear people need to be mindful of it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-04externalsrc: Fix a source date epoch race in reproducible buildsRichard Purdie
When reproducible builds are enabled and externalsrc is in use, the source date epoch function is added. The conditions on the conditional code removing the unpack task need to match the deltask function, else the source date epoch function can end up running twice and the functions can race with each other causing build failures or corruption. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-11externalsrc: Work with reproducible_buildMark Hatle
Externalsrc removes do_fetch, do_unpack, and do_patch. The system normally discovers the correct reproducible date as a postfuncs of do_unpack, so this date is never found, so it falls back to the default epoch. Instead we can move the discovery function to a prefuncs on the epoch deploy task. This task will run before do_configure, and since the source is already available can run safely at anytime. Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-07-30Convert to new override syntaxRichard Purdie
This is the result of automated script conversion: scripts/contrib/convert-overrides.py <oe-core directory> converting the metadata to use ":" as the override character instead of "_". Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-04-18externalsrc: Detect code changes in submodulesDouglas Royds
Further to 50ff9afb39, only detect code changes in submodules that are subdirectories of the EXTERNALSRC directory. The (undocumented) git submodule--helper returns a path for each submodule relative to the top of the repo. Don't add submodules that are not within our source subtree. [YOCTO #14333] Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-04-18Revert "externalsrc: Detect code changes in submodules"Douglas Royds
This reverts commit 4525310d49d115a37705f04ac5c03d639e5e8f8c. Further to 50ff9afb39, only detect code changes in submodules that are subdirectories of the EXTERNALSRC directory. The (undocumented) git submodule--helper returns a path for each submodule relative to the top of the repo. Don't add submodules that are not within our EXTERNALSRC subtree. If we unpack one git repo inside another, like this: SRC_URI = "git://${GIT_SERVER}/repo1;name=repo1;destsuffix=repo1 \ git://${GIT_SERVER}/repo2;name=repo2;destsuffix=repo1/repo2 \ " Git status reports, for repo1: Untracked files: (use "git add <file>..." to include in what will be committed) repo2/ If we run `devtool modify` on this recipe, do_patch runs with: PATCHTOOL = "git" PATCH_COMMIT_FUNCTIONS = "1" The `patch_task_postfunc` (patch.bbclass, line 82) runs a `git add .` on the top-level repo1, leaving the checkout in an invalid state. The following git warning does not appear in the log: $ git add . warning: adding embedded git repository: repo2 hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. hint: If you meant to add a submodule, use: hint: hint: git submodule add <url> repo2 hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached repo2 hint: hint: See "git help submodule" for more information. $ git submodule status fatal: no submodule mapping found in .gitmodules for path 'repo2' No further git submodule commands can be run on the checkout. We could enhance the `patch_task_postfunc` to look for any embedded git checkouts and add them as submodules, but this seems unnecessary complexity for an obscure edge-case. Although the git repo is left in an invalid state with respect to the submodules, it still serves the purpose required by devtool: To take further commits, and generate patch files from them. We are still able to run these commands to examine any submodules, where git submodule--helper reports paths relative to the top of the checkout: $ git ls-files --stage | grep ^160000 160000 5feee12d6e974dd8c0614cf5b593380b046439a5 0 repo2 $ git submodule--helper list 160000 5feee12d6e974dd8c0614cf5b593380b046439a5 0 repo2 When a recipe sets EXTERNALSRC to a subdirectory of the git checkout, we test for the existence of the reported submodule paths within the EXTERNALSRC directory. The latest versions of git submodule--helper accept a path to a subdirectory and correctly report no submodules within that subdirectory. Regrettably, we still support git versions that don't accept a path to a subdirectory. [YOCTO #14333] Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-20externalsrc: Detect code changes in submodulesDouglas Royds
Further to 50ff9afb39, only detect code changes in submodules that are subdirectories of the EXTERNALSRC directory. git submodule status returns a path relative to the cwd for each submodule. We don't add submodules that are not within our source subtree. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-02-26externalsrc: Pass through npmsw URIs in SRC_URIMike Crowe
NPM shrinkwrap files need to stay in SRC_URI even when using externalsrc so that npm_do_fetch can run to fetch the required dependencies. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-28externalsrc: Detect code changes in submodulesTomasz Dziendzielski
The srctree_hash was calculated only from main source directory ignoring changes in submodules. [YOCTO #13748] Use submodule--helper to determine all submodules, and calculate hash from all git tree objects names combined. Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-01-23externalsrc: Fix parsing error with devtool non-git sourcesTomasz Dziendzielski
If srcdir is under poky directory (e.g. devtool poky/build/workspace/sources) and is not a git repository then ${@srctree_hash_files(d)} will run "git rev-parse --git-dir" and detect poky directory as git-dir and run "'git', 'add', '-A', '.'], cwd=s_dir" trying to add srcdir but build dir is in .gitignore and latest git will fail with "The following paths are ignored by one of your .gitignore files: build" which will end with "ExpansionError during parsing". In this commit I added a check if git_dir is the same as git-dir from TOPDIR (which will detect poky directory) and if yes, then treat srcdir as non-git sources. Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-17externalsrc: No single-task lock if S != BDouglas Royds
Allow different recipes to build things from the one external source tree in parallel, but only if the build is happening outside the source tree. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-12-28externalsrc: always set SRCPVAlexander Kanavin
If devupstream is in use by the recipe, then that variant has SRCPV, but the main variant may not, in which case bitbake throws an expansion error. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2019-09-19externalsrc: stop rebuilds of 2+ externalsrc recipes sharing the same git repoQuentin Schulz
externalsrc do_configure task watches oe-devtool-tree-sha1 file and its checksum. That file basically contains the result of `git add -A ${EXTERNALSRC} && git write-tree` which is the hash of temporary "commit" of the non committed changes. This file is stored in the .git directory of the git repo of the externalsrc recipe. do_configure then depends on the checksum of oe-devtool-tree-sha1 file. If 2+ recipes with different externalsrc paths but same git repo (e.g. one recipe at /some/path and the other at /some/path/subdir) are parsed, this oe-devtool-tree-sha1 will be overwritten by those recipes at parsing time since .git is shared between those recipes. If there is one non committed git change in /some/path but not in /some/path/subdir, the oe-devtool-tree-sha1 of both recipes will be different. What will happen is that recipe1 will watch over the oe-devtool-tree-sha1 with a specific checksum, fill in file-checksums for do_configure correctly, then recipe2 will watch over the identically named file with different content also fill in the file-checksums varflag. When do_configure of recipe1 will be evaluated for re-execution, oe-devtool-tree-sha1 will be of the value of what is watched over by recipe2, thus triggering a rebuild of recipe1. This behavior is not always reproducible which I'm guessing is due to a small window between recipe1 putting info into oe-devtool-tree-sha1 and calculating the checksum of that file and recipe2 putting its content into oe-devtool-tree-sha1. By appending the name of the recipe to oe-devtool-tree-sha1, we make sure that a recipe won't have its oe-devtool-tree-sha1 overwritten by another recipe sharing the same externalsrc git repo. Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-08externalsrc.bbclass: Set BB_DONT_CACHE for non-target recipesOla x Nilsson
BB_DONT_CACHE was not set for non-virtual recipes where PN != BPN, such as quilt-native. Recipes that do not set BBCLASSEXTEND should always have BB_DONT_CACHE set by externalsrc. Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-29externalsrc.bbclass: don't configure with --disable-dependency-trackingAndre McCurdy
One of the uses of externalsrc is to enable iterative editing and rebuilding of source files during development. In such situations, disabling Automake dependency tracking can lead to sources not being rebuilt even though files they depend on have been modified. Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-04-05classes/externalsrc: ensure cleandirs code handles non-absolute pathsPaul Eggleton
It's possible that a trailing or extra slash somewhere in the external source path could result in the directory not being removed from cleandirs; it's also possible that a cleandirs entry is somewhere underneath the source tree and that tree should never have parts of it deleted by the build system. Use oe.path.is_path_parent() (which makes paths absolute before checking them) to find out if any path in cleandirs is anywhere underneath the external source path, and drop it if it is. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-05classes/externalsrc: handle if cleandirs contains python expressionsPaul Eggleton
Use the existing oe.recipeutils.split_var_value() function to split the unexpanded value of the cleandirs varflag, in case it contains python expressions - we don't want to split the expression itself as the chunks will not expand properly individually and we can miss something that expands to the source tree (and thus it can get deleted, the avoidance of which is the whole point of this code). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-25externalsrc: do not call make clean for recipes with CLEANBROKEN = "1" setAndreas Müller
ERROR: distrho-ports-0.0.0+git999-r0 do_buildclean: oe_runmake failed ERROR: distrho-ports-0.0.0+git999-r0 do_buildclean: Function failed: do_buildclean ERROR: Logfile of failure stored in: <...>/temp/log.do_buildclean.17285 Log data follows: | DEBUG: Executing shell function do_buildclean | NOTE: make clean | make clean -C libs/drowaudio | make[1]: Entering directory '/home/a.mueller/data/oe-core/workspace/sources/distrho-ports/libs/drowaudio' | make clean -C build-drowaudio | make[2]: Entering directory '/home/a.mueller/data/oe-core/workspace/sources/distrho-ports/libs/drowaudio/build-drowaudio' | make[2]: *** No rule to make target 'clean'. Stop. | make[2]: Leaving directory '/home/a.mueller/data/oe-core/workspace/sources/distrho-ports/libs/drowaudio/build-drowaudio' | make[1]: *** [Makefile:7: clean] Error 2 | make[1]: Leaving directory '/home/a.mueller/data/oe-core/workspace/sources/distrho-ports/libs/drowaudio' | make: *** [Makefile:73: clean] Error 2 | ERROR: oe_runmake failed Signed-off-by: Andreas Müller <schnitzeltony@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-02-16externalsrc.bbclass: Suppress git errorsJoshua Watt
Suppress any warnings git might generate when searching for a valid git directory, as there are use cases where the directory is expected to not exist and the warning is superfluous Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-08externalsrc: fix ExpansionError if the source dir does not exist yetLuca Ceresoli
The externalsrc class code assumes that the source directory (EXTERNALSRC) exists before bitbake is called. Otherwise do_configure will fail obviously since externalsrc does not fetch anything. Commit 3ca6085729d9 ("externalsrc: Handle .git not being a directory") changed this behaviour. Now on a missing EXTERNALSRC directory we get a bb.data_smart.ExpansionError during _parsing_, way before do_configure can be run. This new behaviour creates two problems: * First, there error message is very cryptic (and it's hard to provide a better message since no task is ever run): ERROR: ExpansionError during parsing /<...>/<...>.bb Traceback (most recent call last): bb.data_smart.ExpansionError: Failure expanding variable do_compile[file-checksums], expression was ${@srctree_hash_files(d)} which triggered exception FileNotFoundError: [Errno 2] No such file or directory: '<...>' * Second, this prevents creating a class based on externalsrc that automatically fetches the code in EXTERNALSRC before do_compile runs. Fix both problems by simply calling git with '-C ${EXTERNALSRC}' instead of calling git inside the non-existing directory. This changes from a bb.data_smart.ExpansionError to a subprocess.CalledProcessError, which is in line with what's actually going on: git is telling us it can't find the git dir. Also remove a comment that does not apply anymore. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Cc: Joshua Watt <jpewhacker@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-09-21classes/externalsrc: delete symlinks at start of do_buildcleanPaul Eggleton
To help users find the work and log directories (especially within the eSDK) we create symlinks to these from the source tree. However during do_buildclean we call "make clean", and some project Makefiles which delete something like "*/*/lib" which will match files underneath the oe-workdir symlink and fail. do_buildclean is called from do_clean which is in turn called by devtool reset by default, and thus devtool reset is blocked. An example of a recipe where this is visible is the openssl-qat recipe in meta-intel. In order to fix this, delete the symlinks at the start of do_buildclean since we shouldn't need them at that point anyway, and thus make clean won't be able to trip over them. Fixes [YOCTO #11036]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-08-16externalsrc: Handle .git not being a directoryJoshua Watt
Use git rev-parse to determine the location of the .git directory, in case it is not an immediate child of EXTERNALSRC (e.g. when using submodules). In the event git can't resolve the .git directory, fall back to the non-git method for hashing. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-25externalsrc: place copy of git index into /tmp and do not use copyfile2Enrico Scholz
Using shutil.copy2() to copy .git/index to a temporary file tries to copy SELinux attributes which might fail for confined users in SELinux environments. E.g. our builders are running in docker containers and modification of sources (inclusive updated of .git/index) is done outside. Trying to copy .git/index fails with | $ python3 -c 'import shutil; shutil.copy2("index", "a")' | ... | PermissionError: [Errno 13] Permission denied: 'a' and an AVC like | denied { relabelto } for pid=18043 comm="python3" name="a" dev="dm-29" ino=1067553 scontext=system_u:system_r:container_t:s0:c39,c558 tcontext=unconfined_u:object_r:build_file_t:s0 tclass=file permissive=0 is created. This can not be solved by adapting the SELinux policy because this is a very deep constraint violation: | constrain file { create relabelfrom relabelto } ((u1 == u2 -Fail-) or (t1 == can_change_object_identity -Fail-) ); Constraint DENIED | | Possible cause is the source user (system_u) and target user (unconfined_u) are different. I do not see much sense in using 'shutil.copy2()' here; 'shutil.copyfile()' seems to be a better choice (target file is created in a secure way by tempfile.NamedTemporaryFile()). By placing the tempfile into /tmp we avoid potential problems related to git's 'core.sharedRepository'. As a (positive) side effect, the source tree will not be modified anymore (at least by this part of code) which prevented to mount it read-only from somewhere else. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-14externalsrc: verify that EXTERNALSRC/EXTERNALSRC_BUILD are absolute pathsRoss Burton
If these are set to URLs then the errors produced are not helpful. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-21externalsrc: Use git add -A for compatibility with all git versionsRichard Purdie
I've been debugging a selftest failure on Centos7. The problem turns out to be the elderly git version (1.8.3.1) on those systems. It means that the system doesn't correctly checksum changed files in the source tree, which in turn means do_compile fails to run and this leads to the following selftest failure: ====================================================================== FAIL [141.373s]: test_devtool_buildclean (oeqa.selftest.devtool.DevtoolTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/devtool.py", line 530, in test_devtool_buildclean assertFile(tempdir_mdadm, 'mdadm') File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/devtool.py", line 497, in assertFile self.assertTrue(os.path.exists(f), "%r does not exist" % f) AssertionError: False is not true : '/tmp/devtoolqag88s39z8/mdadm' does not exist The solution is to use -A on the git add commandline which matches the behaviour in git 2.0+ versions and resolves the problem. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31externalsrc: Hide created symlinks with .git/info/excludeOla x Nilsson
Add created symlinks to the exclude file. This will both make them less distracting and hide them from the srctree_hash_files function. Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-16externalsrc.bbclass: Add task buildcleanOla x Nilsson
The buildclean task should call the package build system clean command, just implemented for Make for now. This is meant for recipes where S == B, but can be useful as a standalone task for other recipes too. When S == B, set it to run before do_clean which will do what most developers expect when calling bitbake -c clean. For S != B, do not add it before clean as it is not needed and may take some time. Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-09externalsrc: Add optional srcdir arg to srctree_hash_filesOla x Nilsson
Make it easier to reuse the function for other dirs than EXTERNALSRC. Signed-off-by: Ola x Nilsson <ola.x.nilsson@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-01-09externalsrc: Set STAMPCLEAN to match STAMPOla x Nilsson
Only the last stamp file should be kept, but unless STAMPCLEAN matches files generated using STAMP old stamp files may linger. This may cause false positives for skipping tasks. Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-16meta: remove True option to getVarFlag callsJoshua Lock
getVarFlag() now defaults to expanding by default, thus remove the True option from getVarFlag() calls with a regex search and replace. Search made with the following regex: getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-12-16meta: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2016-10-11classes/externalsrc: re-run do_configure when configure files changePaul Eggleton
If the user modifies files such as CMakeLists.txt in the case of cmake, we want do_configure to re-run so that those changes can take effect. In order to accomplish that, have a variable CONFIGURE_FILES which specifies a list of files that will be put into do_configure's checksum (either full paths, or just filenames which will be searched for in the entire source tree). CONFIGURE_FILES then just needs to be set appropriately depending on what do_configure is doing; for now I've set this for autotools and cmake which are the most common cases. Fixes [YOCTO #7617]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-20externalsrc.bbclass: Make reparsing work for BBCLASSEXTENDed recipesPeter Kjellerstedt
To make sure changes to any source files are detected when externalsrc is used, it sets BB_DONT_CACHE to force the recipe to be reparsed every time. Previously, this was done conditionally based on whether EXTERNALSRC was set. This worked fine for building the base recipe. But if one tried to build, e.g., a native version of it (provided via BBCLASSEXTEND), the recipe would not be reparsed as expected. To solve the above problem, BB_DONT_CACHE is now set for the base recipe if EXTERNALSRC is set for it or any of it derivatives. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02classes/lib: Update to use python3 command pipeline decodingRichard Purdie
In python3, strings are unicode by default. We need to encode/decode from command pipelines and other places where we interface with the real world using the correct locales. This patch updates various call sites to use the correct encoding/decodings. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-05externalsrc: avoid race in temporary git index fileMarkus Lehtonen
Use a unique tempfile as the temporary git index file when determining the git hash of the source tree. A fixed filename was obviously causing races (with the git index.lock file) under oe-selftest where multiple bitbake instances were run against the same source tree at the same time. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>