[pacman-dev] [PATCH] makepkg: improve srcdir check and add pkgdir

Dan McGee dpmcgee at gmail.com
Wed Sep 29 09:27:40 EDT 2010


On Wed, Sep 29, 2010 at 7:51 AM, Allan McRae <allan at archlinux.org> wrote:
> On 29/09/10 22:41, Nathan Wayde wrote:
>>
>> On 29/09/10 13:35, Allan McRae wrote:
>>>
>>> On 29/09/10 22:06, Marc - A. Dahlhaus wrote:
>>>>
>>>> Am Mittwoch, den 29.09.2010, 21:59 +1000 schrieb Allan McRae:
>>>>>
>>>>> The checking of the package for $srcdir references was overly
>>>>> sensitive and gave a lot of what appear to be false positives with
>>>>> binary files (in particular with debugging symbols kept).
>>>>>
>>>>> Restrict the search for $srcdir to non-binary files as this should
>>>>> still catch the majority of configuration issues the check was
>>>>> initially designed to catch. Also, add a similar check for $pkgdir.
>>>>>
>>>>> Signed-off-by: Allan McRae<allan at archlinux.org>
>>>>> ---
>>>>> scripts/makepkg.sh.in | 9 +++++++--
>>>>> 1 files changed, 7 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>>> index ed1380d..01d73f8 100644
>>>>> --- a/scripts/makepkg.sh.in
>>>>> +++ b/scripts/makepkg.sh.in
>>>>> @@ -972,10 +972,15 @@ check_package() {
>>>>> fi
>>>>> done
>>>>>
>>>>> - # check for references to the build directory
>>>>> - if find "${pkgdir}" -type f -exec grep -q "${srcdir}" {} +; then
>>>>> + # check for references to the build and package directory
>>>>> + local filelist=$(find "${pkgdir}" -type f)
>>>>> + if grep -q -I "${srcdir}" $filelist; then
>>>>> warning "$(gettext "Package contains reference to %s")" "\$srcdir"
>>>>> fi
>>>>> + if grep -q -I $filelist; then
>>>>> + warning "$(gettext "Package contains reference to %s")" "\$pkgdir"
>>>>> + fi
>>>>> +
>>>>> }
>>>>>
>>>>> create_package() {
>>>>
>>>> This change could exeed the maximum number of allowed params for large
>>>> packages. It would be better to continue to use the exec param for find
>>>> IMO.
>>>
>>> That is a good point. I did not want to run the find twice but I guess
>>> that will be mostly cached anyway so it will make little difference. I
>>> will make this change on my working branch.
>>>
>>> Allan
>>>
>>>
>>
>> just pipe it through xargs, something like `find "${pkgdir}" -type f
>> -print0 | xargs -0 grep -m 1 -q "${pkgdir}"`
>
> Doesn't that suffer from the same issue with potentially exceeding the
> maximum number of parameters?

No, the entire purpose of xargs is to split up the input so no command
line maximums are exceeded.

-Dan


More information about the pacman-dev mailing list