diff --git a/common/environment/pkg/.empty b/common/environment/pkg/.empty deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/common/environment/pkg/extglob.sh b/common/environment/pkg/extglob.sh new file mode 100644 index 00000000000..be620cec704 --- /dev/null +++ b/common/environment/pkg/extglob.sh @@ -0,0 +1,17 @@ +# This provides the extglob function to expand wildcards in the destdir + +expand_destdir() { + local glob_list= result= glob= file= + + for glob; do + glob_list+=" $DESTDIR/$glob" + done + shopt -s extglob + for file in $glob_list; do + result+=" ${file#$DESTDIR/}" + done + shopt -u extglob + echo $result +} + + diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh index 3ace80fedcf..8ffa91d8e5a 100644 --- a/common/hooks/do-pkg/00-gen-pkg.sh +++ b/common/hooks/do-pkg/00-gen-pkg.sh @@ -1,17 +1,6 @@ # This hook generates a XBPS binary package from an installed package in destdir. -expand_dstdir() { - local glob_list= result= glob= file= - - for glob; do - glob_list+=" $DESTDIR/$glob" - done - shopt -s extglob - for file in $glob_list; do - result+=" ${file#$DESTDIR/}" - done - shopt -u extglob -} +source ${XBPS_COMMONDIR}/environment/pkg/extglob.sh genpkg() { local pkgdir="$1" arch="$2" desc="$3" pkgver="$4" binpkg="$5" @@ -63,7 +52,7 @@ genpkg() { local _replaces="$(echo $replaces)" local _reverts="$(echo $reverts)" local _mutable_files="$(echo $mutable_files)" - local _conf_files="$(expand_dstdir $conf_files)" + local _conf_files="$(expand_destdir $conf_files)" local _alternatives="$(echo $alternatives)" local _tags="$(echo $tags)" diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index d42877814b6..d584b78d7a1 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -1,5 +1,7 @@ # This hook checks for common issues related to void. +source ${XBPS_COMMONDIR}/environment/pkg/extglob.sh + hook() { local error=0 filename= rev= libname= conflictPkg= conflictFile= local conflictRev= ignore= found= mapshlibs=$XBPS_COMMONDIR/shlibs @@ -25,8 +27,8 @@ hook() { done # Check that configuration files really exist. - for f in ${conf_files}; do - if [ ! -f ${PKGDESTDIR}/${f} ]; then + for f in $(expand_destdir ${conf_files}); do + if [ ! -f "${PKGDESTDIR}/${f}" ]; then msg_red "${pkgver}: '$f' configuration file not in PKGDESTDIR!\n" error=1 fi