Merge pull request #17874 from DaanDeMeyer/mkosi-build-verbosity

Reduce mkosi build script verbosity
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-12-07 10:12:33 +01:00 committed by GitHub
commit e0f90ad988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 20 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
set -ex
set -e
# This is a build script for OS image generation using mkosi (https://github.com/systemd/mkosi).
# Simply invoke "mkosi" in the project directory to build an OS image.
@ -21,21 +21,21 @@ umask 022
# So let's ensure we're running under UTF-8.
#
# If our current locale already is UTF-8, then we don't need to do anything:
if [ "$(locale charmap)" != "UTF-8" ] ; then
if [ "$(locale charmap 2> /dev/null)" != "UTF-8" ] ; then
# Try using C.UTF-8 locale, if available. This locale is not shipped
# by upstream glibc, so it's not available in all distros.
# (In particular, it's not available in Arch Linux.)
export LC_CTYPE=C.UTF-8
if [ "$(locale charmap)" != "UTF-8" ] ; then
# Finally, try something like en_US.UTF-8, which should be
# available in Arch Linux, but is not present in Debian's
# minimal image in our mkosi config.
if locale -a | grep -q -E "C.UTF-8|C.utf8"; then
export LC_CTYPE=C.UTF-8
# Finally, try something like en_US.UTF-8, which should be
# available in Arch Linux, but is not present in Debian's
# minimal image in our mkosi config.
elif locale -a | grep -q en_US.utf8; then
export LC_CTYPE=en_US.UTF-8
if [ "$(locale charmap)" != "UTF-8" ] ; then
# If nothing works, fail early.
echo "*** Could not find a valid locale that supports UTF-8. ***" >&2
exit 1
fi
else
# If nothing works, fail early.
echo "*** Could not find a valid locale that supports UTF-8. ***" >&2
exit 1
fi
fi
@ -84,7 +84,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then
fi
fi
meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D "rootprefix=$rootprefix" -D default-hierarchy=unified -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group"
meson "$BUILDDIR" -D "sysvinit-path=$sysvinit_path" -D "rootprefix=$rootprefix" -D man=false -D "nobody-user=$nobody_user" -D "nobody-group=$nobody_group"
fi
ninja -C "$BUILDDIR" all
@ -95,7 +95,13 @@ if [ "$WITH_TESTS" = 1 ] ; then
ninja -C "$BUILDDIR" test
fi
ninja -C "$BUILDDIR" install
# Ubuntu Focal is stuck with meson 0.53.0.
if [ "$(meson -v | cut -d . -f 2)" -gt 53 ] ; then
meson install -C "$BUILDDIR" --quiet --no-rebuild
else
meson install -C "$BUILDDIR" --no-rebuild
fi
mkdir -p "$DESTDIR"/etc

View File

@ -1,12 +1,18 @@
#!/bin/sh
set -eu
if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
VERBOSE=""
else
VERBOSE="v"
fi
# this is needed mostly because $DESTDIR is provided as a variable,
# and we need to create the target directory...
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
mkdir -${VERBOSE}p "$(dirname "${DESTDIR:-}$2")"
if [ "$(dirname $1)" = . -o "$(dirname $1)" = .. ]; then
ln -vfs -T -- "$1" "${DESTDIR:-}$2"
ln -${VERBOSE}fs -T -- "$1" "${DESTDIR:-}$2"
else
ln -vfs -T --relative -- "${DESTDIR:-}$1" "${DESTDIR:-}$2"
ln -${VERBOSE}fs -T --relative -- "${DESTDIR:-}$1" "${DESTDIR:-}$2"
fi

View File

@ -5,6 +5,12 @@ unitdir="$1"
target="$2"
unit="$3"
if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
VERBOSE=""
else
VERBOSE="v"
fi
case "$target" in
*/?*) # a path, but not just a slash at the end
dir="${DESTDIR:-}${target}"
@ -18,11 +24,11 @@ unitpath="${DESTDIR:-}${unitdir}/${unit}"
case "$target" in
*/)
mkdir -vp -m 0755 "$dir"
mkdir -${VERBOSE}p -m 0755 "$dir"
;;
*)
mkdir -vp -m 0755 "$(dirname "$dir")"
mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")"
;;
esac
ln -vfs --relative "$unitpath" "$dir"
ln -${VERBOSE}fs --relative "$unitpath" "$dir"