base.bbclass: detect when S has been set incorrectly
cover base.bbclass: detect when S has been set incorrectly
From: Peter Mabacker <[email protected]>
This is my proposed solution for [YOCTO #5627].
I'm will gratefully recieve feedback regarding especially the removal of auto-create 'S' in base.bbclass and if 'S' not set to a proper value, should generate a warning or error.
I have chosen a warning (at least to start with). Since a lot of recipes have faulty $S (for example S=WORKDIR/$PN (default) instead of S=WORKDIR), you might assume that a lot of external layers have recipes with this problem as well and display an error and abort might be a bit to hard. At least until people have had the chance to clean this up.
So the suggestion is to start with a warning and consider changing this to error later on (in 1.9?).
The following changes since commit 876370419a50264a28feb4278f8c465b0019e709:
bitbake: toaster: implementation of project page (2015-01-08 22:34:38 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib petmab/bug5627
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=petmab/bug5627
Petter Mabäcker (5):
base.bbclass: detect when S has been set incorrectly
makedevs: set and handle S in a proper way
lsof: handle S in a proper way
xorg-minimal-fonts: set and handle S in a proper way
meta: set proper S value
meta/classes/base.bbclass | 17 +++++++++++++---- meta/recipes-bsp/alsa-state/alsa-state.bb | 2 ++ meta/recipes-bsp/hostap/hostap-conf_1.0.bb | 2 ++ meta/recipes-bsp/keymaps/keymaps_1.0.bb | 2 ++ meta/recipes-connectivity/connman/connman-conf.bb | 2 ++ meta/recipes-connectivity/ppp-dialin/ppp-dialin_0.1.bb | 2 ++ meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb | 2 ++ .../initrdscripts/initramfs-framework_1.0.bb | 2 ++ .../initrdscripts/initramfs-live-boot_1.0.bb | 2 ++ .../initramfs-live-install-efi-testfs_1.0.bb | 2 ++ .../initrdscripts/initramfs-live-install-efi_1.0.bb | 2 ++ .../initrdscripts/initramfs-live-install-testfs_1.0.bb | 2 ++ .../initrdscripts/initramfs-live-install_1.0.bb | 2 ++ meta/recipes-core/initscripts/initscripts_1.0.bb | 2 ++ meta/recipes-core/systemd/systemd-systemctl-native.bb | 2 ++ meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb | 2 +- meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 ++ meta/recipes-devtools/makedevs/makedevs_1.0.1.bb | 6 ++---- meta/recipes-devtools/opkg/opkg-collateral.bb | 2 ++ .../recipes-devtools/run-postinsts/run-postinsts_1.0.bb | 2 ++ meta/recipes-extended/lsof/lsof_4.88.bb | 7 +++++++ meta/recipes-extended/shadow/shadow-securetty_4.2.1.bb | 2 ++ meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb | 4 +++- .../xorg-xserver/xserver-xf86-config_0.1.bb | 2 ++ .../modutils-initscripts/modutils-initscripts.bb | 3 +++ meta/recipes-qt/qt-demo/qt-demo-init_0.1.bb | 2 ++ meta/recipes-support/ptest-runner/ptest-runner_1.0.bb | 2 ++ 28 files changed, 73 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
RFC PATCH 1/5 base.bbclass: detect when S has been set incorrectly
Currently base.bbclass is creating S if it's not created by unpacking an archive or fetching a repository. If we avoid creating S we can detect when S hasn't been set correctly, since it will not exist. Then we can tell the user that they should set S to a proper value, instead of just failing with odd errors in later tasks.
Besides removing the auto-creation of S this change will introduce a warning if S is set incorrectly. The reason for not display an error and return is due to all external layers that might have recipes that will fail otherwise and that might be a bit to hard to start with. So use a warning until people have had a chance to cleanup affected recipes.
[YOCTO #5627]
--- meta/classes/base.bbclass | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
meta/classes/base.bbclass +13 -4
@@ -113,7 +113,6 @@ python base_do_fetch() { addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" -do_unpack[cleandirs] = "${S}/patches" python base_do_unpack() { src_uri = (d.getVar('SRC_URI', True) or "").split() if len(src_uri) == 0:
@@ -121,11 +120,21 @@ python base_do_unpack() { rootdir = d.getVar('WORKDIR', True) + # Ensure that we cleanup ${S}/patches + # TODO: Investigate if we can remove + # the entire ${S} in this case. + s_dir = d.getVar('S', True) + p_dir = os.path.join(s_dir, 'patches') + bb.utils.remove(p_dir, True) + try: fetcher = bb.fetch2.Fetch(src_uri, d) fetcher.unpack(rootdir) except bb.fetch2.BBFetchException as e: raise bb.build.FuncFailed(e) + + if not os.path.exists(s_dir): + bb.warn("%s ('S') don't exist, you must set 'S' to a proper value" % s_dir) } def pkgarch_mapping(d):
@@ -220,7 +229,7 @@ CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" CLEANBROKEN = "0" addtask configure after do_patch -do_configure[dirs] = "${S} ${B}" +do_configure[dirs] = "${B}" do_configure[deptask] = "do_populate_sysroot" base_do_configure() { if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
@@ -238,7 +247,7 @@ base_do_configure() { } addtask compile after do_configure -do_compile[dirs] = "${S} ${B}" +do_compile[dirs] = "${B}" base_do_compile() { if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then oe_runmake || die "make failed"
@@ -248,7 +257,7 @@ base_do_compile() { } addtask install after do_compile -do_install[dirs] = "${D} ${S} ${B}" +do_install[dirs] = "${D} ${B}" # Remove and re-create ${D} so that is it guaranteed to be empty do_install[cleandirs] = "${D}"
Signature · 1 line
1.9.1
RFC PATCH 2/5 makedevs: set and handle S in a proper way
In reply to Petter MabäckerAfter removal of auto-creating S we must ensure that all recipes are using a proper value for S. Also do some cleanup of code not needed after changing value of S.
[YOCTO #5627]
--- meta/recipes-devtools/makedevs/makedevs_1.0.1.bb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
meta/recipes-devtools/makedevs/makedevs_1.0.1.bb +2 -4
@@ -5,11 +5,9 @@ SECTION = "base" SRC_URI = "file://makedevs.c \ file://COPYING.patch" -FILES_${PN}_append_class-nativesdk = " ${datadir}" +S = "${WORKDIR}" -do_configure() { - install -m 0644 ${WORKDIR}/makedevs.c ${S}/ -} +FILES_${PN}_append_class-nativesdk = " ${datadir}" do_compile() { ${CC} ${CFLAGS} ${LDFLAGS} -o ${S}/makedevs ${S}/makedevs.c
Signature · 1 line
1.9.1
RFC PATCH 3/5 lsof: handle S in a proper way
In reply to Petter MabäckerSince lsof are doing two unpacks and S should be set to match the second unpack of an internal archive, we should let the build system know that we are aware of this.
Solve this by temporarily set S like lsof are doing with SRC_URI.
[YOCTO #5627]
--- meta/recipes-extended/lsof/lsof_4.88.bb | 7 +++++++ 1 file changed, 7 insertions(+)
meta/recipes-extended/lsof/lsof_4.88.bb +7 -0
@@ -15,9 +15,16 @@ S = "${WORKDIR}/lsof_${PV}_src" LIC_FILES_CHKSUM = "file://${S}/00README;beginline=645;endline=679;md5=964df275d26429ba3b39dbb9f205172a" python do_unpack () { + # temporarily change S for unpack + # of lsof_${PV} + s = d.getVar('S') + d.setVar('S', '${WORKDIR}/lsof_${PV}') bb.build.exec_func('base_do_unpack', d) + # temporarily change SRC_URI for unpack + # of lsof_${PV}_src src_uri = d.getVar('SRC_URI') d.setVar('SRC_URI', '${LOCALSRC}') + d.setVar('S', s) bb.build.exec_func('base_do_unpack', d) d.setVar('SRC_URI', src_uri) }
Signature · 1 line
1.9.1
RFC PATCH 4/5 xorg-minimal-fonts: set and handle S in a proper way
In reply to Petter MabäckerAfter removal of auto-creating S we must ensure that all recipes are using a proper value for S. Also do some minor adjustment after changing value of S.
[YOCTO #5627]
--- meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-graphics/xorg-font/xorg-minimal-fonts.bb +3 -1
@@ -15,13 +15,15 @@ PR = "r2" inherit allarch +S = "${WORKDIR}/misc" + PACKAGES = "${PN}" FILES_${PN} = "${libdir}/X11/ ${datadir}/fonts/X11/" RDEPENDS_${PN} += "font-alias" do_install() { install -d ${D}/${datadir}/fonts/X11/misc - install -m 0644 ${WORKDIR}/misc/* ${D}/${datadir}/fonts/X11/misc/ + install -m 0644 ${S}/* ${D}/${datadir}/fonts/X11/misc/ install -d ${D}/${libdir}/X11 ln -sf ${datadir}/fonts/X11/ ${D}/${libdir}/X11/fonts -s }
Signature · 1 line
1.9.1
RFC PATCH 5/5 meta: set proper S value
In reply to Petter MabäckerAfter removal of auto-creating S we must ensure that all recipes are using a proper value for S.
Fix all recipes that only need to set S equals to WORKDIR.
[YOCTO #5627]
--- meta/recipes-bsp/alsa-state/alsa-state.bb | 2 ++ meta/recipes-bsp/hostap/hostap-conf_1.0.bb | 2 ++ meta/recipes-bsp/keymaps/keymaps_1.0.bb | 2 ++ meta/recipes-connectivity/connman/connman-conf.bb | 2 ++ meta/recipes-connectivity/ppp-dialin/ppp-dialin_0.1.bb | 2 ++ meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb | 2 ++ .../initrdscripts/initramfs-live-install-efi-testfs_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb | 2 ++ meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb | 2 ++ meta/recipes-core/initscripts/initscripts_1.0.bb | 2 ++ meta/recipes-core/systemd/systemd-systemctl-native.bb | 2 ++ meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb | 2 +- meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 ++ meta/recipes-devtools/opkg/opkg-collateral.bb | 2 ++ meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb | 2 ++ meta/recipes-extended/shadow/shadow-securetty_4.2.1.bb | 2 ++ meta/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bb | 2 ++ meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb | 3 +++ meta/recipes-qt/qt-demo/qt-demo-init_0.1.bb | 2 ++ meta/recipes-support/ptest-runner/ptest-runner_1.0.bb | 2 ++ 24 files changed, 48 insertions(+), 1 deletion(-)
meta/recipes-bsp/alsa-state/alsa-state.bb +2 -0
@@ -18,6 +18,8 @@ SRC_URI = "\ file://alsa-state-init \ " +S = "${WORKDIR}" + # As the recipe doesn't inherit systemd.bbclass, we need to set this variable # manually to avoid unnecessary postinst/preinst generated. python __anonymous() {
meta/recipes-bsp/hostap/hostap-conf_1.0.bb +2 -0
@@ -10,6 +10,8 @@ SRC_URI = "file://hostap_cs.modalias \ inherit allarch +S = "${WORKDIR}" + do_compile() { }
meta/recipes-bsp/keymaps/keymaps_1.0.bb +2 -0
@@ -26,6 +26,8 @@ SRC_URI = "file://keymap.sh \ INITSCRIPT_NAME = "keymap.sh" INITSCRIPT_PARAMS = "start 01 S ." +S = "${WORKDIR}" + do_install () { # Only install the script if 'sysvinit' is in DISTRO_FEATURES # THe ulitity this script provides could be achieved by systemd-vconsole-setup.service
meta/recipes-connectivity/connman/connman-conf.bb +2 -0
@@ -9,6 +9,8 @@ SRC_URI_append_qemuall = "file://wired.config \ " PR = "r2" +S = "${WORKDIR}" + PACKAGE_ARCH = "${MACHINE_ARCH}" FILES_${PN} = "${localstatedir}/* ${libdir}/*"
meta/recipes-connectivity/ppp-dialin/ppp-dialin_0.1.bb +2 -0
@@ -12,6 +12,8 @@ SRC_URI = "file://host-peer \ inherit allarch useradd +S = "${WORKDIR}" + do_install() { install -d ${D}${sysconfdir}/ppp/peers install -m 0644 ${WORKDIR}/host-peer ${D}${sysconfdir}/ppp/peers/host
meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb +2 -0
@@ -16,6 +16,8 @@ SRC_URI = "file://copyright \ file://interfaces \ file://nfsroot" +S = "${WORKDIR}" + do_install () { install -d ${D}${sysconfdir}/init.d \ ${D}${sysconfdir}/network/if-pre-up.d \
meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb +2 -0
@@ -5,6 +5,8 @@ SRC_URI = "file://init-boot.sh" PR = "r2" +S = "${WORKDIR}" + do_install() { install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init }
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +2 -0
@@ -14,6 +14,8 @@ SRC_URI = "file://init \ file://e2fs \ file://debug" +S = "${WORKDIR}" + do_install() { install -d ${D}/init.d
meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb +2 -0
@@ -7,6 +7,8 @@ SRC_URI = "file://init-live.sh" PR = "r12" +S = "${WORKDIR}" + do_install() { install -m 0755 ${WORKDIR}/init-live.sh ${D}/init }
meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb +2 -0
@@ -5,6 +5,8 @@ SRC_URI = "file://init-install-efi-testfs.sh" RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools" +S = "${WORKDIR}" + do_install() { install -m 0755 ${WORKDIR}/init-install-efi-testfs.sh ${D}/install-efi.sh }
meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb +2 -0
@@ -7,6 +7,8 @@ PR = "r1" RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools" +S = "${WORKDIR}" + do_install() { install -m 0755 ${WORKDIR}/init-install-efi.sh ${D}/install-efi.sh }
meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb +2 -0
@@ -5,6 +5,8 @@ SRC_URI = "file://init-install-testfs.sh" RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs" +S = "${WORKDIR}" + do_install() { install -m 0755 ${WORKDIR}/init-install-testfs.sh ${D}/install.sh }
meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb +2 -0
@@ -5,6 +5,8 @@ SRC_URI = "file://init-install.sh" PR = "r9" +S = "${WORKDIR}" + RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs" do_install() {
meta/recipes-core/initscripts/initscripts_1.0.bb +2 -0
@@ -35,6 +35,8 @@ SRC_URI = "file://functions \ file://logrotate-dmesg.conf \ " +S = "${WORKDIR}" + SRC_URI_append_arm = " file://alignment.sh" KERNEL_VERSION = ""
meta/recipes-core/systemd/systemd-systemctl-native.bb +2 -0
@@ -9,6 +9,8 @@ inherit native SRC_URI = "file://systemctl" +S = "${WORKDIR}" + do_install() { install -d ${D}${bindir} install -m 0755 ${WORKDIR}/systemctl ${D}${bindir}
meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb +1 -1
@@ -6,7 +6,7 @@ PR = "r10" SRC_URI = "file://inittab" -S = "${WORKDIR}/sysvinit-${PV}" +S = "${WORKDIR}" INHIBIT_DEFAULT_DEPS = "1"
meta/recipes-core/udev/udev-extraconf_1.1.bb +2 -0
@@ -13,6 +13,8 @@ SRC_URI = " \ file://localextra.rules \ " +S = "${WORKDIR}" + do_install() { install -d ${D}${sysconfdir}/udev/rules.d
meta/recipes-devtools/opkg/opkg-collateral.bb +2 -0
@@ -8,6 +8,8 @@ SRC_URI = "file://opkg.conf.comments \ file://dest \ file://src " +S = "${WORKDIR}" + OPKGLIBDIR = "${localstatedir}/lib" do_compile () { cat ${WORKDIR}/opkg.conf.comments >${WORKDIR}/opkg.conf
meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb +2 -0
@@ -9,6 +9,8 @@ SRC_URI = "file://run-postinsts \ file://run-postinsts.init \ file://run-postinsts.service" +S = "${WORKDIR}" + inherit allarch systemd update-rc.d INITSCRIPT_NAME = "run-postinsts"
meta/recipes-extended/shadow/shadow-securetty_4.2.1.bb +2 -0
@@ -9,6 +9,8 @@ PR = "r3" SRC_URI = "file://securetty" +S = "${WORKDIR}" + # Since SERIAL_CONSOLES is likely to be set from the machine configuration PACKAGE_ARCH = "${MACHINE_ARCH}"
meta/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bb +2 -0
@@ -7,6 +7,8 @@ PR = "r33" SRC_URI = "file://xorg.conf" +S = "${WORKDIR}" + CONFFILES_${PN} = "${sysconfdir}/X11/xorg.conf" PACKAGE_ARCH = "${MACHINE_ARCH}"
meta/recipes-kernel/modutils-initscripts/modutils-initscripts.bb +3 -0
@@ -4,8 +4,11 @@ LICENSE = "PD" LIC_FILES_CHKSUM = "file://LICENSE;md5=7bf87fc37976e93ec66ad84fac58c098" SRC_URI = "file://modutils.sh \ file://PD.patch" + PR = "r7" +S = "${WORKDIR}" + INITSCRIPT_NAME = "modutils.sh" INITSCRIPT_PARAMS = "start 05 S ."
meta/recipes-qt/qt-demo/qt-demo-init_0.1.bb +2 -0
@@ -6,6 +6,8 @@ PR = "r3" LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +S = "${WORKDIR}" + do_install() { install -d ${D}${sysconfdir}/init.d/ install -m 0755 ${WORKDIR}/qtdemo-init ${D}${sysconfdir}/init.d/qtdemo
meta/recipes-support/ptest-runner/ptest-runner_1.0.bb +2 -0
@@ -11,6 +11,8 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d INHIBIT_DEFAULT_DEPS = "1" +S = "${WORKDIR}" + do_install () { mkdir -p ${D}${bindir} install -m 0755 ${WORKDIR}/ptest-runner ${D}${bindir}
Signature · 1 line
1.9.1
Hi Petter,
Quoted 72 lines · On Saturday 10 January 2015 15:40:10 Petter Mabäcker wrote:
Currently base.bbclass is creating S if it's not created by unpacking an archive or fetching a repository. If we avoid creating S we can detect when S hasn't been set correctly, since it will not exist. Then we can tell the user that they should set S to a proper value, instead of just failing with odd errors in later tasks.
Besides removing the auto-creation of S this change will introduce a warning if S is set incorrectly. The reason for not display an error and return is due to all external layers that might have recipes that will fail otherwise and that might be a bit to hard to start with. So use a warning until people have had a chance to cleanup affected recipes.
[YOCTO #5627]
Signed-off-by Petter Mabäcker <[email protected]>--- meta/classes/base.bbclass | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)meta/classes/base.bbclass +12
-3@@ -113,7 +113,6 @@ python base_do_fetch() { addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" -do_unpack[cleandirs] = "${S}/patches" python base_do_unpack() { src_uri = (d.getVar('SRC_URI', True) or "").split() if len(src_uri) == 0:@@ -121,11 +120,21 @@ python base_do_unpack() { rootdir = d.getVar('WORKDIR', True) + # Ensure that we cleanup ${S}/patches + # TODO: Investigate if we can remove + # the entire ${S} in this case. + s_dir = d.getVar('S', True) + p_dir = os.path.join(s_dir, 'patches') + bb.utils.remove(p_dir, True) + try: fetcher = bb.fetch2.Fetch(src_uri, d) fetcher.unpack(rootdir) except bb.fetch2.BBFetchException as e: raise bb.build.FuncFailed(e) + + if not os.path.exists(s_dir): + bb.warn("%s ('S') don't exist, you must set 'S' to a proper value" % s_dir) } def pkgarch_mapping(d):@@ -220,7 +229,7 @@ CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" CLEANBROKEN = "0" addtask configure after do_patch -do_configure[dirs] = "${S} ${B}" +do_configure[dirs] = "${B}" do_configure[deptask] = "do_populate_sysroot" base_do_configure() { if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then@@ -238,7 +247,7 @@ base_do_configure() { } addtask compile after do_configure -do_compile[dirs] = "${S} ${B}" +do_compile[dirs] = "${B}" base_do_compile() { if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then oe_runmake || die "make failed"
meta/classes/base.bbclass base_do_compile() { · line 262
Quoted 7 lines
meta/classes/base.bbclass +1
-1@@ -248,7 +257,7 @@ base_do_compile() { } addtask install after do_compile -do_install[dirs] = "${D} ${S} ${B}" +do_install[dirs] = "${D} ${B}" # Remove and re-create ${D} so that is it guaranteed to be empty do_install[cleandirs] = "${D}"
This looks reasonable to me; however I'm sure I recall Chris talking about some kind of complication with this issue a year or so ago - Chris do you remember what that was about?
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 86 lines · Paul Eggleton
Hi Petter,
Quoted 72 lines · On Saturday 10 January 2015 15:40:10 Petter Mabäcker wrote:
Currently base.bbclass is creating S if it's not created by unpacking an archive or fetching a repository. If we avoid creating S we can detect when S hasn't been set correctly, since it will not exist. Then we can tell the user that they should set S to a proper value, instead of just failing with odd errors in later tasks.
Besides removing the auto-creation of S this change will introduce a warning if S is set incorrectly. The reason for not display an error and return is due to all external layers that might have recipes that will fail otherwise and that might be a bit to hard to start with. So use a warning until people have had a chance to cleanup affected recipes.
[YOCTO #5627]
Signed-off-by Petter Mabäcker <[email protected]>--- meta/classes/base.bbclass | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)meta/classes/base.bbclass +12
-3@@ -113,7 +113,6 @@ python base_do_fetch() { addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" -do_unpack[cleandirs] = "${S}/patches" python base_do_unpack() { src_uri = (d.getVar('SRC_URI', True) or "").split() if len(src_uri) == 0:@@ -121,11 +120,21 @@ python base_do_unpack() { rootdir = d.getVar('WORKDIR', True) + # Ensure that we cleanup ${S}/patches + # TODO: Investigate if we can remove + # the entire ${S} in this case. + s_dir = d.getVar('S', True) + p_dir = os.path.join(s_dir, 'patches') + bb.utils.remove(p_dir, True) + try: fetcher = bb.fetch2.Fetch(src_uri, d) fetcher.unpack(rootdir) except bb.fetch2.BBFetchException as e: raise bb.build.FuncFailed(e) + + if not os.path.exists(s_dir): + bb.warn("%s ('S') don't exist, you must set 'S' to a proper value" % s_dir) } def pkgarch_mapping(d):@@ -220,7 +229,7 @@ CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" CLEANBROKEN = "0" addtask configure after do_patch -do_configure[dirs] = "${S} ${B}" +do_configure[dirs] = "${B}" do_configure[deptask] = "do_populate_sysroot" base_do_configure() { if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then@@ -238,7 +247,7 @@ base_do_configure() { } addtask compile after do_configure -do_compile[dirs] = "${S} ${B}" +do_compile[dirs] = "${B}" base_do_compile() { if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then oe_runmake || die "make failed"meta/classes/base.bbclass base_do_compile() { · line 262
Quoted 7 lines
meta/classes/base.bbclass +1
-1@@ -248,7 +257,7 @@ base_do_compile() { } addtask install after do_compile -do_install[dirs] = "${D} ${S} ${B}" +do_install[dirs] = "${D} ${B}" # Remove and re-create ${D} so that is it guaranteed to be empty do_install[cleandirs] = "${D}"This looks reasonable to me; however I'm sure I recall Chris talking about some kind of complication with this issue a year or so ago - Chris do you remember what that was about?
Quoted 3 lines
Cheers,
Paul
Ok, I will wait and see if Chris remembers anything sneaky about this. I have run quite some tests without seeing any problems so far. Perhaps it was about removing ${S} instead of just ${S}/patches in do_unpack ? Because I think there have been some discussions about that in the past. I also did some test with that in the scope of 'bug 5627', but it is far more complex to do such a chance, a lot of recipes didn't liked that at all =/ It seems more correct to really wipe entire ${S} in that case, but I guess it have to wait..
BR,
Petter
Honestly I can't recall anymore. I remember looking into this, as this has been a long-standing annoyance, but I don't recall what the issues were. I'm absolutely in favor of your pursuing this.
Quoted 111 lines · Petter Mabäcker
Quoted 5 lines · Paul Eggleton
Hi Petter,
Quoted 2 lines · On Saturday 10 January 2015 15:40:10 Petter Mabäcker wrote:
Currently base.bbclass is creating S if it's not created by unpacking an archive or fetching a repository. If we avoid creating S we can
detect
Quoted 1 line
Quoted 1 line
when S hasn't been set correctly, since it will not exist. Then we can
tell
Quoted 1 line
Quoted 1 line
the user that they should set S to a proper value, instead of just
failing
Quoted 3 lines
Quoted 3 lines
with odd errors in later tasks.
Besides removing the auto-creation of S this change will introduce a
warning
Quoted 1 line
Quoted 1 line
if S is set incorrectly. The reason for not display an error and return
is
Quoted 1 line
Quoted 1 line
due to all external layers that might have recipes that will fail
otherwise
Quoted 26 lines
Quoted 26 lines
and that might be a bit to hard to start with. So use a warning until people have had a chance to cleanup affected recipes.
[YOCTO #5627]
Signed-off-by Petter Mabäcker <[email protected]>--- meta/classes/base.bbclass | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)meta/classes/base.bbclass +0
-1@@ -113,7 +113,6 @@ python base_do_fetch() { addtask unpack after do_fetch do_unpack[dirs] = "${WORKDIR}" -do_unpack[cleandirs] = "${S}/patches" python base_do_unpack() { src_uri = (d.getVar('SRC_URI', True) or "").split() if len(src_uri) == 0:@@ -121,11 +120,21 @@ python base_do_unpack() { rootdir = d.getVar('WORKDIR', True)Quoted 15 lines
Quoted 5 lines
meta/classes/base.bbclass +5
-0+ # Ensure that we cleanup ${S}/patches + # TODO: Investigate if we can remove + # the entire ${S} in this case. + s_dir = d.getVar('S', True) + p_dir = os.path.join(s_dir, 'patches')meta/classes/base.bbclass python base_do_unpack() {
Quoted 10 lines
meta/classes/base.bbclass +5
-0+ bb.utils.remove(p_dir, True) + try: fetcher = bb.fetch2.Fetch(src_uri, d) fetcher.unpack(rootdir) except bb.fetch2.BBFetchException as e: raise bb.build.FuncFailed(e) + + if not os.path.exists(s_dir): + bb.warn("%s ('S') don't exist, you must set 'S' to a propervalue"
Quoted 6 lines
Quoted 6 lines
meta/classes/base.bbclass +0
-0% s_dir) } def pkgarch_mapping(d):@@ -220,7 +229,7 @@ CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" CLEANBROKEN = "0"Quoted 6 lines
meta/classes/base.bbclass CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
Quoted 6 lines
meta/classes/base.bbclass +1
-1addtask configure after do_patch -do_configure[dirs] = "${S} ${B}" +do_configure[dirs] = "${B}" do_configure[deptask] = "do_populate_sysroot" base_do_configure() { if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ];then
Quoted 12 lines
Quoted 12 lines
meta/classes/base.bbclass +1
-1@@ -238,7 +247,7 @@ base_do_configure() { } addtask compile after do_configure -do_compile[dirs] = "${S} ${B}" +do_compile[dirs] = "${B}" base_do_compile() { if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then oe_runmake || die "make failed"@@ -248,7 +257,7 @@ base_do_compile() { }Quoted 6 lines
meta/classes/base.bbclass base_do_compile() { · line 262
Quoted 5 lines
meta/classes/base.bbclass +1
-1addtask install after do_compile -do_install[dirs] = "${D} ${S} ${B}" +do_install[dirs] = "${D} ${B}" # Remove and re-create ${D} so that is it guaranteed to be empty do_install[cleandirs] = "${D}"This looks reasonable to me; however I'm sure I recall Chris talking
about
Quoted 6 lines
some kind of complication with this issue a year or so ago - Chris do you remember what that was about?
Cheers,
PaulOk, I will wait and see if Chris remembers anything sneaky about this. I have run quite some tests without seeing any problems so far. Perhaps it was about removing ${S} instead of just ${S}/patches in
do_unpack? Because I think there have been some discussions about that in the past. I also did some test with that in the scope of 'bug 5627', but it is far more complex to do such a chance, a lot of recipes didn't liked that at all =/ It seems more correct to really wipe entire ${S} in that case, but I guess it have to wait..BR,
Petter