Skip to content

Commit 883ad0d

Browse files
committed
feat: add snap package configuration
Simplify keeping the snap package up to date by including the snapcraft.yaml in the repo. We can then wire up the snapstore to autobuild the package for amd64,i386,arm* etc. Many thanks to @ElOpio for the work of getting ipfs into the snap store in the first place, and to @bertrandfalguiere and @mkg20001 for pushing it forwards. See: https://github.com/ipfs-shipyard/ipfs-snap for more info. Fixes #7250 WIP #3595 License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
1 parent a61132e commit 883ad0d

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ vendor
2727
go-ipfs-source.tar.gz
2828
docs/examples/go-ipfs-as-a-library/example-folder/Qm*
2929
/test/sharness/t0054-dag-car-import-export-data/*.car
30+
31+
# ignore build output from snapcraft
32+
/ipfs_*.snap
33+
/parts
34+
/stage
35+
/prime

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM golang:1.14.4-buster
1+
# Note: when updating the go minor version here, also update the go-channel in snap/snapcraft.yml
2+
FROM golang:1.14.4-buster
23
LABEL maintainer="Steven Allen <steven@stebalien.com>"
34

45
# Install deps

snap/snapcraft.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This snap will build go-ipfs from source.
2+
# See: https://github.com/ipfs-shipyard/ipfs-snap for more details
3+
name: ipfs
4+
summary: global, versioned, peer-to-peer filesystem # 79 char long summary
5+
description: |
6+
IPFS combines good ideas from Git, BitTorrent, Kademlia, SFS, and the Web.
7+
It is like a single bittorrent swarm, exchanging git objects. IPFS provides
8+
an interface as simple as the HTTP web, but with permanence built in. You
9+
can also mount the world at /ipfs.
10+
11+
# fetch the version number in the `ipfs` part rather than hardcode it here
12+
# see: https://snapcraft.io/docs/using-external-metadata#heading--scriptlet
13+
adopt-info: ipfs
14+
base: core18
15+
grade: stable
16+
confinement: strict
17+
18+
apps:
19+
ipfs:
20+
command: ipfs
21+
plugs: [network, network-bind, removable-media]
22+
environment:
23+
# Snaps versions are isolated by default. This keeps the same ipfs repo across upgrades.
24+
IPFS_PATH: "$SNAP_USER_COMMON"
25+
26+
parts:
27+
ipfs:
28+
source: '.'
29+
# TODO: set this to master when porting this file to ipfs/go-ipfs.
30+
# Setting it explicitly lets us build the missing versions 0.5 and 0.6
31+
source-tag: master
32+
plugin: go
33+
# keep me up to date with the go version that go-ipfs expects to be built with.
34+
go-channel: 1.14/stable
35+
go-importpath: github.com/ipfs/go-ipfs
36+
build-packages:
37+
- build-essential
38+
39+
# use `make` to build and set the snap version from `ipfs version` output
40+
override-build: |
41+
export GOPATH=$SNAPCRAFT_PART_BUILD/go
42+
make install
43+
cp $SNAPCRAFT_PART_BUILD/go/bin/ipfs $SNAPCRAFT_PART_INSTALL
44+
export IPFS_VERSION=$($SNAPCRAFT_PART_BUILD/go/bin/ipfs version --commit | cut -c 14-)
45+
echo "found version $IPFS_VERSION"
46+
snapcraftctl set-version $IPFS_VERSION

0 commit comments

Comments
 (0)