From 77feb7b76ab3388351ade029042158aa78914b54 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Sat, 9 Jul 2016 16:42:48 -0400 Subject: [PATCH 1/5] Decompose readLink and makeLink helper functions. Part of #7374. --- tools/cli/dev-bundle-links.js | 9 +++++++++ tools/cli/dev-bundle.js | 5 +++-- tools/project-context.js | 9 +++------ 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 tools/cli/dev-bundle-links.js diff --git a/tools/cli/dev-bundle-links.js b/tools/cli/dev-bundle-links.js new file mode 100644 index 0000000000..698c4ca7b8 --- /dev/null +++ b/tools/cli/dev-bundle-links.js @@ -0,0 +1,9 @@ +var fs = require("fs"); + +exports.makeLink = function (target, linkPath) { + fs.symlinkSync(target, linkPath, "junction"); +}; + +exports.readLink = function (linkPath) { + return fs.realpathSync(linkPath); +}; diff --git a/tools/cli/dev-bundle.js b/tools/cli/dev-bundle.js index da6a06491f..0de6711891 100644 --- a/tools/cli/dev-bundle.js +++ b/tools/cli/dev-bundle.js @@ -7,6 +7,7 @@ var fs = require("fs"); var path = require("path"); +var links = require("./dev-bundle-links.js"); var rootDir = path.resolve(__dirname, "..", ".."); var defaultDevBundlePromise = Promise.resolve(path.join(rootDir, "dev_bundle")); @@ -34,7 +35,7 @@ function getDevBundleDir() { var devBundleStat = statOrNull(devBundleLink, "isDirectory"); if (devBundleStat) { return new Promise(function (resolve) { - resolve(fs.realpathSync(devBundleLink)); + resolve(links.readLink(devBundleLink)); }); } @@ -48,7 +49,7 @@ function getDevBundleDir() { return getDevBundleForRelease(release).then(function (devBundleDir) { if (devBundleDir) { - fs.symlink(devBundleDir, devBundleLink, "junction"); + links.makeLink(devBundleDir, devBundleLink); return devBundleDir; } diff --git a/tools/project-context.js b/tools/project-context.js index 3442ca138f..34b3838757 100644 --- a/tools/project-context.js +++ b/tools/project-context.js @@ -1386,12 +1386,9 @@ _.extend(exports.ReleaseFile.prototype, { } } - files.symlink( - newTarget, - devBundleLink, - // Since the target is a directory, Windows can create a junction - // without needing administrator privileges. - "junction" + require("./cli/dev-bundle-links.js").makeLink( + files.convertToOSPath(newTarget), + files.convertToOSPath(devBundleLink) ); }, From 1dac34f00cfad25bc35c3b5f4fcb0368968fe1eb Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Sat, 9 Jul 2016 17:15:14 -0400 Subject: [PATCH 2/5] Store .meteor/dev_bundle target as text when symbolic linking fails. This wouldn't work if .meteor/dev_bundle needed to be a true symbolic link, but fortunately we just need to record the target path in a way that allows us to read it later. Fixes #7374. --- tools/cli/dev-bundle-links.js | 22 ++++++++++++++++++++-- tools/cli/dev-bundle.js | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/cli/dev-bundle-links.js b/tools/cli/dev-bundle-links.js index 698c4ca7b8..b4de1464e0 100644 --- a/tools/cli/dev-bundle-links.js +++ b/tools/cli/dev-bundle-links.js @@ -1,9 +1,27 @@ var fs = require("fs"); exports.makeLink = function (target, linkPath) { - fs.symlinkSync(target, linkPath, "junction"); + var tempPath = linkPath + "-" + Math.random().toString(36).slice(2); + + try { + fs.symlinkSync(target, tempPath, "junction"); + } catch (e) { + fs.writeFileSync(tempPath, target, "utf8"); + } + + fs.renameSync(tempPath, linkPath); }; exports.readLink = function (linkPath) { - return fs.realpathSync(linkPath); + var stat = fs.lstatSync(linkPath); + + if (stat.isSymbolicLink()) { + return fs.realpathSync(linkPath); + } + + if (stat.isFile()) { + return fs.readFileSync(linkPath, "utf8"); + } + + return linkPath; }; diff --git a/tools/cli/dev-bundle.js b/tools/cli/dev-bundle.js index 0de6711891..286eb5d0a2 100644 --- a/tools/cli/dev-bundle.js +++ b/tools/cli/dev-bundle.js @@ -32,7 +32,7 @@ function getDevBundleDir() { "dev_bundle" ); - var devBundleStat = statOrNull(devBundleLink, "isDirectory"); + var devBundleStat = statOrNull(devBundleLink); if (devBundleStat) { return new Promise(function (resolve) { resolve(links.readLink(devBundleLink)); From 07e4bb081475016b743322e7c2ed945b85e53fc6 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Sat, 9 Jul 2016 17:22:28 -0400 Subject: [PATCH 3/5] Bump package versions for 1.3.4.4-rc.0 release. --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-experimental.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index 5514fe3c74..a555b02915 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.3.4_3' + version: '1.3.4-4-rc.0' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-experimental.json b/scripts/admin/meteor-release-experimental.json index b37ea7b66f..b1b64812d8 100644 --- a/scripts/admin/meteor-release-experimental.json +++ b/scripts/admin/meteor-release-experimental.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "1.3.4.3-rc.2", + "version": "1.3.4.4-rc.0", "recommended": false, "official": false, "description": "Meteor" From 0689cae25a3e0da3615a402cdd0bec94ce8455c8 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Sun, 10 Jul 2016 10:03:39 -0400 Subject: [PATCH 4/5] Set loglevel = error for `Npm.depends`-related `npm` commands. --- tools/isobuild/meteor-npm-userconfig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/isobuild/meteor-npm-userconfig b/tools/isobuild/meteor-npm-userconfig index dbb8f15466..0cc575c925 100644 --- a/tools/isobuild/meteor-npm-userconfig +++ b/tools/isobuild/meteor-npm-userconfig @@ -1,2 +1,7 @@ -# This file intentionally left empty to ensure consistent npm -# configuration. +# These configuration options govern `npm` commands run on behalf of +# Meteor packages that have `Npm.depends` calls in their package.js files, +# not `meteor npm ...` commands. Because the developer is not running +# these commands herself, we don't care as much about helpful warnings, +# and we certainly don't want them to obscure actual errors. + +loglevel = error From ab0f803b06dd85c88513c733ec29c661ad79571c Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Sun, 10 Jul 2016 10:06:40 -0400 Subject: [PATCH 5/5] Bump package versions for the official 1.3.4.4 release. --- packages/meteor-tool/package.js | 2 +- scripts/admin/meteor-release-official.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/meteor-tool/package.js b/packages/meteor-tool/package.js index a555b02915..0d39040a98 100644 --- a/packages/meteor-tool/package.js +++ b/packages/meteor-tool/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "The Meteor command-line tool", - version: '1.3.4-4-rc.0' + version: '1.3.4_4' }); Package.includeTool(); diff --git a/scripts/admin/meteor-release-official.json b/scripts/admin/meteor-release-official.json index 0ef452a33d..f2f4992061 100644 --- a/scripts/admin/meteor-release-official.json +++ b/scripts/admin/meteor-release-official.json @@ -1,6 +1,6 @@ { "track": "METEOR", - "version": "1.3.4.3", + "version": "1.3.4.4", "recommended": false, "official": true, "description": "The Official Meteor Distribution"