osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/35111?usp=email )
Change subject: gen_makefile: update URL code for netfilter urls ......................................................................
gen_makefile: update URL code for netfilter urls
* libgtnpnl is now developed at gerrit.osmocom.org * use https:// instead of git:// for libnftnl, nftables * read the urls from a new all.urls file * don't set a push URL pointing to gerrit for projects that have different URLs
Change-Id: I5522c9fcc594d296c581ba59c0beb4882e2d976e --- A all.urls M gen_makefile.py 2 files changed, 43 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/11/35111/1
diff --git a/all.urls b/all.urls new file mode 100644 index 0000000..27aaf6e --- /dev/null +++ b/all.urls @@ -0,0 +1,4 @@ +# Git clone URLs for projects not developed at gerrit.osmocom.org +# project url +libnftnl https://git.netfilter.org/libnftnl/ +nftables https://git.netfilter.org/nftables/ diff --git a/gen_makefile.py b/gen_makefile.py index a00234f..9a8a5cf 100755 --- a/gen_makefile.py +++ b/gen_makefile.py @@ -52,6 +52,7 @@
topdir = os.path.dirname(os.path.realpath(__file__)) all_deps_file = os.path.join(topdir, "all.deps") +all_urls_file = os.path.join(topdir, "all.urls") parser = argparse.ArgumentParser(epilog=__doc__, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('configure_opts_files', @@ -148,6 +149,18 @@ l.append((tokens[0], tokens[1:])) return l
+def read_projects_urls(path): + 'Read urls config and return dict {project_name: url, …}.' + ret = {} + for line in open(path): + line = line.strip() + if not line or line.startswith('#'): + continue + project, url = line.split() + assert project not in ret, f"project '{project} found twice in {path}" + ret[project] = url + return ret + def read_configure_opts(path): 'Read config opts file and return tuples of (project_name, config-opts).' if not path: @@ -179,14 +192,21 @@ touch $@ '''
- if proj in ("libgtpnl", "libnftnl", "nftables"): - url = "git://git.netfilter.org" + if proj in projects_urls: + url = projects_urls[proj] + cmd_set_push_url = "true" + else: + url = f"{url}/{proj}" + push_url = f"{push_url}/{proj}" + cmd_set_push_url = f'git -C "{src}/{proj}" remote set-url --push origin "{push_url}"' + + cmd_clone = f'git -C {src} clone --recurse-submodules "{url}" "{proj}"'
return f''' .make.{proj}.clone: @echo -e "\n\n\n===== $@\n" test -d {src} || mkdir -p {src} - test -d {src_proj} || ( git -C {src} clone --recurse-submodules "{url}/{proj}" "{proj}" && git -C "{src}/{proj}" remote set-url --push origin "{push_url}/{proj}" ) + test -d {src_proj} || ( {cmd_clone} && {cmd_set_push_url} ) sync touch $@ ''' @@ -303,6 +323,7 @@
projects_deps = read_projects_deps(all_deps_file) +projects_urls = read_projects_urls(all_urls_file) configure_opts = listdict() configure_opts_files = sorted(args.configure_opts_files or []) for configure_opts_file in configure_opts_files: