Skip to content

Commit 7933849

Browse files
committed
litex_setup.py: Add --release argument to create a LiteX release with a specific tag.
1 parent c307bf2 commit 7933849

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

litex_setup.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ def git_checkout(sha1=None, tag=None):
197197
sha1_tag = subprocess.check_output(sha1_tag_cmd).decode("UTF-8")[:-1]
198198
os.system(f"git checkout {sha1_tag}")
199199

200+
def git_tag(tag=None):
201+
assert tag is not None
202+
os.system(f"git tag {tag}")
203+
os.system(f"git push --tags")
204+
200205
# Git repositories initialization ------------------------------------------------------------------
201206

202207
def litex_setup_init_repos(config="standard", tag=None, dev_mode=False):
@@ -309,6 +314,22 @@ def litex_setup_freeze_repos(config="standard"):
309314
r += "}\n"
310315
print(r)
311316

317+
# Git repositories release -------------------------------------------------------------------------
318+
319+
def litex_setup_release_repos(tag):
320+
print_status(f"Making release {tag}...", underline=True)
321+
confirm = input("Please confirm by pressing Y:")
322+
if confirm.upper() == "Y":
323+
for name in install_configs["full"]:
324+
if name in ["migen"]:
325+
repo = git_repos[name]
326+
os.chdir(os.path.join(current_path, name))
327+
# Tag Repo.
328+
print_status(f"Tagging {name} Git repository as {tag}...")
329+
git_tag(tag=tag)
330+
else:
331+
print_status(f"Not confirmed, exiting.")
332+
312333
# GCC toolchains install ---------------------------------------------------------------------------
313334

314335
# RISC-V toolchain.
@@ -389,13 +410,14 @@ def main():
389410
parser.add_argument("--user", action="store_true", help="Install in User-Mode.")
390411
parser.add_argument("--config", default="standard", help="Install config (minimal, standard, full).")
391412
parser.add_argument("--tag", default=None, help="Use version from release tag.")
392-
parser.add_argument("--freeze", action="store_true", help="Freeze and display current config.")
393413

394414
# GCC toolchains.
395415
parser.add_argument("--gcc", default=None, help="Install GCC Toolchain (riscv, powerpc or openrisc).")
396416

397417
# Development mode.
398-
parser.add_argument("--dev", action="store_true", help="Development-Mode (no Auto-Update of litex_setup.py / Switch to git@github.com URLs).")
418+
parser.add_argument("--dev", action="store_true", help="Development-Mode (no Auto-Update of litex_setup.py / Switch to git@github.com URLs).")
419+
parser.add_argument("--freeze", action="store_true", help="Freeze and display current config.")
420+
parser.add_argument("--release", default=None, help="Make release.")
399421

400422
# Retro-compatibility.
401423
parser.add_argument("compat_args", nargs="*", help="Retro-Compatibility arguments (init, update, install or gcc).")
@@ -430,6 +452,10 @@ def main():
430452
if args.freeze:
431453
litex_setup_freeze_repos(config=args.config)
432454

455+
# Release.
456+
if args.release:
457+
litex_setup_release_repos(tag=args.release)
458+
433459
# GCC.
434460
os.chdir(os.path.join(current_path))
435461
if args.gcc == "riscv":

0 commit comments

Comments
 (0)