Skip to content

Commit

Permalink
Merge branch 'rel/beta' into multi_arch
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Toll committed Oct 30, 2020
2 parents e7574e9 + f8bdceb commit bc24dce
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 31 deletions.
30 changes: 8 additions & 22 deletions scripts/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,15 @@ done

mkdir ${PKG_ROOT}/genesis

if [ ! -z "${RELEASE_GENESIS_PROCESS}" ]; then
genesis_dirs=("devnet" "testnet" "mainnet" "betanet")
for dir in "${genesis_dirs[@]}"; do
mkdir -p ${PKG_ROOT}/genesis/${dir}
cp ${REPO_DIR}/installer/genesis/${dir}/genesis.json ${PKG_ROOT}/genesis/${dir}/
#${GOPATHBIN}/buildtools genesis ensure -n ${dir} --source ${REPO_DIR}/gen/${dir}/genesis.json --target ${PKG_ROOT}/genesis/${dir}/genesis.json --releasedir ${REPO_DIR}/installer/genesis
if [ $? -ne 0 ]; then exit 1; fi
done
# Copy the appropriate network genesis.json for our default (in root ./genesis folder)
cp ${PKG_ROOT}/genesis/${DEFAULT_RELEASE_NETWORK}/genesis.json ${PKG_ROOT}/genesis
genesis_dirs=("devnet" "testnet" "mainnet" "betanet")
for dir in "${genesis_dirs[@]}"; do
mkdir -p ${PKG_ROOT}/genesis/${dir}
cp ${REPO_DIR}/installer/genesis/${dir}/genesis.json ${PKG_ROOT}/genesis/${dir}/
if [ $? -ne 0 ]; then exit 1; fi
elif [[ "${CHANNEL}" == "dev" || "${CHANNEL}" == "stable" || "${CHANNEL}" == "nightly" || "${CHANNEL}" == "beta" ]]; then
cp ${REPO_DIR}/installer/genesis/${DEFAULTNETWORK}/genesis.json ${PKG_ROOT}/genesis/
#${GOPATHBIN}/buildtools genesis ensure -n ${DEFAULTNETWORK} --source ${REPO_DIR}/gen/${DEFAULTNETWORK}/genesis.json --target ${PKG_ROOT}/genesis/genesis.json --releasedir ${REPO_DIR}/installer/genesis
if [ $? -ne 0 ]; then exit 1; fi
else
cp installer/genesis/${DEFAULTNETWORK}/genesis.json ${PKG_ROOT}/genesis
if [ $? -ne 0 ]; then exit 1; fi
#if [ -z "${TIMESTAMP}" ]; then
# TIMESTAMP=$(date +%s)
#fi
#${GOPATHBIN}/buildtools genesis timestamp -f ${PKG_ROOT}/genesis/genesis.json -t ${TIMESTAMP}
fi
done
# Copy the appropriate network genesis.json for our default (in root ./genesis folder)
cp ${PKG_ROOT}/genesis/${DEFAULT_RELEASE_NETWORK}/genesis.json ${PKG_ROOT}/genesis
if [ $? -ne 0 ]; then exit 1; fi

TOOLS_ROOT=${PKG_ROOT}/tools

Expand Down
16 changes: 16 additions & 0 deletions scripts/release/common/cpu_name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Take common name (amd64, arm64, arm) and map to the unames (x86_64, aarch64)

COMMON_NAME="${1}"

if [ "amd64" == "${COMMON_NAME}" ]; then
echo "x86_64"
elif [ "arm64" == "${COMMON_NAME}" ]; then
echo "aarch64"
elif [ "arm32" == "${COMMON_NAME}" ]; then
echo "armv7l"
elif [ "arm" == "${COMMON_NAME}" ]; then
echo "armv7l"
else
echo "Unsupported cpu arch ${COMMON_NAME}"
exit 1
fi
2 changes: 1 addition & 1 deletion scripts/release/mule/Makefile.mule
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mule-docker:
mule-package-%: PKG_TYPE=$*
mule-package-%:
echo Building algorand package...
scripts/release/mule/package/$(PKG_TYPE)/package.sh
scripts/release/mule/package/$(PKG_TYPE)/package.sh algorand
echo Building algorand-devtools package...
scripts/release/mule/package/$(PKG_TYPE)/package.sh algorand-devtools

Expand Down
2 changes: 2 additions & 0 deletions scripts/release/mule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ In addition, make sure that the following AWS credentials are set in environment

+ `BRANCH`
+ `CHANNEL`
+ `ARCH_BIT`, i.e., the value from `uname -m`
+ `NETWORK`
+ `S3_SOURCE`, i.e., the S3 bucket from which to download
+ `SHA`, i.e., the value from `git rev-parse HEAD` if not passed on CLI
Expand All @@ -96,6 +97,7 @@ In addition, make sure that the following AWS credentials are set in environment

+ `BRANCH`
+ `CHANNEL`
+ `ARCH_BIT`, i.e., the value from `uname -m`
+ `S3_SOURCE`, i.e., the S3 bucket from which to download
+ `VERSION`

Expand Down
8 changes: 5 additions & 3 deletions scripts/release/mule/package/rpm/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ BRANCH=${BRANCH:-$(./scripts/compute_branch.sh)}
CHANNEL=${CHANNEL:-$(./scripts/compute_branch_channel.sh "$BRANCH")}
DEFAULTNETWORK=${DEFAULTNETWORK:-$(./scripts/compute_branch_network.sh "$BRANCH")}
DEFAULT_RELEASE_NETWORK=$(./scripts/compute_branch_release_network.sh "$DEFAULTNETWORK")
PACKAGE_NAME="$1"

find tmp/node_pkgs -name "*${CHANNEL}*linux*${FULLVERSION}*.tar.gz" | cut -d '/' -f3-4 | sort --unique | while read OS_ARCH; do
OS_TYPE=$(echo "${OS_ARCH}" | cut -d '/' -f1)
ARCH_TYPE=$(echo "${OS_ARCH}" | cut -d '/' -f2)
ARCH_UNAME=$(./scripts/release/common/cpu_name.sh ${ARCH_TYPE})
ALGO_BIN="$REPO_DIR/tmp/node_pkgs/$OS_TYPE/$ARCH_TYPE/$CHANNEL/$OS_TYPE-$ARCH_TYPE/bin"
# A make target in Makefile.mule may pass the name as an argument.
ALGORAND_PACKAGE_NAME=${1:-$(./scripts/compute_package_name.sh "$CHANNEL")}
ALGORAND_PACKAGE_NAME=$(./scripts/compute_package_name.sh "$CHANNEL" "$PACKAGE_NAME")

if [[ "$ALGORAND_PACKAGE_NAME" =~ devtools ]]; then
REQUIRED_ALGORAND_PACKAGE=$(./scripts/compute_package_name.sh "$CHANNEL")
Expand All @@ -42,11 +44,11 @@ find tmp/node_pkgs -name "*${CHANNEL}*linux*${FULLVERSION}*.tar.gz" | cut -d '/'
< "./installer/rpm/$INSTALLER_DIR/$INSTALLER_DIR.spec" \
sed -e "s,@PKG_NAME@,$ALGORAND_PACKAGE_NAME," \
-e "s,@VER@,$FULLVERSION," \
-e "s,@ARCH@,$ARCH_TYPE," \
-e "s,@ARCH@,$ARCH_UNAME," \
-e "s,@REQUIRED_ALGORAND_PKG@,$REQUIRED_ALGORAND_PACKAGE," \
> "$TEMPDIR/$ALGORAND_PACKAGE_NAME.spec"

rpmbuild --buildroot "$HOME/foo" --define "_rpmdir $RPMTMP" --define "RELEASE_GENESIS_PROCESS x$RELEASE_GENESIS_PROCESS" --define "LICENSE_FILE ./COPYING" -bb "$TEMPDIR/$ALGORAND_PACKAGE_NAME.spec" --target $ARCH_TYPE
rpmbuild --buildroot "$HOME/foo" --define "_rpmdir $RPMTMP" --define "RELEASE_GENESIS_PROCESS x$RELEASE_GENESIS_PROCESS" --define "LICENSE_FILE ./COPYING" -bb "$TEMPDIR/$ALGORAND_PACKAGE_NAME.spec" --target $ARCH_UNAME

cp -p "$RPMTMP"/*/*.rpm "./tmp/node_pkgs/$OS_TYPE/$ARCH_TYPE"
echo "${RPMTMP}"
Expand Down
1 change: 1 addition & 0 deletions scripts/release/mule/sign/sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ for os in "${OS_TYPES[@]}"; do
ARCHS=(amd64 arm arm64)
for arch in "${ARCHS[@]}"; do
(
mkdir -p "$os/$arch"
cd "$os/$arch"

# Clean package directory of any previous operations.
Expand Down
10 changes: 6 additions & 4 deletions scripts/release/mule/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
set -ex

export PKG_TYPE="$1"
ARCH_BIT=$(uname -m)
export ARCH_BIT
ARCH_TYPE=$(./scripts/archtype.sh)
export ARCH_TYPE
OS_TYPE=$(./scripts/ostype.sh)
Expand All @@ -28,8 +30,8 @@ then
aws s3 cp "s3://$PREFIX/algorand-devtools_${CHANNEL}_${OS_TYPE}-${ARCH_TYPE}_${VERSION}.deb" .

# rpm
aws s3 cp "s3://$PREFIX/algorand-$CHANNEL-$VERSION-1.$ARCH_TYPE.rpm" .
aws s3 cp "s3://$PREFIX/algorand-devtools-$CHANNEL-$VERSION-1.$ARCH_TYPE.rpm" .
aws s3 cp "s3://$PREFIX/algorand-$VERSION-1.$ARCH_BIT.rpm" .
aws s3 cp "s3://$PREFIX/algorand-devtools-$VERSION-1.$ARCH_BIT.rpm" .
fi

popd
Expand All @@ -50,8 +52,8 @@ else
# Normally, this is installed for us b/c it's a dependency.
# See `./installer/rpm/algorand/algorand.spec`.
yum install yum-cron -y
rpm -i algorand-"$VERSION"-1."$ARCH_TYPE".rpm
rpm -i algorand-devtools-"$VERSION"-1."$ARCH_TYPE".rpm
rpm -i algorand-"$VERSION"-1."$ARCH_BIT".rpm
rpm -i algorand-devtools-"$VERSION"-1."$ARCH_BIT".rpm
fi

popd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ else
# attempt to generate the .spec file, but it doesn't give us the info we need.
#
# Instead, we'll just install using `dpkg` and grep the error stream.
if ! rpm -i "./tmp/node_pkgs/$OS_TYPE/$ARCH_TYPE/algorand-devtools-$VERSION"*"$ARCH_TYPE".rpm 2> "$RPMTMP/rpm.install"
if ! rpm -i "./tmp/node_pkgs/$OS_TYPE/$ARCH_TYPE/algorand-devtools-$VERSION"*"$ARCH_BIT".rpm 2> "$RPMTMP/rpm.install"
then
#
# We're looking for lines that looks like the following:
Expand Down

0 comments on commit bc24dce

Please sign in to comment.