Skip to content
Closed
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
22 changes: 13 additions & 9 deletions util/build-gnu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,28 @@ cd -
export CARGOFLAGS # tell to make
if [ "${SELINUX_ENABLED}" = 1 ];then
# Build few utils for SELinux for faster build. MULTICALL=y fails...
make UTILS="cat chcon chmod cp cut dd echo env groups id install ln ls mkdir mkfifo mknod mktemp mv printf rm rmdir runcon seq stat test touch tr true uname wc whoami"
UTILS="cat chcon chmod cp cut dd echo env groups id install ln ls mkdir mkfifo mknod mktemp mv printf rm rmdir runcon seq stat test touch tr true uname wc whoami"
export UTILS
make
else
# Use MULTICALL=y for faster build
make MULTICALL=y SKIP_UTILS=more
for binary in $("${UU_BUILD_DIR}"/coreutils --list)
do [ -e "${UU_BUILD_DIR}/${binary}" ] || ln -vf "${UU_BUILD_DIR}/coreutils" "${UU_BUILD_DIR}/${binary}"
UTILS=$("${UU_BUILD_DIR}"/coreutils --list)
for binary in ${UTILS}
do ln -sf "${UU_BUILD_DIR}/coreutils" "${UU_BUILD_DIR}/${binary}"
done
fi
[ -e "${UU_BUILD_DIR}/ginstall" ] || ln -vf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests use ginstall
ln -sf "${UU_BUILD_DIR}/install" "${UU_BUILD_DIR}/ginstall" # The GNU tests use ginstall
##

cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"

# Any binaries that aren't built become `false` to make tests failure
for binary in $(./build-aux/gen-lists-of-programs.sh --list-progs); do
bin_path="${UU_BUILD_DIR}/${binary}"
test -f "${bin_path}" || cp -v /usr/bin/false "${bin_path}"
test -f "${bin_path}" || ln -sv /usr/bin/false "${bin_path}"
done

# Always update the PATH to test the uutils coreutils instead of the GNU coreutils
# This ensures the correct path is used even if the repository was moved or rebuilt in a different location
sed -i "s/^[[:blank:]]*PATH=.*/ PATH='${UU_BUILD_DIR//\//\\/}\$(PATH_SEPARATOR)'\"\$\$PATH\" \\\/" tests/local.mk

if test -f gnu-built; then
echo "GNU build already found. Skip"
echo "'rm -f $(pwd)/{gnu-built,src/getlimits}' to force the build"
Expand Down Expand Up @@ -160,6 +159,11 @@ else
touch gnu-built
fi

# Hijack coreutils
for binary in ${UTILS}
do ln -sf "${UU_BUILD_DIR}/${binary}" src/"${binary}"
done

grep -rl 'path_prepend_' tests/* | xargs -r "${SED}" -i 's| path_prepend_ ./src||'
# path_prepend_ sets $abs_path_dir_: set it manually instead.
grep -rl '\$abs_path_dir_' tests/*/*.sh | xargs -r "${SED}" -i "s|\$abs_path_dir_|${UU_BUILD_DIR//\//\\/}|g"
Expand Down
Loading