From acafbccb32510bca036894287afbe83765bc2d30 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.26.2
--

Mit freundlichen Grüßen

 

ASTRO Strobel                      
Kommunikationssysteme GmbH

 

Dr. Arno Baumfalk
Entwicklung


Telefon: +49 (0) 2204 405 228
Fax: +49 (0) 2204 405 220
eMail a.baumfalk@astro-kom.de
Internet: www.astro-kom.de

Folgen Sie uns    

 

 

ASTRO Strobel Kommunikationssysteme GmbH
Olefant 1-3 · 51427 Bergisch Gladbach
Geschäftsführer: Herbert Strobel
Registergericht Köln HRB 46271
Steuer-Nr. 204/5710/0569 · USt.ID-Nr. DE 121980384

Die Informationen in dieser eMail zusammen mit allen Anlagen sind streng vertraulich. Sie sind ausschließlich für den Gebrauch des rechtmäßigen Empfängers bestimmt. Jegliche Weitergabe ohne unsere ausdrückliche Genehmigung ist verboten und kann strafrechtlich verfolgt werden. Sollten Sie nicht der vorgesehene Empfänger dieser E-Mail sein, informieren Sie uns bitte unter 02204/405-0 oder leiten Sie die Mail an uns zurück a.baumfalk@astro-kom.de. Löschen Sie bitte die E-Mail von Ihrem System. Die ASTRO Strobel Kommunikationssysteme GmbH trägt weder die Verantwortung für die richtige und vollständige Übertragung dieser E-Mail noch für die Verzögerungen in der Übertragung.

The information and attachments in this e-mail are strictly confidential. They are for the exclusive use of the legitimate recipient. Any transfer without our express approval is prohibited and can be prosecuted. If you are not the destined recipient of this e-mail, please inform us by phone number +49 2204 405 0 or send the e-mail back to a.baumfalk@astro-kom.de. Please delete this e-mail from your system. The ASTRO Strobel Kommunikationssysteme GmbH is neither responsible for the complete transmission of this e-mail nor for transmission delays.