From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6546088382730076160 X-Received: by 10.80.165.200 with SMTP id b8mr1884873edc.1.1524134167635; Thu, 19 Apr 2018 03:36:07 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.80.192.24 with SMTP id r24ls3649533edb.3.gmail; Thu, 19 Apr 2018 03:36:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx48eNlQ6VdzmYUD3GzevesPWXDcgYJ7ctVsOrZ9WteFK4e9F2zmaiu0dBwgjFYzZC0ce4JOe X-Received: by 10.80.190.71 with SMTP id b7mr1804318edi.7.1524134167053; Thu, 19 Apr 2018 03:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524134167; cv=none; d=google.com; s=arc-20160816; b=Q27uVLPsMhRkkhevyYflIJs3qG9vlnbEXJ39kq20IjzS3tTL95NY/dUCQxG+Q529Lc +gqXHcT/UXfRsUdp9eiNVAPnJFMUka2tXhvjaHRt6evWJe3wVTxq+JWh5vyvkCERsR9F Z6r1DUZ5Hd+TtViutYnRbrtmz33d1mVDptr+PXwtsgvPyhu0DgAFzq0cj42LejRbNBbi UQ7KIeT8Xls1ROwDH5FF9FTbywWqGai0gxqCebANDVuKvSQvsAjUMj4EA71pbFeWl+EG 6cNkXdWUcQpVnbhDmSMz1wiXDRyJzcXlYfg4ri7vqaY85TQd1YpO/qNsxApnTOL3/526 H29w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=cgK/7ZW7I2x69+vbPOQ2tDFKUJO/OAzI/7Oo9YHGFaM=; b=n+1KZbDItY/QOqdTsRy4IL3ZfS9gycBYJo87XeAfI7qlaYld/mjHlOB2UrbhhjkMvr UQxJeih/ONSI4O5xBuFWk71oZ6DECudhwp0dPz5GJ2IfziYtczxKnJ3k3SZtKDlVPZRz oZ2MTj/6SqdigsDYzCRoTtNoqAv/SyEA7O2U8LDaoFNsxvfE0FXSOuvTt8XFPwVUQalI jW8XSwbMos4eSmHSHo2dG2+HngfDOY26XCaAGj0LgfQz1zhKHgziPzbbKcO0PpLexDKL ouVrywdeC7sbLjepuxipawtWOHlRXQfzQUgXuyX6fH3iIPUzCW9qj/oMm27ogFm/FADJ xCww== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id v10si134026edf.4.2018.04.19.03.36.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 03:36:06 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w3JAa6BL012500 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 19 Apr 2018 12:36:06 +0200 Received: from mmd1pvb1c.ad001.siemens.net (md1pvb1c.ad001.siemens.net [139.25.68.40] (may be forged)) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id w3JAa6n7005688; Thu, 19 Apr 2018 12:36:06 +0200 Date: Thu, 19 Apr 2018 12:36:05 +0200 From: Henning Schild To: Jan Kiszka Cc: Subject: Re: [PATCH] Correctly use the bitbake variable S from now on Message-ID: <20180419123605.622b6b1c@mmd1pvb1c.ad001.siemens.net> In-Reply-To: <17ad58e3-a7f1-384e-cd8b-3cbb1caa53b8@siemens.com> References: <20180419092602.7791-1-henning.schild@siemens.com> <17ad58e3-a7f1-384e-cd8b-3cbb1caa53b8@siemens.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-TUID: UXNY9ziVB325 Am Thu, 19 Apr 2018 11:45:05 +0200 schrieb Jan Kiszka : > On 2018-04-19 11:26, Henning Schild wrote: > > S is defined as ${WORKDIR}/${P} so it already contains ${WORKDIR} > > by its definition. In Isar it was often concatinated with WORKDIR > > again. One example where this was a problem is if you specified a > > patch in SRC_URI but did not actually overwrite S. > > Align the use of the variable with OE and bitbake defaults again. =20 >=20 > Yeah, I missed that when migrating Isar from SRC_DIR to S. >=20 > >=20 > > Impact: layers building on top of Isar will have to adjust their > > recipes like the internal ones needed modification. The suggestion > > is to not set S and make sure to unpack to ${WORKDIR}/${P}. When > > setting S make sure to include =C2=A7{WORKDIR}. This patch also > > introduces a warning and tries to preserve the old behaviour a bit. > > However if your recipe uses patches in SRC_URI and sets S you will > > get the warning and do_patch will fail. > >=20 > > Signed-off-by: Henning Schild > > --- > > doc/user_manual.md | 2 +- > > meta-isar/recipes-app/example-hello/example-hello.bb | 4 +--- > > meta-isar/recipes-app/libhello/libhello.bb | 4 +--- > > meta-isar/recipes-kernel/example-module/example-module.bb | 2 +- > > meta-isar/recipes-kernel/linux/linux-cip_4.4.bb | 4 +--- > > meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb | 4 +--- > > meta/classes/dpkg-base.bbclass | 13 > > +++++++++++-- > > meta/classes/dpkg.bbclass | 2 +- > > meta/classes/patch.bbclass | 2 +- > > meta/recipes-kernel/linux-module/module.inc | 8 > > ++++---- meta/recipes-kernel/linux/linux-custom.inc > > | 2 +- 11 files changed, 24 insertions(+), 23 deletions(-) > >=20 > > diff --git a/doc/user_manual.md b/doc/user_manual.md > > index 2bd3793..3072bd5 100644 > > --- a/doc/user_manual.md > > +++ b/doc/user_manual.md > > @@ -511,7 +511,7 @@ PV =3D "1.0" > > SRC_URI =3D "git://github.com/ilbers/hello.git" > > SRCREV =3D "ad7065ecc4840cc436bfcdac427386dbba4ea719" > > =20 > > -S =3D "git" > > +S =3D "${WORKDIR}/git" =20 >=20 > Should we promote this pattern now or destsuffix? Both are fine. That is why i kind of mixed them in this commit. I am not sure which one to promote. One tells people to modify an internal variable the other one is not consistent between fetchers. git uses destsuffix while tar.gz uses subdir > > =20 > > inherit dpkg > > ``` > > diff --git a/meta-isar/recipes-app/example-hello/example-hello.bb > > b/meta-isar/recipes-app/example-hello/example-hello.bb index > > 9788ec0..d23ee6c 100644 --- > > a/meta-isar/recipes-app/example-hello/example-hello.bb +++ > > b/meta-isar/recipes-app/example-hello/example-hello.bb @@ -15,11 > > +15,9 @@ PV =3D "0.2-86cc719" DEPENDS +=3D "libhello" > > =20 > > SRC_URI =3D " \ > > - git://github.com/ilbers/hello.git;protocol=3Dhttps \ > > + > > git://github.com/ilbers/hello.git;protocol=3Dhttps;destsuffix=3D${P} \ > > file://0001-Add-some-help.patch \ > > file://yet-another-change.txt;apply=3Dyes;striplevel=3D0" SRCREV =3D > > "86cc719b3359adc3c4e243387feba50360a860f3"=20 > > -S =3D "git" > > - > > inherit dpkg > > diff --git a/meta-isar/recipes-app/libhello/libhello.bb > > b/meta-isar/recipes-app/libhello/libhello.bb index 1875831..4e75f98 > > 100644 --- a/meta-isar/recipes-app/libhello/libhello.bb > > +++ b/meta-isar/recipes-app/libhello/libhello.bb > > @@ -10,9 +10,7 @@ LIC_FILES_CHKSUM =3D > > "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=3D751419260=20 > > PV =3D "0.1-98f2e41" > > =20 > > -SRC_URI =3D "git://github.com/ilbers/libhello.git;protocol=3Dhttps" > > +SRC_URI =3D > > "git://github.com/ilbers/libhello.git;protocol=3Dhttps;destsuffix=3D${P= }" > > SRCREV =3D "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93"=20 > > -S =3D "git" > > - > > inherit dpkg > > diff --git > > a/meta-isar/recipes-kernel/example-module/example-module.bb > > b/meta-isar/recipes-kernel/example-module/example-module.bb index > > dbaf5ac..98d0aaa 100644 --- > > a/meta-isar/recipes-kernel/example-module/example-module.bb +++ > > b/meta-isar/recipes-kernel/example-module/example-module.bb @@ -9,6 > > +9,6 @@ include recipes-kernel/linux-module/module.inc SRC_URI +=3D > > "file://src"=20 > > -S =3D "src" > > +S =3D "${WORKDIR}/src" > > =20 > > AUTOLOAD =3D "1" > > diff --git a/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb > > b/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb index > > 7502f70..e9aaa9f 100644 --- > > a/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb +++ > > b/meta-isar/recipes-kernel/linux/linux-cip_4.4.bb @@ -8,12 +8,10 @@ > > require recipes-kernel/linux/linux-custom.inc > > =20 > > SRC_URI +=3D " \ > > - > > git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-cip.git;branch= =3Dlinux-4.4.y-cip > > \ > > + > > git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-cip.git;branch= =3Dlinux-4.4.y-cip;destsuffix=3D${P} > > \ file://x86_64_defconfig"=20 > > SRCREV =3D "4e52cc5f668c4666e31a8485725b5f4e897b3baf" > > PV =3D "4.4.112-cip18" > > =20 > > -S =3D "git" > > - > > KERNEL_DEFCONFIG_qemuamd64 =3D "x86_64_defconfig" > > diff --git > > a/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb > > b/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb index > > 2c93d40..751912f 100644 --- > > a/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb +++ > > b/meta-isar/recipes-kernel/linux/linux-mainline_4.14.18.bb @@ -8,10 > > +8,8 @@ require recipes-kernel/linux/linux-custom.inc=20 > > SRC_URI +=3D " \ > > - > > https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz \ > > + > > https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz;subdir= =3D${P} > > \ file://x86_64_defconfig" SRC_URI[sha256sum] =3D > > "866a94c1c38d923ae18e74b683d7a8a79b674ebdfe7f40f1a3be9a27d39fe354"=20 > > -S =3D "linux-${PV}" > > - > > KERNEL_DEFCONFIG_qemuamd64 =3D "x86_64_defconfig" > > diff --git a/meta/classes/dpkg-base.bbclass > > b/meta/classes/dpkg-base.bbclass index 3c3a484..3845d8c 100644 > > --- a/meta/classes/dpkg-base.bbclass > > +++ b/meta/classes/dpkg-base.bbclass > > @@ -2,8 +2,8 @@ > > # Copyright (C) 2017 Siemens AG > > =20 > > do_adjust_git() { > > - if [ -f ${WORKDIR}/${S}/.git/objects/info/alternates ]; then > > - sed -i ${WORKDIR}/${S}/.git/objects/info/alternates \ > > + if [ -f ${S}/.git/objects/info/alternates ]; then > > + sed -i ${S}/.git/objects/info/alternates \ > > -e 's|${DL_DIR}|/downloads|' > > fi > > } > > @@ -21,9 +21,18 @@ do_build[depends] =3D "buildchroot:do_build" > > DEPENDS ?=3D "" > > do_build[deptask] =3D "do_deploy_deb" > > =20 > > +def get_package_srcdir(d): > > + s =3D d.getVar("S", True) > > + workdir =3D d.getVar("WORKDIR", True) > > + if s.startswith(workdir): > > + return s[len(workdir)+1:] > > + bb.warn('S does not start with WORKDIR') > > + return s > > + > > # Each package should have its own unique build folder, so use > > # recipe name as identifier > > PP =3D "/home/builder/${PN}" > > +PPS ?=3D "${@get_package_srcdir(d)}" > > =20 > > BUILDROOT =3D "${BUILDCHROOT_DIR}/${PP}" > > do_build[stamp-extra-info] =3D "${DISTRO}-${DISTRO_ARCH}" > > diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass > > index 06f0579..c8d4ac5 100644 > > --- a/meta/classes/dpkg.bbclass > > +++ b/meta/classes/dpkg.bbclass > > @@ -6,5 +6,5 @@ inherit dpkg-base > > # Build package from sources using build script > > dpkg_runbuild() { > > E=3D"${@ bb.utils.export_proxies(d)}" > > - sudo -E chroot ${BUILDCHROOT_DIR} /build.sh ${PP}/${S} > > + sudo -E chroot ${BUILDCHROOT_DIR} /build.sh ${PP}/${PPS} > > } > > diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass > > index 26a0c81..1559359 100644 > > --- a/meta/classes/patch.bbclass > > +++ b/meta/classes/patch.bbclass > > @@ -5,7 +5,7 @@ python do_patch() { > > import subprocess > > =20 > > workdir =3D d.getVar("WORKDIR", True) + "/" > > - src_dir =3D workdir + (d.getVar("S", True) or "") > > + src_dir =3D (d.getVar("S", True) or "") =20 >=20 > That's not equivalent, but I'm undecided if it matters. S should never > be unset (bitbake.conf holds the default). So we could just pull S and > let the build fail if that assumption should ever be wrong. I was wondering why the or "" was there in the first place, S was always set even before recipes decided to overwrite it. Some python sniplets seem to return Null on some intermediate steps when using layers. Might that be why you introduced the 'or ""'? Henning > > =20 > > for src_uri in (d.getVar("SRC_URI", True) or "").split(): > > try: > > diff --git a/meta/recipes-kernel/linux-module/module.inc > > b/meta/recipes-kernel/linux-module/module.inc index > > ec1c4b0..3075f44 100644 --- > > a/meta/recipes-kernel/linux-module/module.inc +++ > > b/meta/recipes-kernel/linux-module/module.inc @@ -18,14 +18,14 @@ > > AUTOLOAD ?=3D "0" inherit dpkg > > =20 > > dpkg_runbuild_prepend() { > > - cp -r ${WORKDIR}/debian ${WORKDIR}/${S}/ > > + cp -r ${WORKDIR}/debian ${S}/ > > sed -i -e 's/@PN@/${PN}/g' -e 's/@PV@/${PV}/g' \ > > -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \ > > -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \ > > - ${WORKDIR}/${S}/debian/changelog > > ${WORKDIR}/${S}/debian/control > > + ${S}/debian/changelog ${S}/debian/control > > =20 > > if [ ${AUTOLOAD} =3D "1" ]; then > > - echo "echo ${PN} >> /etc/modules" >> > > ${WORKDIR}/${S}/debian/postinst > > - chmod +x ${WORKDIR}/${S}/debian/postinst > > + echo "echo ${PN} >> /etc/modules" >> ${S}/debian/postinst > > + chmod +x ${S}/debian/postinst > > fi > > } > > diff --git a/meta/recipes-kernel/linux/linux-custom.inc > > b/meta/recipes-kernel/linux/linux-custom.inc index 0498dfa..2643fec > > 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc > > +++ b/meta/recipes-kernel/linux/linux-custom.inc > > @@ -32,7 +32,7 @@ dpkg_runbuild() { > > # Install package builder script > > sudo install -m 755 ${WORKDIR}/build-kernel.sh > > ${BUILDCHROOT_DIR}=20 > > - sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} > > ${WORKDIR}/${S}/.config > > + sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/.config > > =20 > > E=3D"${@ bb.utils.export_proxies(d)}" > > =20 > > =20 >=20 > Otherwise: > Reviewed-by: Jan Kiszka >=20 > Jan