bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: belouargamohamed@gmail.com
To: bitbake-devel@lists.openembedded.org
Cc: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
Subject: [master][PATCH v2 3/3] fetch2: npm: Remove special caracters that causes recipe tool to fail
Date: Sun,  4 Jun 2023 03:39:19 +0200	[thread overview]
Message-ID: <20230604013919.13904-3-m.belouarga@technologyandstrategy.com> (raw)
In-Reply-To: <20230604013919.13904-1-m.belouarga@technologyandstrategy.com>

From: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>

Packages like @(._.)/execute causes problems because they generate names
that are not supported by yocto

Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
---
 lib/bb/fetch2/npm.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index e6d0598f5d..f83485ad85 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -44,9 +44,12 @@ def npm_package(package):
     """Convert the npm package name to remove unsupported character"""
     # Scoped package names (with the @) use the same naming convention
     # as the 'npm pack' command.
-    if package.startswith("@"):
-        return re.sub("/", "-", package[1:])
-    return package
+    name = re.sub("/", "-", package)
+    name = name.lower()
+    name = re.sub(r"[^\-a-z0-9]", "", name)
+    name = name.strip("-")
+    return name
+
 
 def npm_filename(package, version):
     """Get the filename of a npm package"""
-- 
2.25.1



  parent reply	other threads:[~2023-06-04  1:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-04  1:39 [master][PATCH v2 1/3] bitbake: fetch2: npmsw: Add support for the new format of the shrinkwrap file belouargamohamed
2023-06-04  1:39 ` [master][PATCH v2 2/3] fetch2: npmsw: Don't fetch dev dependencies when they are not demanded belouargamohamed
2023-06-04  1:39 ` belouargamohamed [this message]
2023-06-07 12:43 ` [bitbake-devel] [master][PATCH v2 1/3] bitbake: fetch2: npmsw: Add support for the new format of the shrinkwrap file Alexandre Belloni
2023-06-07 13:05   ` belouargamohamed
2023-06-07 19:44     ` [bitbake-devel] " Alexandre Belloni

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=20230604013919.13904-3-m.belouarga@technologyandstrategy.com \
    --to=belouargamohamed@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=m.belouarga@technologyandstrategy.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;
as well as URLs for NNTP newsgroup(s).