oshazard / apacman

ArchLinux User Repository (AUR) helper and pacman wrapper
https://aur.archlinux.org/packages/apacman/
GNU General Public License v3.0
70 stars 11 forks source link

apacman tries to install -debug package instead of the main package #100

Closed hagabaka closed 6 years ago

hagabaka commented 6 years ago

With both strip and debug turned on in OPTIONS in makepkg.conf, makepkg will create a package named $pkgname-debug which contains the detached debug symbols. This debug package has the main package as a dependency. When I use apacman to install a package from AUR, it builds and then tries to install the -debug package instead the main package, and fails because of unmet dependency.

==> Leaving fakeroot environment.
==> Finished making: mypkg 1.13.8-1 (Wed Sep 20 21:16:05 EDT 2017)
  -> Status
        built  (1): mypkg

  -> Saving package: mypkg-debug-1.13.8-1-x86_64.pkg.tar
[sudo] password for hagabaka: 
  -> Installing mypkg
loading packages...
resolving dependencies...
warning: cannot resolve "mypkg=1.13.8-1", a dependency of "mypkg-debug"
:: The following package cannot be upgraded due to unresolvable dependencies:
      mypkg-debug

:: Do you want to skip the above package for this upgrade? [y/N] y
looking for conflicting packages...
 there is nothing to do

Interestingly the name after "built (1)" is correct, but the one after "saving package" is the debug. Looking at the code,

  pkgtar=$(ls $1-${epoch}${pkgver}*${PKGEXT} 2>/dev/null | tail -n 1)
  if [[ $pkgtar ]]; then
    [ -d $savedir ] || mkdir -p $savedir 2>/dev/null || runasroot mkdir -p $savedir
    echo -e "${COLOR5}  -> ${COLOR1}Saving package:${ENDCOLOR} ${pkgtar}"
    cp ${pkgtar} $savedir/ 2>/dev/null || runasroot cp ${pkgtar} $savedir/
    echo -e "${COLOR5}  -> ${COLOR1}Installing ${1}${ENDCOLOR}"

It seems that the glob is matching the debug package name, and that could only happen if epoch and pkgver are empty.

hagabaka commented 6 years ago

Ah, I'm using the released v3.1 which doesn't include epoch or pkgver in the globbing pattern. So this was already fixed in c5cd108cbc906daa39c0a075ed5e5332df3742c5.