[pacman-dev] [PATCH] makepkg: list files containing $srcdir (FS#31558)
From: Phillip Smith <fukawi2@gmail.com> when checking for files in a built package that contain references to $srcdir or $pkgdir_base, show the files that match to assist in debugging. Signed-off-by: Phillip Smith <fukawi2@gmail.com> --- scripts/makepkg.sh.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 75ddfe5..1b3cc5a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1606,11 +1606,19 @@ tidy_install() { done # check for references to the build and package directory - if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then - warning "$(gettext "Package contains reference to %s")" "\$srcdir" + mapfile -t srcdir_refs <<< $(cd "${pkgdir}" && find -type f -exec grep -I -l "$srcdir" {} \;) + if [[ -n ${srcdir_refs[*]} ]] ; then + warning "$(gettext "The following files within the package reference %s")" "\$srcdir" + for fname in ${srcdir_refs[*]} ; do + printf " %s\n" "$fname" + done fi - if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${pkgdirbase}" ; then - warning "$(gettext "Package contains reference to %s")" "\$pkgdir" + mapfile -t pkgdir_refs <<< $(cd "${pkgdir}" && find -type f -exec grep -I -l "${pkgdirbase}" {} \;) + if [[ -n ${pkgdir_refs[*]} ]] ; then + warning "$(gettext "The following files within the package reference %s")" "\$pkgdir" + for fname in ${pkgdir_refs[*]} ; do + printf " %s\n" "$fname" + done fi if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then -- 1.8.2.3
On May 20, 2013 3:08 AM, "Phillip Smith" <lists@fukawi2.nl> wrote:
From: Phillip Smith <fukawi2@gmail.com>
when checking for files in a built package that contain references to $srcdir or $pkgdir_base, show the files that match to assist in debugging.
Signed-off-by: Phillip Smith <fukawi2@gmail.com> --- scripts/makepkg.sh.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 75ddfe5..1b3cc5a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1606,11 +1606,19 @@ tidy_install() { done
# check for references to the build and package directory - if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I
"${srcdir}" ; then
- warning "$(gettext "Package contains reference to %s")" "\$srcdir" + mapfile -t srcdir_refs <<< $(cd "${pkgdir}" && find -type f -exec grep -I -l "$srcdir" {} \;)
+ if [[ -n ${srcdir_refs[*]} ]] ; then + warning "$(gettext "The following files within the
+ for fname in ${srcdir_refs[*]} ; do + printf " %s\n" "$fname" + done fi - if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${pkgdirbase}" ; then - warning "$(gettext "Package contains reference to %s")" "\$pkgdir" + mapfile -t pkgdir_refs <<< $(cd "${pkgdir}" && find -type f -exec grep -I -l "${pkgdirbase}" {} \;) + if [[ -n ${pkgdir_refs[*]} ]] ; then + warning "$(gettext "The following files within the
Not what I had in mind (or gave you). This will "work", but the process substitution is preferable over the here string. package reference %s")" "\$srcdir" package reference %s")" "\$pkgdir"
+ for fname in ${pkgdir_refs[*]} ; do + printf " %s\n" "$fname" + done fi
if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then -- 1.8.2.3
On 20/05/13 20:58, Dave Reisner wrote:
On May 20, 2013 3:08 AM, "Phillip Smith" <lists@fukawi2.nl> wrote:
From: Phillip Smith <fukawi2@gmail.com>
when checking for files in a built package that contain references to $srcdir or $pkgdir_base, show the files that match to assist in debugging.
Signed-off-by: Phillip Smith <fukawi2@gmail.com> --- scripts/makepkg.sh.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 75ddfe5..1b3cc5a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1606,11 +1606,19 @@ tidy_install() { done
# check for references to the build and package directory - if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I
"${srcdir}" ; then
- warning "$(gettext "Package contains reference to %s")" "\$srcdir" + mapfile -t srcdir_refs <<< $(cd "${pkgdir}" && find -type f -exec grep -I -l "$srcdir" {} \;)
Not what I had in mind (or gave you). This will "work", but the process substitution is preferable over the here string.
+ if [[ -n ${srcdir_refs[*]} ]] ; then + warning "$(gettext "The following files within the package reference %s")" "\$srcdir" + for fname in ${srcdir_refs[*]} ; do + printf " %s\n" "$fname" + done
Also not you do not need the whole for loop here. Just printf " %s\n" "${srcdir_refs[@]}"
fi - if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I
- warning "$(gettext "Package contains reference to %s")" "\$pkgdir" + mapfile -t pkgdir_refs <<< $(cd "${pkgdir}" && find -type f -exec grep -I -l "${pkgdirbase}" {} \;) + if [[ -n ${pkgdir_refs[*]} ]] ; then + warning "$(gettext "The following files within the
"${pkgdirbase}" ; then package reference %s")" "\$pkgdir"
+ for fname in ${pkgdir_refs[*]} ; do + printf " %s\n" "$fname" + done fi
if check_option "zipman" "y" && [[ -n ${MAN_DIRS[*]} ]]; then -- 1.8.2.3
On 20 May 2013 20:58, Dave Reisner <d@falconindy.com> wrote:
Not what I had in mind (or gave you). This will "work", but the process substitution is preferable over the here string.
Sorry; what I saw in yours was '<<' which obviously didn't work so I assumed you meant '<<<' On 20 May 2013 21:07, Allan McRae <allan@archlinux.org> wrote:
Also not you do not need the whole for loop here. Just
printf " %s\n" "${srcdir_refs[@]}"
That did not work in my testing; line breaks were not preserved.
On 21/05/13 09:09, Phillip Smith wrote:
On 20 May 2013 20:58, Dave Reisner <d@falconindy.com> wrote:
Not what I had in mind (or gave you). This will "work", but the process substitution is preferable over the here string.
Sorry; what I saw in yours was '<<' which obviously didn't work so I assumed you meant '<<<'
On 20 May 2013 21:07, Allan McRae <allan@archlinux.org> wrote:
Also not you do not need the whole for loop here. Just
printf " %s\n" "${srcdir_refs[@]}"
That did not work in my testing; line breaks were not preserved.
allan@arya ~
mapfile -t srcdir_refs < <(cd "tmp" && find -type f -exec grep -Il "10" {} +)
allan@arya ~
echo ${srcdir_refs[@]} ./out/out-7.txt ./out/out-3.txt ./out/out-2.txt ./out/out-9.txt ./out/out-8.txt ./out/out-5.txt ./out/out-4.txt ./out/out-1.txt ./out/out-6.txt
allan@arya ~
printf " %s\n" ${srcdir_refs[@]} ./out/out-7.txt ./out/out-3.txt ./out/out-2.txt ./out/out-9.txt ./out/out-8.txt ./out/out-5.txt ./out/out-4.txt ./out/out-1.txt ./out/out-6.txt
On 21 May 2013 09:21, Allan McRae <allan@archlinux.org> wrote:
allan@arya ~
mapfile -t srcdir_refs < <(cd "tmp" && find -type f -exec grep -Il "10" {} +)
allan@arya ~
echo ${srcdir_refs[@]} ./out/out-7.txt ./out/out-3.txt ./out/out-2.txt ./out/out-9.txt ./out/out-8.txt ./out/out-5.txt ./out/out-4.txt ./out/out-1.txt ./out/out-6.txt
allan@arya ~
printf " %s\n" ${srcdir_refs[@]} ./out/out-7.txt ./out/out-3.txt ./out/out-2.txt ./out/out-9.txt ./out/out-8.txt ./out/out-5.txt ./out/out-4.txt ./out/out-1.txt ./out/out-6.txt
Buggered if I know; did not work when I tested it.
participants (3)
-
Allan McRae
-
Dave Reisner
-
Phillip Smith