mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-05 20:01:57 -05:00
Merge pull request #3805 from owncloud/fix-version
fix version for legacy clients
This commit is contained in:
@@ -29,7 +29,7 @@ ifndef VERSION
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||
else
|
||||
VERSION ?= $(shell git rev-parse --short HEAD)
|
||||
STRING ?= $(shell git rev-parse --short HEAD)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -37,8 +37,8 @@ ifndef DATE
|
||||
DATE := $(shell date -u '+%Y%m%d')
|
||||
endif
|
||||
|
||||
LDFLAGS += -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn -s -w -X "$(OCIS_REPO)/ocis-pkg/version.String=$(VERSION)" -X "$(OCIS_REPO)/ocis-pkg/version.Date=$(DATE)"
|
||||
DEBUG_LDFLAGS += -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn -X "$(OCIS_REPO)/ocis-pkg/version.String=$(VERSION)" -X "$(OCIS_REPO)/ocis-pkg/version.Date=$(DATE)"
|
||||
LDFLAGS += -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn -s -w -X "$(OCIS_REPO)/ocis-pkg/version.String=$(STRING)" -X "$(OCIS_REPO)/ocis-pkg/version.Tag=$(VERSION)" -X "$(OCIS_REPO)/ocis-pkg/version.Date=$(DATE)"
|
||||
DEBUG_LDFLAGS += -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn -X "$(OCIS_REPO)/ocis-pkg/version.String=$(STRING)" -X "$(OCIS_REPO)/ocis-pkg/version.Tag=$(VERSION)"-X "$(OCIS_REPO)/ocis-pkg/version.Date=$(DATE)"
|
||||
|
||||
GCFLAGS += all=-N -l
|
||||
|
||||
|
||||
6
changelog/unreleased/fix-version.md
Normal file
6
changelog/unreleased/fix-version.md
Normal file
@@ -0,0 +1,6 @@
|
||||
Bugfix: Fix version number in status page
|
||||
|
||||
We needed to undo the version number changes on the status page to keep compatibility for legacy clients. We added a new field `productversion` for the actual version of the product.
|
||||
|
||||
https://github.com/owncloud/ocis/issues/3788
|
||||
https://github.com/owncloud/ocis/pull/3805
|
||||
@@ -139,11 +139,12 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"installed": true,
|
||||
"maintenance": false,
|
||||
"needsDbUpgrade": false,
|
||||
"version": version.Long(),
|
||||
"versionstring": version.GetString(),
|
||||
"version": version.Legacy,
|
||||
"versionstring": version.LegacyString,
|
||||
"edition": "Community",
|
||||
"productname": "Infinite Scale",
|
||||
"product": "Infinite Scale",
|
||||
"productversion": version.GetString(),
|
||||
"hostname": "",
|
||||
},
|
||||
"support_url_signing": true,
|
||||
@@ -215,10 +216,10 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} {
|
||||
"version": map[string]interface{}{
|
||||
"product": "Infinite Scale",
|
||||
"edition": "Community",
|
||||
"major": version.Parsed().Major(),
|
||||
"minor": version.Parsed().Minor(),
|
||||
"micro": version.Parsed().Patch(),
|
||||
"string": version.GetString(),
|
||||
"major": version.ParsedLegacy().Major(),
|
||||
"minor": version.ParsedLegacy().Minor(),
|
||||
"micro": version.ParsedLegacy().Patch(),
|
||||
"string": version.LegacyString,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -58,6 +58,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
ocdav.GatewaySvc(cfg.Reva.Address),
|
||||
ocdav.JWTSecret(cfg.TokenManager.JWTSecret),
|
||||
ocdav.ProductName(cfg.Status.ProductName),
|
||||
ocdav.ProductVersion(cfg.Status.ProductVersion),
|
||||
ocdav.Product(cfg.Status.Product),
|
||||
ocdav.Version(cfg.Status.Version),
|
||||
ocdav.VersionString(cfg.Status.VersionString),
|
||||
|
||||
@@ -79,9 +79,10 @@ type Auth struct {
|
||||
|
||||
// Status holds the configurable values for the status.php
|
||||
type Status struct {
|
||||
Version string
|
||||
VersionString string
|
||||
Product string
|
||||
ProductName string
|
||||
Edition string
|
||||
Version string
|
||||
VersionString string
|
||||
Product string
|
||||
ProductName string
|
||||
ProductVersion string
|
||||
Edition string
|
||||
}
|
||||
|
||||
@@ -44,11 +44,12 @@ func DefaultConfig() *config.Config {
|
||||
},
|
||||
},
|
||||
Status: config.Status{
|
||||
Version: version.Long(),
|
||||
VersionString: version.GetString(),
|
||||
Product: "Infinite Scale",
|
||||
ProductName: "Infinite Scale",
|
||||
Edition: "Community",
|
||||
Version: version.Legacy,
|
||||
VersionString: version.LegacyString,
|
||||
ProductVersion: version.GetString(),
|
||||
Product: "Infinite Scale",
|
||||
ProductName: "Infinite Scale",
|
||||
Edition: "Community",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,10 @@ func DefaultPolicies() []config.Policy {
|
||||
Endpoint: "/webdav/",
|
||||
Service: "com.owncloud.web.ocdav",
|
||||
},
|
||||
{
|
||||
Endpoint: "/status",
|
||||
Service: "com.owncloud.web.ocdav",
|
||||
},
|
||||
{
|
||||
Endpoint: "/status.php",
|
||||
Service: "com.owncloud.web.ocdav",
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
)
|
||||
|
||||
var (
|
||||
// String gets defined by the build system.
|
||||
String = "dev"
|
||||
// String gets defined by the build system
|
||||
String string
|
||||
|
||||
// Tag gets defined by the build system
|
||||
Tag string
|
||||
|
||||
// LatestTag is the latest released version plus the dev meta version.
|
||||
// Will be overwritten by the release pipeline
|
||||
// Needs a manual change for every tagged release
|
||||
LatestTag = "2.0.0-beta1+dev"
|
||||
|
||||
// Date indicates the build date.
|
||||
Date = time.Now().Format("20060102")
|
||||
|
||||
// Legacy defines the old long 4 number ownCloud version needed for some clients
|
||||
Legacy = "10.11.0.0"
|
||||
|
||||
// LegacyString defines the old ownCloud version needed for some clients
|
||||
LegacyString = "10.11.0"
|
||||
)
|
||||
|
||||
// Compiled returns the compile time of this service.
|
||||
@@ -27,26 +40,34 @@ func GetString() string {
|
||||
}
|
||||
|
||||
// Parsed returns a semver Version
|
||||
func Parsed() *semver.Version {
|
||||
versionToParse := String
|
||||
if String == "dev" {
|
||||
versionToParse = "0.0.0+dev"
|
||||
func Parsed() (version *semver.Version) {
|
||||
versionToParse := LatestTag
|
||||
if Tag != "" {
|
||||
versionToParse = Tag
|
||||
}
|
||||
parsedVersion, err := semver.NewVersion(versionToParse)
|
||||
version, err := semver.NewVersion(versionToParse)
|
||||
// We have no semver version but a commitid
|
||||
if err != nil {
|
||||
parsedVersion, err = semver.NewVersion("0.0.0+" + String)
|
||||
// this should never happen
|
||||
if err != nil {
|
||||
return &semver.Version{}
|
||||
}
|
||||
}
|
||||
return parsedVersion
|
||||
if String != "" {
|
||||
nVersion, err := version.SetMetadata(String)
|
||||
if err != nil {
|
||||
return &semver.Version{}
|
||||
}
|
||||
version = &nVersion
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
// Long returns the legacy version with 4 number parts like 10.9.8.0
|
||||
func Long() string {
|
||||
return strconv.FormatInt(Parsed().Major(), 10) + "." +
|
||||
strconv.FormatInt(Parsed().Minor(), 10) + "." +
|
||||
strconv.FormatInt(Parsed().Patch(), 10) + "." + "0"
|
||||
// ParsedLegacy returns the legacy version
|
||||
func ParsedLegacy() *semver.Version {
|
||||
parsedVersion, err := semver.NewVersion(LegacyString)
|
||||
if err != nil {
|
||||
return &semver.Version{}
|
||||
}
|
||||
return parsedVersion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user