Fix release kind detection

Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
This commit is contained in:
István Váradi 2024-08-23 19:48:38 +02:00 committed by István Váradi
parent 4233ea6a38
commit c1cee5b6df
2 changed files with 13 additions and 5 deletions

View file

@ -59,7 +59,7 @@ for distribution in ${UBUNTU_DISTRIBUTIONS} ${DEBIAN_DISTRIBUTIONS}; do
git merge ${DRONE_COMMIT}
read basever revdate kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable)
read basever revdate kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable "" "" ${DRONE_COMMIT})
break
done

View file

@ -48,7 +48,8 @@ def getCommitVersion(commit):
except:
return None
def collectEntries(baseCommit, baseVersion, kind, finalBaseVersion, finalRevDate, config):
def collectEntries(baseCommit, baseVersion, kind, finalBaseVersion,
finalRevDate, config, finalCommit):
newVersionCommit = None
newVersionTag = None
@ -99,6 +100,7 @@ def collectEntries(baseCommit, baseVersion, kind, finalBaseVersion, finalRevDate
lastCMAKEVersion = version
(baseVersion, _kind) = result
commitTags = []
for tag in subprocess.check_output(["git", "tag",
"--points-at",
commit]).splitlines():
@ -106,6 +108,7 @@ def collectEntries(baseCommit, baseVersion, kind, finalBaseVersion, finalRevDate
result = processVersionTag(tag)
if result:
lastVersionTag = tag
commitTags.append(tag)
(baseVersion, kind1) = result
if kind1!=kind and kind!="release":
kind = kind1
@ -114,6 +117,9 @@ def collectEntries(baseCommit, baseVersion, kind, finalBaseVersion, finalRevDate
entries.append((commit, name, email, date, revdate, subject,
baseVersion, kind))
if commit==finalCommit or finalCommit in commitTags:
break
if entries:
(commit, name, email, date, revdate, subject, baseVersion, kind) = entries[-1]
if finalRevDate is None:
@ -169,11 +175,13 @@ if __name__ == "__main__":
baseVersion = config.get("base", "version")
distribution = sys.argv[2]
finalRevDate = sys.argv[3] if len(sys.argv)>3 else None
finalBaseVersion = sys.argv[4] if len(sys.argv)>4 else None
finalRevDate = sys.argv[3] if len(sys.argv)>3 and sys.argv[3] else None
finalBaseVersion = sys.argv[4] if len(sys.argv)>4 and sys.argv[4] else None
finalCommit = sys.argv[5] if len(sys.argv)>5 and sys.argv[5] else None
entries = collectEntries(baseCommit, baseVersion, "alpha",
finalBaseVersion, finalRevDate, config)
finalBaseVersion, finalRevDate, config,
finalCommit)
with open(sys.argv[1], "wt") as f:
(baseVersion, revdate, kind) = genChangeLogEntries(f, entries, distribution)