initial checkpoint for "buildArchitectures"

this is a string like "browser+os"
This commit is contained in:
David Glasser
2014-06-17 17:48:08 -07:00
parent fb20f60dcf
commit 4f3aa0fc53
11 changed files with 29 additions and 23 deletions

View File

@@ -42,7 +42,8 @@ insertVersion("jquery", "1.8.2", "1.8.0");
var insertBuild = function (name, version, ecv) {
Builds.insert({ packageName: name, version: version,
earliestCompatibleVersion: ecv, architecture: [ "browser", "os" ] });
earliestCompatibleVersion: ecv,
buildArchitectures: "browser+os" });
};
insertBuild("sparky-forms", "1.1.2", "1.1.0");

View File

@@ -274,7 +274,7 @@ _.extend(baseCatalog.BaseCatalog.prototype, {
var build = allBuilds[i];
// XXX why isn't this a list in the DB? I guess because of the unique
// index?
var buildArches = build.architecture.split('+');
var buildArches = build.buildArchitectures.split('+');
var usingThisBuild = false;
_.each(neededArches, function (ignored, neededArch) {
if (archinfo.mostSpecificMatch(neededArch, buildArches)) {
@@ -299,16 +299,17 @@ _.extend(baseCatalog.BaseCatalog.prototype, {
},
// Unlike the previous, this looks for a build which *precisely* matches the
// given architectures string (joined with +). Also, it takes a versionRecord
// rather than name/version.
getBuildWithArchesString: function (versionRecord, archesString) {
// given buildArchitectures string. Also, it takes a versionRecord rather than
// name/version.
getBuildWithPreciseBuildArchitectures: function (versionRecord,
buildArchitectures) {
var self = this;
self._requireInitialized();
return self._recordOrRefresh(function () {
return _.findWhere(self.builds,
{ versionId: versionRecord._id,
architecture: archesString });
buildArchitectures: buildArchitectures });
});
},

View File

@@ -658,7 +658,7 @@ _.extend(CompleteCatalog.prototype, {
name, sourcePath, unip);
self.builds.push({
architecture: unip.architectures().join('+'),
buildArchitectures: unip.architecturesString(),
builtBy: null,
build: null, // this would be the URL and hash
versionId: versionId,

View File

@@ -599,9 +599,10 @@ main.registerCommand({
process.stdout.write("new package\n");
return;
} else {
var existingBuild = catalog.official.getBuildWithArchesString(
oldVersion,
compileResult.unipackage.architecturesString());
var existingBuild =
catalog.official.getBuildWithPreciseBuildArchitectures(
oldVersion,
compileResult.unipackage.architecturesString());
// If the version number mentioned in package.js exists, but
// there's no build of this architecture, then either the old

View File

@@ -1092,7 +1092,7 @@ main.registerCommand({
// XXX check to make sure this is the three arches that we want? it's easier
// during 0.9.0 development to allow it to just decide "ok, i just want to
// build the OSX tarball" though.
var buildArches = _.pluck(toolPkgBuilds, 'architecture');
var buildArches = _.pluck(toolPkgBuilds, 'buildArchitectures');
var osArches = _.map(buildArches, function (buildArch) {
var subArches = buildArch.split('+');
var osArches = _.filter(subArches, function (subArch) {

View File

@@ -806,7 +806,7 @@ compiler.compile = function (packageSource, options) {
_.each(packageSource.architectures, function (unibuild) {
var unibuildSources = compileUnibuild(unipackage, unibuild, packageLoader,
nodeModulesPath, isPortable);
nodeModulesPath, isPortable);
sources.push.apply(sources, unibuildSources);
});

View File

@@ -313,7 +313,7 @@ var createAndPublishBuiltPackage = function (conn, unipackage) {
var uploadInfo = conn.call('createPackageBuild', {
packageName: unipackage.name,
version: unipackage.version,
architecture: unipackage.architectures().join('+')
buildArchitectures: unipackage.architecturesString()
});
var bundleResult = bundleBuild(unipackage);

View File

@@ -109,8 +109,8 @@ _.extend(exports.PackageLoader.prototype, {
return catalogs.complete.getLoadPathForPackage(name, version);
},
// Given a package name like "ddp" and an architecture, get the unibuild of that
// package at the right architecture.
// Given a package name like "ddp" and an architecture, get the unibuild of
// that package at the right architecture.
getUnibuild: function (packageName, arch) {
var self = this;

View File

@@ -1381,7 +1381,7 @@ _.extend(PackageSource.prototype, {
}
var reference = {
arch: archinfo.withoutSpecificOs(arch.arch),
arch: archinfo.withoutSpecificOs(arch.arch)
};
if (use.weak) {
reference.weak = true;

View File

@@ -55,10 +55,10 @@ _.extend(exports.Tropohouse.prototype, {
// Return a path to a location that would contain a specified build of the
// package at the specified version, if we have this build cached on disk.
downloadedBuildPath: function(packageName, version, buildArches) {
downloadedBuildPath: function(packageName, version, buildArchitectures) {
var self = this;
return path.join(self.downloadedBuildsDirectory(packageName, version),
buildArches);
buildArchitectures);
},
// Returns a list of builds that we have downloaded for a package&version by
@@ -109,7 +109,8 @@ _.extend(exports.Tropohouse.prototype, {
var self = this;
// XXX nb: "version" field is calculated by getBuildsForArches
var path = self.downloadedBuildPath(
buildRecord.packageName, buildRecord.version, buildRecord.architecture);
buildRecord.packageName, buildRecord.version,
buildRecord.buildArchitectures);
var packageTarball = httpHelpers.getUrl({
url: buildRecord.build.url,
encoding: null

View File

@@ -301,7 +301,9 @@ _.extend(Unipackage.prototype, {
architectures: function () {
var self = this;
return _.uniq(_.pluck(self.unibuilds, 'arch').concat(self._toolArchitectures())).sort();
return _.uniq(
_.pluck(self.unibuilds, 'arch').concat(self._toolArchitectures())
).sort();
},
architecturesString: function () {
@@ -321,9 +323,9 @@ _.extend(Unipackage.prototype, {
return _.uniq(toolArches).sort();
},
// Return the unibuild of the package to use for a given target architecture (eg,
// 'os.linux.x86_64' or 'browser'), or throw an exception if that packages
// can't be loaded under these circumstances.
// Return the unibuild of the package to use for a given target architecture
// (eg, 'os.linux.x86_64' or 'browser'), or throw an exception if that
// packages can't be loaded under these circumstances.
getUnibuildAtArch: function (arch) {
var self = this;