Skip to content

Commit

Permalink
check-each-crate: Do not reference crate to check by name
Browse files Browse the repository at this point in the history
This pull request changes how `check-each-crate.py` is working. Instead
of passing the name of the crate via `-p`, we now jump into the
directory of the crate and call there `cargo check`. This should fix
issues like #2013 where
a crate is present twice in the `Cargo.lock`.

Besides that it also changes `core/Cargo.toml` to not always pull in bandersnatch.
  • Loading branch information
bkchr committed Oct 31, 2023
1 parent 18ad449 commit bfdc8c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .gitlab/check-each-crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
crates = []
for line in output.splitlines():
if line != b"":
crates.append(line.decode('utf8').split(" ")[0])
line = line.decode('utf8').split(" ")
crate_name = line[0]
# The crate path is always the last element in the line.
crate_path = line[len(line) - 1].replace("(", "").replace(")", "")
crates.append((crate_name, crate_path))

# Make the list unique and sorted
crates = list(set(crates))
Expand Down Expand Up @@ -49,9 +53,9 @@
for i in range(0, crates_per_group + overflow_crates):
crate = crates_per_group * target_group + i

print(f"Checking {crates[crate]}", file=sys.stderr)
print(f"Checking {crates[crate][0]}", file=sys.stderr)

res = subprocess.run(["cargo", "check", "--locked", "-p", crates[crate]])
res = subprocess.run(["cargo", "check", "--locked"], cwd = crates[crate][1])

if res.returncode != 0:
sys.exit(1)
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion substrate/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bench = false
default = [ "std" ]
std = [
"array-bytes",
"bandersnatch_vrfs/getrandom",
"bandersnatch_vrfs?/getrandom",
"bip39/rand",
"bip39/std",
"blake2/std",
Expand Down

0 comments on commit bfdc8c3

Please sign in to comment.