From ce168ecac214c1d729cff0ce776e33b8ef978e13 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Fri, 4 Feb 2022 23:46:12 +0100 Subject: [PATCH] Configurable version suffix independent of version number --- Makefile | 8 ++++---- fs/version.go | 14 ++++++++++++-- fs/versionsuffix.go | 4 ++++ fs/versiontag.go | 4 ++++ 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 fs/versionsuffix.go create mode 100644 fs/versiontag.go diff --git a/Makefile b/Makefile index f96e1d92a..f921a2743 100644 --- a/Makefile +++ b/Makefile @@ -245,18 +245,18 @@ retag: startdev: @echo "Version is $(VERSION)" @echo "Next version is $(NEXT_VERSION)" - echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEXT_VERSION)-DEV\"\n" | gofmt > fs/version.go + echo -e "package fs\n\n// VersionTag of rclone\nvar VersionTag = \"$(NEXT_VERSION)\"\n" | gofmt > fs/versiontag.go echo -n "$(NEXT_VERSION)" > docs/layouts/partials/version.html echo "$(NEXT_VERSION)" > VERSION - git commit -m "Start $(NEXT_VERSION)-DEV development" fs/version.go VERSION docs/layouts/partials/version.html + git commit -m "Start $(NEXT_VERSION)-DEV development" fs/versiontag.go VERSION docs/layouts/partials/version.html startstable: @echo "Version is $(VERSION)" @echo "Next stable version is $(NEXT_PATCH_VERSION)" - echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEXT_PATCH_VERSION)-DEV\"\n" | gofmt > fs/version.go + echo -e "package fs\n\n// VersionTag of rclone\nvar VersionTag = \"$(NEXT_PATCH_VERSION)\"\n" | gofmt > fs/versiontag.go echo -n "$(NEXT_PATCH_VERSION)" > docs/layouts/partials/version.html echo "$(NEXT_PATCH_VERSION)" > VERSION - git commit -m "Start $(NEXT_PATCH_VERSION)-DEV development" fs/version.go VERSION docs/layouts/partials/version.html + git commit -m "Start $(NEXT_PATCH_VERSION)-DEV development" fs/versiontag.go VERSION docs/layouts/partials/version.html winzip: zip -9 rclone-$(TAG).zip rclone.exe diff --git a/fs/version.go b/fs/version.go index fc23bb3ba..bebf62fd1 100644 --- a/fs/version.go +++ b/fs/version.go @@ -1,4 +1,14 @@ package fs -// Version of rclone -var Version = "v1.59.0-DEV" +// Version of rclone containing the complete version string +var Version string + +func init() { + if Version == "" { + if VersionSuffix == "" { + Version = VersionTag + } else { + Version = VersionTag + "-" + VersionSuffix + } + } +} diff --git a/fs/versionsuffix.go b/fs/versionsuffix.go new file mode 100644 index 000000000..cf7c7cfcd --- /dev/null +++ b/fs/versionsuffix.go @@ -0,0 +1,4 @@ +package fs + +// VersionSuffix of rclone containing the pre-release label if any +var VersionSuffix = "DEV" diff --git a/fs/versiontag.go b/fs/versiontag.go new file mode 100644 index 000000000..714e98978 --- /dev/null +++ b/fs/versiontag.go @@ -0,0 +1,4 @@ +package fs + +// VersionTag of rclone +var VersionTag = "v1.59.0"