From 3d64b13555340bbef9c98805beb4eff8770975b8 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Tue, 10 Mar 2015 03:50:41 -0700 Subject: [PATCH] Give more commands "--allow-incompatible-change" build, deploy, --prepare-app, and --get-ready for now. Make the error message more generic (not mention which commands support the flag, because it will be basically "all" of them). Also replace "breaking" with "potentially incompatible" as discussed with Matt a while back. --- packages/constraint-solver/input-tests.js | 2 +- packages/constraint-solver/solver.js | 7 ++++--- tools/commands-packages.js | 16 ++++++++++++---- tools/commands.js | 12 ++++++++---- tools/help.txt | 8 ++++++++ 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/packages/constraint-solver/input-tests.js b/packages/constraint-solver/input-tests.js index dbb8b011ab..29c3e700ee 100644 --- a/packages/constraint-solver/input-tests.js +++ b/packages/constraint-solver/input-tests.js @@ -184,7 +184,7 @@ Tinytest.add("constraint solver - input - don't break root dep", function (test) "bar 2.0.1": [] } } - }, 'Breaking change required to top-level dependency: bar 2.0.0, was 2.0.1.\nConstraints on package "bar":\n* bar@=2.0.0 <- foo 1.0.0\n\nTo allow breaking changes to top-level dependencies, you must pass --allow-incompatible-update to meteor [run], update, add, or remove.'); + }, 'Potentially incompatible change required to top-level dependency: bar 2.0.0, was 2.0.1.\nConstraints on package "bar":\n* bar@=2.0.0 <- foo 1.0.0\n\nTo allow potentially incompatible changes to top-level dependencies, you must pass --allow-incompatible-update on the command line.'); }); Tinytest.add("constraint solver - input - don't pick RCs", function (test) { diff --git a/packages/constraint-solver/solver.js b/packages/constraint-solver/solver.js index d8e166e99d..e5a5fd7d86 100644 --- a/packages/constraint-solver/solver.js +++ b/packages/constraint-solver/solver.js @@ -713,12 +713,13 @@ CS.Solver.prototype.getSolution = function (options) { var pv = CS.PackageAndVersion.fromString(pvStr); var prevVersion = input.previousSolution[pv.package]; self.errors.push( - 'Breaking change required to top-level dependency: ' + + 'Potentially incompatible change required to top-level dependency: ' + pvStr + ', was ' + prevVersion + '.\n' + self.listConstraintsOnPackage(pv.package)); }); - self.errors.push('To allow breaking changes to top-level dependencies, you ' + - 'must pass --allow-incompatible-update to meteor [run], update, add, or remove.'); + self.errors.push('To allow potentially incompatible changes to top-level ' + + 'dependencies, you must pass --allow-incompatible-update ' + + 'on the command line.'); self.throwAnyErrors(); } diff --git a/tools/commands-packages.js b/tools/commands-packages.js index ea37633d98..ab0d0cabef 100644 --- a/tools/commands-packages.js +++ b/tools/commands-packages.js @@ -112,14 +112,18 @@ var formatArchitecture = function (s) { // whenever necessary! main.registerCommand({ name: '--get-ready', - catalogRefresh: new catalog.Refresh.OnceAtStart({ ignoreErrors: false }) + catalogRefresh: new catalog.Refresh.OnceAtStart({ ignoreErrors: false }), + options: { + 'allow-incompatible-update': { type: Boolean } + } }, function (options) { // If we're in an app, make sure that we can build the current app. Otherwise // just make sure that we can build some fake app. var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir || files.mkdtemp('meteor-get-ready'), neverWriteProjectConstraintsFile: true, - neverWritePackageMap: true + neverWritePackageMap: true, + allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while initializing project:", function () { projectContext.initializeCatalog(); @@ -157,10 +161,14 @@ main.registerCommand({ main.registerCommand({ name: '--prepare-app', requiresApp: true, - catalogRefresh: new catalog.Refresh.Never() + catalogRefresh: new catalog.Refresh.Never(), + options: { + 'allow-incompatible-update': { type: Boolean } + } }, function (options) { var projectContext = new projectContextModule.ProjectContext({ - projectDir: options.appDir + projectDir: options.appDir, + allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while initializing project:", function () { projectContext.prepareProjectForBuild(); diff --git a/tools/commands.js b/tools/commands.js index c63daa6bb3..99077cace3 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -712,7 +712,8 @@ var buildCommands = { server: { type: String }, // XXX COMPAT WITH 0.9.2.2 "mobile-port": { type: String }, - verbose: { type: Boolean, short: "v" } + verbose: { type: Boolean, short: "v" }, + 'allow-incompatible-update': { type: Boolean } }, catalogRefresh: new catalog.Refresh.Never() }; @@ -761,7 +762,8 @@ var buildCommand = function (options) { var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir, - serverArchitectures: _.uniq([bundleArch, archinfo.host()]) + serverArchitectures: _.uniq([bundleArch, archinfo.host()]), + allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while initializing project:", function () { @@ -1078,7 +1080,8 @@ main.registerCommand({ // it contains binary packages that should be incompatible. A hack to allow // people to deploy from checkout or do other weird shit. We are not // responsible for the consequences. - 'override-architecture-with-local' : { type: Boolean } + 'override-architecture-with-local' : { type: Boolean }, + 'allow-incompatible-update': { type: Boolean } }, requiresApp: function (options) { return ! options.delete; @@ -1125,7 +1128,8 @@ main.registerCommand({ var projectContext = new projectContextModule.ProjectContext({ projectDir: options.appDir, - serverArchitectures: _.uniq([buildArch, archinfo.host()]) + serverArchitectures: _.uniq([buildArch, archinfo.host()]), + allowIncompatibleUpdate: options['allow-incompatible-update'] }); main.captureAndExit("=> Errors while initializing project:", function () { diff --git a/tools/help.txt b/tools/help.txt index 17c04f7a77..c8d5376389 100644 --- a/tools/help.txt +++ b/tools/help.txt @@ -296,6 +296,10 @@ Options: developer machine's architecture. Valid architectures include os.osx.x86_64, os.linux.x86_64, and os.linux.x86_32. + --allow-incompatible-update Allow packages in your project to be upgraded or + downgraded to versions that are potentially incompatible + with the current versions, if required to satisfy all + package version constraints. >>> shell @@ -379,6 +383,10 @@ Options: --delete, -D permanently delete this deployment --debug deploy in debug mode (don't minify, etc) --settings set optional data for Meteor.settings + --allow-incompatible-update Allow packages in your project to be upgraded or + downgraded to versions that are potentially incompatible with + the current versions, if required to satisfy all package version + constraints. >>> logs