Closed helixarch closed 9 years ago
I thought there was a bug in the providedinpacman function, so I spent awhile working up a way to scrape the repository DBs directly ...
# Alternative to providedinpacman function
existsinpacmandb() {
unset virtual virtnum
pacmandb='/var/lib/pacman/sync'
for repo in $(ls $pacmandb/*.db 2>/dev/null); do
dbresults=$(tar -xOf $repo | sed ':a;N;$!ba;s/%NAME%\n/%NAME% :: /g')
dbresults=$(echo "$dbresults" | sed ':a;N;$!ba;s/%PROVIDES%\n/%PROVIDES% :: /g')
dbresults=$(echo "$dbresults" | grep -E "(%NAME%|%PROVIDES%)")
dbresults=$(echo "$dbresults" | awk -v pkg=$1 '$0 == "%PROVIDES% :: " pkg {print x}; {x=$0}')
dbresults=$(echo "$dbresults" | awk '{print $NF}')
for pkg in $dbresults; do
virtual+=($pkg)
done
done;
[[ $virtual ]] && selectprovider $1 "${virtual[@]}"
}
Anyway, turns out it was something else which was an easy fix. However, I noticed that pacman
does not prompt to pick when there are multiple options to provide a virtual package, so I spent time working on that.
I'm currently doing regression testing but looks like I have it working now (and perhaps better than with pacman
alone) for v2.3 which will be up soon!
# pacman -S ttf-font
resolving dependencies...
looking for conflicting packages...
Package (1) Old Version New Version Net Change Download Size
extra/ttf-bitstream-vera 1.10-10 1.10-10 0.00 MiB 0.21 MiB
Total Download Size: 0.21 MiB
Total Installed Size: 0.58 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n]
vs
# apacman -S ttf-font
:: There are 8 packages that provide ttf-font:
1) ttf-bitstream-vera
2) ttf-dejavu
3) ttf-freefont
4) ttf-linux-libertine
5) ttf-oxygen
6) ttf-droid
7) ttf-liberation
8) ttf-ubuntu-font-family
Enter a selection (default=1): 6
Pacman Targets (1): ttf-droid
resolving dependencies...
looking for conflicting packages...
Package (1) Old Version New Version Net Change Download Size
community/ttf-droid 20121017-4 20121017-4 0.00 MiB 3.53 MiB
Total Download Size: 3.53 MiB
Total Installed Size: 15.31 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n]
(P.S. It does not prompt the user for firebug
--> firefox-firebug
because there is only one package provider in the official repos)
Fixed in v2.3 (@1fcbecdc5af210465a9f7bd88f95b6ab2b2e0052)
apacman fails to install directly a virtual package. For example, for virtual package "firebug" apacman gives error:
apacman -S firebug Package `firebug' does not exist.
while pacman understands which package provides this virtual package and installs that package without errors:
pacman -S firebug resolving dependencies... looking for conflicting packages...
Packages (1) firefox-firebug-2.0.8-1
Total Download Size: 1.22 MiB Total Installed Size: 9.27 MiB
:: Proceed with installation? [Y/n]