From 37ede490777369103d1806ae30fb04700bb633b6 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 14 Apr 2020 14:20:44 +0200 Subject: [PATCH] build: Remove snap build machinery (#6532) --- .gitignore | 6 ------ Dockerfile.builder | 11 +--------- build.go | 45 ----------------------------------------- snapcraft.yaml.template | 36 --------------------------------- 4 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 snapcraft.yaml.template diff --git a/.gitignore b/.gitignore index d920fea7c..48fd7d9a8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,11 +16,5 @@ syncthing.sig RELEASE deb lib/auto/gui.files.go -snapcraft.yaml -prime/ -snap/ -parts/ -stage/ -*.snap *.bz2 /repos diff --git a/Dockerfile.builder b/Dockerfile.builder index 3f1094834..0319e52f7 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -1,13 +1,4 @@ -# We will grab the Go compiler from the latest Go image. -FROM golang:1.13 as go - -# Otherwise we base on the snapcraft container as that is by far the -# most complex and tricky thing to get installed and working... -FROM snapcore/snapcraft - -# Go -COPY --from=go /usr/local/go /usr/local/go -ENV PATH="/usr/local/go/bin:$PATH" +FROM golang:1.13 # FPM to build Debian packages RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/build.go b/build.go index bf763601a..f03f66d22 100644 --- a/build.go +++ b/build.go @@ -31,7 +31,6 @@ import ( "runtime" "strconv" "strings" - "text/template" "time" ) @@ -323,9 +322,6 @@ func runCommand(cmd string, target target) { case "deb": buildDeb(target) - case "snap": - buildSnap(target) - case "vet": metalintShort() @@ -588,47 +584,6 @@ func buildDeb(target target) { runPrint("fpm", args...) } -func buildSnap(target target) { - os.RemoveAll("snap") - - tmpl, err := template.ParseFiles("snapcraft.yaml.template") - if err != nil { - log.Fatal(err) - } - f, err := os.Create("snapcraft.yaml") - defer f.Close() - if err != nil { - log.Fatal(err) - } - - snaparch := goarch - if snaparch == "armhf" { - goarch = "arm" - } else if snaparch == "i386" { - goarch = "386" - } - snapver := version - if strings.HasPrefix(snapver, "v") { - snapver = snapver[1:] - } - snapgrade := "devel" - if matched, _ := regexp.MatchString(`^\d+\.\d+\.\d+(-rc.\d+)?$`, snapver); matched { - snapgrade = "stable" - } - err = tmpl.Execute(f, map[string]string{ - "Version": snapver, - "HostArchitecture": runtime.GOARCH, - "TargetArchitecture": snaparch, - "Grade": snapgrade, - }) - if err != nil { - log.Fatal(err) - } - runPrint("snapcraft", "clean") - build(target, []string{"noupgrade"}) - runPrint("snapcraft") -} - func shouldBuildSyso(dir string) (string, error) { type M map[string]interface{} version := getVersion() diff --git a/snapcraft.yaml.template b/snapcraft.yaml.template deleted file mode 100644 index 56c73de3a..000000000 --- a/snapcraft.yaml.template +++ /dev/null @@ -1,36 +0,0 @@ -name: syncthing -version: {{.Version}} -summary: Open Source Continuous File Synchronization -description: | - Syncthing replaces proprietary sync and cloud services with something open, - trustworthy and decentralized. Your data is your data alone and you deserve - to choose where it is stored, if it is shared with some third party and how - it's transmitted over the Internet. -architectures: - - build-on: [{{.HostArchitecture}}] - run-on: [{{.TargetArchitecture}}] - -grade: {{.Grade}} -confinement: strict - -apps: - syncthing: - command: syncthing - environment: - HOME: ${SNAP_USER_COMMON} - XDG_CONFIG_HOME: ${SNAP_USER_COMMON} - plugs: - - desktop - - home - - network - - network-bind - - removable-media - -parts: - syncthing: - source: . - plugin: dump - stage: - - syncthing - prime: - - syncthing