rmarquis / pacaur

[unmaintained] An AUR helper that minimizes user interaction
https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144
ISC License
796 stars 113 forks source link

conflicts again: issue with multiple conflicting packages #401

Closed 5chdn closed 8 years ago

5chdn commented 8 years ago

hi, i have mist-git and geth-git installed.

now i tried to install mist and geth where each of the packages conflicts with one of the above. pacaur does not know how to handle this in this special situation.

 $ pacaur -S mist
:: Package(s) mist not found in repositories, trying AUR...
:: resolving dependencies...
:: looking for inter-conflicts...
:: geth and geth-git are in conflict (geth-git). Remove geth-git? [y/N] y
:: mist and mist-git are in conflict (libnode). Remove mist-git? [y/N] y

AUR Packages  (2):

Name      Old Version          New Version        

aur/geth                       1.3.3-1                           
aur/mist  0.3.7.r0.g3e8b9dc-2  0.3.8-2                           

:: Proceed with installation? [Y/n] y
:: Retrieving package(s)...
Already up-to-date.
Already up-to-date.
:: View mist PKGBUILD? [Y/n] n
:: View geth PKGBUILD? [Y/n] n
:: Checking geth integrity...
==> Making package: geth 1.3.3-1 (Wed Jan 20 13:48:09 CET 2016)
==> Retrieving sources...
  -> Found geth-1.3.3.tar.bz2
==> Validating source files with sha256sums...
    geth-1.3.3.tar.bz2 ... Passed
:: Checking mist integrity...
==> Making package: mist 0.3.8-2 (Wed Jan 20 13:48:09 CET 2016)
==> Retrieving sources...
  -> Found mist-0-3-8.zip
==> Validating source files with sha256sums...
    mist-0-3-8.zip ... Passed
:: Building geth package(s)...
==> Making package: geth 1.3.3-1 (Wed Jan 20 13:48:10 CET 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found geth-1.3.3.tar.bz2
==> Validating source files with sha256sums...
    geth-1.3.3.tar.bz2 ... Passed
==> Extracting sources...
  -> Extracting geth-1.3.3.tar.bz2 with bsdtar
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Purging unwanted files...
  -> Removing libtool files...
  -> Removing static library files...
  -> Compressing man and info pages...
  -> Stripping unneeded symbols from binaries and libraries...
==> Creating package "geth"...
  -> Generating .PKGINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: geth 1.3.3-1 (Wed Jan 20 13:48:19 CET 2016)
==> Cleaning up...
:: Installing geth package(s)...
loading packages...
resolving dependencies...
looking for conflicting packages...
:: geth and geth-git are in conflict. Remove geth-git? [y/N] 
error: failed to prepare transaction (could not satisfy dependencies)
:: mist-git: requires geth-git
:: Building mist package(s)...
==> Making package: mist 0.3.8-2 (Wed Jan 20 13:48:19 CET 2016)
==> Checking runtime dependencies...
==> Installing missing dependencies...
error: target not found: geth
==> ERROR: 'pacman' failed to install missing dependencies.
:: Installing mist package(s)...
:: failed to build mist package(s)

It first asked me to remove geth-git and I said y but later it fails because mist-git requires it. But I also said y to remove mist-git. Weird situation, i know :p

rmarquis commented 8 years ago

Not sure if that is a pacaur issue: geth-git provides geth, but does not conflict with it. As a result, makepkg cannot handle this conflict properly. Please poke the maintainer about it.

troyengel commented 8 years ago

I'm having the same problem, and I'm the maintainer of both sets of packages:

The global config is untouched, I have minimal config in my per-user:

$ pacman -Q pacaur
pacaur 4.4.4-1

$ egrep -v "^(#|$)" /etc/xdg/pacaur/config

$ egrep -v "^(#|$)" ~/.config/pacaur/config 
editor="${EDITOR:-vim}"               # PKGBUILD editor
displaybuildfiles=none                # display build files (none|diff|full)

If I do this:

pacaur -S bcc bcc-tools python-bcc python2-bcc
...then:
pacaur -S bcc-git bcc-tools-git python-bcc-git python2-bcc-git

It fails the same way as the original comment above, but if I then simply do this:

$ cd /tmp/pacaurtmp-tengel/bcc-git/
$ pacaur -U *.xz

...it works fine and upgrades the non-git to the from-git versions. It also fails in the reverse direction (from-git installed, non-git being installed) and the same manual -U works without problem. Below is expanded output; one thing I noticed is pressing 'y' during the -S run required no ENTER, but doing the -U run requires "yENTER" if this helps in any way.

$ pacaur -S bcc-git bcc-tools-git python-bcc-git python2-bcc-git
:: Package(s) bcc-git bcc-tools-git python-bcc-git python2-bcc-git not found in repositories, trying AUR...
:: resolving dependencies...
:: looking for inter-conflicts...
:: bcc-git and bcc are in conflict (bcc). Remove bcc? [y/N] y
:: bcc-tools-git and bcc-tools are in conflict (bcc-tools). Remove bcc-tools? [y/N] y
:: python-bcc-git and python-bcc are in conflict (python-bcc). Remove python-bcc? [y/N] y
:: python2-bcc-git and python2-bcc are in conflict (python2-bcc). Remove python2-bcc? [y/N] y

AUR Packages  (4): bcc-git-latest  bcc-tools-git-latest  python-bcc-git-latest  python2-bcc-git-latest  

:: Proceed with installation? [Y/n] 

:: Retrieving package(s)...

[... build stuff ...]

==> Leaving fakeroot environment.
==> Finished making: bcc-git v0.1.7.r88.f50ca1f-2 (Sun Jan 24 13:55:36 CST 2016)
==> Cleaning up...
:: Installing bcc-tools-git,python-bcc-git,python2-bcc-git,bcc-git package(s)...
loading packages...
resolving dependencies...
looking for conflicting packages...
:: bcc-git and bcc are in conflict. Remove bcc? [y/N] 
error: failed to prepare transaction (could not satisfy dependencies)
:: bcc-tools: requires bcc
:: python-bcc: requires bcc
:: python2-bcc: requires bcc
loading packages...
resolving dependencies...
warning: cannot resolve "bcc-git", a dependency of "bcc-tools-git"
warning: cannot resolve "bcc-git", a dependency of "python-bcc-git"
warning: cannot resolve "bcc-git", a dependency of "python2-bcc-git"
:: The following packages cannot be upgraded due to unresolvable dependencies:
      bcc-tools-git  python-bcc-git  python2-bcc-git

:: Do you want to skip the above packages for this upgrade? [y/N] 
error: failed to prepare transaction (could not satisfy dependencies)
:: bcc-tools-git: requires bcc-git
:: python-bcc-git: requires bcc-git
:: python2-bcc-git: requires bcc-git

=========================

$ cd /tmp/pacaurtmp-tengel/bcc-git/
$ pacaur -U *.xz
loading packages...
resolving dependencies...
looking for conflicting packages...
:: bcc-git and bcc are in conflict. Remove bcc? [y/N] y
:: bcc-tools-git and bcc-tools are in conflict. Remove bcc-tools? [y/N] y
:: python-bcc-git and python-bcc are in conflict. Remove python-bcc? [y/N] y
:: python2-bcc-git and python2-bcc are in conflict. Remove python2-bcc? [y/N] y

Packages (8) bcc-0.1.7-4 [removal]  bcc-tools-0.1.7-4 [removal]
             python-bcc-0.1.7-4 [removal]  python2-bcc-0.1.7-4 [removal]
             bcc-git-v0.1.7.r88.f50ca1f-2  bcc-tools-git-v0.1.7.r88.f50ca1f-2
             python-bcc-git-v0.1.7.r88.f50ca1f-2
             python2-bcc-git-v0.1.7.r88.f50ca1f-2

Total Installed Size:  33.89 MiB
Net Upgrade Size:       0.15 MiB

:: Proceed with installation? [Y/n] 
(4/4) checking keys in keyring                     [######################] 100%
(4/4) checking package integrity                   [######################] 100%
(4/4) loading package files                        [######################] 100%
(4/4) checking for file conflicts                  [######################] 100%
(8/8) checking available disk space                [######################] 100%
(1/4) removing python2-bcc                         [######################] 100%
(2/4) removing python-bcc                          [######################] 100%
(3/4) removing bcc-tools                           [######################] 100%
(4/4) removing bcc                                 [######################] 100%
(1/4) installing bcc-git                           [######################] 100%
Optional dependencies for bcc-git
    bcc-tools-git: Python utilites using the BCC library [pending]
    python-bcc-git: Python 3 bindings for BCC [pending]
    python2-bcc-git: Python 2 bindings for BCC [pending]
(2/4) installing bcc-tools-git                     [######################] 100%
Optional dependencies for bcc-tools-git
    python-bcc-git: Python 3 bindings for BCC [pending]
    python2-bcc-git: Python 2 bindings for BCC [pending]
(3/4) installing python-bcc-git                    [######################] 100%
(4/4) installing python2-bcc-git                   [######################] 100%

It's the exact same output (in the failures) when going in the reverse direction; it's as if the 'Y' chosen for the replacements is getting lost between the time pacaur starts and the time it goes to do the actual install, it's a 'N' (default).

edit: fix ENTER indication above, github.com eats angle brackets as embedded HTML :-/

troyengel commented 8 years ago

Quick update: pacaur 4.3.2 works perfectly, 4.4.0+ do not so we have a delta window; unfortunately there were a ton of commits to bisect.

troyengel commented 8 years ago

Commit 12707cc7f9fb733082dcb33e22e4994c11eabb5f is what breaks it. With this commit, the output is "smaller":

==> Finished making: bcc 0.1.7-4 (Sun Jan 24 15:39:39 CST 2016)
==> Installing bcc package group with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...
:: bcc-tools and bcc-tools-git are in conflict. Remove bcc-tools-git? [y/N] 
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: bcc-tools and bcc-tools-git are in conflict
==> WARNING: Failed to install built package(s).
:: bcc cleaned

The next commit 6b2c1ed9726538434cfae0865c637579be430765 is what cause the rest of the split packages to start showing up as broken as well.

If I understand commit 12707cc7f9fb733082dcb33e22e4994c11eabb5f correctly, what's been done is replacing "Yes" to pacman with "--noconfirm" which is not the same; if the default for pacman is N (as shown in our output here) then it just assumes N to the replacement of the package, when Y was the intended result and why it worked before the commit.

rmarquis commented 8 years ago

These PKGBUILDs are completely fancy... Please have a look at pacaur and pacaur-git to see how to manage a package and its -git version (check provides and conflicts arrays).

As for the yes and noconfirm issue, you missed the additional ask parameter here.

5chdn commented 8 years ago

I agree the PKGBUILDs are a mess, but in my case I don't have access to all mentioned packages. I already poked the maintainers about changes but they didnt respond yet. Shouldnt pacaur be able to handle this?

rmarquis commented 8 years ago

No. If the PKGBUILD is faulty, then it should be corrected.

rmarquis commented 8 years ago

No answer, closing. Please comment if the issue actually happens with correctly written PKGBUILDs.

troyengel commented 8 years ago

You mistake my apathy in dealing with this as agreement - my PKGBUILD is fine, your code is broken here:

https://github.com/rmarquis/pacaur/blob/master/pacaur#L927

[[ -n "${builtdepspkgs[@]}" ]] && sudo $pacmanbin -U ${builtdepspkgs[@]} --ask 36 --asdeps ${pacopts[@]} --noconfirm
[[ -n "${builtpkgs[@]}" ]] && sudo $pacmanbin -U ${builtpkgs[@]} --ask 36 ${pacopts[@]} --noconfirm

Just combine those two line into one pacman commandline and it works perfectly to swap out all the pieces as intended. Because that's what pacman expects you to be doing in this situation.

In my example, ${builtdepspkgs[@]} == "bcc" (or bcc-git) and ${builtpkgs[@]} == "bcc-tools python-bcc python2-bcc" (or the -git variants). Your code is trying to tell pacman to manually install a single piece of a split package on it's own that is intrinsically tied to it's children (these are API interfaces and bindings to the API), when all 4 have to be passed to pacman as one operation (transaction) so that it's internal depsolver will sort it out. This is no different than if you used rpm or dpkg the same way to try and install "mysql-server" RPM/DEB directly and it had conflicting split packages with "mysql-devel" or whatever; all members of a split package family that are dependency intertwined have to passed to the package manager together at the same time. (or if you force it with "--nodeps" or similar as a hack)

In this instance, --asdeps is also incorrect; that flag is meant to solve a circular dependency where the package being installed has a depends() that isn't built, so you have to add that depends() package to the DB as a dependency of nothing (after it's built) until you get the main package built, then you go back and reconnect them once they're both in the DB. That's not at all what's happening with my transaction, it's a simple split package that all has to be upgraded/swapped at one time - you cannot do it piecemeal and --asdeps has no real world effect in making it work as it should. It must be a single transaction with all packages at once for the deps to resolve.

--ask is completely undocumented anywhere in the pacman github tree except inside the source code in two minor places (and it's not actually documented other than in the header file where the bitmasks are defined); I read the source to find it, so I will say thank you for exposing me to an undocumented feature.

Fix it, don't fix it, I just don't care anymore.

rmarquis commented 8 years ago

All right, let's do it again:

Now, let's have a look at your PKGBUILDs:

bcc PKGBUILD:

bcc-git PKGBUILD:

Please fix your PKGBUILDs, after what I can look into that issue without asking myself if side effects are also involved in the process. I am genuinely interested in fixing bugs if they exists (which might very be possible here). Also, feel free to ask any additional questions should you need it.

Lastly, note that --ask is primarily used in the pacman test suite. This flag is not documented since it is not designed for end-users, but it's a perfect fit for pacaur since pacaur precomputes conflicts and provides before any actions, unlike any other helpers.

rmarquis commented 8 years ago

And of course, once bcc-git provides bcc, the issue magically disappear. Closing now.