[OE-core] [PATCH v2] (PRE)MIRRORS: add pattern for npm:// without slash

Olaf Mandel o.mandel at menlosystems.com
Fri Aug 25 09:58:08 UTC 2017


For URIs with the npm:// transport but with no other slash in it, the
common MIRRORS and PREMIRRORS pattern of npm://.*/.* fails to match.
Add a new pattern in the mirros.bbclass and own-mirrors.bbclass classes
for these URIs.

Many URIs with the npm:// transport have no slash after the host part:

  npm://registry.npmjs.org;name=foo;version=0.1.2

This means that MIRRORS and PREMIRRORS containing entries like the
first one will not match these URIs:

  npm://.*/.*   # fails to match
  npm://.*      # matches

The npm:// URIs without a slash also matches URIs with a slash, but
then the file is searched for on the mirror with the same path that was
in the URI. Because of that, the pattern with the slash should be first
in the list, to prevent extra requests to the mirrors containing the
wrong path.

Signed-off-by: Olaf Mandel <o.mandel at menlosystems.com>
---
 meta/classes/mirrors.bbclass     | 2 ++
 meta/classes/own-mirrors.bbclass | 1 +
 2 files changed, 3 insertions(+)

diff --git a/meta/classes/mirrors.bbclass b/meta/classes/mirrors.bbclass
index b98684f5c6..7ac654494b 100644
--- a/meta/classes/mirrors.bbclass
+++ b/meta/classes/mirrors.bbclass
@@ -49,6 +49,7 @@ osc://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \n \
 https?$://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
 ftp://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \n \
 npm://.*/.*     http://downloads.yoctoproject.org/mirror/sources/ \n \
+npm://.*        http://downloads.yoctoproject.org/mirror/sources/ \n \
 cvs://.*/.*     http://sources.openembedded.org/ \n \
 svn://.*/.*     http://sources.openembedded.org/ \n \
 git://.*/.*     http://sources.openembedded.org/ \n \
@@ -59,6 +60,7 @@ osc://.*/.*     http://sources.openembedded.org/ \n \
 https?$://.*/.* http://sources.openembedded.org/ \n \
 ftp://.*/.*     http://sources.openembedded.org/ \n \
 npm://.*/.*     http://sources.openembedded.org/ \n \
+npm://.*        http://sources.openembedded.org/ \n \
 ${CPAN_MIRROR}  http://cpan.metacpan.org/ \n \
 ${CPAN_MIRROR}  http://search.cpan.org/CPAN/ \n \
 "
diff --git a/meta/classes/own-mirrors.bbclass b/meta/classes/own-mirrors.bbclass
index 12b42675bc..c70b94e7dc 100644
--- a/meta/classes/own-mirrors.bbclass
+++ b/meta/classes/own-mirrors.bbclass
@@ -10,4 +10,5 @@ osc://.*/.*     ${SOURCE_MIRROR_URL}
 https?$://.*/.* ${SOURCE_MIRROR_URL}
 ftp://.*/.*     ${SOURCE_MIRROR_URL}
 npm://.*/.*     ${SOURCE_MIRROR_URL}
+npm://.*        ${SOURCE_MIRROR_URL}
 }
-- 
2.11.0




More information about the Openembedded-core mailing list