Skip to content

Commit ea9feef

Browse files
author
oech3
committed
build-gnu.sh: Use any profile & cleanup arg
1 parent 35f7db9 commit ea9feef

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

.github/workflows/GnuTests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
run: |
110110
## Build binaries
111111
cd 'uutils'
112-
bash util/build-gnu.sh --release-build
112+
env PROFILE=release-small bash util/build-gnu.sh
113113
114114
### Run tests as user
115115
- name: Run GNU tests
@@ -244,7 +244,7 @@ jobs:
244244
### Build
245245
- name: Build binaries
246246
run: |
247-
lima bash -c "cd ~/work/uutils/ && SELINUX_ENABLED=1 bash util/build-gnu.sh --release-build"
247+
lima bash -c "cd ~/work/uutils/ && SELINUX_ENABLED=1 PROFILE=release-small bash util/build-gnu.sh"
248248
249249
### Run tests as user
250250
- name: Generate SELinux tests list

DEVELOPMENT.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ To run uutils against the GNU test suite locally, run the following commands:
230230
```shell
231231
bash util/build-gnu.sh
232232
# Build uutils with release optimizations
233-
bash util/build-gnu.sh --release-build
233+
env PROFILE=release bash util/build-gnu.sh
234+
# Build uutils with SELinux
235+
env SELINUX_ENABLED=1 bash util/build-gnu.sh
234236
bash util/run-gnu-test.sh
235237
# To run a single test:
236238
bash util/run-gnu-test.sh tests/touch/not-owner.sh # for example

util/build-gnu.sh

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,17 @@ NPROC=$(command -v gnproc||command -v nproc)
1414
READLINK=$(command -v greadlink||command -v readlink)
1515
SED=$(command -v gsed||command -v sed)
1616

17+
SYSTEM_TIMEOUT=$(command -v timeout)
18+
SYSTEM_YES=$(command -v yes)
19+
1720
ME="${0}"
1821
ME_dir="$(dirname -- "$("${READLINK}" -fm -- "${ME}")")"
1922
REPO_main_dir="$(dirname -- "${ME_dir}")"
2023

21-
# Default profile is 'debug'
22-
UU_MAKE_PROFILE='debug'
23-
CARGO_FEATURE_FLAGS=""
24-
25-
for arg in "$@"
26-
do
27-
if [ "$arg" == "--release-build" ]; then
28-
UU_MAKE_PROFILE='release'
29-
break
30-
fi
31-
done
3224

33-
echo "UU_MAKE_PROFILE='${UU_MAKE_PROFILE}'"
25+
: ${PROFILE:=debug} # default profile
26+
export PROFILE
27+
CARGO_FEATURE_FLAGS=""
3428

3529
### * config (from environment with fallback defaults); note: GNU is expected to be a sibling repo directory
3630

@@ -39,11 +33,6 @@ path_GNU="$("${READLINK}" -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"
3933

4034
###
4135

42-
SYSTEM_TIMEOUT=$(command -v timeout)
43-
SYSTEM_YES=$(command -v yes)
44-
45-
###
46-
4736
release_tag_GNU="v9.9"
4837

4938
# check if the GNU coreutils has been cloned, if not print instructions
@@ -71,9 +60,9 @@ echo "path_GNU='${path_GNU}'"
7160
###
7261

7362
if [[ ! -z "$CARGO_TARGET_DIR" ]]; then
74-
UU_BUILD_DIR="${CARGO_TARGET_DIR}/${UU_MAKE_PROFILE}"
63+
UU_BUILD_DIR="${CARGO_TARGET_DIR}/${PROFILE}"
7564
else
76-
UU_BUILD_DIR="${path_UUTILS}/target/${UU_MAKE_PROFILE}"
65+
UU_BUILD_DIR="${path_UUTILS}/target/${PROFILE}"
7766
fi
7867
echo "UU_BUILD_DIR='${UU_BUILD_DIR}'"
7968

@@ -105,9 +94,9 @@ fi
10594
cd -
10695

10796
# Pass the feature flags to make, which will pass them to cargo
108-
"${MAKE}" PROFILE="${UU_MAKE_PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
97+
"${MAKE}" PROFILE="${PROFILE}" CARGOFLAGS="${CARGO_FEATURE_FLAGS}"
10998
# min test for SELinux
110-
[ "${SELINUX_ENABLED}" = 1 ] && touch g && "${UU_MAKE_PROFILE}"/stat -c%C g && rm g
99+
[ "${SELINUX_ENABLED}" = 1 ] && touch g && "${PROFILE}"/stat -c%C g && rm g
111100

112101
cp "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests rename this script before running, to avoid confusion with the make target
113102
# Create *sum binaries

0 commit comments

Comments
 (0)