From a2521a83bc055e315b2ce0f6cc876a4a5ac80908 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 24 Jun 2024 17:21:49 +0200 Subject: just-import-git: make rust-rules default to a public upstream repository ... now that the rules are published. --- bin/just-import-cargo.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'bin/just-import-cargo.py') diff --git a/bin/just-import-cargo.py b/bin/just-import-cargo.py index af59e7d..a08870a 100755 --- a/bin/just-import-cargo.py +++ b/bin/just-import-cargo.py @@ -27,6 +27,8 @@ from hashlib import sha256 from tempfile import TemporaryDirectory from typing import Any, Dict, List, Optional, Tuple, Union, cast +UPSTREAM_RULES_RUST = "https://github.com/just-buildsystem/rules-rust" + JSON = Union[str, int, float, bool, None, Dict[str, 'JSON'], List['JSON']] # ------- JSON formating ------------ @@ -668,13 +670,17 @@ def main(): global IMPORTED_REPOS IMPORTED_REPOS.add("rust-rules-root") else: - print( - "Warning: adding local path to this checkout to the repository configuration", - file=sys.stderr) + # Use git to find out the head commit of the upstream rules-rust + head_commit=subprocess.run( + ["git", "ls-remote", UPSTREAM_RULES_RUST, "master"], + stdout=subprocess.PIPE).stdout.decode('utf-8').split('\t')[0] repos_json["rust-rules-root"] = { "repository": - {"type": "file", - "path": os.path.normpath(os.path.join(my_directory, "../rules")), + {"type": "git", + "repository": UPSTREAM_RULES_RUST, + "branch": "master", + "commit": head_commit, + "subdir": "rules" } } -- cgit v1.2.3