[pacman-dev] bacman

Aaron Griffin aaronmgriffin at gmail.com
Thu May 29 20:43:46 EDT 2008


On Thu, May 29, 2008 at 7:25 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> On Thu, May 29, 2008 at 7:19 PM, Allan McRae <mcrae_allan at hotmail.com> wrote:
>> It seems I was beaten to send it...
>>
>>
>> Anyway, the only section I changed was this:
>>
>>> #
>>> # Setting environmental variables
>>> #
>>> eval $(sed -nre
>>> 's:[[:space:]]*(DBPath)[[:space:]]*=[[:space:]]*([[:print:]]*):\1="\2":p'
>>> /etc/pacman.conf)
>>> pac_db="${DBPath:-/var/lib/pacman/}/local"
>>> eval $(sed -nre
>>> 's:[[:space:]]*(CacheDir)[[:space:]]*=[[:space:]]*([[:print:]]*):\1="\2":p'
>>> /etc/pacman.conf)
>>> pac_cache="${CacheDir:-/var/cache/pacman/pkg/}"
>>> pkg_name="$1"
>>> pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)"
>>> eval $(sed -nre
>>> 's:[[:space:]]*(CARCH)[[:space:]]*=[[:space:]]*([[:print:]]*):\1=\2:p'
>>> /etc/makepkg.conf)
>>> pkg_arch=${CARCH:-'unknown'}
>>> eval $(sed -nre
>>> 's:[[:space:]]*(PKGDEST)[[:space:]]*=[[:space:]]*([[:print:]]*):\1=\2:p'
>>> /etc/makepkg.conf)
>>> pkg_dest="${PKGDEST:-$PWD}"
>>> eval $(sed -nre
>>> 's:[[:space:]]*(PACKAGER)[[:space:]]*=[[:space:]]*([[:print:]]*):\1=\2:p'
>>> /etc/makepkg.conf)
>>> pkg_pkger=${PACKAGER:-'Unknown Packager'}
>>> pkg_namver="${pkg_dir##*/}"
>>>
>>
>> The mailing list doesn't like the length of those sed statements....
> It is gmail, not the mailing list. git-send-email seems to handle long
> lines, for instance.
>
>> The eval statement appears to only work until the first comments so I
>> changed it so that each variable needs to be read in separately.
>>
>> Also, those sed statements are monstrous...  They do allow spaces in
>> path names though.  So the question is: Does pacman allow spaces in
>> DBPath or CacheDir?  If not we can simply those statements.  It should
>> not be needed for the reading of variables from makepkg.conf because
>> they are bash variables and should be nicely quoted anyway.
>
> We should just be able to source makepkg.conf, no need to sed it to
> death. Be sure we source ~/.makepkg.conf as well though if this script
> can be run as a user. Just look to makepkg to see the canonical way to
> do all this.
>
> Man I wish there was a better way to get the pacman.conf stuff in.
>
> I'll take a further look at everything else later, but I don't have
> the time tonight. Hopefully some others can offer some feedback and
> this can get plunked in contrib/.

FYI He's sed-ing pacman.conf, not makepkg.conf. I thought it was neat,
but crazy-complex




More information about the pacman-dev mailing list