bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Arno Baumfalk <a.baumfalk@astro-kom.de>
To: <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] fetch2/npm: evaluate PATH before patching HOME
Date: Wed, 24 May 2023 14:04:48 +0200 (CEST)	[thread overview]
Message-ID: <20230524120448.40B7640A91@labor3.labor.astro> (raw)

From 814de5df87fbd39c773177580639bb22862c11a6 Mon Sep 17 00:00:00 2001
From: Arno Baumfalk <a.baumfalk@astro-kom.de>
Date: Tue, 16 May 2023 17:18:26 +0200
Subject: [PATCH] fetch2/npm: evaluate PATH before patching HOME

When the user configures the TMPDIR variable in a way that it contains $HOME (in local.conf), the DataSmart (d) object's PATH variable will also contain $HOME.

As the NpmEnvironment patches HOME with a temporary directory, further evaluation of PATH will become invalid an the build breaks with an error (npm not found).

As countermeasure PATH is evaluated *before* patching HOME.

Signed-off-by: Arno Baumfalk <a.baumfalk@astro-kom.de>
---
 bitbake/lib/bb/fetch2/npm.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index 8a179a339a..e6d0598f5d 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -103,6 +103,7 @@ class NpmEnvironment(object):
         """Run npm command in a controlled environment"""
         with tempfile.TemporaryDirectory() as tmpdir:
             d = bb.data.createCopy(self.d)
+            d.setVar("PATH", d.getVar("PATH"))  # PATH might contain $HOME - evaluate it before patching
             d.setVar("HOME", tmpdir)
 
             if not workdir:
-- 
2.40.1



             reply	other threads:[~2023-05-24 12:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 12:04 Arno Baumfalk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-16 16:07 [PATCH] fetch2/npm: evaluate PATH before patching HOME Dr. Arno Baumfalk

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=20230524120448.40B7640A91@labor3.labor.astro \
    --to=a.baumfalk@astro-kom.de \
    --cc=bitbake-devel@lists.openembedded.org \
    /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;
as well as URLs for NNTP newsgroup(s).