FS#63000 - [makepkg] does not correctly remove installed packages if installing makedepends fails.

Attached to Project: Pacman
Opened by Erich Eckner (deepthought) - Tuesday, 25 June 2019, 11:20 GMT
Last edited by Allan McRae (Allan) - Friday, 11 October 2019, 01:33 GMT
Task Type Bug Report
Category makepkg
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 5.1.3
Due in Version 5.2.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:

consider this PKGBUILD:

---- start

pkgname='test'
pkgver=0
pkgrel=0
arch=(any)
pkgdesc='just a PKGBUILD demo'
url='archlinux.org'
license=(custom)

depends=(perl-xml-xpath)
makedepends=(boggggussss)

package() {
touch $pkgdir/test
}

---- end

which has a normal entry in depends=() and an unresolvable entry in makedepends=().
running `makepkg -fcrs` installs the depends=(), then tries to install the makedepends=() and fails.
But it also fails to uninstall perl-xml-xpath which got installed as depends=().

The reason is, that makepkg does not update the "current_pkglist" variable between installing depends=() and makedepends=() (and checkdepends=()).

The following patch solves the issue:

---- start

--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1366,6 +1366,10 @@ else
msg "$(gettext "Checking runtime dependencies...")"
resolve_deps ${depends[@]} || deperr=1

+ if (( RMDEPS )); then
+ current_pkglist=($(run_pacman -Qq)) # required by remove_deps
+ fi
+
if (( RMDEPS && INSTALL )); then
original_pkglist=($(run_pacman -Qq)) # required by remove_dep
fi

---- end

I experience this with makepkg for quite some time now (I'm unsure if it was better at any time), most recently with pacman-5.1.3-1.

regards,
deep42thought

P.S.: How is one supposed to compile/test with the git HEAD of pacman? Running `sudo make install` inside the git repo (after building with make) killed my pacman ... (I was used to install modified devtools versions into /usr/local with this command)
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 11 October 2019, 01:33 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit d91710943
Comment by Allan McRae (Allan) - Tuesday, 25 June 2019, 11:26 GMT
> P.S.: How is one supposed to compile/test with the git HEAD of pacman?

Everything can be run in tree.
Comment by Erich Eckner (deepthought) - Tuesday, 25 June 2019, 11:29 GMT
> Everything can be run in tree.

ok, thx.
I just tested my patch on the current master and it seems to do the right thing (in my case).
Comment by Allan McRae (Allan) - Tuesday, 25 June 2019, 11:58 GMT
Better fix. The real issue was makepkg calling exit in multiple places and too soon.

Loading...