[pacman-dev] makepkg enhancements: globstar and variable expansions in PURGE_TARGETS, MAN_DIRS, etc.

Ciprian Dorin, Craciun ciprian.craciun at gmail.com
Sat Nov 14 07:27:42 EST 2009


On Sat, Nov 14, 2009 at 2:15 PM, Allan McRae <allan at archlinux.org> wrote:
> Ciprian Dorin, Craciun wrote:
>>
>> On Sat, Nov 14, 2009 at 12:40 PM, Allan McRae <allan at archlinux.org> wrote:
>>>
>>> Ciprian Dorin, Craciun wrote:
>>>
>>>>   One quick note. I've tried what you've suggested (`package/*/...`)
>>>> and it doesn't work (as expected `*` expands before anything is in the
>>>> current dir).
>>>>
>>> It does not expand it until it actually uses the value in the array. i.e.
>>> when it goes to do the man page compression/purging.
>>>
>>> This is my test PKGBUILD
>>>
>>> --start PKGBUILD--
>>>
>>> pkgname=('t1')
>>> pkgdesc="text with spaces"
>>> pkgver=1
>>> pkgrel=1
>>> arch=('i686' 'x86_64')
>>> license=('testing the license')
>>> depends=('pacman')
>>>
>>> build () {
>>>  return 0
>>> }
>>>
>>> package() {
>>>  mkdir -p ${pkgdir}/package/foobar-2.1/usr/share/man/man1
>>>  echo "I am a man page" >
>>> ${pkgdir}/package/foobar-2.1/usr/share/man/man1/test.1
>>> }
>>>
>>> --end PKGBUILD--
>>>
>>> I get that "man page" compressed with
>>>
>>> MAN_DIRS=({package/*,}{usr{,/local}{,/share},opt/*}/{man,info})
>>
>>
>>    Sorry, didn't work for me. I've updated the /etc/makepkg.conf, to
>> also include your
>> `{package/*,}{usr{,/local}{,/share},opt/*}/{man,info}`, and also
>> checked that I have zipman in OPTIONS.
>>
>>    I've also updated /usr/bin/makepkg to start with bash -x (display
>> all commands), and this is what I have:
>>
>> ~~~~
>>  -> Compressing man and info pages...
>> ++> local manpage ext file link hardlinks hl
>> ++> read manpage
>> ++> find usr/man usr/info usr/share/man usr/share/info usr/local/man
>> usr/local/info usr/local/share/man usr/local/share/info 'opt/*/man'
>> 'opt/*/info' 'package/*usr/man' 'package/*usr/info'
>> 'package/*usr/share/man' 'package/*usr/share/info'
>> 'package/*usr/local/man' 'package/*usr/local/info'
>> 'package/*usr/local/share/man' 'package/*usr/local/share/info'
>> 'package/*opt/*/man' 'package/*opt/*/info' usr/man usr/info
>> usr/share/man usr/share/info usr/local/man usr/local/info
>> usr/local/share/man usr/local/share/info 'opt/*/man' 'opt/*/info'
>> -type f
>> ~~~~
>>
>>    You can clearly see that find receives as arguments paths that
>> contain a *, and that these paths are quoted.
>>
>>    Ciprian.
>>
>>    P.S.: The makepkg is the one from the ArchLinux distribution, and
>> not the one I've patched.
>>
>
> From the output it should have been fairly obvious I screwed up the MAN_DIRS
> line...
>
> MAN_DIRS=({package/*/,}{usr{,/local}{,/share},opt/*}/{man,info})
>
> Not the extra "/"
>
> Allan

    Sorry, indeed it works, but, the find invocation is still odd:

~~~~
++> printf '  -> Compressing man and info pages...\n'
  -> Compressing man and info pages...
++> local manpage ext file link hardlinks hl
++> read manpage
++> find usr/man usr/info usr/share/man usr/share/info usr/local/man
usr/local/info usr/local/share/man usr/local/share/info 'opt/*/man'
'opt/*/info' 'package/*/usr/man' 'package/*/usr/info'
package/foobar-2.1/usr/share/man 'package/*/usr/share/info'
'package/*/usr/local/man' 'package/*/usr/local/info'
'package/*/usr/local/share/man' 'package/*/usr/local/share/info'
'package/*/opt/*/man' 'package/*/opt/*/info' usr/man usr/info
usr/share/man usr/share/info usr/local/man usr/local/info
usr/local/share/man usr/local/share/info 'opt/*/man' 'opt/*/info'
-type f
++> '[' -f package/foobar-2.1/usr/share/man/man1/test.1 ']'
++> ext=1
++> file=test.1
++> '[' 1 '!=' gz -a 1 '!=' bz2 ']'
...
~~~~

    Ciprian.


More information about the pacman-dev mailing list