public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Moessbauer, Felix" <felix.moessbauer@siemens.com>
To: "Schmidt, Adriaan" <adriaan.schmidt@siemens.com>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: RE: [PATCH 4/4] base.bbclass: don't pass absolute paths to root_cleandirs
Date: Fri, 8 Apr 2022 15:41:08 +0000	[thread overview]
Message-ID: <AM9PR10MB48697525BA0D59662614871989E99@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20220404111613.2159786-5-adriaan.schmidt@siemens.com>

Hi Adriaan,

> -----Original Message-----
> From: isar-users@googlegroups.com <isar-users@googlegroups.com> On
> Behalf Of Adriaan Schmidt
> Sent: Monday, April 4, 2022 1:16 PM
> To: isar-users@googlegroups.com
> Cc: Schmidt, Adriaan (T CED SES-DE) <adriaan.schmidt@siemens.com>
> Subject: [PATCH 4/4] base.bbclass: don't pass absolute paths to root_cleandirs
> 
> The directories to be cleaned are contained in the code that is prepended to the
> modified task. If those contain absolute paths, it can break caching.
> So instead, we pass paths relative to $TMPDIR (code already makes sure the
> paths are actually below $TMPDIR).
> 
> Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
> ---
>  meta/classes/base.bbclass | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index
> a7282110..db355875 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -105,14 +105,16 @@ python do_listtasks() {
>  root_cleandirs() {
>      ROOT_CLEANDIRS_DIRS_PY="${@d.getVar("ROOT_CLEANDIRS_DIRS", True)
> or ""}"
>      ROOT_CLEANDIRS_DIRS="${ROOT_CLEANDIRS_DIRS-
> ${ROOT_CLEANDIRS_DIRS_PY}}"
> +    TMPDIR_PY="$@d.getVar("TMPDIR", True) or ""}"

There is a typo in that line.
By that, the inline python function is not invoked, but instead the line is passed as-is to the TMPDIR_PY.
This leads to a dir "d.getVar(TMPDIR, True) or }" being created in /build.

Felix

> +    TMPDIR="${TMPDIR-${TMPDIR_PY}}"
>      for i in $ROOT_CLEANDIRS_DIRS; do
>          awk '{ print $2 }' /proc/mounts | grep -q "^${i}\(/\|\$\)" && \
>              die "Could not remove $i, because subdir is mounted"
>      done
> -    if [ -n "$ROOT_CLEANDIRS_DIRS" ]; then
> -        sudo rm -rf --one-file-system $ROOT_CLEANDIRS_DIRS
> -        mkdir -p $ROOT_CLEANDIRS_DIRS
> -    fi
> +    for i in $ROOT_CLEANDIRS_DIRS; do
> +        sudo rm -rf --one-file-system "$TMPDIR$i"
> +        mkdir -p "$TMPDIR$i"
> +    done
>  }
> 
>  python() {
> @@ -148,8 +150,10 @@ python() {
>                      )
> 
>                  ws = re.match(r"^\s*", d.getVar(e, False)).group()
> +                # remove prefix ${TMPDIR}, so we don't have absolute paths in
> variable e
> +                dirs = [dir[len(tmpdir):] for dir in rcleandirs]
>                  d.prependVar(
> -                    e, cleandir_code.format(ws=ws, dirlist=" ".join(rcleandirs))
> +                    e, cleandir_code.format(ws=ws, dirlist="
> + ".join(dirs))
>                  )
>  }
> 
> --
> 2.30.2
> 
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to isar-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.g
> oogle.com%2Fd%2Fmsgid%2Fisar-users%2F20220404111613.2159786-5-
> adriaan.schmidt%2540siemens.com&amp;data=04%7C01%7Cfelix.moessbauer
> %40siemens.com%7C59454b1a80a746e5e34008da162c9418%7C38ae3bcd9579
> 4fd4addab42e1495d55a%7C1%7C0%7C637846678701794447%7CUnknown%7C
> TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
> VCI6Mn0%3D%7C2000&amp;sdata=eqpc14UYg7%2FH4z2xJnu%2F3GLthvMv67s
> Xj4NLt65eIR0%3D&amp;reserved=0.

  reply	other threads:[~2022-04-08 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 11:16 [PATCH 0/4] Improve cacheability Adriaan Schmidt
2022-04-04 11:16 ` [PATCH 1/4] bitbake.conf: always start with empty SRC_URI Adriaan Schmidt
2022-04-04 11:16 ` [PATCH 2/4] bitbake.conf: add isar paths to BB_HASHBASE_WHITELIST Adriaan Schmidt
2022-04-04 11:16 ` [PATCH 3/4] isar-bootstrap: no absolute paths in SRC_URI Adriaan Schmidt
2022-04-04 11:16 ` [PATCH 4/4] base.bbclass: don't pass absolute paths to root_cleandirs Adriaan Schmidt
2022-04-08 15:41   ` Moessbauer, Felix [this message]
2022-04-12 12:09     ` Schmidt, Adriaan

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=AM9PR10MB48697525BA0D59662614871989E99@AM9PR10MB4869.EURPRD10.PROD.OUTLOOK.COM \
    --to=felix.moessbauer@siemens.com \
    --cc=adriaan.schmidt@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