{release,version}: add DSM7.2 specific synology builds (#13405)

Add separate builds for DSM7.2 for synology so that we can encode
separate versioning information in the INFO file to distinguish between
the two.

Fixes https://github.com/tailscale/corp/issues/22908

Signed-off-by: Mario Minardi <mario@tailscale.com>
pull/13500/head
Mario Minardi 2 months ago committed by GitHub
parent 8a6f48b455
commit 43f4131d7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -24,13 +24,14 @@ import (
type target struct { type target struct {
filenameArch string filenameArch string
dsmMajorVersion int dsmMajorVersion int
dsmMinorVersion int
goenv map[string]string goenv map[string]string
packageCenter bool packageCenter bool
signer dist.Signer signer dist.Signer
} }
func (t *target) String() string { func (t *target) String() string {
return fmt.Sprintf("synology/dsm%d/%s", t.dsmMajorVersion, t.filenameArch) return fmt.Sprintf("synology/dsm%s/%s", t.dsmVersionString(), t.filenameArch)
} }
func (t *target) Build(b *dist.Build) ([]string, error) { func (t *target) Build(b *dist.Build) ([]string, error) {
@ -42,9 +43,31 @@ func (t *target) Build(b *dist.Build) ([]string, error) {
return t.buildSPK(b, inner) return t.buildSPK(b, inner)
} }
// dsmVersionInt combines major and minor version info into an int
// representation.
//
// Version 7.2 becomes 72 as an example.
func (t *target) dsmVersionInt() int {
return t.dsmMajorVersion*10 + t.dsmMinorVersion
}
// dsmVersionString returns a string representation of the version
// including minor version information if it exists.
//
// If dsmMinorVersion is 0 this returns dsmMajorVersion as a string,
// otherwise it returns "dsmMajorVersion-dsmMinorVersion".
func (t *target) dsmVersionString() string {
dsmVersionString := fmt.Sprintf("%d", t.dsmMajorVersion)
if t.dsmMinorVersion != 0 {
dsmVersionString = fmt.Sprintf("%s-%d", dsmVersionString, t.dsmMinorVersion)
}
return dsmVersionString
}
func (t *target) buildSPK(b *dist.Build, inner *innerPkg) ([]string, error) { func (t *target) buildSPK(b *dist.Build, inner *innerPkg) ([]string, error) {
synoVersion := b.Version.Synology[t.dsmMajorVersion] synoVersion := b.Version.Synology[t.dsmVersionInt()]
filename := fmt.Sprintf("tailscale-%s-%s-%d-dsm%d.spk", t.filenameArch, b.Version.Short, synoVersion, t.dsmMajorVersion) filename := fmt.Sprintf("tailscale-%s-%s-%d-dsm%s.spk", t.filenameArch, b.Version.Short, synoVersion, t.dsmVersionString())
out := filepath.Join(b.Out, filename) out := filepath.Join(b.Out, filename)
if t.packageCenter { if t.packageCenter {
log.Printf("Building %s (for package center)", filename) log.Printf("Building %s (for package center)", filename)
@ -117,7 +140,7 @@ func (t *target) mkInfo(b *dist.Build, uncompressedSz int64) []byte {
fmt.Fprintf(&ret, "%s=%q\n", k, v) fmt.Fprintf(&ret, "%s=%q\n", k, v)
} }
f("package", "Tailscale") f("package", "Tailscale")
f("version", fmt.Sprintf("%s-%d", b.Version.Short, b.Version.Synology[t.dsmMajorVersion])) f("version", fmt.Sprintf("%s-%d", b.Version.Short, b.Version.Synology[t.dsmVersionInt()]))
f("arch", t.filenameArch) f("arch", t.filenameArch)
f("description", "Connect all your devices using WireGuard, without the hassle.") f("description", "Connect all your devices using WireGuard, without the hassle.")
f("displayname", "Tailscale") f("displayname", "Tailscale")

@ -28,11 +28,22 @@ var v7Models = []string{
func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target { func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
var ret []dist.Target var ret []dist.Target
for _, dsmVersion := range []int{6, 7} { for _, dsmVersion := range []struct {
major int
minor int
}{
// DSM6
{major: 6},
// DSM7
{major: 7},
// DSM7.2
{major: 7, minor: 2},
} {
ret = append(ret, ret = append(ret,
&target{ &target{
filenameArch: "x86_64", filenameArch: "x86_64",
dsmMajorVersion: dsmVersion, dsmMajorVersion: dsmVersion.major,
dsmMinorVersion: dsmVersion.minor,
goenv: map[string]string{ goenv: map[string]string{
"GOOS": "linux", "GOOS": "linux",
"GOARCH": "amd64", "GOARCH": "amd64",
@ -42,7 +53,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
}, },
&target{ &target{
filenameArch: "i686", filenameArch: "i686",
dsmMajorVersion: dsmVersion, dsmMajorVersion: dsmVersion.major,
dsmMinorVersion: dsmVersion.minor,
goenv: map[string]string{ goenv: map[string]string{
"GOOS": "linux", "GOOS": "linux",
"GOARCH": "386", "GOARCH": "386",
@ -52,7 +64,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
}, },
&target{ &target{
filenameArch: "armv8", filenameArch: "armv8",
dsmMajorVersion: dsmVersion, dsmMajorVersion: dsmVersion.major,
dsmMinorVersion: dsmVersion.minor,
goenv: map[string]string{ goenv: map[string]string{
"GOOS": "linux", "GOOS": "linux",
"GOARCH": "arm64", "GOARCH": "arm64",
@ -67,7 +80,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
for _, v5Arch := range v5Models { for _, v5Arch := range v5Models {
ret = append(ret, &target{ ret = append(ret, &target{
filenameArch: v5Arch, filenameArch: v5Arch,
dsmMajorVersion: dsmVersion, dsmMajorVersion: dsmVersion.major,
dsmMinorVersion: dsmVersion.minor,
goenv: map[string]string{ goenv: map[string]string{
"GOOS": "linux", "GOOS": "linux",
"GOARCH": "arm", "GOARCH": "arm",
@ -80,7 +94,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
for _, v7Arch := range v7Models { for _, v7Arch := range v7Models {
ret = append(ret, &target{ ret = append(ret, &target{
filenameArch: v7Arch, filenameArch: v7Arch,
dsmMajorVersion: dsmVersion, dsmMajorVersion: dsmVersion.major,
dsmMinorVersion: dsmVersion.minor,
goenv: map[string]string{ goenv: map[string]string{
"GOOS": "linux", "GOOS": "linux",
"GOARCH": "arm", "GOARCH": "arm",

@ -61,7 +61,7 @@ type VersionInfo struct {
// Winres is the version string that gets embedded into Windows exe // Winres is the version string that gets embedded into Windows exe
// metadata. It is of the form "x,y,z,0". // metadata. It is of the form "x,y,z,0".
Winres string Winres string
// Synology is a map of Synology DSM major version to the // Synology is a map of Synology DSM version to the
// Tailscale numeric version that gets embedded in Synology spk // Tailscale numeric version that gets embedded in Synology spk
// files. // files.
Synology map[int]int64 Synology map[int]int64
@ -252,12 +252,13 @@ func mkOutput(v verInfo) (VersionInfo, error) {
Track: track, Track: track,
Synology: map[int]int64{ Synology: map[int]int64{
// Synology requires that version numbers be in a specific format. // Synology requires that version numbers be in a specific format.
// Builds with version numbers that don't start with "60" or "70" will fail, // Builds with version numbers that don't start with "60", "70", or "72" will fail,
// and the full version number must be within int32 range. // and the full version number must be within int32 range.
// So, we do the following mapping from our Tailscale version to Synology version, // So, we do the following mapping from our Tailscale version to Synology version,
// giving major version three decimal places, minor version three, and patch two. // giving major version three decimal places, minor version three, and patch two.
6: 6*100_000_000 + int64(v.major-1)*1_000_000 + int64(v.minor)*1_000 + int64(v.patch), 60: 60*10_000_000 + int64(v.major-1)*1_000_000 + int64(v.minor)*1_000 + int64(v.patch),
7: 7*100_000_000 + int64(v.major-1)*1_000_000 + int64(v.minor)*1_000 + int64(v.patch), 70: 70*10_000_000 + int64(v.major-1)*1_000_000 + int64(v.minor)*1_000 + int64(v.patch),
72: 72*10_000_000 + int64(v.major-1)*1_000_000 + int64(v.minor)*1_000 + int64(v.patch),
}, },
} }

Loading…
Cancel
Save