New package build process with merged configuration folders

This commit is contained in:
Greg Szabo 2017-10-03 23:47:59 -04:00
parent 9ff1bd8c9c
commit eb3f6e65a0
15 changed files with 116 additions and 195 deletions

View File

@ -32,12 +32,12 @@ endif
# Here comes the real deal
###
binaries = tendermint basecoin ethermint trackomatron gaia cosmos-sdk
build-binaries = build-tendermint build-basecoin build-ethermint build-trackomatron build-gaia build-cosmos-sdk
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint package-rpm-trackomatron package-rpm-gaia package-rpm-cosmos-sdk
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint install-rpm-trackomatron install-rpm-gaia package-rpm-cosmos-sdk
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint package-deb-trackomatron package-deb-gaia package-deb-cosmos-sdk
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint install-deb-trackomatron install-deb-gaia install-deb-cosmos-sdk
binaries = tendermint basecoin ethermint trackomatron gaia basecoin-old
build-binaries = build-tendermint build-basecoin build-ethermint build-trackomatron build-gaia build-basecoin-old
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint package-rpm-trackomatron package-rpm-gaia package-rpm-basecoin-old
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint install-rpm-trackomatron install-rpm-gaia package-rpm-basecoin-old
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint package-deb-trackomatron package-deb-gaia package-deb-basecoin-old
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint install-deb-trackomatron install-deb-gaia install-deb-basecoin-old
all: $(binaries)
build: $(build-binaries)
@ -60,11 +60,12 @@ build-tendermint: git-branch
cp $(GOPATH)/src/github.com/tendermint/tendermint/build/tendermint $(GOPATH)/bin
@echo "*** Built tendermint"
build-basecoin: git-branch
@echo "*** Building basecoin"
build-basecoin-old: git-branch
@echo "*** Building basecoin-old"
go get -d -u github.com/tendermint/basecoin/cmd/basecoin
cd $(GOPATH)/src/github.com/tendermint/basecoin && git checkout "$(GIT_BRANCH)" && git pull
$(MAKE) -C $(GOPATH)/src/github.com/tendermint/basecoin get_vendor_deps install
@echo "Workaround: basecoin-old does not have a binary that gives the basecoin-old version number." && rm -rf $(GOPATH)/bin/basecoin-old && ln -s $(GOPATH)/bin/basecoin $(GOPATH)/bin/basecoin-old
@echo "*** Built basecoin"
build-ethermint: git-branch
@ -90,13 +91,12 @@ build-gaia: git-branch
$(MAKE) -C $(GOPATH)/src/github.com/cosmos/gaia get_vendor_deps install
@echo "*** Built gaia"
build-cosmos-sdk: git-branch
@echo "*** Building cosmos-sdk"
build-basecoin: git-branch
@echo "*** Building basecoin from cosmos-sdk"
go get -d -u go github.com/cosmos/cosmos-sdk || echo "Workaround for go downloads."
cd $(GOPATH)/src/github.com/cosmos/cosmos-sdk && git checkout "$(GIT_BRANCH)" && git pull
$(MAKE) -C $(GOPATH)/src/github.com/cosmos/cosmos-sdk get_vendor_deps install
@echo "Workaround: cosmos-sdk does not have a binary that gives the cosmos-sdk version number." && rm -rf $(GOPATH)/bin/cosmos-sdk && ln -s $(GOPATH)/bin/basecoin $(GOPATH)/bin/cosmos-sdk
@echo "*** Built cosmos-sdk"
@echo "*** Built basecoin from cosmos-sdk"
###
# Prepare package files
@ -119,14 +119,13 @@ prepare-files = rm -rf $(build_folder) && mkdir -p $(build_folder) && cp -r ./$(
##
prepare-tendermint =
prepare-basecoin = cp $(GOPATH)/bin/basecli $(build_folder)/usr/bin
prepare-basecoin-old = rm -f $(build_folder)/usr/bin/basecoin-old && cp $(GOPATH)/bin/basecli $(GOPATH)/bin/basecoin $(build_folder)/usr/bin
prepare-ethermint = mkdir -p $(build_folder)/etc/ethermint && \
cp $(GOPATH)/src/github.com/tendermint/ethermint/setup/genesis.json $(build_folder)/etc/ethermint/genesis.json && \
cp -r $(GOPATH)/src/github.com/tendermint/ethermint/setup/keystore $(build_folder)/etc/ethermint
prepare-trackomatron = rm -f $(build_folder)/usr/bin/trackomatron && cp $(GOPATH)/bin/tracko $(GOPATH)/bin/trackocli $(build_folder)/usr/bin
prepare-gaia =
prepare-cosmos-sdk = rm -f $(build_folder)/usr/bin/cosmos-sdk && \
cp $(GOPATH)/bin/basecli $(GOPATH)/bin/basecoin $(GOPATH)/bin/baseserver $(GOPATH)/bin/counter $(GOPATH)/bin/countercli $(GOPATH)/bin/eyes $(GOPATH)/bin/eyescli $(build_folder)/usr/bin
prepare-basecoin = rm -f $(build_folder)/usr/bin/basecoin-old && cp $(GOPATH)/bin/basecli $(GOPATH)/bin/basecoin $(GOPATH)/bin/baseserver $(GOPATH)/bin/counter $(GOPATH)/bin/countercli $(GOPATH)/bin/eyes $(GOPATH)/bin/eyescli $(build_folder)/usr/bin
###
# Package the binary for CentOS/RedHat (RPM) and Debian/Ubuntu (DEB)
@ -146,9 +145,10 @@ package-rpm-%: folder-%
mkdir -p {SPECS,tmp}
cp ./spectemplates/$*.spec SPECS
./generate-spec $* spectemplates SPECS
sed -i "s/@VERSION@/$($*_version)/" SPECS/$*.spec
sed -i "s/@BUILD_NUMBER@/$(BUILD_NUMBER)/" SPECS/$*.spec
sed -i "s/@PACKAGE_NAME@/$*/" SPECS/$*.spec
rpmbuild -bb SPECS/$*.spec --define "_topdir `pwd`" --define "_tmppath `pwd`/tmp"
./sign RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm "$(gpg_key)" "`which gpg`"

View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.10.0)
Depends: tendermint (>=0.11.0)
Standards-Version: 3.9.6
Homepage: https://tendermint.com
Package: basecoin

View File

@ -3,7 +3,8 @@ Description=Basecoin server
Requires=network-online.target
BindTo=basecoin.service
PartOf=basecoin.service
After=network-online.target basecoin.service
Before=basecoin.service
After=network-online.target
PropagatesReloadTo=basecoin.service
ReloadPropagatedFrom=basecoin.service
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target basecoin.service
WantedBy=multi-user.target
Also=basecoin.service

View File

@ -7,8 +7,7 @@ BindTo=basecoin-server.service
#propagates stop and restart (one-way)
PartOf=basecoin-server.service
#order
Before=basecoin-server.service
After=network-online.target
After=network-online.target basecoin-server.service
#propagates reload
PropagatesReloadTo=basecoin-server.service
ReloadPropagatedFrom=basecoin-server.service
@ -24,6 +23,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target basecoin-server.service
Also=basecoin-server.service

36
build/generate-spec Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Usage: $0 <application> <template_source_dir> <SPEC_dir>"
exit 1
fi
app=$1
src=$2
dst=$3
# Find spectemplate
if [ ! -f "$src/$app.spec" ]; then
if [ ! -f "$src/app-template.spec" ]; then
echo "Source template not found."
exit 1
else
srcfile="$src/app-template.spec"
fi
else
srcfile="$src/$app.spec"
fi
# Copy spectemplate to SPECS
cp "$srcfile" "$dst/$app.spec"
# Apply any variables defined in .data
if [ -f "$src/$app.data" ]; then
srcdata="$src/$app.data"
source "$srcdata"
for var in `grep -v -e ^# -e ^\s*$ "$srcdata" | grep = | sed 's/\s*=.*$//'`
do
sed -i "s\\@${var}@\\${!var}\\g" "$dst/$app.spec"
done
fi

View File

@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: gaia
Summary: gaia - Tendermint Cosmos delegation game chain
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
License: Apache 2.0
URL: https://cosmos.network/
URL: @PACKAGE_URL@
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
#Requires(pre): useradd
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
%description
Gaia description comes later.
@PACKAGE_DESCRIPTION@
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
chmod 755 %{_sysconfdir}/%{name}
chown %{name}.%{name} %{_sysconfdir}/%{name}
fi
%prep
@ -33,12 +35,9 @@ cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} gaia init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
sudo -Hu %{name} %{name} init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 %{_sysconfdir}/%{name}/tendermint
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
@ -55,7 +54,6 @@ systemctl daemon-reload
%files
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*

View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="basecoin is a Proof-of-Stake cryptocurrency and framework"
PACKAGE_URL="https://cosmos.network/"
PACKAGE_ADDITIONAL_HEADER="Provides: basecli"
PACKAGE_DESCRIPTION="Basecoin is an ABCI application designed to be used with the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency. It also provides a general purpose framework for extending the feature-set of the cryptocurrency by implementing plugins."

View File

@ -1,69 +0,0 @@
Version: @VERSION@
Release: @BUILD_NUMBER@
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: basecoin
Summary: basecoin is a Proof-of-Stake cryptocurrency and framework
License: Apache 2.0
URL: https://tendermint.com/
Packager: Greg Szabo
Requires: tendermint >= 0.11.0
Provides: basecli
%description
Basecoin is an ABCI application designed to be used with the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency. It also provides a general purpose framework for extending the feature-set of the cryptocurrency by implementing plugins.
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
echo "`date`: useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}" >> /tmp/rpmdebug
set >> /tmp/rpmdebug
echo "---" >> /tmp/rpmdebug
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
chmod 755 %{_sysconfdir}/%{name}
fi
%prep
# Nothing to do here. - It is done in the Makefile.
%build
# Nothing to do here.
%install
cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} basecoin init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 %{_sysconfdir}/%{name}/tendermint
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
rm -f %{_sysconfdir}/%{name}/key2.json
systemctl daemon-reload
%preun
systemctl stop %{name} 2> /dev/null || :
systemctl stop %{name}-service 2> /dev/null || :
%postun
systemctl daemon-reload
%files
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%dir %{_defaultlicensedir}/%{name}
%doc %{_defaultlicensedir}/%{name}/LICENSE

View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="cosmos-sdk is a Proof-of-Stake framework"
PACKAGE_URL="https://cosmos.network/"
PACKAGE_ADDITIONAL_HEADER="Provides: basecoin basecli"
PACKAGE_DESCRIPTION="Cosmos-SDK is a general purpose framework for the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency."

View File

@ -1,67 +0,0 @@
Version: @VERSION@
Release: @BUILD_NUMBER@
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: cosmos-sdk
Summary: cosmos-sdk is a Proof-of-Stake framework
License: Apache 2.0
URL: https://cosmos.network/
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
Provides: basecoin basecli
#Requires(pre): useradd
%description
Cosmos-SDK is a general purpose framework for the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency.
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
chmod 755 %{_sysconfdir}/%{name}
fi
%prep
# Nothing to do here. - It is done in the Makefile.
%build
# Nothing to do here.
%install
cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} basecoin init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 %{_sysconfdir}/%{name}/tendermint
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
rm -f %{_sysconfdir}/%{name}/key2.json
systemctl daemon-reload
%preun
systemctl stop %{name} 2> /dev/null || :
systemctl stop %{name}-service 2> /dev/null || :
%postun
systemctl daemon-reload
%files
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%dir %{_defaultlicensedir}/%{name}
%doc %{_defaultlicensedir}/%{name}/LICENSE

View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="ethermint enables ethereum as an ABCI application on tendermint and the COSMOS hub"
PACKAGE_URL="https://tendermint.com/"
PACKAGE_ADDITIONAL_HEADER="Provides: basecli"
PACKAGE_DESCRIPTION="Ethermint enables ethereum to run as an ABCI application on tendermint and the COSMOS hub. This application allows you to get all the benefits of ethereum without having to run your own miners."

View File

@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: ethermint
Summary: ethermint enables ethereum as an ABCI application on tendermint and the COSMOS hub
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
License: Apache 2.0
URL: https://tendermint.com/
URL: @PACKAGE_URL@
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
#Requires(pre): useradd
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
%description
Ethermint enables ethereum to run as an ABCI application on tendermint and the COSMOS hub. This application allows you to get all the benefits of ethereum without having to run your own miners.
@PACKAGE_DESCRIPTION@
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
chmod 755 %{_sysconfdir}/%{name}
chown %{name}.%{name} %{_sysconfdir}/%{name}
fi
%prep
@ -33,10 +35,9 @@ cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} %{_bindir}/%{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
chmod 755 %{_sysconfdir}/%{name}/tendermint
sudo -Hu %{name} %{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
systemctl daemon-reload
@ -52,7 +53,6 @@ systemctl daemon-reload
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/genesis.json
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/keystore
%attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/keystore/*
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*

View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="gaia - Tendermint Cosmos delegation game chain"
PACKAGE_URL="https://cosmos.network/"
PACKAGE_ADDITIONAL_HEADER=""
PACKAGE_DESCRIPTION="Gaia description comes later."

View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="Trackomatron - Track invoices on the blockchain"
PACKAGE_URL="https://tendermint.com/"
PACKAGE_ADDITIONAL_HEADER=""
PACKAGE_DESCRIPTION="This software is intended to create a space to easily send invoices between and within institutions. Firstly, the commands of trackmatron are separated into two broad categories: submitting information to the blockchain (transactions), and retrieving information from the blockchain (query)."

View File

@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: trackomatron
Summary: Trackomatron - Track invoices on the blockchain
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
License: Apache 2.0
URL: https://tendermint.com/
URL: @PACKAGE_URL@
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
#Requires(pre): useradd
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
%description
This software is intended to create a space to easily send invoices between and within institutions. Firstly, the commands of trackmatron are separated into two broad categories: submitting information to the blockchain (transactions), and retrieving information from the blockchain (query).
@PACKAGE_DESCRIPTION@
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
chmod 755 %{_sysconfdir}/%{name}
chown %{name}.%{name} %{_sysconfdir}/%{name}
fi
%prep
@ -35,10 +37,7 @@ cd %{name}-%{version}-%{release}
%post
sudo -Hu %{name} tracko init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 %{_sysconfdir}/%{name}/tendermint
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
@ -55,7 +54,6 @@ systemctl daemon-reload
%files
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*