litex_setup: add sha1 support on git clone/pull and fix microwatt to a specific sha1.
The pythondata are generated automatically from external sources, some of them are stable, some others still under development, so allow specifying a specific sha1 commit for sources that are moving and breaking LiteX support.
This commit is contained in:
parent
23d43a2c23
commit
55c0ddab36
107
litex_setup.py
107
litex_setup.py
|
@ -13,42 +13,42 @@ current_path = os.path.abspath(os.curdir)
|
||||||
|
|
||||||
# Repositories -------------------------------------------------------------------------------------
|
# Repositories -------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# name, (url, recursive clone, develop)
|
# name, (url, recursive clone, develop, sha1)
|
||||||
repos = [
|
repos = [
|
||||||
# HDL
|
# HDL
|
||||||
("migen", ("https://github.com/m-labs/", True, True)),
|
("migen", ("https://github.com/m-labs/", True, True, None)),
|
||||||
("nmigen", ("https://github.com/nmigen/", True, True)),
|
("nmigen", ("https://github.com/nmigen/", True, True, None)),
|
||||||
|
|
||||||
# LiteX SoC builder
|
# LiteX SoC builder
|
||||||
("pythondata-software-compiler_rt", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-software-compiler_rt", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("litex", ("https://github.com/enjoy-digital/", False, True)),
|
("litex", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
|
|
||||||
# LiteX cores ecosystem
|
# LiteX cores ecosystem
|
||||||
("liteeth", ("https://github.com/enjoy-digital/", False, True)),
|
("liteeth", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litedram", ("https://github.com/enjoy-digital/", False, True)),
|
("litedram", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litepcie", ("https://github.com/enjoy-digital/", False, True)),
|
("litepcie", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litesata", ("https://github.com/enjoy-digital/", False, True)),
|
("litesata", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litesdcard", ("https://github.com/enjoy-digital/", False, True)),
|
("litesdcard", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("liteiclink", ("https://github.com/enjoy-digital/", False, True)),
|
("liteiclink", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litevideo", ("https://github.com/enjoy-digital/", False, True)),
|
("litevideo", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litescope", ("https://github.com/enjoy-digital/", False, True)),
|
("litescope", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litejesd204b", ("https://github.com/enjoy-digital/", False, True)),
|
("litejesd204b", ("https://github.com/enjoy-digital/", False, True, None)),
|
||||||
("litespi", ("https://github.com/litex-hub/", False, True)),
|
("litespi", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
|
|
||||||
# LiteX boards support
|
# LiteX boards support
|
||||||
("litex-boards", ("https://github.com/litex-hub/", False, True)),
|
("litex-boards", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
|
|
||||||
# Optional LiteX data
|
# Optional LiteX data
|
||||||
("pythondata-misc-tapcfg", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-misc-tapcfg", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-lm32", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-lm32", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-mor1kx", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-mor1kx", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-picorv32", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-picorv32", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-serv", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-serv", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-vexriscv", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-vexriscv", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-rocket", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-rocket", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-minerva", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-minerva", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
("pythondata-cpu-microwatt", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-microwatt", ("https://github.com/litex-hub/", False, True, 0xa7859fb)),
|
||||||
("pythondata-cpu-blackparrot", ("https://github.com/litex-hub/", False, True)),
|
("pythondata-cpu-blackparrot", ("https://github.com/litex-hub/", False, True, None)),
|
||||||
]
|
]
|
||||||
|
|
||||||
repos = OrderedDict(repos)
|
repos = OrderedDict(repos)
|
||||||
|
@ -92,63 +92,64 @@ if os.environ.get("TRAVIS", "") == "true":
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Available commands:")
|
print("Available commands:")
|
||||||
print("- init")
|
print("- init")
|
||||||
print("- install (add --user to install to user directory)")
|
|
||||||
print("- update")
|
print("- update")
|
||||||
|
print("- install (add --user to install to user directory)")
|
||||||
print("- gcc")
|
print("- gcc")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
# Repositories cloning
|
# Repositories cloning
|
||||||
if "init" in sys.argv[1:]:
|
if "init" in sys.argv[1:]:
|
||||||
os.chdir(os.path.join(current_path))
|
|
||||||
for name in repos.keys():
|
for name in repos.keys():
|
||||||
|
os.chdir(os.path.join(current_path))
|
||||||
if not os.path.exists(name):
|
if not os.path.exists(name):
|
||||||
url, need_recursive, need_develop = repos[name]
|
url, need_recursive, need_develop, sha1 = repos[name]
|
||||||
# clone repo (recursive if needed)
|
# clone repo (recursive if needed)
|
||||||
print("[cloning " + name + "]...")
|
print("[cloning " + name + "]...")
|
||||||
full_url = url + name
|
full_url = url + name
|
||||||
opts = "--recursive" if need_recursive else ""
|
opts = "--recursive" if need_recursive else ""
|
||||||
subprocess.check_call(
|
subprocess.check_call("git clone " + full_url + " " + opts, shell=True)
|
||||||
"git clone " + full_url + " " + opts,
|
if sha1 is not None:
|
||||||
shell=True)
|
os.chdir(os.path.join(current_path, name))
|
||||||
|
os.system("git checkout {:7x}".format(sha1))
|
||||||
|
|
||||||
|
# Repositories update
|
||||||
|
if "update" in sys.argv[1:]:
|
||||||
|
for name in repos.keys():
|
||||||
|
os.chdir(os.path.join(current_path))
|
||||||
|
url, need_recursive, need_develop, sha1 = repos[name]
|
||||||
|
print(url)
|
||||||
|
if not os.path.exists(name):
|
||||||
|
raise Exception("{} not initialized, please (re)-run init and install first.".format(name))
|
||||||
|
# update
|
||||||
|
print("[updating " + name + "]...")
|
||||||
|
os.chdir(os.path.join(current_path, name))
|
||||||
|
subprocess.check_call("git pull --ff-only", shell=True)
|
||||||
|
if sha1 is not None:
|
||||||
|
os.chdir(os.path.join(current_path, name))
|
||||||
|
os.system("git checkout {:7x}".format(sha1))
|
||||||
|
|
||||||
# Repositories installation
|
# Repositories installation
|
||||||
if "install" in sys.argv[1:]:
|
if "install" in sys.argv[1:]:
|
||||||
for name in repos.keys():
|
for name in repos.keys():
|
||||||
url, need_recursive, need_develop = repos[name]
|
os.chdir(os.path.join(current_path))
|
||||||
|
url, need_recursive, need_develop, sha1 = repos[name]
|
||||||
# develop if needed
|
# develop if needed
|
||||||
print("[installing " + name + "]...")
|
print("[installing " + name + "]...")
|
||||||
if need_develop:
|
if need_develop:
|
||||||
os.chdir(os.path.join(current_path, name))
|
os.chdir(os.path.join(current_path, name))
|
||||||
if "--user" in sys.argv[1:]:
|
if "--user" in sys.argv[1:]:
|
||||||
subprocess.check_call(
|
subprocess.check_call("python3 setup.py develop --user", shell=True)
|
||||||
"python3 setup.py develop --user",
|
|
||||||
shell=True)
|
|
||||||
else:
|
else:
|
||||||
subprocess.check_call(
|
subprocess.check_call("python3 setup.py develop", shell=True)
|
||||||
"python3 setup.py develop",
|
|
||||||
shell=True)
|
|
||||||
os.chdir(os.path.join(current_path))
|
|
||||||
|
|
||||||
if "--user" in sys.argv[1:]:
|
if "--user" in sys.argv[1:]:
|
||||||
if ".local/bin" not in os.environ.get("PATH", ""):
|
if ".local/bin" not in os.environ.get("PATH", ""):
|
||||||
print("Make sure that ~/.local/bin is in your PATH")
|
print("Make sure that ~/.local/bin is in your PATH")
|
||||||
print("export PATH=$PATH:~/.local/bin")
|
print("export PATH=$PATH:~/.local/bin")
|
||||||
|
|
||||||
# Repositories update
|
|
||||||
if "update" in sys.argv[1:]:
|
|
||||||
for name in repos.keys():
|
|
||||||
if not os.path.exists(name):
|
|
||||||
raise Exception("{} not initialized, please (re)-run init and install first.".format(name))
|
|
||||||
# update
|
|
||||||
print("[updating " + name + "]...")
|
|
||||||
os.chdir(os.path.join(current_path, name))
|
|
||||||
subprocess.check_call(
|
|
||||||
"git pull --ff-only",
|
|
||||||
shell=True)
|
|
||||||
os.chdir(os.path.join(current_path))
|
|
||||||
|
|
||||||
# RISC-V GCC installation
|
# RISC-V GCC installation
|
||||||
if "gcc" in sys.argv[1:]:
|
if "gcc" in sys.argv[1:]:
|
||||||
|
os.chdir(os.path.join(current_path))
|
||||||
sifive_riscv_download()
|
sifive_riscv_download()
|
||||||
if "riscv64" not in os.environ.get("PATH", ""):
|
if "riscv64" not in os.environ.get("PATH", ""):
|
||||||
print("Make sure that the downloaded RISC-V compiler is in your $PATH.")
|
print("Make sure that the downloaded RISC-V compiler is in your $PATH.")
|
||||||
|
|
Loading…
Reference in New Issue