From b01c842d7c173f47bb49b090224cfdd6c73f83da Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 30 Oct 2019 20:05:01 +0100 Subject: [PATCH] bump version in toml's and changelog, and trigger deltachat-specific "cargo update". example: `python set_core_version.py 1.0.0-beta.6` automates bumping the version and performs some quick sanity checks --- CHANGELOG.md | 10 +++---- Cargo.lock | 6 ++-- Cargo.toml | 2 +- deltachat-ffi/Cargo.toml | 2 +- set_core_version.py | 61 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 set_core_version.py diff --git a/CHANGELOG.md b/CHANGELOG.md index b4e755160..6b6cba2e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Changelog -## 1.0.0-beta5 +## 1.0.0-beta.5 - fix dc_get_msg() to return empty messages when asked for special ones -## 1.0.0-beta4 +## 1.0.0-beta.4 - fix more than one sending of autocrypt setup message @@ -12,7 +12,7 @@ - tune down error to warning when adding self to chat -## 1.0.0-beta3 +## 1.0.0-beta.3 - add back `dc_empty_server()` #682 @@ -26,7 +26,7 @@ - code streamlining and rustifications -## 1.0.0-beta2 +## 1.0.0-beta.2 - https://c.delta.chat docs are now regenerated again through our CI @@ -46,7 +46,7 @@ - some rustifications/boolifications of c-ints -## 1.0.0-beta1 +## 1.0.0-beta.1 - first beta of the Delta Chat Rust core library. many fixes of crashes and other issues compared to 1.0.0-alpha.5. diff --git a/Cargo.lock b/Cargo.lock index 8c4f45b54..5d22a0640 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -480,7 +480,7 @@ dependencies = [ [[package]] name = "deltachat" -version = "1.0.0-beta.4" +version = "1.0.0-beta.5" dependencies = [ "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -550,9 +550,9 @@ dependencies = [ [[package]] name = "deltachat_ffi" -version = "1.0.0-beta.4" +version = "1.0.0-beta.5" dependencies = [ - "deltachat 1.0.0-beta.4", + "deltachat 1.0.0-beta.5", "deltachat-provider-database 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 3fb2b5540..d8cd93c32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat" -version = "1.0.0-beta.4" +version = "1.0.0-beta.5" authors = ["Delta Chat Developers (ML) "] edition = "2018" license = "MPL" diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml index 6681e0a0d..71e65def2 100644 --- a/deltachat-ffi/Cargo.toml +++ b/deltachat-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat_ffi" -version = "1.0.0-beta.4" +version = "1.0.0-beta.5" description = "Deltachat FFI" authors = ["Delta Chat Developers (ML) "] edition = "2018" diff --git a/set_core_version.py b/set_core_version.py new file mode 100644 index 000000000..8a7ec1bc3 --- /dev/null +++ b/set_core_version.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import os +import sys +import re +import pathlib +import subprocess + +rex = re.compile(r'version = "(\S+)"') + +def read_toml_version(relpath): + p = pathlib.Path(relpath) + assert p.exists() + for line in open(str(p)): + m = rex.match(line) + if m is not None: + return m.group(1) + raise ValueError("no version found in {}".format(relpath)) + +def replace_toml_version(relpath, newversion): + p = pathlib.Path(relpath) + assert p.exists() + tmp_path = str(p) + "_tmp" + with open(tmp_path, "w") as f: + for line in open(str(p)): + m = rex.match(line) + if m is not None: + f.write('version = "{}"\n'.format(newversion)) + else: + f.write(line) + os.rename(tmp_path, str(p)) + +if __name__ == "__main__": + + if len(sys.argv) < 2: + raise SystemExit("need argument: new version, example 1.0.0-beta.27") + newversion = sys.argv[1] + if newversion.count(".") < 2: + raise SystemExit("need at least two dots in version") + + core_toml = read_toml_version("Cargo.toml") + ffi_toml = read_toml_version("deltachat-ffi/Cargo.toml") + assert core_toml == ffi_toml, (core_toml, ffi_toml) + + for line in open("CHANGELOG.md"): + ## 1.0.0-beta5 + if line.startswith("## "): + if line[2:].strip().startswith(newversion): + break + else: + raise SystemExit("CHANGELOG.md contains no entry for version: {}".format(newversion)) + + replace_toml_version("Cargo.toml", newversion) + replace_toml_version("deltachat-ffi/Cargo.toml", newversion) + + subprocess.call(["cargo", "update", "-p", "deltachat"]) + + print("after commit make sure to: ") + print("") + print(" git tag {}".format(newversion)) + print("")