Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
usesh: true
sync: rsync
copyback: false
# We need jq and GNU coreutils to run show-utils.sh and bash to use inline shell string replacement
prepare: pkg install -y rust sudo jq coreutils bash python3
prepare: pkg install -y rust sudo bash python3
run: |
## Prepare, build, and test
# implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
Expand Down Expand Up @@ -130,7 +129,7 @@ jobs:
usesh: true
sync: rsync
copyback: false
prepare: pkg install -y gmake nextest rust sudo jq
prepare: pkg install -y gmake nextest rust sudo
run: |
## Prepare, build, and test
# implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/openbsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ jobs:
sync: rsync
copyback: false
mem: 4096
# We need jq and GNU coreutils to run show-utils.sh and bash to use inline shell string replacement
# Use sudo-- to get the default sudo package without ambiguity
# Install rust and cargo from OpenBSD packages
prepare: |
# Clean up disk space before installing packages
df -h
pkg_add curl sudo-- jq coreutils bash rust rust-clippy rust-rustfmt python3
pkg_add curl sudo-- bash rust rust-clippy rust-rustfmt python3
rm -rf /usr/share/relink/* /usr/X11R6/* /usr/share/doc/* /usr/share/man/* &
# Clean up package cache after installation
pkg_delete -a &
Expand Down Expand Up @@ -154,7 +153,7 @@ jobs:
rsync -a --delete empty/ /usr/X11R6/
rsync -a --delete empty/ /usr/share/doc/
rsync -a --delete empty/ /usr/share/man/
pkg_add curl gmake sudo-- jq rust
pkg_add curl gmake sudo-- rust
# Clean up package cache after installation
pkg_delete -a
df -h
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ jobs:
WASMTIME_LOG: ${{ runner.debug == '1' && 'wasmtime_wasi=trace' || '' }}
WASMTIME_LOG_NO_CONTEXT: ${{ runner.debug == '1' && '1' || '' }}
run: |
# Get all utilities and exclude ones that don't compile for ${{ matrix.job.target }}
EXCLUDE="df|du|env|more"
UTILS=$(./util/show-utils.sh | tr ' ' '\n' | grep -vE "^($EXCLUDE)$" | sed 's/^/-p uu_/' | tr '\n' ' ')
UTILS=$(./util/show-utils.sh --features=feat_wasm | sed 's/^/-p uu_/' | tr '\n' ' ')
cargo test --target ${{ matrix.job.target }} --no-default-features $UTILS
- name: Run integration tests via wasmtime
if: matrix.job.target == 'wasm32-wasip1'
Expand Down
27 changes: 13 additions & 14 deletions util/show-utils.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#!/usr/bin/env bash

set -eo pipefail
# spell-checker:ignore (jq) deps startswith

cd -- "$(dirname -- "$0")/.."

# `jq` available?
if ! jq --version 1>/dev/null 2>&1; then
# refs: <https://forge.rust-lang.org/release/platform-support.html> , <https://docs.rs/platforms/0.2.1/platforms/platform/tier1/index.html>
# default utility list
default_utils=$(cargo tree --depth 1 --features feat_common_core --format "{lib}" --prefix none | sed -n 's/^uu_//p')
echo "WARN: missing \`jq\` (install with \`sudo apt install jq\`); falling back to default (only fully cross-platform) utility list" 1>&2
echo "$default_utils"
if test "$*";then
_args=("$@")
Comment thread
oech3 marked this conversation as resolved.
else
# Find 'coreutils' id with regex
# with cargo v1.76.0, id = "coreutils 0.0.26 (path+file://<coreutils local directory>)"
# with cargo >= v1.77.0
# - if local path != '<...>/coreutils' id = "path+file://<coreutils local directory>#coreutils@0.0.26"
# - if local path == '<...>/coreutils' id = "path+file://<parent directory>/coreutils#0.0.26"
cargo metadata "$@" --format-version 1 | jq -r '[.resolve.nodes[] | select(.id|match(".*coreutils[ |@|#]\\d+\\.\\d+\\.\\d+")) | .deps[] | select(.pkg|match("uu_")) | .name | sub("^uu_"; "")] | sort | join(" ")'
CARGO_BUILD_TARGET="${CARGO_BUILD_TARGET:-$(rustc --print host-tuple)}"
case "$CARGO_BUILD_TARGET" in
*windows*) _args=("--features=windows");;
*wasip*) _args=("--features=feat_wasm");;
*android*) _args=("--features=feat_os_unix_android,feat_require_selinux");;
*linux*) _args=("--features=unix,feat_require_selinux");;
Comment thread
oech3 marked this conversation as resolved.
# unix is default since we don't support too many non-unix

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split the target-related changes to a separate PR so that this one focuses solely on removing the jq dependency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Different commit is strange because show-utils is referenced by *.yml .

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I don't understand. Is it possible to split the change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Because splitiing commit does not guarantee that the script works without jq.

*) _args=("--features=unix");;
esac
fi

cargo tree --depth 1 --format "{lib}" "${_args[@]}" --prefix none | sed -n 's/^uu_//p'
Comment thread
oech3 marked this conversation as resolved.
Loading