mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
{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>
This commit is contained in:
parent
8a6f48b455
commit
43f4131d7a
31
release/dist/synology/pkgs.go
vendored
31
release/dist/synology/pkgs.go
vendored
@ -24,13 +24,14 @@
|
||||
type target struct {
|
||||
filenameArch string
|
||||
dsmMajorVersion int
|
||||
dsmMinorVersion int
|
||||
goenv map[string]string
|
||||
packageCenter bool
|
||||
signer dist.Signer
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -42,9 +43,31 @@ func (t *target) Build(b *dist.Build) ([]string, error) {
|
||||
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) {
|
||||
synoVersion := b.Version.Synology[t.dsmMajorVersion]
|
||||
filename := fmt.Sprintf("tailscale-%s-%s-%d-dsm%d.spk", t.filenameArch, b.Version.Short, synoVersion, t.dsmMajorVersion)
|
||||
synoVersion := b.Version.Synology[t.dsmVersionInt()]
|
||||
filename := fmt.Sprintf("tailscale-%s-%s-%d-dsm%s.spk", t.filenameArch, b.Version.Short, synoVersion, t.dsmVersionString())
|
||||
out := filepath.Join(b.Out, filename)
|
||||
if t.packageCenter {
|
||||
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)
|
||||
}
|
||||
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("description", "Connect all your devices using WireGuard, without the hassle.")
|
||||
f("displayname", "Tailscale")
|
||||
|
27
release/dist/synology/targets.go
vendored
27
release/dist/synology/targets.go
vendored
@ -28,11 +28,22 @@
|
||||
|
||||
func Targets(forPackageCenter bool, signer dist.Signer) []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,
|
||||
&target{
|
||||
filenameArch: "x86_64",
|
||||
dsmMajorVersion: dsmVersion,
|
||||
dsmMajorVersion: dsmVersion.major,
|
||||
dsmMinorVersion: dsmVersion.minor,
|
||||
goenv: map[string]string{
|
||||
"GOOS": "linux",
|
||||
"GOARCH": "amd64",
|
||||
@ -42,7 +53,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
|
||||
},
|
||||
&target{
|
||||
filenameArch: "i686",
|
||||
dsmMajorVersion: dsmVersion,
|
||||
dsmMajorVersion: dsmVersion.major,
|
||||
dsmMinorVersion: dsmVersion.minor,
|
||||
goenv: map[string]string{
|
||||
"GOOS": "linux",
|
||||
"GOARCH": "386",
|
||||
@ -52,7 +64,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
|
||||
},
|
||||
&target{
|
||||
filenameArch: "armv8",
|
||||
dsmMajorVersion: dsmVersion,
|
||||
dsmMajorVersion: dsmVersion.major,
|
||||
dsmMinorVersion: dsmVersion.minor,
|
||||
goenv: map[string]string{
|
||||
"GOOS": "linux",
|
||||
"GOARCH": "arm64",
|
||||
@ -67,7 +80,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
|
||||
for _, v5Arch := range v5Models {
|
||||
ret = append(ret, &target{
|
||||
filenameArch: v5Arch,
|
||||
dsmMajorVersion: dsmVersion,
|
||||
dsmMajorVersion: dsmVersion.major,
|
||||
dsmMinorVersion: dsmVersion.minor,
|
||||
goenv: map[string]string{
|
||||
"GOOS": "linux",
|
||||
"GOARCH": "arm",
|
||||
@ -80,7 +94,8 @@ func Targets(forPackageCenter bool, signer dist.Signer) []dist.Target {
|
||||
for _, v7Arch := range v7Models {
|
||||
ret = append(ret, &target{
|
||||
filenameArch: v7Arch,
|
||||
dsmMajorVersion: dsmVersion,
|
||||
dsmMajorVersion: dsmVersion.major,
|
||||
dsmMinorVersion: dsmVersion.minor,
|
||||
goenv: map[string]string{
|
||||
"GOOS": "linux",
|
||||
"GOARCH": "arm",
|
||||
|
@ -61,7 +61,7 @@ type VersionInfo struct {
|
||||
// Winres is the version string that gets embedded into Windows exe
|
||||
// metadata. It is of the form "x,y,z,0".
|
||||
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
|
||||
// files.
|
||||
Synology map[int]int64
|
||||
@ -252,12 +252,13 @@ func mkOutput(v verInfo) (VersionInfo, error) {
|
||||
Track: track,
|
||||
Synology: map[int]int64{
|
||||
// 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.
|
||||
// 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.
|
||||
6: 6*100_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),
|
||||
60: 60*10_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…
Reference in New Issue
Block a user