You are not logged in.

#1 2020-06-05 21:11:33

altaway
Member
Registered: 2020-06-04
Posts: 15

[solved] Automatically answer yes for package conflicts

With the noconfirm option, pacman answers no when trying to resolve conflicts. How do I make it answer yes?[solved]

Last edited by altaway (2020-10-23 16:14:06)

Offline

#2 2020-06-05 21:55:25

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [solved] Automatically answer yes for package conflicts

Does the replacement package list the package it is replacing in both conflicts and replaces arrays?

Offline

#3 2020-06-05 23:12:04

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [solved] Automatically answer yes for package conflicts

pacman is not optimized for scripting. Install pacutils, and use pacinstall --no-confirm --resolve-conflicts=all, or perhaps pacinstall --yolo

See the manpage: https://jlk.fjfi.cvut.cz/arch/manpages/ … on_Options


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2020-06-06 05:07:26

altaway
Member
Registered: 2020-06-04
Posts: 15

Re: [solved] Automatically answer yes for package conflicts

To be more specific, I am trying to build certain packages from the AUR using makepkg. There are certain packages whose build dependencies conflict with each other. What's the best way to handle this?

Last edited by altaway (2020-06-06 06:24:08)

Offline

#5 2020-06-06 05:14:49

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [solved] Automatically answer yes for package conflicts

altaway wrote:

To be specific...

Not specific at all


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2020-06-06 06:42:50

altaway
Member
Registered: 2020-06-04
Posts: 15

Re: [solved] Automatically answer yes for package conflicts

eschwartz wrote:

pacman is not optimized for scripting. Install pacutils, and use pacinstall --no-confirm --resolve-conflicts=all, or perhaps pacinstall --yolo

See the manpage: https://jlk.fjfi.cvut.cz/arch/manpages/ … on_Options

I came to know about pacutils thanks to you, mate.

Is it possible to replace makepkg with something from pacutils?

Last edited by altaway (2020-06-06 06:46:21)

Offline

#7 2020-06-06 11:03:56

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: [solved] Automatically answer yes for package conflicts

Or you can just confirm "yes" yourself. What's the actual use case here, and how do you get to the conflicts in the first place?


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#8 2020-06-06 18:16:08

altaway
Member
Registered: 2020-06-04
Posts: 15

Re: [solved] Automatically answer yes for package conflicts

1. makepkg is part of a script.
2. The script runs in a devops environment, so the session isn't interactive.
3. The script is supposed to build package1 and package2 by taking the PKGBUILDs from the AUR. package1 has builddeps a, b, c. package2 has builddeps d, e, f.
4. "makepkg -sr --noconfirm" seems to be the thing I am looking for.

Offline

#9 2020-06-06 18:59:17

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [solved] Automatically answer yes for package conflicts

Build each package in their own clean chroot and avoid the conflicts completely.

https://wiki.archlinux.org/index.php/De … ean_chroot

Last edited by Lone_Wolf (2020-06-06 18:59:32)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#10 2020-06-06 20:42:25

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: [solved] Automatically answer yes for package conflicts

Chroots can't avoid conflicts when packages conflict with say, base. (Less likely with the slimmed down base package though.)

Last edited by Alad (2020-06-06 20:44:37)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#11 2020-06-07 03:11:21

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [solved] Automatically answer yes for package conflicts

altaway wrote:

To be more specific, I am trying to build certain packages from the AUR using makepkg. There are certain packages whose build dependencies conflict with each other. What's the best way to handle this?

See, now that would have been useful knowledge to have from the start.

altaway wrote:

Is it possible to replace makepkg with something from pacutils?

Theoretically, anything is possible. You could add a shellscript to $PATH which is named "pacman", but diverts package installations to use pacinstall. You'll have to be exceedingly careful, however, since makepkg internally uses pacman for a number of things including parsing the output of pacman -Qi or pacman -T, so you'd need a good enough option parser to imitate pacman and forward invocations to /usr/bin/pacman *except* when you know it is trying to install a package.

Have you considered implementing makedepends solving outside of makepkg? Use makepkg --printsrcinfo or bash -c 'source PKGBUILD; printf "%s\n" "${makedepends[@]}" "${makedepends_x86_64[@]}" "${depends[@]}" "${depends_x86_64[@]}"' to collect build dependencies, and install them by hand, possibly using pacutils.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#12 2020-06-07 10:08:56

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: [solved] Automatically answer yes for package conflicts

eschwartz wrote:

Theoretically, anything is possible. You could add a shellscript to $PATH which is named "pacman", but diverts package installations to use pacinstall. You'll have to be exceedingly careful, however, since makepkg internally uses pacman for a number of things including parsing the output of pacman -Qi or pacman -T, so you'd need a good enough option parser to imitate pacman and forward invocations to /usr/bin/pacman *except* when you know it is trying to install a package.

Or use PACMAN=/bin/my_pacman, to only affect makepkg and not other programs running pacman.

Have you considered implementing makedepends solving outside of makepkg? Use makepkg --printsrcinfo or bash -c 'source PKGBUILD; printf "%s\n" "${makedepends[@]}" "${makedepends_x86_64[@]}" "${depends[@]}" "${depends_x86_64[@]}"' to collect build dependencies, and install them by hand, possibly using pacutils.

This part seems relatively straightforward. I wonder how to reimplement `-r` though, since you'd need to keep track both of what dependencies were installed, and which (possibly already installed) dependencies were replaced by pacinstall.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#13 2020-06-07 13:32:16

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [solved] Automatically answer yes for package conflicts

Alad wrote:

Have you considered implementing makedepends solving outside of makepkg? Use makepkg --printsrcinfo or bash -c 'source PKGBUILD; printf "%s\n" "${makedepends[@]}" "${makedepends_x86_64[@]}" "${depends[@]}" "${depends_x86_64[@]}"' to collect build dependencies, and install them by hand, possibly using pacutils.

This part seems relatively straightforward. I wonder how to reimplement `-r` though, since you'd need to keep track both of what dependencies were installed, and which (possibly already installed) dependencies were replaced by pacinstall.

makepkg doesn't try to track the latter. Or actually it does, and if it detects that this has happened, it fails with a warning. The comments say it is "too risky" to remove all installed packages in this case.

Otherwise it just diffs the before-list and the after-list and removes all new packages. It's pretty simple to do...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#14 2020-06-07 16:45:51

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,407
Website

Re: [solved] Automatically answer yes for package conflicts

My question then remains, is there a way to "try to track the latter"? I mean, I wouldn't want to remove all installed packages either, but rather keep track of which conflicts were solved with pacinstall, then do those same transactions in the opposite direction during cleanup.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#15 2020-06-07 17:34:28

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [solved] Automatically answer yes for package conflicts

Well, you could try to do a two-way diff then use pactrans to install all packages which were removed and remove all packages which were installed, thus resetting the system to its initial state. This would be slightly complicated by -i, especially if you need to handle runtime-only depends which may or may not also be makedepends....


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#16 2020-06-08 08:56:18

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: [solved] Automatically answer yes for package conflicts

You know what needs to be replaced, so just have the script do it before running makepkg.

Offline

Board footer

Powered by FluxBB