summaryrefslogtreecommitdiff
path: root/baserockimport
diff options
context:
space:
mode:
authorZara Zaimeche <zara.zaimeche@codethink.co.uk>2015-06-08 17:54:09 +0100
committerBaserock Gerrit <gerrit@baserock.org>2015-06-09 14:37:53 +0000
commit40319435eea7cbdd74057a05540c727b597256cd (patch)
tree70a801b4b8ddb86bd83c9fd5db273e7279bb750f /baserockimport
parent298238d9a5cd2e96c8e04007dad50ec19d6d68cb (diff)
downloadimport-40319435eea7cbdd74057a05540c727b597256cd.tar.gz
Fix: honour version flag in npm.to_lorry extension
This fixes a version bug in npm.to_lorry that meant the most recent db entry was used for repo location, regardless of the version specified. The npm registry is a database of all versions of all packages, listing names, source locations, etc. There was a fun bug in npm.to_lorry that meant that the import tool would try access the repo listed in the database entry for the latest version of the package, rather than for the version specified. This meant that if version 1.0.1 of a package had the right url listed, but something was wrong with the url listed for version 1.4.6, the tool would error out, even if version 1.0.1 was requested. Change-Id: If40c8b4c85f5e27fee07ee88daa1e5d2d347944f
Diffstat (limited to 'baserockimport')
-rwxr-xr-xbaserockimport/exts/npm.to_lorry9
1 files changed, 8 insertions, 1 deletions
diff --git a/baserockimport/exts/npm.to_lorry b/baserockimport/exts/npm.to_lorry
index 65d8712..ab66f44 100755
--- a/baserockimport/exts/npm.to_lorry
+++ b/baserockimport/exts/npm.to_lorry
@@ -25,11 +25,18 @@ npm.load(function(er, npm) {
throw ("Usage: ./npm.to_lorry PACKAGENAME [VERSION]");
}
+ if (process.argv.length === 4)
+ packageVersion = process.argv[3];
+ else
+ packageVersion = 'latest';
+
packageName = process.argv[2];
+ var package = packageName +'@' + packageVersion;
+
if (er) throw er;
- npm.commands.view([packageName], "silent", getRepo);
+ npm.commands.view([package], "silent", getRepo);
function getRepo(er, packageInfo){
if (er) throw er;