diff --git a/common/environment/install/extglob.sh b/common/environment/install/extglob.sh new file mode 100644 index 0000000000..c0bf59d74a --- /dev/null +++ b/common/environment/install/extglob.sh @@ -0,0 +1,18 @@ +# This provides the extglob function to expand wildcards in the destdir + +expand_destdir() { + local result= glob= file= + + ( + set -f + for glob in $@; do + files=$(echo "${PKGDESTDIR}/${glob}") + set +f + for file in $files; do + result+="${blank}${file#$PKGDESTDIR/}" + blank=" " + done + done + echo "$result" + ) +} diff --git a/common/environment/pkg/.empty b/common/environment/pkg/.empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/environment/pkg/extglob.sh b/common/environment/pkg/extglob.sh new file mode 120000 index 0000000000..727ffaf564 --- /dev/null +++ b/common/environment/pkg/extglob.sh @@ -0,0 +1 @@ +../install/extglob.sh \ No newline at end of file diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh index 099f889e5d..75d47d3649 100644 --- a/common/hooks/do-pkg/00-gen-pkg.sh +++ b/common/hooks/do-pkg/00-gen-pkg.sh @@ -30,9 +30,7 @@ genpkg() { fi cd $pkgdir - if [ -n "$preserve" ]; then - _preserve="-p" - fi + _preserve=${preserve:+-p} if [ -s ${PKGDESTDIR}/rdeps ]; then _deps="$(cat ${PKGDESTDIR}/rdeps)" fi @@ -46,48 +44,15 @@ genpkg() { _gitrevs="$(cat ${XBPS_STATEDIR}/gitrev)" fi - if [ -n "$provides" ]; then - local _provides= - for f in ${provides}; do - _provides="${_provides} ${f}" - done - fi - if [ -n "$conflicts" ]; then - local _conflicts= - for f in ${conflicts}; do - _conflicts="${_conflicts} ${f}" - done - fi - if [ -n "$replaces" ]; then - local _replaces= - for f in ${replaces}; do - _replaces="${_replaces} ${f}" - done - fi - if [ -n "$reverts" ]; then - local _reverts= - for f in ${reverts}; do - _reverts="${_reverts} ${f}" - done - fi - if [ -n "$mutable_files" ]; then - local _mutable_files= - for f in ${mutable_files}; do - _mutable_files="${_mutable_files} ${f}" - done - fi - if [ -n "$conf_files" ]; then - local _conf_files= - for f in ${conf_files}; do - _conf_files="${_conf_files} ${f}" - done - fi - if [ -n "$alternatives" ]; then - local _alternatives= - for f in ${alternatives}; do - _alternatives="${_alternatives} ${f}" - done - fi + # Stripping whitespaces + local _provides="$(echo $provides)" + local _conflicts="$(echo $conflicts)" + local _replaces="$(echo $replaces)" + local _reverts="$(echo $reverts)" + local _mutable_files="$(echo $mutable_files)" + local _conf_files="$(expand_destdir "$conf_files")" + local _alternatives="$(echo $alternatives)" + local _tags="$(echo $tags)" msg_normal "Creating $binpkg for repository $pkgdir ...\n" diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index d42877814b..441da4a59f 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -25,8 +25,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