From 4f3aa0fc532b612aa902802d305d06ff1ad88eef Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 17 Jun 2014 17:48:08 -0700 Subject: [PATCH] initial checkpoint for "buildArchitectures" this is a string like "browser+os" --- packages/constraint-solver/constraint-solver-tests.js | 3 ++- tools/catalog-base.js | 11 ++++++----- tools/catalog.js | 2 +- tools/commands-packages.js | 7 ++++--- tools/commands.js | 2 +- tools/compiler.js | 2 +- tools/package-client.js | 2 +- tools/package-loader.js | 4 ++-- tools/package-source.js | 2 +- tools/tropohouse.js | 7 ++++--- tools/unipackage.js | 10 ++++++---- 11 files changed, 29 insertions(+), 23 deletions(-) diff --git a/packages/constraint-solver/constraint-solver-tests.js b/packages/constraint-solver/constraint-solver-tests.js index b519643edb..de325d2d12 100644 --- a/packages/constraint-solver/constraint-solver-tests.js +++ b/packages/constraint-solver/constraint-solver-tests.js @@ -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"); diff --git a/tools/catalog-base.js b/tools/catalog-base.js index 40112cd4d2..0efb1637e3 100644 --- a/tools/catalog-base.js +++ b/tools/catalog-base.js @@ -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 }); }); }, diff --git a/tools/catalog.js b/tools/catalog.js index e3836e27ef..e1efcff86b 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -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, diff --git a/tools/commands-packages.js b/tools/commands-packages.js index 68b03c213e..810a85e4dc 100644 --- a/tools/commands-packages.js +++ b/tools/commands-packages.js @@ -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 diff --git a/tools/commands.js b/tools/commands.js index 8b1b1d368d..9249231f46 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -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) { diff --git a/tools/compiler.js b/tools/compiler.js index 7b055ee7ac..e00b752de2 100644 --- a/tools/compiler.js +++ b/tools/compiler.js @@ -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); }); diff --git a/tools/package-client.js b/tools/package-client.js index 17c95c39d6..230d7d6fa2 100644 --- a/tools/package-client.js +++ b/tools/package-client.js @@ -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); diff --git a/tools/package-loader.js b/tools/package-loader.js index 51a6b2bca0..8f15fb445e 100644 --- a/tools/package-loader.js +++ b/tools/package-loader.js @@ -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; diff --git a/tools/package-source.js b/tools/package-source.js index c20c5728b4..5abc8fa75d 100644 --- a/tools/package-source.js +++ b/tools/package-source.js @@ -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; diff --git a/tools/tropohouse.js b/tools/tropohouse.js index e0a3cfb1d5..7089b40d2d 100644 --- a/tools/tropohouse.js +++ b/tools/tropohouse.js @@ -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 diff --git a/tools/unipackage.js b/tools/unipackage.js index 1df57d44de..9255eaa1c6 100644 --- a/tools/unipackage.js +++ b/tools/unipackage.js @@ -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;