Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Beatrici <git@davidebeatrici.dev>2021-02-16 11:53:31 +0300
committerDavide Beatrici <git@davidebeatrici.dev>2021-02-16 11:57:18 +0300
commit9f3685efb7e74b9a0106b087f9c5e74240b46742 (patch)
tree6fb1ca6837d7b004e0770412362ea93e81c97aab /scripts
parent21f69a5a1265c057c7196fdc4c78939775e568c6 (diff)
BUILD(versioning): Add "--type" and "--revision" options to mumble-version.py
This commit removes the tag logic from the script. Its purpose was to set the name of the tag associated to the latest version as version. It was working as expected, however in some instances we don't want the script to take the tag into account. For example, we had to rebuild the first 1.4.0 snapshot as the version was accidentally set to 1.4.0-snapshot1. As replacement, the "--revision" and "--type" options are implemened. They allow to explicitly set the release type and its revision, when applicable. Assuming the revision is set to 1 (default value), the output is currently as follows: Type set to "snapshot": 1.4.0~2021-02-14~g973cee211~snapshot Type set to "beta": 1.4.0-beta1 Type set to "rc": 1.4.0-rc1 Type set to "stable": 1.4.0
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mumble-version.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/scripts/mumble-version.py b/scripts/mumble-version.py
index 70e1af8e6..efb7e400e 100755
--- a/scripts/mumble-version.py
+++ b/scripts/mumble-version.py
@@ -102,6 +102,8 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('-n', '--newline', action = "store_true", help = 'Break line after printing version')
parser.add_argument('-p', '--project', action = "store_true", help = 'Print CMake project version')
+ parser.add_argument('-r', '--revision', type = int, default = 1, help = 'Revision (only used for type \'beta\' and \'rc\')')
+ parser.add_argument('-t', '--type', choices = ['snapshot', 'beta', 'rc', 'stable'], default = 'snapshot', help = 'Release type - determines the suffix')
args = parser.parse_args()
if args.newline:
@@ -109,34 +111,24 @@ def main():
else:
end = ''
- if args.project:
- projectVersion = readProjectVersion()
+ projectVersion = readProjectVersion()
+
+ if args.project or args.type == 'stable':
print(projectVersion, end = end)
return
- # Get all tags associated with the latest commit
- latestCommitTags = [x for x in cmd(['git', 'tag', '--points-at', 'HEAD']).split("\n") if x]
-
- if len(latestCommitTags) > 1:
- raise RuntimeError("Encountered commit with multiple tags: %s" % latestCommitTags)
-
- if len(latestCommitTags) == 1:
- # Most recent commit is tagged -> this is a tagged release version
- # Use the tag as the version-string
- version = latestCommitTags[0]
- else:
- # This is a snapshot (i.e. built from a non-tagged commit)
-
- # Get the date of the most recent commit
- latestCommitDate = cmd(['git', 'log', '-1', '--format=%cd', '--date=short']).strip()
-
- # Get the hash of the most recent commit (shortened)
- latestCommitHash = cmd(['git', 'rev-parse', '--short' , 'HEAD']).strip()
+ if args.type == 'beta' or args.type == 'rc':
+ version = '{0}-{1}{2}'.format(projectVersion, args.type, args.revision)
+ print(version, end = end)
+ return
- projectVersion = readProjectVersion()
+ # Get the date of the most recent commit
+ latestCommitDate = cmd(['git', 'log', '-1', '--format=%cd', '--date=short']).strip()
- version = '{0}~{1}~g{2}~snapshot'.format(projectVersion, latestCommitDate, latestCommitHash)
+ # Get the hash of the most recent commit (shortened)
+ latestCommitHash = cmd(['git', 'rev-parse', '--short', 'HEAD']).strip()
+ version = '{0}~{1}~g{2}~snapshot'.format(projectVersion, latestCommitDate, latestCommitHash)
print(version, end = end)
if __name__ == '__main__':