Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release kind detection #7024

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading