Fixes to unforced update to not-quite-last release

Make sure that project._ensureDepsUpToDate does not get run mid-update,
since it might decide that various things are not compatible with the
packages in the current release. When the update command runs the
constraint solver explicitly, it passes ignoreProjectDeps, but implicit
calls can lead to an unhappy process.exit.
This commit is contained in:
David Glasser
2014-08-25 17:25:08 -07:00
parent 96e606ab89
commit 08f0a3bab0
2 changed files with 26 additions and 5 deletions

View File

@@ -1270,6 +1270,8 @@ main.registerCommand({
return 1;
}
var solutionReleaseRecord = null;
if (!options["packages-only"] && ! files.usesWarehouse()) {
process.stderr.write(
"You are running Meteor from a checkout, so we cannot update the Meteor release.\n" +
@@ -1443,7 +1445,7 @@ main.registerCommand({
var directDependencies = project.getConstraints();
var previousVersions;
var messages = buildmessage.capture(function () {
previousVersions = project.getVersions();
previousVersions = project.getVersions({dontRunConstraintSolver: true});
});
if (messages.hasMessages()) {
process.stderr.write(messages.formatMessages());
@@ -1481,11 +1483,14 @@ main.registerCommand({
}
return false;
}
solutionReleaseRecord = releaseRecord;
return true;
});
if (!solutionReleaseVersion) {
// XXX put an error here when we stop doing an error on every failure above
process.stdout.write(
"This project is at the latest release which is compatible with your\n" +
"current package constraints.\n");
return 1;
}
@@ -1544,10 +1549,23 @@ main.registerCommand({
// We can't update packages when we are not in a release.
if (!options.appDir) return 0;
var releasePackages = {};
if (release.current.isProperRelease()) {
if (solutionReleaseRecord) {
// We updated the release (well, possibly a no-op). Use the packages
// from the chosen release.
releasePackages = solutionReleaseRecord.packages;
} else {
// This maybe is --packages-only. Use the packages from the current
// release.
releasePackages = release.current.getPackages();
}
}
var versions, allPackages;
messages = buildmessage.capture(function () {
versions = project.getVersions();
allPackages = project.getCurrentCombinedConstraints();
versions = project.getVersions({dontRunConstraintSolver: true});
allPackages = project.calculateCombinedConstraints(releasePackages);
});
if (messages.hasMessages()) {
process.stderr.write(messages.formatMessages());

View File

@@ -428,8 +428,11 @@ _.extend(Project.prototype, {
// versions file.
//
// Returns an object mapping package name to its string version.
getVersions : function () {
getVersions : function (options) {
var self = this;
options = options || {};
if (options.dontRunConstraintSolver)
return self.dependencies;
buildmessage.assertInCapture();
self._ensureDepsUpToDate();
return self.dependencies;