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} git merge ${DRONE_COMMIT}
admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate} 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:"` fullver=`head -1 debian/changelog | sed "s:nextcloud-desktop (\([^)]*\)).*:\1:"`

View file

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

View file

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