Browse Source

build: Remove snap build machinery (#6532)

Jakob Borg 5 years ago
parent
commit
37ede49077
4 changed files with 1 additions and 97 deletions
  1. 0 6
      .gitignore
  2. 1 10
      Dockerfile.builder
  3. 0 45
      build.go
  4. 0 36
      snapcraft.yaml.template

+ 0 - 6
.gitignore

@@ -16,11 +16,5 @@ syncthing.sig
 RELEASE
 deb
 lib/auto/gui.files.go
-snapcraft.yaml
-prime/
-snap/
-parts/
-stage/
-*.snap
 *.bz2
 /repos

+ 1 - 10
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 \

+ 0 - 45
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()

+ 0 - 36
snapcraft.yaml.template

@@ -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