mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
version/mkversion: add exports for major/minor/patch
build_dist.sh needs the minor version by itself, for some reason. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
8ed27d65ef
commit
7ca54c890e
@ -25,6 +25,12 @@
|
|||||||
|
|
||||||
// VersionInfo is version information extracted from a git checkout.
|
// VersionInfo is version information extracted from a git checkout.
|
||||||
type VersionInfo struct {
|
type VersionInfo struct {
|
||||||
|
// Major is the major version number portion of Short.
|
||||||
|
Major int
|
||||||
|
// Minor is the minor version number portion of Short.
|
||||||
|
Minor int
|
||||||
|
// Patch is the patch version number portion of Short.
|
||||||
|
Patch int
|
||||||
// Short is the short version string. See the documentation of version.Short
|
// Short is the short version string. See the documentation of version.Short
|
||||||
// for possible values.
|
// for possible values.
|
||||||
Short string
|
Short string
|
||||||
@ -74,6 +80,9 @@ type VersionInfo struct {
|
|||||||
func (v VersionInfo) String() string {
|
func (v VersionInfo) String() string {
|
||||||
f := fmt.Fprintf
|
f := fmt.Fprintf
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
|
f(&b, "VERSION_MAJOR=%d\n", v.Major)
|
||||||
|
f(&b, "VERSION_MINOR=%d\n", v.Minor)
|
||||||
|
f(&b, "VERSION_PATCH=%d\n", v.Patch)
|
||||||
f(&b, "VERSION_SHORT=%q\n", v.Short)
|
f(&b, "VERSION_SHORT=%q\n", v.Short)
|
||||||
f(&b, "VERSION_LONG=%q\n", v.Long)
|
f(&b, "VERSION_LONG=%q\n", v.Long)
|
||||||
f(&b, "VERSION_GIT_HASH=%q\n", v.GitHash)
|
f(&b, "VERSION_GIT_HASH=%q\n", v.GitHash)
|
||||||
@ -193,6 +202,9 @@ func mkOutput(v verInfo) (VersionInfo, error) {
|
|||||||
xcodeMacOS := fmt.Sprintf("%d.%d.%d", otherTime.Year()-1750, otherTime.YearDay(), otherTime.Hour()*60*60+otherTime.Minute()*60+otherTime.Second())
|
xcodeMacOS := fmt.Sprintf("%d.%d.%d", otherTime.Year()-1750, otherTime.YearDay(), otherTime.Hour()*60*60+otherTime.Minute()*60+otherTime.Second())
|
||||||
|
|
||||||
return VersionInfo{
|
return VersionInfo{
|
||||||
|
Major: v.major,
|
||||||
|
Minor: v.minor,
|
||||||
|
Patch: v.patch,
|
||||||
Short: fmt.Sprintf("%d.%d.%d", v.major, v.minor, v.patch),
|
Short: fmt.Sprintf("%d.%d.%d", v.major, v.minor, v.patch),
|
||||||
Long: fmt.Sprintf("%d.%d.%d%s%s", v.major, v.minor, v.patch, changeSuffix, hashes),
|
Long: fmt.Sprintf("%d.%d.%d%s%s", v.major, v.minor, v.patch, changeSuffix, hashes),
|
||||||
GitHash: fmt.Sprintf("%s", v.hash),
|
GitHash: fmt.Sprintf("%s", v.hash),
|
||||||
|
@ -32,6 +32,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{mkInfo("abcdef", "", otherDate, 0, 98, 0, 0), `
|
{mkInfo("abcdef", "", otherDate, 0, 98, 0, 0), `
|
||||||
|
VERSION_MAJOR=0
|
||||||
|
VERSION_MINOR=98
|
||||||
|
VERSION_PATCH=0
|
||||||
VERSION_SHORT="0.98.0"
|
VERSION_SHORT="0.98.0"
|
||||||
VERSION_LONG="0.98.0-tabcdef"
|
VERSION_LONG="0.98.0-tabcdef"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -44,6 +47,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="1C41380B-A742-5A3C-AF5D-DF7894DD0FB8"
|
VERSION_MSIPRODUCT_ARM64="1C41380B-A742-5A3C-AF5D-DF7894DD0FB8"
|
||||||
VERSION_MSIPRODUCT_X86="4ABDDA14-7499-5C2E-A62A-DD435C50C4CB"`},
|
VERSION_MSIPRODUCT_X86="4ABDDA14-7499-5C2E-A62A-DD435C50C4CB"`},
|
||||||
{mkInfo("abcdef", "", otherDate, 0, 98, 1, 0), `
|
{mkInfo("abcdef", "", otherDate, 0, 98, 1, 0), `
|
||||||
|
VERSION_MAJOR=0
|
||||||
|
VERSION_MINOR=98
|
||||||
|
VERSION_PATCH=1
|
||||||
VERSION_SHORT="0.98.1"
|
VERSION_SHORT="0.98.1"
|
||||||
VERSION_LONG="0.98.1-tabcdef"
|
VERSION_LONG="0.98.1-tabcdef"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -56,6 +62,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="A4CCF19C-372B-5007-AFD8-1AF661DFF670"
|
VERSION_MSIPRODUCT_ARM64="A4CCF19C-372B-5007-AFD8-1AF661DFF670"
|
||||||
VERSION_MSIPRODUCT_X86="FF12E937-DDC4-5868-9B63-D35B2050D4EA"`},
|
VERSION_MSIPRODUCT_X86="FF12E937-DDC4-5868-9B63-D35B2050D4EA"`},
|
||||||
{mkInfo("abcdef", "", otherDate, 1, 2, 9, 0), `
|
{mkInfo("abcdef", "", otherDate, 1, 2, 9, 0), `
|
||||||
|
VERSION_MAJOR=1
|
||||||
|
VERSION_MINOR=2
|
||||||
|
VERSION_PATCH=9
|
||||||
VERSION_SHORT="1.2.9"
|
VERSION_SHORT="1.2.9"
|
||||||
VERSION_LONG="1.2.9-tabcdef"
|
VERSION_LONG="1.2.9-tabcdef"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -68,6 +77,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="91D16F75-2A12-5E12-820A-67B89BF858E7"
|
VERSION_MSIPRODUCT_ARM64="91D16F75-2A12-5E12-820A-67B89BF858E7"
|
||||||
VERSION_MSIPRODUCT_X86="8F1AC1C6-B93B-5C70-802E-6AE9591FA0D6"`},
|
VERSION_MSIPRODUCT_X86="8F1AC1C6-B93B-5C70-802E-6AE9591FA0D6"`},
|
||||||
{mkInfo("abcdef", "", otherDate, 1, 15, 0, 129), `
|
{mkInfo("abcdef", "", otherDate, 1, 15, 0, 129), `
|
||||||
|
VERSION_MAJOR=1
|
||||||
|
VERSION_MINOR=15
|
||||||
|
VERSION_PATCH=129
|
||||||
VERSION_SHORT="1.15.129"
|
VERSION_SHORT="1.15.129"
|
||||||
VERSION_LONG="1.15.129-tabcdef"
|
VERSION_LONG="1.15.129-tabcdef"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -80,6 +92,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="DB1A2E86-66C4-5CEC-8F4C-7DB805370F3A"
|
VERSION_MSIPRODUCT_ARM64="DB1A2E86-66C4-5CEC-8F4C-7DB805370F3A"
|
||||||
VERSION_MSIPRODUCT_X86="DC57C0C3-5164-5C92-86B3-2800CEFF0540"`},
|
VERSION_MSIPRODUCT_X86="DC57C0C3-5164-5C92-86B3-2800CEFF0540"`},
|
||||||
{mkInfo("abcdef", "", otherDate, 1, 2, 0, 17), `
|
{mkInfo("abcdef", "", otherDate, 1, 2, 0, 17), `
|
||||||
|
VERSION_MAJOR=1
|
||||||
|
VERSION_MINOR=2
|
||||||
|
VERSION_PATCH=0
|
||||||
VERSION_SHORT="1.2.0"
|
VERSION_SHORT="1.2.0"
|
||||||
VERSION_LONG="1.2.0-17-tabcdef"
|
VERSION_LONG="1.2.0-17-tabcdef"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -92,6 +107,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="39D5D46E-E644-5C80-9EF8-224AC1AD5969"
|
VERSION_MSIPRODUCT_ARM64="39D5D46E-E644-5C80-9EF8-224AC1AD5969"
|
||||||
VERSION_MSIPRODUCT_X86="4487136B-2D11-5E42-BD80-B8529F3326F4"`},
|
VERSION_MSIPRODUCT_X86="4487136B-2D11-5E42-BD80-B8529F3326F4"`},
|
||||||
{mkInfo("abcdef", "defghi", otherDate, 1, 15, 0, 129), `
|
{mkInfo("abcdef", "defghi", otherDate, 1, 15, 0, 129), `
|
||||||
|
VERSION_MAJOR=1
|
||||||
|
VERSION_MINOR=15
|
||||||
|
VERSION_PATCH=129
|
||||||
VERSION_SHORT="1.15.129"
|
VERSION_SHORT="1.15.129"
|
||||||
VERSION_LONG="1.15.129-tabcdef-gdefghi"
|
VERSION_LONG="1.15.129-tabcdef-gdefghi"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -104,6 +122,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="DB1A2E86-66C4-5CEC-8F4C-7DB805370F3A"
|
VERSION_MSIPRODUCT_ARM64="DB1A2E86-66C4-5CEC-8F4C-7DB805370F3A"
|
||||||
VERSION_MSIPRODUCT_X86="DC57C0C3-5164-5C92-86B3-2800CEFF0540"`},
|
VERSION_MSIPRODUCT_X86="DC57C0C3-5164-5C92-86B3-2800CEFF0540"`},
|
||||||
{mkInfo("abcdef", "", otherDate, 1, 2, 0, 17), `
|
{mkInfo("abcdef", "", otherDate, 1, 2, 0, 17), `
|
||||||
|
VERSION_MAJOR=1
|
||||||
|
VERSION_MINOR=2
|
||||||
|
VERSION_PATCH=0
|
||||||
VERSION_SHORT="1.2.0"
|
VERSION_SHORT="1.2.0"
|
||||||
VERSION_LONG="1.2.0-17-tabcdef"
|
VERSION_LONG="1.2.0-17-tabcdef"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
@ -116,6 +137,9 @@ func TestMkversion(t *testing.T) {
|
|||||||
VERSION_MSIPRODUCT_ARM64="39D5D46E-E644-5C80-9EF8-224AC1AD5969"
|
VERSION_MSIPRODUCT_ARM64="39D5D46E-E644-5C80-9EF8-224AC1AD5969"
|
||||||
VERSION_MSIPRODUCT_X86="4487136B-2D11-5E42-BD80-B8529F3326F4"`},
|
VERSION_MSIPRODUCT_X86="4487136B-2D11-5E42-BD80-B8529F3326F4"`},
|
||||||
{mkInfo("abcdef", "defghi", otherDate, 1, 15, 0, 129), `
|
{mkInfo("abcdef", "defghi", otherDate, 1, 15, 0, 129), `
|
||||||
|
VERSION_MAJOR=1
|
||||||
|
VERSION_MINOR=15
|
||||||
|
VERSION_PATCH=129
|
||||||
VERSION_SHORT="1.15.129"
|
VERSION_SHORT="1.15.129"
|
||||||
VERSION_LONG="1.15.129-tabcdef-gdefghi"
|
VERSION_LONG="1.15.129-tabcdef-gdefghi"
|
||||||
VERSION_GIT_HASH="abcdef"
|
VERSION_GIT_HASH="abcdef"
|
||||||
|
Loading…
Reference in New Issue
Block a user