From d31e9557e0e1b43922764073e0b0cf8738eb2be5 Mon Sep 17 00:00:00 2001 From: ms Date: Tue, 28 Sep 2021 12:46:39 +0200 Subject: taler-local utility. Add option to cherry-pick projects to compile. --- bin/WIP/taler-local | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/bin/WIP/taler-local b/bin/WIP/taler-local index 6bfcbca..5eb89d5 100755 --- a/bin/WIP/taler-local +++ b/bin/WIP/taler-local @@ -338,7 +338,9 @@ def get_stale_repos(repos: List[Repo]) -> List[Repo]: continue ts = timestamps[r.name] = s.stat().st_mtime for dep in r.deps: - if timestamps[dep] > ts: + # When 'dep' in not found, it has been + # excluded from the compilation. + if timestamps.get("dep", 0) > ts: stale.append(r) break return stale @@ -349,16 +351,34 @@ def get_stale_repos(repos: List[Repo]) -> List[Repo]: help="WITHOUT REPOS is a unspaced and comma-separated list \ of the repositories to _exclude_ from compilation", default="") -def build(without_repos) -> None: +@click.option( + "--only-repos", metavar="ONLY REPOS", + help="ONLY REPOS is a unspaced and comma-separated exclusive list \ +of the repositories to include in the compilation", + default="") +def build(without_repos, only_repos) -> None: """Build the deployment from source.""" - exclude = split_repos_list(without_repos) - # Get the repositories names from the source directory + if only_repos != "" and without_repos != "": + print("Either use --only-repos or --without-repos") + exit(1) + repos_names = get_repos_names() + if only_repos != "": + repos_names = list(filter( + lambda x: x in split_repos_list(only_repos), + repos_names + )) + if without_repos != "": + repos_names = list(filter( + lambda x: x not in split_repos_list(without_repos), + repos_names + )) + # Reorder the list of repositories so that the # most fundamental dependecies appear left-most. - repos_keys = repos.keys() # Has the precedence rules. + repos_keys = repos.keys() sorted_repos = sorted( set(repos_keys).intersection(repos_names), key=lambda x: list(repos_keys).index(x) @@ -368,9 +388,6 @@ def build(without_repos) -> None: stale = get_stale_repos(target_repos) print(f"found stale repos: {[r.name for r in stale]}") for r in stale: - if r.name in exclude: - print(f"not building: {r.name}") - continue # Warn, if a dependency is not being built: diff = set(r.deps) - set(repos_names) if len(diff) > 0: @@ -387,10 +404,19 @@ def build(without_repos) -> None: default="libmicrohttpd,gnunet,exchange,merchant,wallet-core,taler-merchant-demos,sync,anastasis,libeufin", show_default=True, ) -def bootstrap(repos) -> None: +@click.option( + "--list-repos/--no-list-repos", default=False, + help="Lists the repositories that were bootstrapped.", +) +def bootstrap(list_repos, repos) -> None: """Clone all the specified repositories.""" + if list_repos: + for repo in get_repos_names(): + print(repo) + return + # Download the repository. def checkout_repos(repos: List[Repo]): if len(repos) == 0: -- cgit v1.2.3