mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
closer to having meteor update work
This commit is contained in:
@@ -191,7 +191,7 @@ _.extend(Catalog.prototype, {
|
||||
deps.push(packageName);
|
||||
if (constraint) {
|
||||
var utils = require('./utils.js');
|
||||
var vers = utils.parseConstraint(constraint);
|
||||
var vers = utils.parseVersionConstraint(constraint);
|
||||
vers['packageName'] = packageName;
|
||||
constr.push(vers);
|
||||
}
|
||||
|
||||
@@ -496,6 +496,33 @@ main.registerCommand({
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// OK, let's figure out what release fits with our package constraints!
|
||||
// XXX this will actually be a loop over possible releases in the non-force
|
||||
// case
|
||||
// XXX better error checking on name
|
||||
var releaseRecord = catalog.getReleaseVersion(
|
||||
release.current.name.split('@')[0], release.current.name.split('@')[1]);
|
||||
if (!releaseRecord)
|
||||
throw Error("missing release record?");
|
||||
var directDependencies = project.getDirectDependencies(options.appDir);
|
||||
var previousVersions = project.getIndirectDependencies(options.appDir);
|
||||
var constraints = project.combinedConstraints(
|
||||
directDependencies, releaseRecord.packages);
|
||||
var solutionVersions = catalog.resolveConstraints(
|
||||
constraints, { previousSolution: previousVersions });
|
||||
if (!solutionVersions) {
|
||||
// XXX text
|
||||
process.stderr.write(
|
||||
"Couldn't solve the update to " + release.current.name + ". Ah well.\n");
|
||||
return 1;
|
||||
}
|
||||
project.setDependencies(options.appDir, directDependencies.appDeps,
|
||||
solutionVersions);
|
||||
// XXX did we have to change some package versions? we should probably
|
||||
// mention that fact.
|
||||
|
||||
|
||||
// Find upgraders (in order) necessary to upgrade the app for the new
|
||||
// release (new metadata file formats, etc, or maybe even updating renamed
|
||||
// APIs).
|
||||
|
||||
@@ -5,7 +5,7 @@ var packageCache = require('./package-cache.js');
|
||||
var catalog = require('./catalog.js');
|
||||
var utils = require('./utils.js');
|
||||
var buildmessage = require('./buildmessage.js');
|
||||
var Unipackage = require('./unipackage.js').Unipackage;
|
||||
var unipackage = require('./unipackage.js');
|
||||
|
||||
// options:
|
||||
// - versions: a map from package name to the version to use. or null to only
|
||||
@@ -46,7 +46,7 @@ _.extend(PackageLoader.prototype, {
|
||||
return null;
|
||||
buildmessage.error("package not available: " + name);
|
||||
// recover by returning a dummy (empty) package
|
||||
var pkg = new Unipackage;
|
||||
var pkg = new unipackage.Unipackage;
|
||||
pkg.initEmpty(name);
|
||||
return pkg;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ var meteorReleaseFilePath = function (appDir) {
|
||||
// field with the version constriant, and boolean values for exact and weak. (We
|
||||
// use this format because we treat release packages as exact weak
|
||||
// dependencies.) The result of this gets passed into the constraint solver.
|
||||
project.combinedConstraints = function (deps) {
|
||||
project.combinedConstraints = function (deps, releasePackages) {
|
||||
var allDeps = [];
|
||||
|
||||
_.each(deps.appDeps, function (constraint, packageName) {
|
||||
@@ -230,13 +230,13 @@ project.combinedConstraints = function (deps) {
|
||||
utils.parseVersionConstraint(constraint)));
|
||||
});
|
||||
});
|
||||
var releasePackages = release.current.manifest ? release.current.manifest.packages : {};
|
||||
|
||||
_.each(releasePackages, function(version, name) {
|
||||
allDeps.push({packageName: name, version: version, weak: true, exact: true});
|
||||
});
|
||||
// XXX grr
|
||||
allDeps.push({packageName: "ctl", version: null });
|
||||
|
||||
|
||||
return allDeps;
|
||||
};
|
||||
|
||||
@@ -249,19 +249,20 @@ project.combinedConstraints = function (deps) {
|
||||
project.generatePackageLoader = function (appDir) {
|
||||
var versions = project.getIndirectDependencies(appDir);
|
||||
var packages = project.getDirectDependencies(appDir);
|
||||
var releasePackages =
|
||||
release.current.isProperRelease() ? release.current.getPackages() : {};
|
||||
|
||||
// package name -> list of version constraints
|
||||
var allPackages = project.combinedConstraints(packages);
|
||||
var allPackages = project.combinedConstraints(packages, releasePackages);
|
||||
// Call the constraint solver.
|
||||
var newVersions = catalog.catalog.resolveConstraints(allPackages,
|
||||
{ previousSolution: versions });
|
||||
var newVersions = catalog.catalog.resolveConstraints(
|
||||
allPackages, { previousSolution: versions });
|
||||
if ( ! newVersions) {
|
||||
console.log("Cannot compute versions for: ", allPackages);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Download any necessary package builds and write out the new versions file.
|
||||
delete packages["ctl"];
|
||||
project.setDependencies(appDir, packages.appDeps, newVersions);
|
||||
|
||||
var PackageLoader = require('./package-loader.js');
|
||||
|
||||
@@ -11,7 +11,7 @@ var Release = function (options) {
|
||||
var self = this;
|
||||
|
||||
// If an actual, proper, "released" release, the name of the
|
||||
// release, eg, "1.0". If not a proper release, null.
|
||||
// release, eg, "METEOR-CORE@1.0". If not a proper release, null.
|
||||
self.name = options.name;
|
||||
|
||||
if (self.name === null) {
|
||||
|
||||
@@ -138,6 +138,8 @@ exports.randomPort = function () {
|
||||
return 20000 + Math.floor(Math.random() * 10000);
|
||||
};
|
||||
|
||||
// XXX minimize duplication between this, tools/package-version-parser,
|
||||
// and packages/package-version-parser
|
||||
// Given a version constraint string of the form "1.0.0" or "=1.2.3-rc0",
|
||||
// return an object with keys:
|
||||
// - version: the version part of the constraint, such as "1.0.0" or "1.2.3"
|
||||
@@ -149,7 +151,7 @@ exports.randomPort = function () {
|
||||
// gracefully and print a reasonable error if the user typos their
|
||||
// version constraint in package or whatever
|
||||
exports.parseVersionConstraint = function (versionString) {
|
||||
var versionDesc = { version: null, exact: false };
|
||||
var versionDesc = { version: null, type: 'compatible-with' };
|
||||
|
||||
// XXX #noconstraint #geoff #changed
|
||||
// XXX remove none when it is no longer used
|
||||
@@ -158,7 +160,7 @@ exports.parseVersionConstraint = function (versionString) {
|
||||
}
|
||||
|
||||
if (versionString.charAt(0) === '=') {
|
||||
versionDesc.exact = true;
|
||||
versionDesc.type = 'exactly';
|
||||
versionString = versionString.substr(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user