Skip to content

Commit

Permalink
Snap Packaging #3313
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio authored and jackzampolin committed Jan 28, 2019
1 parent 75c3a44 commit 57ae957
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ draw_deps: tools
@goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png

clean:
rm -f devtools-stamp vendor-deps
rm -f devtools-stamp vendor-deps snapcraft.yaml

########################################
### Documentation
Expand Down Expand Up @@ -235,6 +235,18 @@ localnet-start: localnet-stop
localnet-stop:
docker-compose down


########################################
### Packaging

snapcraft.yaml: snapcraft.yaml.in
sed "s/@VERSION@/${VERSION}/g" < $< > $@

build-snap-edge: snapcraft.yaml
snapcraft clean
snapcraft


# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
Expand All @@ -243,4 +255,5 @@ check_tools check_dev_tools get_vendor_deps draw_deps test test_cli test_unit \
test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \
build-linux build-docker-gaiadnode localnet-start localnet-stop \
format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \
test_sim_gaia_multi_seed test_sim_gaia_import_export update_tools update_dev_tools
test_sim_gaia_multi_seed test_sim_gaia_import_export update_tools update_dev_tools \
build-snap-edge
49 changes: 49 additions & 0 deletions snapcraft.yaml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: gaia # you probably want to 'snapcraft register <name>'
# base: core18 # the base snap is the execution environment for this snap
version: '@VERSION@' # just for humans, typically '1.2+git' or '1.3.2'
summary: Gaia Daemon # 79 char long summary
description: |
This snap provides the Gaia daemon gaiad and the command line
tool gaiacli.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

apps:
gaiad:
command: bin/gaiad
plugs: [home,network,network-bind]
gaiacli:
command: bin/gaiacli
plugs: [home,network,network-bind]

parts:
gaia:
plugin: dump
source: ./
override-pull: |
rootdir=$(pwd)
gitroot=$(git rev-parse --show-toplevel)
cd ${gitroot} && git archive \
-o ${rootdir}/gaia-@[email protected] \
--format tar.gz -9 --prefix gaia-@VERSION@/ HEAD
cd ${rootdir}
tar xvf gaia-@[email protected] ; rm -f gaia-@[email protected]
mkdir -p go/src/github.com/cosmos bin
mv gaia-@VERSION@/ go/src/github.com/cosmos/cosmos-sdk/

# Use the following instructions to build a package from a release.
# wget https://github.com/cosmos/cosmos-sdk/archive/v@[email protected]
# tar xvf v@[email protected]
# rm v@[email protected]

build-snaps: [go]
override-build: |
base=`pwd`
export GOPATH=`pwd`/go
cd $GOPATH/src/github.com/cosmos/cosmos-sdk
make tools
make vendor-deps
make install
mkdir $SNAPCRAFT_PART_INSTALL/bin
cp $GOPATH/bin/gaiad $SNAPCRAFT_PART_INSTALL/bin
cp $GOPATH/bin/gaiacli $SNAPCRAFT_PART_INSTALL/bin

0 comments on commit 57ae957

Please sign in to comment.