Generate a dummy package.js in unipackages, to make the downloader happy.

Change the downloader to no longer expect packages to contain package.js.

This actually requires us (already!) to bump BUILD_VERSION, since I've already
published packages without the package.js!
This commit is contained in:
David Glasser
2013-07-15 13:25:26 -07:00
parent 71065615be
commit 2b80e5b973
2 changed files with 22 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ var sourcemap = require('source-map');
// unipackage/slice changes, but this version (which is build-tool-specific) can
// change when the the contents (not structure) of the built output changes. So
// eg, if we improve the linker's static analysis, this should be bumped.
exports.BUILD_VERSION = 'meteor/1';
exports.BUILD_VERSION = 'meteor/2';
// Find all files under `rootPath` that have an extension in
// `extensions` (an array of extensions without leading dot), and
@@ -1984,6 +1984,22 @@ _.extend(Package.prototype, {
builder.reserve("head");
builder.reserve("body");
// Pre-linker versions of Meteor expect all packages in the warehouse to
// contain a file called "package.js"; they use this as part of deciding
// whether or not they need to download a new package. Because packages
// are downloaded by the *existing* version of the tools, we need to
// include this file until we're comfortable breaking "meteor update" from
// 0.6.4. (Specifically, warehouse.packageExistsInWarehouse used to check
// to see if package.js exists instead of just looking for the package
// directory.)
// XXX Remove this once we can.
builder.write("package.js", {
data: new Buffer(
("// This file is included for compatibility with the Meteor " +
"0.6.4 package downloader.\n"),
"utf8")
};
// Slices
_.each(self.slices, function (slice) {
if (! slice.isBuilt)

View File

@@ -149,11 +149,12 @@ _.extend(warehouse, {
},
packageExistsInWarehouse: function (name, version) {
// Look for presence of "package.js" file in directory so we don't count
// an empty dir as a package. An empty dir could be left by a failed
// package untarring, for example.
// A package exists if its directory exists. (We used to look for a
// particular file name ("package.js") inside the directory, but since we
// always install packages by untarring to a temporary directory and
// renaming atomically, we shouldn't worry about partial packages.)
return fs.existsSync(
path.join(warehouse.getWarehouseDir(), 'packages', name, version, 'package.js'));
path.join(warehouse.getWarehouseDir(), 'packages', name, version));
},
getPackageFreshFile: function (name, version) {