Skip to content

Commit

Permalink
Fix release kind detection
Browse files Browse the repository at this point in the history
Signed-off-by: István Váradi <[email protected]>
  • Loading branch information
ivaradi committed Aug 27, 2024
1 parent 4233ea6 commit c1cee5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion admin/linux/debian/drone-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 12 additions & 4 deletions admin/linux/debian/scripts/git2changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -99,13 +100,15 @@ 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():
if tag!=newVersionOrigTag:
result = processVersionTag(tag)
if result:
lastVersionTag = tag
commitTags.append(tag)
(baseVersion, kind1) = result
if kind1!=kind and kind!="release":
kind = kind1
Expand All @@ -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:
Expand Down Expand Up @@ -169,11 +175,13 @@ def genChangeLogEntries(f, entries, distribution):
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)
Expand Down

0 comments on commit c1cee5b

Please sign in to comment.