summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-06-24 17:21:49 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-06-24 17:29:42 +0200
commita2521a83bc055e315b2ce0f6cc876a4a5ac80908 (patch)
tree43840d8c23c949643602953d17f2669e0b0dbd99
parentf87ad41f72ca4465a0c5b4ba9fd36a7b09e4d4f4 (diff)
downloadrules-rust-a2521a83bc055e315b2ce0f6cc876a4a5ac80908.tar.gz
just-import-git: make rust-rules default to a public upstream repository
... now that the rules are published.
-rwxr-xr-xbin/just-import-cargo.py16
-rw-r--r--share/man/import-cargo.1.md10
2 files changed, 15 insertions, 11 deletions
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"
}
}
diff --git a/share/man/import-cargo.1.md b/share/man/import-cargo.1.md
index d52aece..c3898f5 100644
--- a/share/man/import-cargo.1.md
+++ b/share/man/import-cargo.1.md
@@ -33,12 +33,10 @@ Output a usage message and exit.
**`--rules`** *`name`*
Assume the rust rules are the logical repository *`name`* in the
-configuration provided on standard input. Typically, the rust rules
-would be imported first via **`just-import-git`**(1). If this option
-is not given, as last resort, a *`"file"`* repository for the rules
-is created pointing to the directory `../rules` relative to location
-of this binary. This is correct, if **`just-import-cargo`** is called
-from a (persistent) checkout of `rules-rust`, but hardly ever useful.
+configuration provided on standard input. Typically, the rust rules would
+be imported first via **`just-import-git`**(1). If this option is not
+given, the latest commit of `https://github.com/just-buildsystem/rules-rust`
+is taken.
**`--repo-root`** *`root`*
Specify the root of the physical directory the configuration read from