Allow specifying the base commit and version in the configuration file

Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
This commit is contained in:
István Váradi 2020-03-25 19:13:07 +01:00
parent 7b2de328a2
commit 46c1d7f298
3 changed files with 29 additions and 15 deletions

View file

@ -71,7 +71,8 @@ for distribution in ${UBUNTU_DISTRIBUTIONS} ${DEBIAN_DISTRIBUTIONS}; do
git merge ${DRONE_COMMIT}
admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate}
cp /tmp/tmpchangelog debian/changelog
cat /tmp/tmpchangelog debian/changelog > debian/changelog.new
mv debian/changelog.new debian/changelog
fullver=`head -1 debian/changelog | sed "s:nextcloud-desktop (\([^)]*\)).*:\1:"`

View file

@ -6,3 +6,7 @@
[versionhack]
commit = bc7e65b39552ac458b2adacf76cbf98735ec29a0
tag = v2.4.0-beta
[base]
commit = 56222de768e3def4d504b3f9832d8598b1ec2043
version = 2.7.0

View file

@ -48,18 +48,13 @@ def getCommitVersion(commit):
except:
return None
def collectEntries(baseCommit, baseVersion, kind, finalRevDate):
scriptdir = os.path.dirname(__file__)
configPath = os.path.join(scriptdir, "git2changelog.cfg")
def collectEntries(baseCommit, baseVersion, kind, finalRevDate, config):
newVersionCommit = None
newVersionTag = None
newVersionOrigTag = None
if os.path.exists(configPath):
config = ConfigParser.SafeConfigParser()
config.read(configPath)
if config.has_section("versionhack"):
if config is not None and config.has_section("versionhack"):
if config.has_option("versionhack", "commit") and \
config.has_option("versionhack", "tag"):
newVersionCommit = config.get("versionhack", "commit")
@ -153,13 +148,27 @@ def genChangeLogEntries(f, entries, distribution):
return (latestBaseVersion, latestRevDate, latestKind)
if __name__ == "__main__":
scriptdir = os.path.dirname(__file__)
configPath = os.path.join(scriptdir, "git2changelog.cfg")
baseCommit = "f9b1c724d6ab5431e0cd56b7cd834f2dd48cebb1"
baseVersion = "2.4.0"
config = None
if os.path.exists(configPath):
config = ConfigParser.SafeConfigParser()
config.read(configPath)
if config.has_section("base"):
if config.has_option("base", "commit") and \
config.has_option("base", "version"):
baseCommit = config.get("base", "commit")
baseVersion = config.get("base", "version")
distribution = sys.argv[2]
finalRevDate = sys.argv[3] if len(sys.argv)>3 else None
#entries = collectEntries("8aade24147b5313f8241a8b42331442b7f40eef9", "2.2.4", "release")
entries = collectEntries("f9b1c724d6ab5431e0cd56b7cd834f2dd48cebb1",
"2.4.0", "beta", finalRevDate)
entries = collectEntries(baseCommit, baseVersion, "alpha", finalRevDate, config)
with open(sys.argv[1], "wt") as f:
(baseVersion, revdate, kind) = genChangeLogEntries(f, entries, distribution)