build: Build Debian packages for non-syncthing targets (fixes #4193)
Things like the package name "syncthing" was hardcoded, which is not awesome. With this in place we can build debs called syncthing-discosrv, syncthing-relaysrv and syncthing-relaypoolsrv. I don't actually intend to build and publish the relaypoolsrv, but the others can be good. Using the "syncthing-" prefix to make the obvious "apt-cache search syncthing" actually show them etc. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4206 LGTM: AudriusButkevicius, calmh
This commit is contained in:
parent
9c4175715a
commit
2a38d2a3d2
86
build.go
86
build.go
|
@ -44,6 +44,10 @@ var (
|
||||||
|
|
||||||
type target struct {
|
type target struct {
|
||||||
name string
|
name string
|
||||||
|
debname string
|
||||||
|
debdeps []string
|
||||||
|
debpost string
|
||||||
|
description string
|
||||||
buildPkg string
|
buildPkg string
|
||||||
binaryName string
|
binaryName string
|
||||||
archiveFiles []archiveFile
|
archiveFiles []archiveFile
|
||||||
|
@ -66,9 +70,13 @@ var targets = map[string]target{
|
||||||
},
|
},
|
||||||
"syncthing": {
|
"syncthing": {
|
||||||
// The default target for "build", "install", "tar", "zip", "deb", etc.
|
// The default target for "build", "install", "tar", "zip", "deb", etc.
|
||||||
name: "syncthing",
|
name: "syncthing",
|
||||||
buildPkg: "./cmd/syncthing",
|
debname: "syncthing",
|
||||||
binaryName: "syncthing", // .exe will be added automatically for Windows builds
|
debdeps: []string{"libc6", "procps"},
|
||||||
|
debpost: "script/post-upgrade",
|
||||||
|
description: "Open Source Continuous File Synchronization",
|
||||||
|
buildPkg: "./cmd/syncthing",
|
||||||
|
binaryName: "syncthing", // .exe will be added automatically for Windows builds
|
||||||
archiveFiles: []archiveFile{
|
archiveFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||||
{src: "README.md", dst: "README.txt", perm: 0644},
|
{src: "README.md", dst: "README.txt", perm: 0644},
|
||||||
|
@ -98,9 +106,12 @@ var targets = map[string]target{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"stdiscosrv": {
|
"stdiscosrv": {
|
||||||
name: "stdiscosrv",
|
name: "stdiscosrv",
|
||||||
buildPkg: "./cmd/stdiscosrv",
|
debname: "syncthing-discosrv",
|
||||||
binaryName: "stdiscosrv", // .exe will be added automatically for Windows builds
|
debdeps: []string{"libc6"},
|
||||||
|
description: "Syncthing Discovery Server",
|
||||||
|
buildPkg: "./cmd/stdiscosrv",
|
||||||
|
binaryName: "stdiscosrv", // .exe will be added automatically for Windows builds
|
||||||
archiveFiles: []archiveFile{
|
archiveFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||||
{src: "cmd/stdiscosrv/README.md", dst: "README.txt", perm: 0644},
|
{src: "cmd/stdiscosrv/README.md", dst: "README.txt", perm: 0644},
|
||||||
|
@ -109,17 +120,20 @@ var targets = map[string]target{
|
||||||
},
|
},
|
||||||
installationFiles: []archiveFile{
|
installationFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755},
|
||||||
{src: "cmd/stdiscosrv/README.md", dst: "deb/usr/share/doc/stdiscosrv/README.txt", perm: 0644},
|
{src: "cmd/stdiscosrv/README.md", dst: "deb/usr/share/doc/syncthing-discosrv/README.txt", perm: 0644},
|
||||||
{src: "cmd/stdiscosrv/LICENSE", dst: "deb/usr/share/doc/stdiscosrv/LICENSE.txt", perm: 0644},
|
{src: "cmd/stdiscosrv/LICENSE", dst: "deb/usr/share/doc/syncthing-discosrv/LICENSE.txt", perm: 0644},
|
||||||
{src: "AUTHORS", dst: "deb/usr/share/doc/stdiscosrv/AUTHORS.txt", perm: 0644},
|
{src: "AUTHORS", dst: "deb/usr/share/doc/syncthing-discosrv/AUTHORS.txt", perm: 0644},
|
||||||
{src: "man/stdiscosrv.1", dst: "deb/usr/share/man/man1/stdiscosrv.1", perm: 0644},
|
{src: "man/stdiscosrv.1", dst: "deb/usr/share/man/man1/stdiscosrv.1", perm: 0644},
|
||||||
},
|
},
|
||||||
tags: []string{"purego"},
|
tags: []string{"purego"},
|
||||||
},
|
},
|
||||||
"strelaysrv": {
|
"strelaysrv": {
|
||||||
name: "strelaysrv",
|
name: "strelaysrv",
|
||||||
buildPkg: "./cmd/strelaysrv",
|
debname: "syncthing-relaysrv",
|
||||||
binaryName: "strelaysrv", // .exe will be added automatically for Windows builds
|
debdeps: []string{"libc6"},
|
||||||
|
description: "Syncthing Relay Server",
|
||||||
|
buildPkg: "./cmd/strelaysrv",
|
||||||
|
binaryName: "strelaysrv", // .exe will be added automatically for Windows builds
|
||||||
archiveFiles: []archiveFile{
|
archiveFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||||
{src: "cmd/strelaysrv/README.md", dst: "README.txt", perm: 0644},
|
{src: "cmd/strelaysrv/README.md", dst: "README.txt", perm: 0644},
|
||||||
|
@ -128,16 +142,19 @@ var targets = map[string]target{
|
||||||
},
|
},
|
||||||
installationFiles: []archiveFile{
|
installationFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755},
|
||||||
{src: "cmd/strelaysrv/README.md", dst: "deb/usr/share/doc/strelaysrv/README.txt", perm: 0644},
|
{src: "cmd/strelaysrv/README.md", dst: "deb/usr/share/doc/syncthing-relaysrv/README.txt", perm: 0644},
|
||||||
{src: "cmd/strelaysrv/LICENSE", dst: "deb/usr/share/doc/strelaysrv/LICENSE.txt", perm: 0644},
|
{src: "cmd/strelaysrv/LICENSE", dst: "deb/usr/share/doc/syncthing-relaysrv/LICENSE.txt", perm: 0644},
|
||||||
{src: "AUTHORS", dst: "deb/usr/share/doc/strelaysrv/AUTHORS.txt", perm: 0644},
|
{src: "AUTHORS", dst: "deb/usr/share/doc/syncthing-relaysrv/AUTHORS.txt", perm: 0644},
|
||||||
{src: "man/strelaysrv.1", dst: "deb/usr/share/man/man1/strelaysrv.1", perm: 0644},
|
{src: "man/strelaysrv.1", dst: "deb/usr/share/man/man1/strelaysrv.1", perm: 0644},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"strelaypoolsrv": {
|
"strelaypoolsrv": {
|
||||||
name: "strelaypoolsrv",
|
name: "strelaypoolsrv",
|
||||||
buildPkg: "./cmd/strelaypoolsrv",
|
debname: "syncthing-relaypoolsrv",
|
||||||
binaryName: "strelaypoolsrv", // .exe will be added automatically for Windows builds
|
debdeps: []string{"libc6"},
|
||||||
|
description: "Syncthing Relay Pool Server",
|
||||||
|
buildPkg: "./cmd/strelaypoolsrv",
|
||||||
|
binaryName: "strelaypoolsrv", // .exe will be added automatically for Windows builds
|
||||||
archiveFiles: []archiveFile{
|
archiveFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "{{binary}}", perm: 0755},
|
||||||
{src: "cmd/strelaypoolsrv/README.md", dst: "README.txt", perm: 0644},
|
{src: "cmd/strelaypoolsrv/README.md", dst: "README.txt", perm: 0644},
|
||||||
|
@ -146,9 +163,9 @@ var targets = map[string]target{
|
||||||
},
|
},
|
||||||
installationFiles: []archiveFile{
|
installationFiles: []archiveFile{
|
||||||
{src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755},
|
{src: "{{binary}}", dst: "deb/usr/bin/{{binary}}", perm: 0755},
|
||||||
{src: "cmd/strelaypoolsrv/README.md", dst: "deb/usr/share/doc/relaysrv/README.txt", perm: 0644},
|
{src: "cmd/strelaypoolsrv/README.md", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/README.txt", perm: 0644},
|
||||||
{src: "cmd/strelaypoolsrv/LICENSE", dst: "deb/usr/share/doc/relaysrv/LICENSE.txt", perm: 0644},
|
{src: "cmd/strelaypoolsrv/LICENSE", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/LICENSE.txt", perm: 0644},
|
||||||
{src: "AUTHORS", dst: "deb/usr/share/doc/relaysrv/AUTHORS.txt", perm: 0644},
|
{src: "AUTHORS", dst: "deb/usr/share/doc/syncthing-relaypoolsrv/AUTHORS.txt", perm: 0644},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -528,15 +545,26 @@ func buildDeb(target target) {
|
||||||
// than just 0.14.26. This rectifies that.
|
// than just 0.14.26. This rectifies that.
|
||||||
debver = strings.Replace(debver, "-", "~", -1)
|
debver = strings.Replace(debver, "-", "~", -1)
|
||||||
}
|
}
|
||||||
runPrint("fpm", "-t", "deb", "-s", "dir", "-C", "deb",
|
args := []string{
|
||||||
"-n", "syncthing", "-v", debver, "-a", debarch,
|
"-t", "deb",
|
||||||
"--vendor", maintainer, "-m", maintainer,
|
"-s", "dir",
|
||||||
"-d", "libc6",
|
"-C", "deb",
|
||||||
"-d", "procps", // because postinst script
|
"-n", target.debname,
|
||||||
|
"-v", debver,
|
||||||
|
"-a", debarch,
|
||||||
|
"-m", maintainer,
|
||||||
|
"--vendor", maintainer,
|
||||||
|
"--description", target.description,
|
||||||
"--url", "https://syncthing.net/",
|
"--url", "https://syncthing.net/",
|
||||||
"--description", "Open Source Continuous File Synchronization",
|
"--license", "MPL-2",
|
||||||
"--after-upgrade", "script/post-upgrade",
|
}
|
||||||
"--license", "MPL-2")
|
for _, dep := range target.debdeps {
|
||||||
|
args = append(args, "-d", dep)
|
||||||
|
}
|
||||||
|
if target.debpost != "" {
|
||||||
|
args = append(args, "--after-upgrade", target.debpost)
|
||||||
|
}
|
||||||
|
runPrint("fpm", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildSnap(target target) {
|
func buildSnap(target target) {
|
||||||
|
|
Loading…
Reference in New Issue