diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-20 01:44:08 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-20 01:44:08 +0100 |
commit | 3f4fff9ae43b20fc54034a86a9327d0c682578db (patch) | |
tree | 3333556b6558f13dd034bb305f64d09c3ddbc3e3 /bin | |
parent | 75ffbe7616c30754533c6930b176dab68d019ce8 (diff) | |
download | deployment-3f4fff9ae43b20fc54034a86a9327d0c682578db.tar.gz deployment-3f4fff9ae43b20fc54034a86a9327d0c682578db.tar.bz2 deployment-3f4fff9ae43b20fc54034a86a9327d0c682578db.zip |
sync repos
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/taler-deployment | 76 |
1 files changed, 47 insertions, 29 deletions
diff --git a/bin/taler-deployment b/bin/taler-deployment index 2d6c7a4..2c7b16a 100755 --- a/bin/taler-deployment +++ b/bin/taler-deployment @@ -81,7 +81,7 @@ currmap = { "coverage": "TESTKUDOS", "demo": "KUDOS", "int": "INTKUDOS", - "euro": "EUR" + "euro": "EUR", } @@ -270,7 +270,6 @@ def get_repos(envname): return [Repo("docs", "git://gnunet.org/docs.git", [], build_docs)] if envname == "coverage": return [ - Repo( "libmicrohttpd", "git://gnunet.org/libmicrohttpd.git", @@ -284,7 +283,6 @@ def get_repos(envname): ["gnunet", "libmicrohttpd"], build_exchange, ), - Repo( "merchant", "git://git.taler.net/merchant", @@ -293,7 +291,6 @@ def get_repos(envname): ), ] - if envname == "euro": return [ Repo( @@ -315,7 +312,6 @@ def get_repos(envname): ["exchange", "libmicrohttpd"], build_merchant, ), - Repo("bank", "git://git.taler.net/bank", [], build_bank), Repo("landing", "git://git.taler.net/landing", [], build_landing), Repo("donations", "git://git.taler.net/donations", [], build_donations), @@ -377,7 +373,6 @@ def ensure_activated(): sys.exit(1) - def update_repos(repos: List[Repo]) -> None: for r in repos: r_dir = Path.home() / "sources" / r.name @@ -420,7 +415,7 @@ allowed_envs = ( "auditor-reporter", "docs-builder", "euro", - "coverage" + "coverage", ) @@ -476,24 +471,10 @@ def switch_demo(color) -> None: active_home.symlink_to(f"/home/demo-{color}") -@cli.command() -def bootstrap() -> None: - """Bootstrap a GNU Taler deployment.""" - +def checkout_repos(r): + """Check out repos to the version specified in envcfg.py""" home = Path.home() - - cfg = load_envcfg() - if not cfg: - print("Please create ~/envcfg.py (template in deployment.git can help)") - return 1 - env_info = get_env_info(cfg) - repos = env_info.repos - envname = env_info.name - - # read Python-style config - sources = home / "sources" - for r in repos: r_dir = home / "sources" / r.name if not r_dir.exists(): @@ -508,6 +489,39 @@ def bootstrap() -> None: check=True, ) + +@cli.command() +def sync_repos() -> None: + """Sync repos with the envcfg.py file.""" + home = Path.home() + cfg = load_envcfg() + if not cfg: + print("Please create ~/envcfg.py (template in deployment.git can help)") + return 1 + env_info = get_env_info(cfg) + repos = env_info.repos + checkout_repos(r) + for r in repos: + r_dir = home / "sources" / r.name + subprocess.run(["git", "-C", r_dir.as_posix(), "clean", "-fdx"], check=True) + + +@cli.command() +def bootstrap() -> None: + """Bootstrap a GNU Taler deployment.""" + + home = Path.home() + + cfg = load_envcfg() + if not cfg: + print("Please create ~/envcfg.py (template in deployment.git can help)") + return 1 + env_info = get_env_info(cfg) + repos = env_info.repos + envname = env_info.name + + checkout_repos(r) + with (home / "activate").open("w") as f: f.write( activate_template.format( @@ -515,8 +529,7 @@ def bootstrap() -> None: timestamp=str(time.time()), currency=currmap[envname], curr_path=os.environ["PATH"], - coverage=1 if envname=="coverage" else 0 - + coverage=1 if envname == "coverage" else 0, ) ) @@ -537,13 +550,18 @@ def bootstrap() -> None: elif envname == "coverage": create_bb_worker("bb-worker", "lcov-worker", "lcov-pass") - www_path = (Path.home() / "www") + www_path = Path.home() / "www" www_path.mkdir(exist_ok=True) if not os.path.islink(www_path / "merchant"): - os.symlink(Path.home() / "sources" / "merchant" / "coverage_report", www_path / "merchant") + os.symlink( + Path.home() / "sources" / "merchant" / "coverage_report", + www_path / "merchant", + ) if not os.path.islink(www_path / "exchange"): - os.symlink(Path.home() / "sources" / "exchange" / "coverage_report", www_path / "exchange") - + os.symlink( + Path.home() / "sources" / "exchange" / "coverage_report", + www_path / "exchange", + ) print("Bootstrap finished.") print("Please source the ~/activate file before proceeding.") |