xbps-src: quote wrksrc to allow whitespace

This commit is contained in:
Piotr Wójcik 2020-09-02 19:04:41 +02:00 committed by Piotr
parent 4c29e554b6
commit 6efc7dd98d
9 changed files with 31 additions and 31 deletions

View file

@ -3,10 +3,10 @@
do_extract() { do_extract() {
local f curfile local f curfile
mkdir -p ${wrksrc} mkdir -p "${wrksrc}"
for f in ${distfiles}; do for f in ${distfiles}; do
curfile="${f#*>}" curfile="${f#*>}"
curfile="${curfile##*/}" curfile="${curfile##*/}"
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} ${wrksrc}/${curfile} cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} "${wrksrc}/${curfile}"
done done
} }

View file

@ -20,11 +20,11 @@ do_build() {
msg_error "Stackage version not set in \$stackage.\n" msg_error "Stackage version not set in \$stackage.\n"
fi fi
msg_normal "Using stackage resolver ${stackage}.\n" msg_normal "Using stackage resolver ${stackage}.\n"
STACK_ROOT=$wrksrc/.stack \ STACK_ROOT="$wrksrc/.stack" \
stack init ${_stack_args} --force --resolver ${stackage} stack init ${_stack_args} --force --resolver ${stackage}
fi fi
STACK_ROOT=$wrksrc/.stack stack ${_stack_args} ${makejobs} build \ STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} ${makejobs} build \
${make_build_args} ${make_build_args}
} }
@ -32,6 +32,6 @@ do_install() {
local _stack_args="--system-ghc --skip-ghc-check" local _stack_args="--system-ghc --skip-ghc-check"
vmkdir usr/bin vmkdir usr/bin
STACK_ROOT=$wrksrc/.stack stack ${_stack_args} install \ STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} install \
${make_build_args} --local-bin-path=${DESTDIR}/usr/bin ${make_build_args} --local-bin-path=${DESTDIR}/usr/bin
} }

View file

@ -29,17 +29,17 @@ do_configure() {
fi fi
export PERL5LIB=$perlprefix export PERL5LIB=$perlprefix
if [ -f ${wrksrc}/Makefile.PL ]; then if [ -f "${wrksrc}/Makefile.PL" ]; then
sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" ${wrksrc}/Makefile.PL sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" "${wrksrc}/Makefile.PL"
fi fi
if [ -z "$perl_configure_dirs" ]; then if [ -z "$perl_configure_dirs" ]; then
perlmkf="$wrksrc/Makefile.PL" perlmkf="$wrksrc/Makefile.PL"
if [ ! -f $perlmkf ]; then if [ ! -f "$perlmkf" ]; then
msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n" msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
fi fi
cd $wrksrc cd "$wrksrc"
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \ PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
OPTIMIZE="$CFLAGS" \ OPTIMIZE="$CFLAGS" \
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \ CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
@ -50,8 +50,8 @@ do_configure() {
for i in ${perl_configure_dirs}; do for i in ${perl_configure_dirs}; do
perlmkf="$wrksrc/$i/Makefile.PL" perlmkf="$wrksrc/$i/Makefile.PL"
if [ -f $perlmkf ]; then if [ -f "$perlmkf" ]; then
cd $wrksrc/$i cd "$wrksrc/$i"
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \ PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
OPTIMIZE="$CFLAGS" \ OPTIMIZE="$CFLAGS" \
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \ CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \

View file

@ -7,7 +7,7 @@ hook() {
local TAR_CMD local TAR_CMD
if [ -z "$distfiles" -a -z "$checksum" ]; then if [ -z "$distfiles" -a -z "$checksum" ]; then
mkdir -p $wrksrc mkdir -p "$wrksrc"
return 0 return 0
fi fi
@ -21,7 +21,7 @@ hook() {
done done
if [ -n "$create_wrksrc" ]; then if [ -n "$create_wrksrc" ]; then
mkdir -p ${wrksrc} || msg_error "$pkgver: failed to create wrksrc.\n" mkdir -p "${wrksrc}" || msg_error "$pkgver: failed to create wrksrc.\n"
fi fi
# Disable trap on ERR; the code is smart enough to report errors and abort. # Disable trap on ERR; the code is smart enough to report errors and abort.
@ -81,14 +81,14 @@ hook() {
case ${cursufx} in case ${cursufx} in
tar|txz|tbz|tlz|tgz|crate) tar|txz|tbz|tlz|tgz|crate)
$TAR_CMD -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C $extractdir $TAR_CMD -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C "$extractdir"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
;; ;;
gz|bz2|xz) gz|bz2|xz)
cp -f $srcdir/$curfile $extractdir cp -f $srcdir/$curfile "$extractdir"
cd $extractdir cd "$extractdir"
case ${cursufx} in case ${cursufx} in
gz) gz)
gunzip -f $curfile gunzip -f $curfile
@ -103,12 +103,12 @@ hook() {
;; ;;
zip) zip)
if command -v unzip &>/dev/null; then if command -v unzip &>/dev/null; then
unzip -o -q $srcdir/$curfile -d $extractdir unzip -o -q $srcdir/$curfile -d "$extractdir"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
elif command -v bsdtar &>/dev/null; then elif command -v bsdtar &>/dev/null; then
bsdtar -xf $srcdir/$curfile -C $extractdir bsdtar -xf $srcdir/$curfile -C "$extractdir"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
@ -118,7 +118,7 @@ hook() {
;; ;;
rpm) rpm)
if command -v rpmextract &>/dev/null; then if command -v rpmextract &>/dev/null; then
cd $extractdir cd "$extractdir"
rpmextract $srcdir/$curfile rpmextract $srcdir/$curfile
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
@ -129,19 +129,19 @@ hook() {
;; ;;
txt) txt)
if [ "$create_wrksrc" ]; then if [ "$create_wrksrc" ]; then
cp -f $srcdir/$curfile $extractdir cp -f $srcdir/$curfile "$extractdir"
else else
msg_error "$pkgname: ${curfile##*.} files can only be extracted when create_wrksrc is set\n" msg_error "$pkgname: ${curfile##*.} files can only be extracted when create_wrksrc is set\n"
fi fi
;; ;;
7z) 7z)
if command -v 7z &>/dev/null; then if command -v 7z &>/dev/null; then
7z x $srcdir/$curfile -o$extractdir 7z x $srcdir/$curfile -o"$extractdir"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
elif command -v bsdtar &>/dev/null; then elif command -v bsdtar &>/dev/null; then
bsdtar -xf $srcdir/$curfile -C $extractdir bsdtar -xf $srcdir/$curfile -C "$extractdir"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
fi fi
@ -153,11 +153,11 @@ hook() {
case "$TAR_CMD" in case "$TAR_CMD" in
*bsdtar) *bsdtar)
$TAR_CMD -xOf $srcdir/$curfile data.tar.gz | \ $TAR_CMD -xOf $srcdir/$curfile data.tar.gz | \
$TAR_CMD -xz -C $extractdir -s ",^,${wrksrc##*/}/," -f - $TAR_CMD -xz -C "$extractdir" -s ",^,${wrksrc##*/}/," -f -
;; ;;
*) *)
$TAR_CMD -xOf $srcdir/$curfile data.tar.gz | \ $TAR_CMD -xOf $srcdir/$curfile data.tar.gz | \
$TAR_CMD -xz -C $extractdir --transform="s,^,${wrksrc##*/}/," $TAR_CMD -xz -C "$extractdir" --transform="s,^,${wrksrc##*/}/,"
;; ;;
esac esac
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then

View file

@ -4,10 +4,10 @@ hook() {
local _cfgdir="${XBPS_COMMONDIR}/environment/configure/automake" local _cfgdir="${XBPS_COMMONDIR}/environment/configure/automake"
if [ -z "$build_style" -o "$build_style" = "gnu-configure" ]; then if [ -z "$build_style" -o "$build_style" = "gnu-configure" ]; then
for f in $(find ${wrksrc} -type f -name "*config*.sub"); do for f in $(find "${wrksrc}" -type f -name "*config*.sub"); do
cp -f ${_cfgdir}/config.sub ${f} cp -f ${_cfgdir}/config.sub ${f}
done done
for f in $(find ${wrksrc} -type f -name "*config*.guess"); do for f in $(find "${wrksrc}" -type f -name "*config*.guess"); do
cp -f ${_cfgdir}/config.guess ${f} cp -f ${_cfgdir}/config.guess ${f}
done done
fi fi

View file

@ -40,7 +40,7 @@ fi
# If template defines do_extract() use it rather than the hooks. # If template defines do_extract() use it rather than the hooks.
if declare -f do_extract >/dev/null; then if declare -f do_extract >/dev/null; then
[ ! -d "$wrksrc" ] && mkdir -p $wrksrc [ ! -d "$wrksrc" ] && mkdir -p "$wrksrc"
cd "$wrksrc" cd "$wrksrc"
run_func do_extract run_func do_extract
else else

View file

@ -30,7 +30,7 @@ run_func() {
ch_wrksrc() { ch_wrksrc() {
cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n" cd "$wrksrc" || msg_error "$pkgver: cannot access wrksrc directory [$wrksrc]\n"
if [ -n "$build_wrksrc" ]; then if [ -n "$build_wrksrc" ]; then
cd $build_wrksrc || \ cd "$build_wrksrc" || \
msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n" msg_error "$pkgver: cannot access build_wrksrc directory [$build_wrksrc]\n"
fi fi
} }

View file

@ -79,8 +79,8 @@ remove_pkg_autodeps() {
remove_pkg_wrksrc() { remove_pkg_wrksrc() {
if [ -d "$wrksrc" ]; then if [ -d "$wrksrc" ]; then
msg_normal "$pkgver: cleaning build directory...\n" msg_normal "$pkgver: cleaning build directory...\n"
chmod -R +wX $wrksrc # Needed to delete Go Modules chmod -R +wX "$wrksrc" # Needed to delete Go Modules
rm -rf $wrksrc rm -rf "$wrksrc"
fi fi
} }

View file

@ -762,7 +762,7 @@ case "$XBPS_TARGET" in
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $? chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $?
else else
remove_pkg_wrksrc $wrksrc remove_pkg_wrksrc
remove_pkg_statedir remove_pkg_statedir
if declare -f do_clean >/dev/null; then if declare -f do_clean >/dev/null; then
run_func do_clean run_func do_clean