diff options
author | Julien Stephan <jstephan@baylibre.com> | 2024-01-23 15:06:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-24 15:46:19 +0000 |
commit | facab170b60e521d69262e62f7d60ceb064ff3a2 (patch) | |
tree | 36f79aa7764b854864a780b3592c459d6c7812e1 /scripts | |
parent | 8934057ce8042a588eabbf8f621c12005ae02216 (diff) | |
download | poky-facab170b60e521d69262e62f7d60ceb064ff3a2.tar.gz |
devtool: modify: add support for multiple source in SRC_URI
[YOCTO #15162]
when doing devtool modify, sources are extracted into a devtool
temporary workdir. The main source is moved inside
build/workspace/sources/${BPN}/ and local files are moved inside
build/workspace/sources/${BPN}/oe-local-files. Secondary sources are
currently not handled and are lost.
Here is the output of devtool modify/build on bzip2 recipe:
NOTE: bzip2: compiling from external source tree <...>/build/workspace/sources/bzip2
ERROR: bzip2-1.0.8-r0 do_install_ptest_base: ExecutionError('<...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/temp/run.do_install_ptest_base.3368', 1, None, None)
ERROR: Logfile of failure stored in: <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/temp/log.do_install_ptest_base.3368
Log data follows:
| DEBUG: Executing shell function do_install_ptest_base
| NOTE: make -j 16 DESTDIR=<...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest install-ptest
| sed -n '/^runtest:/,/^install-ptest:/{/^install-ptest:/!p}' \
| ../../../../../../workspace/sources/bzip2/Makefile.am > <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/Makefile
| cp ../../../../../../workspace/sources/bzip2/sample1.ref <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/
| cp ../../../../../../workspace/sources/bzip2/sample2.ref <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/
| cp ../../../../../../workspace/sources/bzip2/sample3.ref <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/
| cp ../../../../../../workspace/sources/bzip2/sample1.bz2 <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/
| cp ../../../../../../workspace/sources/bzip2/sample2.bz2 <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/
| cp ../../../../../../workspace/sources/bzip2/sample3.bz2 <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/
| ln -s /usr/bin/bzip2 <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/bzip2
| cp: cannot stat '<...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/git/commons-compress': No such file or directory
| WARNING: <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/temp/run.do_install_ptest_base.3368:189 exit 1 from 'cp -r <...>/build/tmp/work/core2-64-poky-linux/bzip2/
1.0.8/git/commons-compress <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/image/usr/lib/bzip2/ptest/bzip2-tests/commons-compress'
| WARNING: Backtrace (BB generated script):
| #1: do_install_ptest, <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/temp/run.do_install_ptest_base.3368, line 189
| #2: do_install_ptest_base, <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/temp/run.do_install_ptest_base.3368, line 158
| #3: main, <...>/build/tmp/work/core2-64-poky-linux/bzip2/1.0.8/temp/run.do_install_ptest_base.3368, line 226
ERROR: Task (<...>/poky/meta/recipes-extended/bzip2/bzip2_1.0.8.bb:do_install_ptest_base) failed with exit code '1'
NOTE: Tasks Summary: Attempted 776 tasks of which 765 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
<...>/poky/meta/recipes-extended/bzip2/bzip2_1.0.8.bb:do_install_ptest_base
externalsrc class modify SRC_URI to keep only:
* 'file', 'npmsw' and 'crate' sources
* url with type parameter matching 'kmeta' or 'git-dependency'
So by forcing to add type='git-dependency' on secondary sources, we
ensure that when building the recipe, the secondary sources can be
unpacked into WORKDIR.
This allows recipes containing several sources to be built under a
devtool context, but it has some limitations:
* user would not be able to generate patches for the secondary sources
* type="git-dependency" is added for secondary sources even on non git
sources, so we may want to rename this parameter
(From OE-Core rev: cfd5ee890163a3d975093359016dda104e7b71df)
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/standard.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 13612d64c4..8fb4b934d4 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -956,6 +956,26 @@ def modify(args, config, basepath, workspace): | |||
956 | 956 | ||
957 | bb.utils.mkdirhier(os.path.dirname(appendfile)) | 957 | bb.utils.mkdirhier(os.path.dirname(appendfile)) |
958 | with open(appendfile, 'w') as f: | 958 | with open(appendfile, 'w') as f: |
959 | # if not present, add type=git-dependency to the secondary sources | ||
960 | # (non local files) so they can be extracted correctly when building a recipe after | ||
961 | # doing a devtool modify on it | ||
962 | src_uri = rd.getVar('SRC_URI').split() | ||
963 | src_uri_append = [] | ||
964 | src_uri_remove = [] | ||
965 | |||
966 | # Assume first entry is main source extracted in ${S} so skip it | ||
967 | src_uri = src_uri[1::] | ||
968 | |||
969 | #Add "type=git-dependency" to all non local sources | ||
970 | for url in src_uri: | ||
971 | if not url.startswith('file://') and not 'type=' in url: | ||
972 | src_uri_remove.append(url) | ||
973 | src_uri_append.append('%s;type=git-dependency' % url) | ||
974 | |||
975 | if src_uri_remove: | ||
976 | f.write('SRC_URI:remove = "%s"\n' % ' '.join(src_uri_remove)) | ||
977 | f.write('SRC_URI:append = "%s"\n\n' % ' '.join(src_uri_append)) | ||
978 | |||
959 | f.write('FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"\n') | 979 | f.write('FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"\n') |
960 | # Local files can be modified/tracked in separate subdir under srctree | 980 | # Local files can be modified/tracked in separate subdir under srctree |
961 | # Mostly useful for packages with S != WORKDIR | 981 | # Mostly useful for packages with S != WORKDIR |