mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
refactor package download stuff into tropohouse
also fix some punctuation of messages, etc
This commit is contained in:
@@ -583,7 +583,7 @@ main.registerCommand({
|
||||
|
||||
if (! versionInfo) {
|
||||
process.stderr.write(
|
||||
constraint.packageName + constraint.versionConstraint + ": no such version\n");
|
||||
constraint.packageName + "@" + constraint.versionConstraint + ": no such version\n");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -623,20 +623,24 @@ constraint.packageName + constraint.versionConstraint + ": no such version\n");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var buildInfo = cat.getAnyBuild(packageName, version);
|
||||
if (! buildInfo) {
|
||||
process.stderr.write("This package has no build at this version");
|
||||
// Make sure we have enough builds of the package downloaded such that
|
||||
// we can load a browser slice and a slice that will run on this
|
||||
// system. (Later we may also need to download more builds to be able to
|
||||
// deploy to another architecture.)
|
||||
var available = tropohouse.maybeDownloadPackageForArchitectures(
|
||||
versionInfo, ['browser', archinfo.host()]);
|
||||
if (! available) {
|
||||
// XXX maybe we shouldn't be letting the constraint solver choose
|
||||
// things that don't have the right arches?
|
||||
process.stderr.write("Package " + packageName +
|
||||
" has no compatible build for version " +
|
||||
version);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// If the tarball is not in the warehouse, download it there.
|
||||
if (! tropohouse.hasSpecifiedBuild(packageName, version,
|
||||
buildInfo.architecture)) {
|
||||
tropohouse.downloadSpecifiedBuild(packageName, version, buildInfo);
|
||||
}
|
||||
|
||||
process.stdout.write("Added :" + packageName + " at " + version + "\n");
|
||||
})
|
||||
process.stdout.write("Added: " + packageName + " at " + version + "\n");
|
||||
});
|
||||
|
||||
// Write the new indirect dependencies file.
|
||||
project.rewriteIndirectDependencies(options.appDir, newVersions);
|
||||
|
||||
@@ -9,6 +9,7 @@ var utils = require('./utils.js');
|
||||
var updater = require('./updater.js');
|
||||
var httpHelpers = require('./http-helpers.js');
|
||||
var fiberHelpers = require('./fiber-helpers.js');
|
||||
var release = require('./release.js');
|
||||
|
||||
var tropohouse = exports;
|
||||
|
||||
@@ -25,7 +26,7 @@ tropohouse.getWarehouseDir = function () {
|
||||
return path.join(warehouseBase, ".meteor");
|
||||
};
|
||||
|
||||
tropohouse.calculatePath= function(packageName, version, archString) {
|
||||
tropohouse.calculatePath = function(packageName, version, archString) {
|
||||
var uniquePath = path.join(packageName, version, archString);
|
||||
var fullPath = path.join(tropohouse.getWarehouseDir(), "packages", uniquePath);
|
||||
return fullPath;
|
||||
@@ -47,3 +48,26 @@ tropohouse.downloadSpecifiedBuild = function(packageName, version, buildRecord)
|
||||
// XXX: if there is a plus in archstring, split and for each one that does not exist, split into symlink.
|
||||
// XXX: make atomic.
|
||||
};
|
||||
|
||||
// Returns true if we now have the package.
|
||||
// XXX more precise error handling in offline case. maybe throw instead like
|
||||
// warehouse does.
|
||||
tropohouse.maybeDownloadPackageForArchitectures = function (versionInfo,
|
||||
architectures) {
|
||||
var cat = release.current.catalog;
|
||||
var buildInfo = cat.getAnyBuild(versionInfo.packageName, versionInfo.version);
|
||||
if (! buildInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the tarball is not in the warehouse, download it there.
|
||||
if (tropohouse.hasSpecifiedBuild(versionInfo.packageName,versionInfo.version,
|
||||
buildInfo.architecture)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// XXX error handling
|
||||
tropohouse.downloadSpecifiedBuild(
|
||||
versionInfo.packageName, versionInfo.version, buildInfo);
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user