Skip to content

Commit

Permalink
building all tags #10451
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Oct 2, 2023
1 parent 59b856b commit fa88f52
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions tools/build/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from __future__ import absolute_import

import subprocess
import optparse
import shutil
import os
import sys
Expand All @@ -32,23 +31,36 @@
import sumolib # noqa


optParser = optparse.OptionParser()
optParser.add_option("-b", "--begin", default="v1_3_0", help="first revision to build")
optParser.add_option("-e", "--end", default="HEAD", help="last revision to build")
options, args = optParser.parse_args()
arg_parser = sumolib.options.ArgumentParser()
arg_parser.add_argument("-b", "--begin", default="v1_3_0", help="first revision to build")
arg_parser.add_argument("-e", "--end", default="HEAD", help="last revision to build")
arg_parser.add_argument("-t", "--tags-only", action="store_true", default=False,
help="only build tagged revisions")
options = arg_parser.parse_args()

LOCK = "../history.lock"
if os.path.exists(LOCK):
sys.exit("History building is still locked!")
open(LOCK, 'w').close()
try:
subprocess.call(["git", "checkout", "-q", "master"])
subprocess.call(["git", "checkout", "-q", "main"])
subprocess.call(["git", "pull"])
commits = {}
for line in subprocess.check_output(["git", "log", "%s..%s" % (options.begin, options.end)]).splitlines():
if line.startswith("commit "):
h = line.split()[1]
commits[h] = sumolib.version.gitDescribe(h)
if options.tags_only:
active = False
for tag in subprocess.check_output(["git", "tag", "--sort=taggerdate"], universal_newlines=True).splitlines():
if tag == options.begin:
active = True
if active:
commits[tag] = tag
if tag == options.end:
active = False
print(commits)
else:
for line in subprocess.check_output(["git", "log", "%s..%s" % (options.begin, options.end)]).splitlines():
if line.startswith("commit "):
h = line.split()[1]
commits[h] = sumolib.version.gitDescribe(h)
haveBuild = False
for h, desc in sorted(commits.items(), key=lambda x: x[1]):
if not os.path.exists('../bin%s' % desc):
Expand All @@ -68,7 +80,7 @@
dups = line.split()
for d in dups[1:]:
subprocess.call('ln -sf %s %s' % (dups[0], d), shell=True)
subprocess.call(["git", "checkout", "-q", "master"])
subprocess.call(["git", "checkout", "-q", "main"])
except Exception:
traceback.print_exc()
os.remove(LOCK)

0 comments on commit fa88f52

Please sign in to comment.