diff --git a/bin/compile b/bin/compile index debbcf00c..aee2dba53 100755 --- a/bin/compile +++ b/bin/compile @@ -23,6 +23,7 @@ function indent() { NODE_VERSION="0.4.7" NPM_VERSION="1.0.94" SCONS_VERSION="1.2.0" +S3_BUCKET="language-pack-nodejs" # parse and derive params BUILD_DIR=$1 @@ -32,9 +33,9 @@ CACHE_STORE_DIR=$CACHE_DIR"/node_modules/$NPM_VERSION" CACHE_TARGET_DIR=$BUILD_DIR"/node_modules" # s3 packages -NODE_PACKAGE="http://language-pack-nodejs.s3.amazonaws.com/nodejs-${NODE_VERSION}.tgz" -NPM_PACKAGE="http://language-pack-nodejs.s3.amazonaws.com/npm-${NPM_VERSION}.tgz" -SCONS_PACKAGE="http://language-pack-nodejs.s3.amazonaws.com/scons-${SCONS_VERSION}.tgz" +NODE_PACKAGE="http://${S3_BUCKET}.s3.amazonaws.com/nodejs-${NODE_VERSION}.tgz" +NPM_PACKAGE="http://${S3_BUCKET}.s3.amazonaws.com/npm-${NPM_VERSION}.tgz" +SCONS_PACKAGE="http://${S3_BUCKET}.s3.amazonaws.com/scons-${SCONS_VERSION}.tgz" # vendor directories VENDORED_NODE="$(mktmpdir node)" diff --git a/support/aws/s3 b/support/aws/s3 index d5cf94d2a..efd05dec1 100755 --- a/support/aws/s3 +++ b/support/aws/s3 @@ -24,10 +24,10 @@ check_or_die() { # Bail if we do not. check_s3() { local sak x - for x in S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY; do + for x in AWS_ID AWS_SECRET; do check_or_die ${x}; done - sak="$(echo -n $S3_SECRET_ACCESS_KEY | wc -c)" + sak="$(echo -n $AWS_SECRET | wc -c)" (( ${sak%%[!0-9 ]*} == 40 )) || \ die "S3 Secret Access Key is not exactly 40 bytes long. Please fix it." } @@ -98,7 +98,7 @@ s3_signature_string() { printf "%s\n%s\n%s\n%s\n%s\n%s%s" \ "${verb}" "${md5}" "${mime}" "${date}" \ "${headers}" "${bucket}" "${resource}" | \ - hmac sha1 "${S3_SECRET_ACCESS_KEY}" | openssl base64 -e -a + hmac sha1 "${AWS_SECRET}" | openssl base64 -e -a } # cheesy, but it is the best way to have multiple headers. @@ -147,7 +147,7 @@ s3_curl() { date="$(TZ=UTC date '+%a, %e %b %Y %H:%M:%S %z')" sig=$(s3_signature_string ${1} "${date}" "${bucket}" "${remote}" "${md5}" "" "x-amz-acl:public-read") - headers[${#headers[@]}]="Authorization: AWS ${S3_ACCESS_KEY_ID}:${sig}" + headers[${#headers[@]}]="Authorization: AWS ${AWS_ID}:${sig}" headers[${#headers[@]}]="Date: ${date}" [[ ${md5} ]] && headers[${#headers[@]}]="Content-MD5: ${md5}" curl ${arg} "${inout}" ${stdopts} -o - -K <(curl_headers "${headers[@]}") \ diff --git a/support/package_node b/support/package_node index cc1d51920..16e280ecb 100755 --- a/support/package_node +++ b/support/package_node @@ -9,13 +9,18 @@ if [ "$node_version" == "" ]; then exit 1 fi -if [ "$S3_ACCESS_KEY_ID" == "" ]; then - echo "must set S3_ACCESS_KEY_ID" +if [ "$AWS_ID" == "" ]; then + echo "must set AWS_ID" exit 1 fi -if [ "$S3_SECRET_ACCESS_KEY" == "" ]; then - echo "must set S3_SECRET_ACCESS_KEY" +if [ "$AWS_SECRET" == "" ]; then + echo "must set AWS_SECRET" + exit 1 +fi + +if [ "$S3_BUCKET" == "" ]; then + echo "must set S3_BUCKET" exit 1 fi @@ -38,7 +43,7 @@ pushd node-v${node_version} vulcan build -v -o $tempdir/node-${node_version}.tgz # upload nodejs to s3 -$basedir/aws/s3 put language-pack-nodejs \ +$basedir/aws/s3 put $S3_BUCKET \ nodejs-${node_version}.tgz $tempdir/node-${node_version}.tgz # go into scons @@ -49,5 +54,5 @@ scons_version=$(ls | grep "scons-local" | cut -d- -f3) tar czvf $tempdir/scons-${scons_version}.tgz * # upload scons to s3 -$basedir/aws/s3 put language-pack-nodejs \ +$basedir/aws/s3 put $S3_BUCKET \ scons-${scons_version}.tgz $tempdir/scons-${scons_version}.tgz diff --git a/support/package_npm b/support/package_npm index ba747aa32..ad4c95955 100755 --- a/support/package_npm +++ b/support/package_npm @@ -9,6 +9,21 @@ if [ "$npm_version" == "" ]; then exit 1 fi +if [ "$AWS_ID" == "" ]; then + echo "must set AWS_ID" + exit 1 +fi + +if [ "$AWS_SECRET" == "" ]; then + echo "must set AWS_SECRET" + exit 1 +fi + +if [ "$S3_BUCKET" == "" ]; then + echo "must set S3_BUCKET" + exit 1 +fi + basedir="$( cd -P "$( dirname "$0" )" && pwd )" # make a temp directory @@ -31,5 +46,5 @@ git submodule update --init --recursive tar czvf $tempdir/npm-${npm_version}.tgz * # upload npm to s3 -$basedir/aws/s3 put language-pack-nodejs \ +$basedir/aws/s3 put $S3_BUCKET \ npm-${npm_version}.tgz $tempdir/npm-${npm_version}.tgz