forked from algorand/go-algorand
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new
algorand-devtools
package (algorand#1492)
- Loading branch information
btoll
authored
Sep 16, 2020
1 parent
18cdaed
commit c1b79d8
Showing
34 changed files
with
446 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/etc/apt/apt.conf.d/53algorand-devtools-upgrades | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Package: @PKG_NAME@ | ||
Homepage: https://www.algorand.com/ | ||
Maintainer: Algorand developers <[email protected]> | ||
Version: @VER@ | ||
Architecture: @ARCH@ | ||
Pre-Depends: algorand (>= @VER@) | ||
Recommends: unattended-upgrades | ||
Description: Algorand tools software | ||
This package provides development tools for the Algorand blockchain. | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[algorand] | ||
name=Algorand-devtools | ||
baseurl=https://releases.algorand.com/rpm/stable/ | ||
enabled=1 | ||
gpgcheck=1 | ||
gpgkey=https://releases.algorand.com/rpm/rpm_algorand.pub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Name: @PKG_NAME@ | ||
Version: @VER@ | ||
Release: 1 | ||
Summary: Algorand tools software | ||
URL: https://www.algorand.com | ||
License: AGPL-3+ | ||
Requires: algorand >= @VER@ | ||
|
||
%define SRCDIR go-algorand-rpmbuild | ||
%define _buildshell /bin/bash | ||
|
||
%description | ||
This package provides development tools for the Algorand blockchain. | ||
|
||
%license | ||
%include %{LICENSE_FILE} | ||
|
||
%prep | ||
## Nothing to prep; intended to be built using scripts/release/mule/package/{OS_TYPE}/{ARCH}/rpm/package.sh | ||
|
||
%build | ||
## Nothing to prep; intended to be built using scripts/release/mule/package/{OS_TYPE}/{ARCH}/rpm/package.sh | ||
|
||
%install | ||
mkdir -p %{buildroot}/usr/bin | ||
# NOTE: keep in sync with scripts/build_deb.sh bin_files | ||
# NOTE: keep in sync with %files section below | ||
for f in carpenter catchupsrv msgpacktool tealcut tealdbg; do | ||
install -m 755 ${ALGO_BIN}/${f} %{buildroot}/usr/bin/${f} | ||
done | ||
|
||
mkdir -p %{buildroot}/etc/pki/rpm-gpg | ||
install -m 644 ${REPO_DIR}/installer/rpm/RPM-GPG-KEY-Algorand %{buildroot}/etc/pki/rpm-gpg/RPM-GPG-KEY-Algorand | ||
|
||
mkdir -p %{buildroot}/usr/lib/algorand/yum.repos.d | ||
install -m 644 ${REPO_DIR}/installer/rpm/algorand-devtools/algorand-devtools.repo %{buildroot}/usr/lib/algorand/yum.repos.d/algorand-devtools.repo | ||
|
||
%files | ||
/usr/bin/carpenter | ||
/usr/bin/catchupsrv | ||
/usr/bin/msgpacktool | ||
/usr/bin/tealcut | ||
/usr/bin/tealdbg | ||
/etc/pki/rpm-gpg/RPM-GPG-KEY-Algorand | ||
/usr/lib/algorand/yum.repos.d/algorand-devtools.repo | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,16 +42,16 @@ install -m 644 ${REPO_DIR}/installer/algorand.service %{buildroot}/lib/systemd/s | |
install -m 644 ${REPO_DIR}/installer/[email protected] %{buildroot}/lib/systemd/system/[email protected] | ||
|
||
mkdir -p %{buildroot}/etc/cron.hourly | ||
install -m 755 ${REPO_DIR}/installer/rpm/0yum-algorand-hourly.cron %{buildroot}/etc/cron.hourly/0yum-algorand-hourly.cron | ||
install -m 755 ${REPO_DIR}/installer/rpm/algorand/0yum-algorand-hourly.cron %{buildroot}/etc/cron.hourly/0yum-algorand-hourly.cron | ||
|
||
mkdir -p %{buildroot}/etc/yum | ||
install -m 644 ${REPO_DIR}/installer/rpm/yum-cron-algorand.conf %{buildroot}/etc/yum/yum-cron-algorand.conf | ||
install -m 644 ${REPO_DIR}/installer/rpm/algorand/yum-cron-algorand.conf %{buildroot}/etc/yum/yum-cron-algorand.conf | ||
|
||
mkdir -p %{buildroot}/etc/pki/rpm-gpg | ||
install -m 644 ${REPO_DIR}/installer/rpm/RPM-GPG-KEY-Algorand %{buildroot}/etc/pki/rpm-gpg/RPM-GPG-KEY-Algorand | ||
|
||
mkdir -p %{buildroot}/usr/lib/algorand/yum.repos.d | ||
install -m 644 ${REPO_DIR}/installer/rpm/algorand.repo %{buildroot}/usr/lib/algorand/yum.repos.d/algorand.repo | ||
install -m 644 ${REPO_DIR}/installer/rpm/algorand/algorand.repo %{buildroot}/usr/lib/algorand/yum.repos.d/algorand.repo | ||
|
||
mkdir -p %{buildroot}/var/lib/algorand/genesis | ||
if [ "%{RELEASE_GENESIS_PROCESS}" != "x" ]; then | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# ./compute_package_name <CHANNEL> | ||
# ./compute_package_name <CHANNEL> <NAME> | ||
# | ||
# Examples: | ||
# ./compute_package_name stable -> algorand | ||
# ./compute_package_name beta -> algorand-beta | ||
# ./compute_package_name nightly algorand-devtools -> algorand-devtools-nightly | ||
|
||
if [ "$1" = "nightly" ]; then | ||
echo "algorand-nightly" | ||
elif [ "$1" = "beta" ]; then | ||
echo "algorand-beta" | ||
CHANNEL=${1:-stable} | ||
NAME=${2:-algorand} | ||
|
||
if [ "$CHANNEL" = beta ]; then | ||
echo "$NAME-beta" | ||
elif [ "$CHANNEL" = nightly ]; then | ||
echo "$NAME-nightly" | ||
else | ||
echo "algorand" | ||
echo "$NAME" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=2038,2045,2064 | ||
|
||
set -ex | ||
|
||
echo | ||
date "+build_release begin PACKAGE DEB stage %Y%m%d_%H%M%S" | ||
echo | ||
|
||
ARCH="$1" | ||
OUTDIR="$2" | ||
CHANNEL="$3" | ||
PKG_NAME="$4" | ||
OS_TYPE=$(./scripts/ostype.sh) | ||
mkdir -p "$OUTDIR/bin" | ||
VER=${VERSION:-$(./scripts/compute_build_number.sh -f)} | ||
|
||
echo "Building debian package $PKG_NAME ($CHANNEL) for '$OS - $ARCH'" | ||
|
||
DEFAULTNETWORK=$("./scripts/compute_branch_network.sh") | ||
DEFAULT_RELEASE_NETWORK=$("./scripts/compute_branch_release_network.sh" "$DEFAULTNETWORK") | ||
export DEFAULT_RELEASE_NETWORK | ||
|
||
PKG_ROOT=$(mktemp -d) | ||
trap "rm -rf $PKG_ROOT" 0 | ||
|
||
mkdir -p "$PKG_ROOT/usr/bin" | ||
|
||
# NOTE: keep in sync with `./installer/rpm/algorand.spec`. | ||
if [ "$PKG_NAME" = "algorand-devtools" ]; then | ||
BIN_FILES=("carpenter" "catchupsrv" "msgpacktool" "tealcut" "tealdbg") | ||
UNATTENDED_UPGRADES_FILE="53algorand-devtools-upgrades" | ||
OUTPUT_DEB="$OUTDIR/algorand_devtools_${CHANNEL}_${OS_TYPE}-${ARCH}_${VER}.deb" | ||
else | ||
BIN_FILES=("algocfg" "algod" "algoh" "algokey" "ddconfig.sh" "diagcfg" "goal" "kmd" "node_exporter") | ||
UNATTENDED_UPGRADES_FILE="51algorand-upgrades" | ||
OUTPUT_DEB="$OUTDIR/algorand_${CHANNEL}_${OS_TYPE}-${ARCH}_${VER}.deb" | ||
fi | ||
|
||
for binary in "${BIN_FILES[@]}"; do | ||
cp "$GOPATH/bin/$binary" "$PKG_ROOT/usr/bin" | ||
chmod 755 "$PKG_ROOT/usr/bin/$binary" | ||
done | ||
|
||
if [ "$PKG_NAME" != "algorand-devtools" ]; then | ||
mkdir -p "${PKG_ROOT}/usr/lib/algorand" | ||
lib_files=("updater" "find-nodes.sh") | ||
for lib in "${lib_files[@]}"; do | ||
cp "$GOPATH/bin/$lib" "$PKG_ROOT/usr/lib/algorand" | ||
chmod g-w "$PKG_ROOT/usr/lib/algorand/$lib" | ||
done | ||
|
||
data_files=("config.json.example" "system.json") | ||
mkdir -p "$PKG_ROOT/var/lib/algorand" | ||
for data in "${data_files[@]}"; do | ||
cp "./installer/$data" "$PKG_ROOT/var/lib/algorand" | ||
done | ||
|
||
genesis_dirs=("devnet" "testnet" "mainnet" "betanet") | ||
for dir in "${genesis_dirs[@]}"; do | ||
mkdir -p "$PKG_ROOT/var/lib/algorand/genesis/$dir" | ||
cp "./installer/genesis/$dir/genesis.json" "$PKG_ROOT/var/lib/algorand/genesis/$dir/genesis.json" | ||
done | ||
cp "./installer/genesis/$DEFAULTNETWORK/genesis.json" "$PKG_ROOT/var/lib/algorand/genesis.json" | ||
|
||
# files should not be group writable but directories should be | ||
chmod -R g-w "$PKG_ROOT/var/lib/algorand" | ||
find "$PKG_ROOT/var/lib/algorand" -type d | xargs chmod g+w | ||
|
||
SYSTEMD_FILES=("algorand.service" "[email protected]") | ||
mkdir -p "$PKG_ROOT/lib/systemd/system" | ||
for svc in "${SYSTEMD_FILES[@]}"; do | ||
cp "./installer/${svc}" "${PKG_ROOT}/lib/systemd/system" | ||
chmod 644 "${PKG_ROOT}/lib/systemd/system/${svc}" | ||
done | ||
fi | ||
|
||
mkdir -p "$PKG_ROOT/etc/apt/apt.conf.d" | ||
cat <<EOF> "$PKG_ROOT/etc/apt/apt.conf.d/$UNATTENDED_UPGRADES_FILE" | ||
## This file is provided by the Algorand package to configure | ||
## unattended upgrades for the Algorand node software. | ||
Unattended-Upgrade::Allowed-Origins { | ||
"Algorand:$CHANNEL"; | ||
}; | ||
Dpkg::Options { | ||
"--force-confdef"; | ||
"--force-confold"; | ||
}; | ||
EOF | ||
mkdir -p "$PKG_ROOT/DEBIAN" | ||
# Can contain `control`, `preinst`, `postinst`, `prerm`, `postrm`, `conffiles`. | ||
CTL_FILES_DIR="./installer/debian/$PKG_NAME" | ||
for ctl_file in $(ls "$CTL_FILES_DIR"); do | ||
# Copy first, to preserve permissions, then overwrite to fill in template. | ||
cp -a "$CTL_FILES_DIR/$ctl_file" "$PKG_ROOT/DEBIAN/$ctl_file" | ||
< "$CTL_FILES_DIR/$ctl_file" \ | ||
sed -e "s,@ARCH@,$ARCH," \ | ||
-e "s,@VER@,$VER," \ | ||
-e "s,@PKG_NAME@,$PKG_NAME," \ | ||
> "$PKG_ROOT/DEBIAN/$ctl_file" | ||
done | ||
# TODO: make `Files:` segments for vendor/... and crypto/libsodium-fork, but reasonably this should be understood to cover all _our_ files and copied in packages continue to be licenced under their own terms | ||
cat <<EOF> "$PKG_ROOT/DEBIAN/copyright" | ||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: Algorand | ||
Upstream-Contact: Algorand developers <[email protected]> | ||
Source: https://github.com/algorand/go-algorand | ||
Files: * | ||
Copyright: Algorand developers <[email protected]> | ||
License: AGPL-3+ | ||
EOF | ||
sed 's/^$/./g' < COPYING | sed 's/^/ /g' >> "$PKG_ROOT/DEBIAN/copyright" | ||
mkdir -p "$PKG_ROOT/usr/share/doc/$PKG_NAME" | ||
cp -p "$PKG_ROOT/DEBIAN/copyright" "$PKG_ROOT/usr/share/doc/$PKG_NAME/copyright" | ||
dpkg-deb --build "$PKG_ROOT" "$OUTPUT_DEB" | ||
echo | ||
date "+build_release end PACKAGE DEB stage %Y%m%d_%H%M%S" | ||
echo | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.