Apply suggestions from code review

Thank you @krnowak! Great review and awesome feedback, as always.

Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
This commit is contained in:
Thilo Fromm 2023-09-29 14:54:13 +02:00
parent 6f38b9ad69
commit ba4342d2b7
3 changed files with 20 additions and 20 deletions

View File

@ -17,7 +17,7 @@ Before prefix build support are considered stable, the below must be implemented
## About ## About
Prefix builds let you build and ship applications and all their dependencies in a custom directory. Prefix builds let you build and ship applications and all their dependencies in a custom directory.
This custom directory is self-contained, all dependencies are included, and binaries are only linked agains libraries in the custom directory. This custom directory is self-contained, all dependencies are included, and binaries are only linked against libraries in the custom directory.
The applications' root will be `/` - i.e. there's no need to `chroot` into the custom directory. The applications' root will be `/` - i.e. there's no need to `chroot` into the custom directory.
For example, applications built with the prefix `/usr/local/my-app` will ship For example, applications built with the prefix `/usr/local/my-app` will ship

View File

@ -4,7 +4,7 @@
DEFAULT_STAGING_ROOT="/build/" DEFAULT_STAGING_ROOT="/build/"
function lineprepend() { function lineprepend() {
awk -v msg="$@" '{ print msg ": " $0}' awk -v msg="$*" '{ print msg ": " $0}'
} }
# -- # --
@ -114,17 +114,17 @@ function create_make_conf() {
sudo_clobber "${filepath}" <<EOF sudo_clobber "${filepath}" <<EOF
DISTDIR="/mnt/host/source/.cache/distfiles" DISTDIR="/mnt/host/source/.cache/distfiles"
PKGDIR="${STAGINGDIR}/pkgs" PKGDIR=${STAGINGDIR@Q}/pkgs
PORT_LOGDIR="${dir}/logs" PORT_LOGDIR=${dir@Q}/logs
PORTAGE_TMPDIR="${dir}/tmp" PORTAGE_TMPDIR=${dir@Q}/tmp
PORTAGE_BINHOST="" PORTAGE_BINHOST=""
PORTAGE_USERNAME="sdk" PORTAGE_USERNAME="sdk"
MAKEOPTS="--jobs=4" MAKEOPTS="--jobs=4"
CHOST="${PREFIX_CHOST}" CHOST=${PREFIX_CHOST@Q}
ACCEPT_KEYWORDS="${PREFIX_KEYWORDS}" ACCEPT_KEYWORDS=${PREFIX_KEYWORDS@Q}
EMERGE_DEFAULT_OPTS="${emerge_opts}" EMERGE_DEFAULT_OPTS=${emerge_opts@Q}
USE=" USE="
-desktop -desktop
@ -162,11 +162,11 @@ function create_emerge_wrapper() {
set -euo pipefail set -euo pipefail
PREFIXNAME="${PREFIXNAME}" PREFIXNAME=${PREFIXNAME@Q}
EPREFIX="${EPREFIX}" EPREFIX=${EPREFIX@Q}
STAGINGROOT="${STAGINGROOT}" STAGINGROOT=${STAGINGROOT@Q}
FINALROOT="${FINALROOT}" FINALROOT=${FINALROOT@Q}
CB_ROOT="${CB_ROOT}" CB_ROOT=${CB_ROOT@Q}
if [ "\${1}" = "--help" ] ; then if [ "\${1}" = "--help" ] ; then
echo "\$0 : emerge prefix wrapper for prefix '\${PREFIXNAME}'" echo "\$0 : emerge prefix wrapper for prefix '\${PREFIXNAME}'"
@ -178,11 +178,11 @@ if [ "\${1}" = "--help" ] ; then
echo " --install Skip build, just install. Binpkg must exist in staging." echo " --install Skip build, just install. Binpkg must exist in staging."
echo echo
echo " Prefix configuration:" echo " Prefix configuration:"
echo " PREFIXNAME=\"\${PREFIXNAME}\"" echo " PREFIXNAME=\${PREFIXNAME@Q}"
echo " EPREFIX=\"\${EPREFIX}\"" echo " EPREFIX=\${EPREFIX@Q}"
echo " STAGINGROOT=\"\${STAGINGROOT}\"" echo " STAGINGROOT=\${STAGINGROOT@Q}"
echo " FINALROOT=\"\${FINALROOT}\"" echo " FINALROOT=\${FINALROOT@Q}"
echo " CB_ROOT="\${CB_ROOT}"" echo " CB_ROOT=\${CB_ROOT@Q}"
exit exit
fi fi
@ -199,7 +199,7 @@ if [ "\${skip_build}" = "true" ] ; then
echo "NOTE that install into final will fail if binpkgs are missing." echo "NOTE that install into final will fail if binpkgs are missing."
else else
echo "Building in staging..." echo "Building in staging..."
sudo -E EPREFIX=\${EPREFIX} \${CB_ROOT}/bin/cb-emerge \${STAGINGROOT} "\$@" sudo -E EPREFIX="\${EPREFIX}" "\${CB_ROOT}/bin/cb-emerge" "\${STAGINGROOT}" "\$@"
fi fi
if [ "\${skip_install}" = "true" ] ; then if [ "\${skip_install}" = "true" ] ; then

View File

@ -11,6 +11,6 @@ KEYWORDS="amd64 arm64"
# These should be the absolute minimum runtime dependencies of the "final" prefix. # These should be the absolute minimum runtime dependencies of the "final" prefix.
# "Staging" has @system so it is pretty heavyweight. # "Staging" has @system so it is pretty heavyweight.
RDEPEND="${RDEPEND} RDEPEND="
virtual/libc virtual/libc
" "