diff --git a/scripts/admin/build-package-tarballs.sh b/scripts/admin/build-package-tarballs.sh index 75b4799183..d9b5f3af39 100755 --- a/scripts/admin/build-package-tarballs.sh +++ b/scripts/admin/build-package-tarballs.sh @@ -11,6 +11,7 @@ ### we do for tools. set -e +set -u # cd to top level dir cd `dirname $0` @@ -20,6 +21,9 @@ TOPDIR=$(pwd) OUTDIR="$TOPDIR/dist/packages" mkdir -p $OUTDIR +# Make sure all NPM modules are updated. +./meteor --get-ready + # A hacky (?) way to pass the release manifest chunk with package # versions back into build-release.sh. Contents set below if [ -e "$TOPDIR/.package_manifest_chunk" ]; then @@ -37,7 +41,7 @@ do PACKAGE_VERSION=$(git ls-tree HEAD $PACKAGE | shasum | cut -f 1 -d " ") # shasum's output looks like: 'SHA -' echo "$PACKAGE version $PACKAGE_VERSION" - tar -c -z -f $OUTDIR/$PACKAGE-$PACKAGE_VERSION.tar.gz $PACKAGE + tar -c -z -f $OUTDIR/$PACKAGE-${PACKAGE_VERSION}-${PLATFORM}.tar.gz $PACKAGE # this is used in build-release.sh, which constructs the release json. echo -n " \"$PACKAGE\": \"$PACKAGE_VERSION\"" >> "$TOPDIR/.package_manifest_chunk" diff --git a/scripts/admin/build-release.sh b/scripts/admin/build-release.sh index 83d0bf2e5f..7427ef0480 100755 --- a/scripts/admin/build-release.sh +++ b/scripts/admin/build-release.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +set -u # cd to top level dir cd `dirname $0` @@ -11,6 +12,12 @@ OUTDIR="$TOPDIR/dist" rm -rf "$OUTDIR" mkdir -p "$OUTDIR" +UNAME=$(uname) +ARCH=$(uname -m) +export PLATFORM="${UNAME}_${ARCH}" + + + scripts/admin/build-tools-tarballs.sh TOOLS_VERSION=$(cat "$TOPDIR/.tools_version") scripts/admin/build-package-tarballs.sh diff --git a/scripts/admin/build-tools-tarballs.sh b/scripts/admin/build-tools-tarballs.sh index 090494514e..9866a12235 100755 --- a/scripts/admin/build-tools-tarballs.sh +++ b/scripts/admin/build-tools-tarballs.sh @@ -1,16 +1,13 @@ #!/bin/bash set -e +set -u # cd to top level dir cd `dirname $0` cd ../.. TOPDIR=$(pwd) -UNAME=$(uname) -ARCH=$(uname -m) -PLATFORM="${UNAME}_${ARCH}" - TOOLS_TMPDIR=$(mktemp -d -t meteor-build-release-XXXXXXXX) trap 'rm -rf "$TOOLS_TMPDIR" >/dev/null 2>&1' 0 diff --git a/scripts/admin/build-tools-tree.sh b/scripts/admin/build-tools-tree.sh index dfb5cdd23a..c674f6d4b0 100755 --- a/scripts/admin/build-tools-tree.sh +++ b/scripts/admin/build-tools-tree.sh @@ -25,7 +25,7 @@ fi echo "Setting up tools tree in $TARGET_DIR" # make sure dev bundle exists before trying to install -./meteor --version 2>&1 | grep Unreleased +./meteor --get-ready function CPR { tar -c --exclude .meteor/local "$1" | tar -x -C "$2" diff --git a/scripts/admin/publish-release/server/publish-release.js b/scripts/admin/publish-release/server/publish-release.js index b2b2b30b98..028fac3cc1 100644 --- a/scripts/admin/publish-release/server/publish-release.js +++ b/scripts/admin/publish-release/server/publish-release.js @@ -4,6 +4,12 @@ var Fiber = Npm.require("fibers"); var Future = Npm.require("fibers/future"); var child_process = Npm.require("child_process"); +var PLATFORMS = [ + 'Darwin_x86_64', + 'Linux_i686', + 'Linux_x86_64' +]; + var die = function (msg) { console.error(msg); process.exit(1); @@ -88,30 +94,16 @@ var anyWithPrefix = function(s3, prefix) { return !_.isEmpty(files.Body.ListBucketResult.Contents); }; -// publish a given tools, copying multiple files from -// s3://com.meteor.warehouse/unpublished/GITSHA/ to -// s3://com.meteor.warehouse/tools/VERSION/ -var publishTools = function(s3, gitSha, version) { - var destPath = ["tools", version].join("/"); - - process.stdout.write("tools " + version + ": "); - if (anyWithPrefix(s3, destPath)) { - console.log("already published"); - return; - } else { - publishedArtifacts.push("tools " + version); - console.log("publishing"); - } - - var toolsArtifacts = s3.ListObjects({ +var copyFilesWithPrefix = function (s3, prefix, destDir) { + var artifacts = s3.ListObjects({ BucketName: "com.meteor.warehouse", - Prefix: ["unpublished", gitSha, "meteor-tools-"].join("/") + Prefix: prefix }).Body.ListBucketResult.Contents; - parallelEach(toolsArtifacts, function (artifact) { + parallelEach(artifacts, function (artifact) { var sourceKey = artifact.Key; var filename = _.last(sourceKey.split("/")); - var destKey = [destPath, filename].join("/"); + var destKey = [destDir, filename].join("/"); var opts = { BucketName: "com.meteor.warehouse", @@ -124,31 +116,42 @@ var publishTools = function(s3, gitSha, version) { }); }; +// publish a given tools, copying multiple files from +// s3://com.meteor.warehouse/unpublished/GITSHA/ to +// s3://com.meteor.warehouse/tools/VERSION/ +var publishTools = function(s3, gitSha, version) { + var destDir = ["tools", version].join("/"); + + process.stdout.write("tools " + version + ": "); + if (anyWithPrefix(s3, destDir + "/")) { + console.log("already published"); + return; + } else { + publishedArtifacts.push("tools " + version); + console.log("publishing"); + } + + copyFilesWithPrefix( + s3, ["unpublished", gitSha, "meteor-tools-"].join("/"), destDir); +}; + // publish a given package, copying from -// s3://com.meteor.warehouse/unpublished/GITSHA/NAME-VERSION.tar.gz to -// s3://com.meteor.warehouse/packages/NAME-VERSION.tar.gz +// s3://com.meteor.warehouse/unpublished/GITSHA/NAME-VERSION-{PLATFORM}.tar.gz to +// s3://com.meteor.warehouse/packages/NAME-VERSION-{PLATFORM}.tar.gz var publishPackage = function(s3, gitSha, name, version) { - var filename = name + "-" + version + ".tar.gz"; - var destKey = ["packages", name, filename].join("/"); - var sourceKey = ["unpublished", gitSha, filename].join("/"); + var destDir = ["packages", name, version].join("/"); + var sourcePrefix = ["unpublished", gitSha, + name + "-" + version + "-"].join("/"); var packageHeader = "package " + name + " version " + version + ": "; - if (anyWithPrefix(s3, destKey)) { + if (anyWithPrefix(s3, destDir)) { console.log(packageHeader + "already published"); return; } else { publishedArtifacts.push("package " + name + " version " + version); console.log(packageHeader + "publishing"); } - - var opts = { - BucketName: "com.meteor.warehouse", - ObjectName: destKey, - SourceBucket: "com.meteor.warehouse", - SourceObject: sourceKey, - Acl: "public-read" - }; - s3.CopyObject(opts); + copyFilesWithPrefix(s3, sourcePrefix, destDir); }; // publish the release manifest, copying from diff --git a/tools/meteor.js b/tools/meteor.js index 7e12f8874d..78877af43b 100644 --- a/tools/meteor.js +++ b/tools/meteor.js @@ -937,6 +937,18 @@ Fiber(function () { process.exit(0); }; + var getReady = function () { + if (files.usesWarehouse()) { + die("meteor --get-ready only works in a checkout"); + } + // dev bundle is downloaded by the wrapper script. We just need to install + // NPM dependencies. + _.each(packages.list(context.packageSearchOptions), function (p) { + p.installNpmDependencies(); + }); + process.exit(0); + }; + var main = function() { var optimist = require('optimist') .alias("h", "help") @@ -957,6 +969,13 @@ Fiber(function () { if (!files.in_checkout() && !process.env.METEOR_TEST_NO_SPRINGBOARD) toolsSpringboard(); + // Run this to ensure that your checkout's Meteor is "complete" (dev bundle + // downloaded and all NPM modules installed). + if (argv['get-ready']) { + getReady(); + return; + } + if (argv.help) { argv._.splice(0, 0, "help"); delete argv.help; diff --git a/tools/warehouse.js b/tools/warehouse.js index 63b09cc139..14407ff21f 100644 --- a/tools/warehouse.js +++ b/tools/warehouse.js @@ -313,7 +313,8 @@ _.extend(warehouse, { var packageDir = path.join( warehouseDirectory, 'packages', name, version); var packageUrl = (urlBase || WAREHOUSE_URLBASE) + "/packages/" + name + - "/" + name + '-' + version + ".tar.gz"; + "/" + name + '-' + version + "-" + warehouse._platform() + + ".tar.gz"; var tarball = files.getUrl({url: packageUrl, encoding: null}); files.extractTarGz(tarball, packageDir);