[pacman-dev] delta support in libalpm

Xavier shiningxc at gmail.com
Fri Feb 27 11:51:41 EST 2009


On Fri, Feb 27, 2009 at 5:24 PM, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
> On Fri, Feb 27, 2009 at 10:14 AM, Xavier <shiningxc at gmail.com> 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
}


More information about the pacman-dev mailing list