From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6546088382730076160 X-Received: by 10.80.158.13 with SMTP id z13mr3239679ede.9.1524227866585; Fri, 20 Apr 2018 05:37:46 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.80.205.69 with SMTP id d5ls2099140edj.0.gmail; Fri, 20 Apr 2018 05:37:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+mYt8IBqcPLr4Ud9Hsqy2Ub4sZjHhbgGl6+ZsGexM1i3FpCi4DVAJImp9DYHQLCUvpnrkn X-Received: by 10.80.230.15 with SMTP id y15mr3256064edm.0.1524227866121; Fri, 20 Apr 2018 05:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524227866; cv=none; d=google.com; s=arc-20160816; b=hB3HC+QWlic0+i22EhTbh3PCukGPaeCwEkX16KfxRiCuK+I3u8aJZXxpZoEPowoqz5 ymDFTpTf0/PSvCruFfixaiPKvLUcJg74pUrswCzsGPwADVYfaUgH4rU5jPHJviUveUQK 9ogaK8yLh2ZR/q2GB6o09YBlYZ4BBXX3sb3/jTcBm6Of7arKm0MiICu+J8NR5SnzHg3v ofHky07eiZXyyyA/Gm+PD0/FnQSqmI3/wC1ph/hyswtpVxxzF19+lctYlXuE14xTwZlt RUVT4l+CXsXanow4qraHed2F7XHvOOTOZafFnQvX6BDyNW3OgTKYTCzQ81xF2afN5F46 hqVA== 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=cTfWN/ir887dEupi6f6CHwDKpdIURC45UwMnTEB4r1M=; b=dx0BMTmHLh/YDnLCD4fUv8jZqFrJe2VQ07zwjAfSl+I3+AiteFHfuevxz6rozaWPd7 CUrI6qQHAW3ZSAI7TWrhBkmHotNNJ9AHmN9WBhJbUa+atN8f7F3YepWH30nCb7vRnl8n MeSyUEca62qQSQKNV0G5e0IadGFp0TfAlhhdIH0xxCCdgihZoPfeYhi5LFYWJiKlHpyv cfLEdhAtA6sHXKGIUEHa6q/HVcch9fdsTV/u3HJm5unHJzd6fbL4caCc6RWyVls4SHVu OmC2B8oPG6MKBbqSG9VmPzIPiPx/6p/mMV8Vu3rCYRQtaIbJz5pm7z7sUK7ZDDp0udFi 2w2w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id v10si248905edf.4.2018.04.20.05.37.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 05:37:46 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id w3KCbjjb015465 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 20 Apr 2018 14:37:45 +0200 Received: from mmd1pvb1c.ad001.siemens.net (md1pvb1c.ad001.siemens.net [139.25.68.40] (may be forged)) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w3KCbjhm009046; Fri, 20 Apr 2018 14:37:45 +0200 Date: Fri, 20 Apr 2018 14:37:43 +0200 From: Henning Schild To: Cc: Jan Kiszka Subject: Re: [PATCH v3] Correctly use the bitbake variable S from now on Message-ID: <20180420143743.502ab214@mmd1pvb1c.ad001.siemens.net> In-Reply-To: <20180420123626.25330-1-henning.schild@siemens.com> References: <20180419165832.10741-1-henning.schild@siemens.com> <20180420123626.25330-1-henning.schild@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=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: DRcyuV4sCzW9 This one is now manually tested against linux-cip and -mainline recipes from the Isar tree. Henning Am Fri, 20 Apr 2018 14:36:26 +0200 schrieb Henning Schild : > 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. > > 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 ${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. > > 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 | 2 +- > 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 | > 4 ++-- 11 files changed, 25 insertions(+), 22 deletions(-) > > 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 = "1.0" > SRC_URI = "git://github.com/ilbers/hello.git" > SRCREV = "ad7065ecc4840cc436bfcdac427386dbba4ea719" > > -S = "git" > +S = "${WORKDIR}/git" > > 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 = "0.2-86cc719" DEPENDS += "libhello" > > SRC_URI = " \ > - git://github.com/ilbers/hello.git;protocol=https \ > + git://github.com/ilbers/hello.git;protocol=https;destsuffix=${P} > \ file://0001-Add-some-help.patch \ > file://yet-another-change.txt;apply=yes;striplevel=0" > SRCREV = "86cc719b3359adc3c4e243387feba50360a860f3" > > -S = "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 = > "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260 > PV = "0.1-98f2e41" > > -SRC_URI = "git://github.com/ilbers/libhello.git;protocol=https" > +SRC_URI = > "git://github.com/ilbers/libhello.git;protocol=https;destsuffix=${P}" > SRCREV = "98f2e41e7d05ab8d19b0c5d160b104b725c8fd93" > -S = "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 += > "file://src" > -S = "src" > +S = "${WORKDIR}/src" > > AUTOLOAD = "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 > > SRC_URI += " \ > - > git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-cip.git;branch=linux-4.4.y-cip > \ > + > git://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-cip.git;branch=linux-4.4.y-cip;destsuffix=${P} > \ file://x86_64_defconfig" > SRCREV = "4e52cc5f668c4666e31a8485725b5f4e897b3baf" > PV = "4.4.112-cip18" > > -S = "git" > - > KERNEL_DEFCONFIG_qemuamd64 = "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..fc465fd 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 @@ -12,6 > +12,6 @@ SRC_URI += " \ file://x86_64_defconfig" > SRC_URI[sha256sum] = > "866a94c1c38d923ae18e74b683d7a8a79b674ebdfe7f40f1a3be9a27d39fe354" > -S = "linux-${PV}" > +S = "${WORKDIR}/linux-${PV}" > > KERNEL_DEFCONFIG_qemuamd64 = "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 > > 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] = "buildchroot:do_build" > DEPENDS ?= "" > do_build[deptask] = "do_deploy_deb" > > +def get_package_srcdir(d): > + s = d.getVar("S", True) > + workdir = 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 = "/home/builder/${PN}" > +PPS ?= "${@get_package_srcdir(d)}" > > BUILDROOT = "${BUILDCHROOT_DIR}/${PP}" > do_build[stamp-extra-info] = "${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="${@ 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..0bc449f 100644 > --- a/meta/classes/patch.bbclass > +++ b/meta/classes/patch.bbclass > @@ -5,7 +5,7 @@ python do_patch() { > import subprocess > > workdir = d.getVar("WORKDIR", True) + "/" > - src_dir = workdir + (d.getVar("S", True) or "") > + src_dir = d.getVar("S", True) > > 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 ?= "0" > inherit dpkg > > 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 > > if [ ${AUTOLOAD} = "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..1176b25 > 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} > - sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} > ${WORKDIR}/${S}/.config > + sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/.config > > E="${@ bb.utils.export_proxies(d)}" > > @@ -43,5 +43,5 @@ dpkg_runbuild() { > export KERNEL_DEBIAN_DEPENDS="${KERNEL_DEBIAN_DEPENDS}" > export > KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}" > - sudo -E chroot ${BUILDCHROOT_DIR} /build-kernel.sh ${PP}/${S} > + sudo -E chroot ${BUILDCHROOT_DIR} /build-kernel.sh > ${PP}/${PPS} }