From: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
To: Henning Schild <henning.schild@siemens.com>
Cc: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>,
isar-users@googlegroups.com
Subject: Re: [PATCH] Introduce SCRIPTSDIR variable
Date: Wed, 29 Jan 2020 11:52:44 +0530 [thread overview]
Message-ID: <20200129062244.GB11866@oxygen> (raw)
In-Reply-To: <20200128224347.70f35102@md1za8fc.ad001.siemens.net>
On Tue, Jan 28, 2020 at 10:43:47PM +0100, Henning Schild wrote:
> The unspoken rule (not yet in Isar) would be to use kas and kas-docker
> to get an always reproducible build with a known environment.
>
Yes. I agree that kas effectively handles these scenarios. But, we
should take into consideration the non-kas based builds, as we do now,
and its repercussions. Atlast kas is just another tool outside ISAR and
people might use it or skip it :)
> Looking at the patch you do replace the env variable ISARROOT with
> another "global" SCRIPTSDIR. Could you go into detail who unsets that
> to solve the issue with global env variables?
Sorry. I am not sure what is the issue you are referring to. I don't
think it needs any unset. It is derived from ISARROOT and set each time
the setup script is sourced. Somewhat like your BUILDDIR. If you see,
the problem with ISARROOT is it is set only when it is empty. This
behaviour derived from OE, as pointed out by Jan in [1], is to have
provision to have a caller/wrapper script to pass in ISARROOT to the
isar-init-build-env script.
Considering all these it made sense either to duplicate ISARROOT
(something like ISARHOME) and unset the former. But, on going through
the history, the ISARROOT was orignally exported to locate the most
commonly used scripts directory, for wic and other purposes. So it made
sense to address that and derive anything which might need the actual
ISARROOT equivalent from it.
[1] https://groups.google.com/forum/#!msg/isar-users/jklvMqAT_uA/L5BQY8xXBwAJ
Thanks,
Vijai Kumar K
> I did not see an "unset" so i assume it must be in contrib (oe or
> bitbake) code.
>
> Henning
>
> On Wed, 29 Jan 2020 01:05:20 +0530
> Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> wrote:
>
> > When switching between two ISAR workspaces in the same shell
> > session, the ISARROOT setting of the previous workspace would be
> > picked up for the new workspace resulting in an incorrect
> > configuration. The user had to manually unset ISARROOT to avoid
> > any issues.
> >
> > As like OEROOT in OE, let us unset ISARROOT at the end of the
> > initialization script. This helps us to avoid the above issue
> > and also preserves support for passing ISARROOT from a caller
> > script as in OE.
> >
> > ISARROOT is mostly used with wic implemetation for the scripts
> > directory. Introduce SCRIPTSDIR to satisfy wic.
> >
> > When ISARROOT equivalent is needed, derive it from SCRIPTSDIR.
> >
> > Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> > ---
> > isar-init-build-env | 1 +
> > meta/classes/image-sdk-extension.bbclass | 2 +-
> > meta/classes/wic-img.bbclass | 9 +++++----
> > scripts/ci_build.sh | 12 +++++++-----
> > scripts/isar-buildenv-internal | 5 ++++-
> > 5 files changed, 18 insertions(+), 11 deletions(-)
> >
> > diff --git a/isar-init-build-env b/isar-init-build-env
> > index b08bb59..85fb82f 100755
> > --- a/isar-init-build-env
> > +++ b/isar-init-build-env
> > @@ -55,5 +55,6 @@ export ISARROOT
> > unset ISARROOT
> > return 1
> > }
> > +unset ISARROOT
> >
> > [ -z "$BUILDDIR" ] || cd "$BUILDDIR"
> > diff --git a/meta/classes/image-sdk-extension.bbclass
> > b/meta/classes/image-sdk-extension.bbclass index b9f2cf4..b91fdd6
> > 100644 --- a/meta/classes/image-sdk-extension.bbclass
> > +++ b/meta/classes/image-sdk-extension.bbclass
> > @@ -19,7 +19,7 @@ do_populate_sdk() {
> > sudo rm -f ${SDKCHROOT_DIR}/chroot-setup.sh
> > ${SDKCHROOT_DIR}/configscript.sh
> > # Copy mount_chroot.sh for convenience
> > - sudo cp ${ISARROOT}/scripts/mount_chroot.sh ${SDKCHROOT_DIR}
> > + sudo cp ${SCRIPTSDIR}/mount_chroot.sh ${SDKCHROOT_DIR}
> >
> > # Create SDK archive
> > cd -P ${SDKCHROOT_DIR}/..
> > diff --git a/meta/classes/wic-img.bbclass
> > b/meta/classes/wic-img.bbclass index 7d30e45..e715f56 100644
> > --- a/meta/classes/wic-img.bbclass
> > +++ b/meta/classes/wic-img.bbclass
> > @@ -86,7 +86,7 @@ STAGING_DATADIR ?= "/usr/lib/"
> > STAGING_LIBDIR ?= "/usr/lib/"
> > STAGING_DIR ?= "${TMPDIR}"
> > IMAGE_BASENAME ?= "${PN}-${DISTRO}"
> > -FAKEROOTCMD ?= "${ISARROOT}/scripts/wic_fakeroot"
> > +FAKEROOTCMD ?= "${SCRIPTSDIR}/wic_fakeroot"
> > RECIPE_SYSROOT_NATIVE ?= "/"
> > BUILDCHROOT_DIR = "${BUILDCHROOT_TARGET_DIR}"
> >
> > @@ -132,7 +132,7 @@ do_wic_image() {
> > buildchroot_do_mounts
> > sudo -s <<'EOSUDO'
> > ( flock 9
> > - for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do
> > + for dir in ${BBLAYERS} ${STAGING_DIR} ${SCRIPTSDIR}; do
> > mkdir -p ${BUILDCHROOT_DIR}/$dir
> > if ! mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1;
> > then mount --bind --make-private $dir ${BUILDCHROOT_DIR}/$dir
> > @@ -148,12 +148,13 @@ EOSUDO
> > WICTMP=$(cd ${BUILDCHROOT_DIR}; mktemp -d -p tmp)
> >
> > sudo -E chroot ${BUILDCHROOT_DIR} \
> > - ${ISARROOT}/scripts/wic create ${WKS_FULL_PATH} \
> > + ${SCRIPTSDIR}/wic create ${WKS_FULL_PATH} \
> > --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \
> > -o /$WICTMP/${IMAGE_FULLNAME}.wic/ \
> > --bmap \
> > -e ${IMAGE_BASENAME} ${WIC_CREATE_EXTRA_ARGS}
> > - sudo chown -R $(stat -c "%U" ${ISARROOT}) ${ISARROOT}/meta
> > ${ISARROOT}/meta-isar ${ISARROOT}/scripts || true
> > + ROOTDIR=`dirname ${SCRIPTSDIR}`
> > + sudo chown -R $(stat -c "%U" ${ROOTDIR}) ${ROOTDIR}/meta
> > ${ROOTDIR}/meta-isar ${SCRIPTSDIR} || true WIC_DIRECT=$(ls -t -1
> > ${BUILDCHROOT_DIR}/$WICTMP/${IMAGE_FULLNAME}.wic/*.direct | head -1)
> > sudo chown -R $(id -u):$(id -g) ${BUILDCHROOT_DIR}/${WICTMP} mv -f
> > ${WIC_DIRECT} ${WIC_IMAGE_FILE} diff --git a/scripts/ci_build.sh
> > b/scripts/ci_build.sh index 7cd5a2f..727b4a9 100755
> > --- a/scripts/ci_build.sh
> > +++ b/scripts/ci_build.sh
> > @@ -133,13 +133,15 @@ if [ ! -d "$BUILD_DIR" ]; then
> > fi
> > source isar-init-build-env "$BUILD_DIR"
> >
> > +ROOTDIR=`dirname ${SCRIPTSDIR}`
> > +
> > if [ -n "$CROSS_BUILD" ]; then
> > sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?=
> > "1"/g' conf/local.conf fi
> >
> > if [ -n "$REPRO_BUILD" ]; then
> > -
> > ISAR_TESTSUITE_GPG_PUB_KEY_FILE="$ISARROOT/testsuite/base-apt/test_pub.key"
> > -
> > ISAR_TESTSUITE_GPG_PRIV_KEY_FILE="$ISARROOT/testsuite/base-apt/test_priv.key"
> > +
> > ISAR_TESTSUITE_GPG_PUB_KEY_FILE="$ROOTDIR/testsuite/base-apt/test_pub.key"
> > +
> > ISAR_TESTSUITE_GPG_PRIV_KEY_FILE="$ROOTDIR/testsuite/base-apt/test_priv.key"
> > export GNUPGHOME=$(mktemp -d) gpg --import
> > $ISAR_TESTSUITE_GPG_PUB_KEY_FILE $ISAR_TESTSUITE_GPG_PRIV_KEY_FILE
> > @@ -188,9 +190,9 @@ if [ -z "$FAST_BUILD" ]; then
> > bitbake $BB_ARGS $TARGETS_SET
> > fi
> >
> > -cp -a "${ISARROOT}/meta/classes/dpkg-base.bbclass"
> > "${ISARROOT}/meta/classes/dpkg-base.bbclass.ci-backup" -echo -e
> > "do_fetch_append() {\n\n}" >>
> > "${ISARROOT}/meta/classes/dpkg-base.bbclass" +cp -a
> > "${ROOTDIR}/meta/classes/dpkg-base.bbclass"
> > "${ROOTDIR}/meta/classes/dpkg-base.bbclass.ci-backup" +echo -e
> > "do_fetch_append() {\n\n}" >>
> > "${ROOTDIR}/meta/classes/dpkg-base.bbclass" bitbake $BB_ARGS
> > mc:qemuamd64-stretch:isar-image-base -mv
> > "${ISARROOT}/meta/classes/dpkg-base.bbclass.ci-backup"
> > "${ISARROOT}/meta/classes/dpkg-base.bbclass" +mv
> > "${ROOTDIR}/meta/classes/dpkg-base.bbclass.ci-backup"
> > "${ROOTDIR}/meta/classes/dpkg-base.bbclass" diff --git
> > a/scripts/isar-buildenv-internal b/scripts/isar-buildenv-internal
> > index 72a91ab..a91ad7a 100755 --- a/scripts/isar-buildenv-internal
> > +++ b/scripts/isar-buildenv-internal @@ -74,5 +74,8 @@ export PATH
> > BBPATH="${BUILDDIR}" export BBPATH
> > -BB_ENV_EXTRAWHITE="BUILDDIR ISARROOT http_proxy https_proxy
> > ftp_proxy no_proxy GNUPGHOME" +SCRIPTSDIR="${ISARROOT}/scripts"
> > +export SCRIPTSDIR
> > +
> > +BB_ENV_EXTRAWHITE="BUILDDIR SCRIPTSDIR http_proxy https_proxy
> > ftp_proxy no_proxy GNUPGHOME" export BB_ENV_EXTRAWHITE
>
next prev parent reply other threads:[~2020-01-29 6:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 19:35 Vijai Kumar K
2020-01-28 21:43 ` Henning Schild
2020-01-29 6:22 ` Vijai Kumar K [this message]
2020-02-18 6:05 ` vijai kumar
2020-04-05 16:49 ` Baurzhan Ismagulov
2020-04-06 8:30 ` vijai kumar
2020-04-23 14:56 ` vijai kumar
2020-04-27 9:11 ` [PATCH v2] Replace ISARROOT with more relevant variables Vijai Kumar K
2020-04-27 10:22 ` vijai kumar
2020-04-27 10:28 ` [PATCH v3] " Vijai Kumar K
2020-05-26 2:54 ` vijai kumar
2020-05-26 7:51 ` Baurzhan Ismagulov
2020-05-28 5:28 ` vijai kumar
2020-09-16 19:11 ` Baurzhan Ismagulov
2020-09-17 2:45 ` vijai kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200129062244.GB11866@oxygen \
--to=vijaikumar.kanagarajan@gmail.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox