You are not logged in.
Anyone know of a reliable way to get the path to a package's PKGBUILD file in the ABS using the package's name? At first, I tried something like this:
function get-abs-path {
for repo in core extra community multilib
do
if [ -r /var/abs/$repo/$1 ]; then
echo /var/abs/$repo/$1/PKGBUILD
fi
done
}The problem with this is that it does not handle split packages correctly. The PKGBUILDs for packages such as gcc-libs, compiz-core etc cannot be located this way because they reside in a different package's PKGBUILD.
The only thing that I have thought up so far would be to scan each and every package in the ABS and generate a database of the paths - that has its own issues though. (Its slow, and parsing the PKGBUILD files correctly for their names is not exactly easy).
Any ideas?
Edit: Marked as solved.
Last edited by jiggpig (2011-09-26 02:43:27)
Offline
Offline
Mmmm so this sort of piqued my interest. I tried this a while ago, but was bent on not sourcing the PKGBUILDs which made my life hell, didn't quite work, etc etc, threw it away...
#!/bin/bash
. /etc/makepkg.conf
{
echo "declare -A splitpkgdb"
for p in "/var/abs/*/*/PKGBUILD; do
(
pkgdir=${p%/PKGBUILD}
. "$pkgdir/PKGBUILD" 2>/dev/null
for split in "${pkgname[@]}"; do
printf "splitpkgdb[%s]=%s\n" "$split" "${pkgdir##*/}"
done
)
done | sort -u
} >dbThe outfile 'db' should be about 5400 lines and is ready for sourcing by a calling application. One design decision worth noting here is that you only get the provider that the split belongs to. You'll still need to do a repo lookup for the resolved package. This is to avoid clashes with packages existing in multiple repos (e.g. curl might exist in testing and core at the same time).
Last edited by falconindy (2011-09-26 04:01:40)
Offline
This is rather a package creating topic. Moving to Creating & Modifying Packages.
To know or not to know ...
... the questions remain forever.
Offline
That works perfectly; thank you, falconindy!
Offline