diff --git a/lib/packagefetcher/git.js b/lib/packagefetcher/git.js index c9cadac..0d8592a 100644 --- a/lib/packagefetcher/git.js +++ b/lib/packagefetcher/git.js @@ -51,6 +51,7 @@ function fetchMetaDataFromGit(baseDir, dependencyName, versionSpec, callback) { delete parsedUrl.hash; + /* Compose a Git URL out of the parsed object */ var gitURL = parsedUrl.format(); /* Compose a metadata object out of the git repository */ @@ -110,6 +111,7 @@ function fetchMetaDataFromGit(baseDir, dependencyName, versionSpec, callback) { }, function(callback) { + /* When no commitIsh has been provide, parse the revision of HEAD */ var branch; if(commitIsh === null) { @@ -141,6 +143,7 @@ function fetchMetaDataFromGit(baseDir, dependencyName, versionSpec, callback) { function(callback) { if(commitIsh !== null && rev == "") { + /* If we were still unable to parse a revision, we try to parse the revision of the origin's branch */ process.stderr.write("Parsing the revision of commitish: origin/"+commitIsh+"\n"); /* Resolve the hash of the branch/tag */ @@ -169,6 +172,7 @@ function fetchMetaDataFromGit(baseDir, dependencyName, versionSpec, callback) { if(rev == "") { callback(null); } else { + /* When we have resolved a revision, do a checkout of it */ rev = rev.substr(0, rev.length - 1); process.stderr.write("Checking out revision: "+rev+"\n"); @@ -196,7 +200,7 @@ function fetchMetaDataFromGit(baseDir, dependencyName, versionSpec, callback) { function(callback, packageJSON) { packageObj = JSON.parse(packageJSON); - /* Search for .git files to prune out of the checkout */ + /* Search for .git directories to prune out of the checkout */ var finder = findit(repositoryDir); finder.on("directory", function(dir, stat) { diff --git a/lib/packagefetcher/local.js b/lib/packagefetcher/local.js index cd51d15..8587e47 100644 --- a/lib/packagefetcher/local.js +++ b/lib/packagefetcher/local.js @@ -3,6 +3,23 @@ var path = require('path'); var slasp = require('slasp'); var nijs = require('nijs'); +function composeSourcePath(outputDir, versionSpec, resolvedPath) { + var first = versionSpec.substr(0, 1); + + if(first === '~' || first === '/') { // Path is absolute + return versionSpec; + } else { + // Compose path relative to the output directory + var srcPath = path.relative(outputDir, resolvedPath); + + if(srcPath.substr(0, 1) !== ".") { + srcPath = "./"+srcPath; // If a path starts with a . prefix it, so that it is a valid path in the Nix language + } + + return srcPath; + } +} + /** * @member packagefetcher.local * @@ -20,17 +37,8 @@ function fetchMetaDataFromLocalDirectory(baseDir, outputDir, versionSpec, callba process.stderr.write("fetching local directory: "+versionSpec+" from "+baseDir+"\n"); var resolvedPath = path.resolve(baseDir, versionSpec); - var first = versionSpec.substr(0, 1); - if ( first === '~' || first === '/') { - var srcPath = versionSpec; - } else { - var srcPath = path.relative(outputDir, resolvedPath); - - if(srcPath.substr(0, 1) !== ".") { - srcPath = "./"+srcPath; - } - } - + var srcPath = composeSourcePath(outputDir, versionSpec, resolvedPath); + slasp.sequence([ function(callback) { fs.readFile(path.join(resolvedPath, "package.json"), callback); diff --git a/node-packages.nix b/node-packages.nix index 9754744..38d5a45 100644 --- a/node-packages.nix +++ b/node-packages.nix @@ -202,13 +202,13 @@ let sha1 = "2d46fa874337af9498a2f12bb43d8d0be4a36873"; }; }; - "inherits-2.0.2" = { + "inherits-2.0.3" = { name = "inherits"; packageName = "inherits"; - version = "2.0.2"; + version = "2.0.3"; src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.2.tgz"; - sha1 = "7880e686ae72d327c3e7cdb406c3b71ad12b36b8"; + url = "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"; + sha1 = "633c2c83e3da42a502f52466022480f4208261de"; }; }; "typedarray-0.0.6" = { @@ -1093,13 +1093,13 @@ let sha1 = "7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"; }; }; - "signal-exit-3.0.0" = { + "signal-exit-3.0.1" = { name = "signal-exit"; packageName = "signal-exit"; - version = "3.0.0"; + version = "3.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.0.tgz"; - sha1 = "3c0543b65d7b4fbc60b6cd94593d9bf436739be8"; + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz"; + sha1 = "5a4c884992b63a7acd9badb7894c3ee9cfccad81"; }; }; "string-width-1.0.2" = { @@ -1350,7 +1350,7 @@ let sources."chownr-1.0.1" (sources."concat-stream-1.5.2" // { dependencies = [ - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."typedarray-0.0.6" (sources."readable-stream-2.0.6" // { dependencies = [ @@ -1409,7 +1409,7 @@ let (sources."readable-stream-2.0.6" // { dependencies = [ sources."core-util-is-1.0.2" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."isarray-1.0.0" sources."process-nextick-args-1.0.7" sources."string_decoder-0.10.31" @@ -1542,7 +1542,7 @@ let sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."minimatch-3.0.3" // { dependencies = [ (sources."brace-expansion-1.1.6" // { @@ -1568,7 +1568,7 @@ let dependencies = [ sources."buffer-shims-1.0.0" sources."core-util-is-1.0.2" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."isarray-1.0.0" sources."process-nextick-args-1.0.7" sources."string_decoder-0.10.31" @@ -1584,7 +1584,7 @@ let sources."has-color-0.1.7" sources."has-unicode-2.0.1" sources."object-assign-4.1.0" - sources."signal-exit-3.0.0" + sources."signal-exit-3.0.1" (sources."string-width-1.0.2" // { dependencies = [ (sources."code-point-at-1.0.0" // { @@ -1619,7 +1619,7 @@ let sources."proto-list-1.2.4" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."ini-1.3.4" (sources."mkdirp-0.5.1" // { dependencies = [ @@ -1689,7 +1689,7 @@ let }) ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) (sources."temp-0.8.3" // { diff --git a/tests/grunt/node-packages.nix b/tests/grunt/node-packages.nix index 15e20b2..d29e3de 100644 --- a/tests/grunt/node-packages.nix +++ b/tests/grunt/node-packages.nix @@ -301,13 +301,13 @@ let sha1 = "988df33feab191ef799a61369dd76c17adf957ea"; }; }; - "signal-exit-3.0.0" = { + "signal-exit-3.0.1" = { name = "signal-exit"; packageName = "signal-exit"; - version = "3.0.0"; + version = "3.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.0.tgz"; - sha1 = "3c0543b65d7b4fbc60b6cd94593d9bf436739be8"; + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz"; + sha1 = "5a4c884992b63a7acd9badb7894c3ee9cfccad81"; }; }; "array-find-index-1.0.1" = { @@ -580,13 +580,13 @@ let sha1 = "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a"; }; }; - "inherits-2.0.2" = { + "inherits-2.0.3" = { name = "inherits"; packageName = "inherits"; - version = "2.0.2"; + version = "2.0.3"; src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.2.tgz"; - sha1 = "7880e686ae72d327c3e7cdb406c3b71ad12b36b8"; + url = "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"; + sha1 = "633c2c83e3da42a502f52466022480f4208261de"; }; }; "once-1.4.0" = { @@ -1292,7 +1292,7 @@ let sources."array-find-index-1.0.1" ]; }) - sources."signal-exit-3.0.0" + sources."signal-exit-3.0.1" ]; }) sources."map-obj-1.0.1" @@ -1407,7 +1407,7 @@ let sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."once-1.4.0" // { dependencies = [ sources."wrappy-1.0.2" @@ -1425,7 +1425,7 @@ let sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."once-1.4.0" // { dependencies = [ sources."wrappy-1.0.2" @@ -1545,7 +1545,7 @@ let sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."once-1.4.0" // { dependencies = [ sources."wrappy-1.0.2" @@ -1581,7 +1581,7 @@ let sources."core-util-is-1.0.2" sources."isarray-0.0.1" sources."string_decoder-0.10.31" - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) sources."entities-1.0.0" @@ -1619,7 +1619,7 @@ let sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."once-1.4.0" // { dependencies = [ sources."wrappy-1.0.2" @@ -1653,7 +1653,7 @@ let sources."depd-1.1.0" (sources."http-errors-1.3.1" // { dependencies = [ - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."statuses-1.3.0" ]; }) diff --git a/tests/grunt/supplement.nix b/tests/grunt/supplement.nix index 054cdd4..fc74eb7 100644 --- a/tests/grunt/supplement.nix +++ b/tests/grunt/supplement.nix @@ -301,13 +301,13 @@ let sha1 = "988df33feab191ef799a61369dd76c17adf957ea"; }; }; - "signal-exit-3.0.0" = { + "signal-exit-3.0.1" = { name = "signal-exit"; packageName = "signal-exit"; - version = "3.0.0"; + version = "3.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.0.tgz"; - sha1 = "3c0543b65d7b4fbc60b6cd94593d9bf436739be8"; + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz"; + sha1 = "5a4c884992b63a7acd9badb7894c3ee9cfccad81"; }; }; "array-find-index-1.0.1" = { @@ -580,13 +580,13 @@ let sha1 = "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a"; }; }; - "inherits-2.0.2" = { + "inherits-2.0.3" = { name = "inherits"; packageName = "inherits"; - version = "2.0.2"; + version = "2.0.3"; src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.2.tgz"; - sha1 = "7880e686ae72d327c3e7cdb406c3b71ad12b36b8"; + url = "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"; + sha1 = "633c2c83e3da42a502f52466022480f4208261de"; }; }; "once-1.4.0" = { @@ -1285,7 +1285,7 @@ in sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."minimatch-3.0.3" // { dependencies = [ (sources."brace-expansion-1.1.6" // { diff --git a/tests/node-packages-v4.nix b/tests/node-packages-v4.nix index d1627eb..a1fc156 100644 --- a/tests/node-packages-v4.nix +++ b/tests/node-packages-v4.nix @@ -571,13 +571,13 @@ let sha1 = "dded45cc18256d51ed40aec142489d5c61026d28"; }; }; - "inherits-2.0.2" = { + "inherits-2.0.3" = { name = "inherits"; packageName = "inherits"; - version = "2.0.2"; + version = "2.0.3"; src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.2.tgz"; - sha1 = "7880e686ae72d327c3e7cdb406c3b71ad12b36b8"; + url = "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"; + sha1 = "633c2c83e3da42a502f52466022480f4208261de"; }; }; "send-0.13.2" = { @@ -1621,13 +1621,13 @@ let sha1 = "7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"; }; }; - "signal-exit-3.0.0" = { + "signal-exit-3.0.1" = { name = "signal-exit"; packageName = "signal-exit"; - version = "3.0.0"; + version = "3.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.0.tgz"; - sha1 = "3c0543b65d7b4fbc60b6cd94593d9bf436739be8"; + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz"; + sha1 = "5a4c884992b63a7acd9badb7894c3ee9cfccad81"; }; }; "string-width-1.0.2" = { @@ -2121,7 +2121,7 @@ in sources."destroy-1.0.3" (sources."http-errors-1.3.1" // { dependencies = [ - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) sources."mime-1.3.4" @@ -2138,7 +2138,7 @@ in sources."destroy-1.0.4" (sources."http-errors-1.3.1" // { dependencies = [ - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) sources."mime-1.3.4" @@ -2289,8 +2289,8 @@ in version = "4.16.0-pre"; src = fetchgit { url = "git://github.com/lodash/lodash"; - rev = "8176d56c725489156e19d68aeaf8851d313f4446"; - sha256 = "92205818347cc8d1880152f87d25ddc28308d2b584a1ba2c135b9fa2664b6018"; + rev = "d2a2b3a8c408b125a4986442110a7b4c811bfb71"; + sha256 = "9890cce3193f3ce8188877b33ad0e275733c2b514103cbe87281665138c3d4cc"; }; buildInputs = globalBuildInputs; meta = { @@ -2359,7 +2359,7 @@ in sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."minimatch-3.0.3" // { dependencies = [ (sources."brace-expansion-1.1.6" // { @@ -2476,7 +2476,7 @@ in (sources."readable-stream-2.0.6" // { dependencies = [ sources."core-util-is-1.0.2" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."isarray-1.0.0" sources."process-nextick-args-1.0.7" sources."string_decoder-0.10.31" @@ -2613,7 +2613,7 @@ in dependencies = [ sources."buffer-shims-1.0.0" sources."core-util-is-1.0.2" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."isarray-1.0.0" sources."process-nextick-args-1.0.7" sources."string_decoder-0.10.31" @@ -2629,7 +2629,7 @@ in sources."has-color-0.1.7" sources."has-unicode-2.0.1" sources."object-assign-4.1.0" - sources."signal-exit-3.0.0" + sources."signal-exit-3.0.1" (sources."string-width-1.0.2" // { dependencies = [ (sources."code-point-at-1.0.0" // { @@ -2673,7 +2673,7 @@ in sources."wrappy-1.0.2" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" (sources."once-1.4.0" // { dependencies = [ sources."wrappy-1.0.2" @@ -2693,7 +2693,7 @@ in sources."graceful-fs-4.1.6" ]; }) - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) (sources."tar-pack-3.1.4" // { @@ -2706,12 +2706,12 @@ in (sources."fstream-1.0.10" // { dependencies = [ sources."graceful-fs-4.1.6" - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) (sources."fstream-ignore-1.0.5" // { dependencies = [ - sources."inherits-2.0.2" + sources."inherits-2.0.3" ]; }) (sources."once-1.3.3" // { @@ -2723,7 +2723,7 @@ in dependencies = [ sources."buffer-shims-1.0.0" sources."core-util-is-1.0.2" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."isarray-1.0.0" sources."process-nextick-args-1.0.7" sources."string_decoder-0.10.31" diff --git a/tests/node-packages-v5.nix b/tests/node-packages-v5.nix index ef24d63..96217f1 100644 --- a/tests/node-packages-v5.nix +++ b/tests/node-packages-v5.nix @@ -571,13 +571,13 @@ let sha1 = "dded45cc18256d51ed40aec142489d5c61026d28"; }; }; - "inherits-2.0.2" = { + "inherits-2.0.3" = { name = "inherits"; packageName = "inherits"; - version = "2.0.2"; + version = "2.0.3"; src = fetchurl { - url = "https://registry.npmjs.org/inherits/-/inherits-2.0.2.tgz"; - sha1 = "7880e686ae72d327c3e7cdb406c3b71ad12b36b8"; + url = "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"; + sha1 = "633c2c83e3da42a502f52466022480f4208261de"; }; }; "send-0.13.2" = { @@ -1594,13 +1594,13 @@ let sha1 = "7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"; }; }; - "signal-exit-3.0.0" = { + "signal-exit-3.0.1" = { name = "signal-exit"; packageName = "signal-exit"; - version = "3.0.0"; + version = "3.0.1"; src = fetchurl { - url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.0.tgz"; - sha1 = "3c0543b65d7b4fbc60b6cd94593d9bf436739be8"; + url = "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.1.tgz"; + sha1 = "5a4c884992b63a7acd9badb7894c3ee9cfccad81"; }; }; "string-width-1.0.2" = { @@ -2071,7 +2071,7 @@ in sources."http-errors-1.3.1" sources."mime-1.3.4" sources."statuses-1.2.1" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."media-typer-0.3.0" ]; buildInputs = globalBuildInputs; @@ -2168,8 +2168,8 @@ in version = "4.16.0-pre"; src = fetchgit { url = "git://github.com/lodash/lodash"; - rev = "8176d56c725489156e19d68aeaf8851d313f4446"; - sha256 = "92205818347cc8d1880152f87d25ddc28308d2b584a1ba2c135b9fa2664b6018"; + rev = "d2a2b3a8c408b125a4986442110a7b4c811bfb71"; + sha256 = "9890cce3193f3ce8188877b33ad0e275733c2b514103cbe87281665138c3d4cc"; }; buildInputs = globalBuildInputs; meta = { @@ -2227,7 +2227,7 @@ in sources."resolve-1.1.7" sources."glob-5.0.15" sources."inflight-1.0.5" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."minimatch-3.0.3" sources."once-1.4.0" sources."path-is-absolute-1.0.0" @@ -2330,7 +2330,7 @@ in sources."tunnel-agent-0.4.3" sources."readable-stream-2.0.6" sources."core-util-is-1.0.2" - sources."inherits-2.0.2" + sources."inherits-2.0.3" sources."isarray-1.0.0" sources."process-nextick-args-1.0.7" sources."string_decoder-0.10.31" @@ -2416,7 +2416,7 @@ in sources."has-color-0.1.7" sources."has-unicode-2.0.1" sources."object-assign-4.1.0" - sources."signal-exit-3.0.0" + sources."signal-exit-3.0.1" sources."string-width-1.0.2" sources."wide-align-1.1.0" sources."code-point-at-1.0.0"