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() {
local f curfile
mkdir -p ${wrksrc}
mkdir -p "${wrksrc}"
for f in ${distfiles}; do
curfile="${f#*>}"
curfile="${curfile##*/}"
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} ${wrksrc}/${curfile}
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} "${wrksrc}/${curfile}"
done
}

View File

@ -20,11 +20,11 @@ do_build() {
msg_error "Stackage version not set in \$stackage.\n"
fi
msg_normal "Using stackage resolver ${stackage}.\n"
STACK_ROOT=$wrksrc/.stack \
STACK_ROOT="$wrksrc/.stack" \
stack init ${_stack_args} --force --resolver ${stackage}
fi
STACK_ROOT=$wrksrc/.stack stack ${_stack_args} ${makejobs} build \
STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} ${makejobs} build \
${make_build_args}
}
@ -32,6 +32,6 @@ do_install() {
local _stack_args="--system-ghc --skip-ghc-check"
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
}

View File

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

View File

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

View File

@ -4,10 +4,10 @@ hook() {
local _cfgdir="${XBPS_COMMONDIR}/environment/configure/automake"
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}
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}
done
fi

View File

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

View File

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

View File

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

View File

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