On Fri, Feb 27, 2009 at 5:24 PM, Aaron Griffin <[email protected]> wrote:
> On Fri, Feb 27, 2009 at 10:14 AM, Xavier <[email protected]> wrote:
>> find_pkgentry()
>> {
>>  local pkgname=$1
>>  local pkgentry
>>  for pkgentry in $gstmpdir/$pkgname*; do
>>    name=${pkgentry##*/}
>>    if [ "${name%-*-*}" = "$pkgname" ]; then
>>      echo $pkgentry
>>      return 0
>>    fi
>>  done
>>  return 1
>> }
>
> Is this doable without unpacking the DB? Perhaps using bsdtar -tf ?

Ah yeah, good idea :)

getfilename()
{
        if [ $# -ne 2 ]; then
                return 1
        fi
        repo=$1
        pkgname=$2
        bsdtar tf $repo "$pkgname*/desc" 2>/dev/null |
        while read entry; do
                name=${entry%%/*}
                if [ "${name%-*-*}" = "$pkgname" ]; then
                        bsdtar xOf $repo $entry | grep -A1 FILENAME | tail -n1
                        return 0
                fi
        done
        return 1
}
_______________________________________________
pacman-dev mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/pacman-dev

Reply via email to