yay icon indicating copy to clipboard operation
yay copied to clipboard

ignore errors and continue to build more packages (skip failing packages)

Open milahu opened this issue 5 years ago • 12 comments

Priority

medium ~~super low~~

Affected Version

yay v9.0.1 - libalpm v11.0.1

Issue

when i want to install many packages, but do not need all packages, i want yay to ignore build errors, and continue to build the next package.

sample:

yay -S $(
  LANG=C \
  yay -Ss gtk-theme- \
  | grep -v '^    ' | grep -v '(Installed)$' \
  | cut -d' ' -f1 | cut -d/ -f2 | sort -u | grep -v -- '-git$'
) 

some packages fail to build, cos i must manually download source files, so now i have to either ...

... exclude failing packages with

  | grep -v -e gtk-theme-+1 -e gtk-theme-absolute

... or, call yay in a loop

# install all the themes

for p in $(
  LANG=C \
  yay -Ss gtk-theme- \
  | grep -v '^    ' | grep -v '(Installed)$' \
  | cut -d' ' -f1 | cut -d/ -f2 | sort -u | grep -v -- '-git$'
) 
do
  yay --answerdiff None --answerclean All -S $p \
  || echo failed to build $p | tee -a yay.log
done

though no one will need this, 'install by glob pattern' would be nice

# proposition

yay --glob -S 'gtk-theme-*'

... but maybe there is someone with too much time : D

milahu avatar Dec 29 '18 15:12 milahu

On the ignore errors there's been similar requests and I'm tempted to change it, I would still like it to identify if it was a dependency of a certain package and cancel that whole tree but that may be too ambitious.

About the globing, I'll see if there's a straightforward way of implementing it, behind an option is a good idea to avoid it being used casually, I think it's a use at your own risk option

Jguer avatar Dec 29 '18 17:12 Jguer

Off topic but -Ssq and --needed would greatly simplify whatever you're trying to do here.

Morganamilo avatar Jan 26 '19 18:01 Morganamilo

Today there was 5 packages to update: brave-bin, chromedriver, postman-bin, webstorm and webstorm-jre. I did: $ yay -Suy and then yay canceled the whole building process because of this error:

==> ERROR: One or more files did not pass the validity check!
Error downloading sources: webstorm (webstorm webstorm-jre)

I had to update the first 3 packages separately. It doesn't make sense to me that the building process is canceled because some packages (without dependencies) are failing.

hubitor avatar Feb 02 '19 10:02 hubitor

I'd say the probably on this should be medium. Anyone with a lot of AUR packages installed will find it pretty impractical to do a bulk update with yay -Syu --aur, with the way it's set up right now.

crabdancing avatar Feb 12 '19 21:02 crabdancing

How about a naive implementation for now, which simply restarts the entire process and ignores any program which failed in the previous iteration. This is basically what we do manually, but I don't want to have to do it manually. I could maybe do this in a script, but if the optimal solution (pruning the dependency tree/graph on failure) is hard, then why don't we start with the most naive solution and iteratively improve the runtime performance?

I think many people would be happy with that compromise. In the meantime, I'm going to write a script to do the same, but I won't like it.

EDIT: Well it turns out it was easier than I expected: https://gist.github.com/norcalli/6b564e93e36ad37240067a479c7356eb

norcalli avatar Jun 07 '19 17:06 norcalli

Related:

  • Install as many packages as possible #1247
  • Suggestion: have a way to continue interrupted AUR installs/builds. #1199

HaleTom avatar Jul 24 '20 08:07 HaleTom

Are there any updates on this? I'd really like proper support for an option like this.

lincoln177 avatar Dec 30 '20 02:12 lincoln177

Well it turns out it was easier than I expected: https://gist.github.com/norcalli/6b564e93e36ad37240067a479c7356eb

LOL. why write one line if you can write 70 lines?

# update AUR packages, continue on errors
yay -Quq --aur | while read p; do yes '' | yay -S $p || echo $p >>yay-failed.log; done

# update all packages (repo + AUR), continue on errors
yay -Quq | while read p; do yes '' | yay -S $p || echo $p >>yay-failed.log; done

# install all gtk-theme-* packages, continue on errors
yay -Ssq gtk-theme- | grep ^gtk-theme- | while read p; do yes '' | yay -S $p || echo $p >>yay-failed.log; done

yay -Qu shows packages to update yay -Quq shows only pkg names yay -Quq --aur shows only AUR pkgs to be updated yes '' will print \n on all questions = default answer

to make yay less interactive, use something like yay --noremovemake --nocleanafter --answerclean None --answerdiff None --answeredit None

$ man pacman | grep -A1 -- --needed
       --needed
           Do not reinstall the targets that are already up-to-date.

.. may be useful

edit: yes -> yes ''

milahu avatar Dec 30 '20 08:12 milahu

can we not have an argument for this, instead of random bash wrappers?

f-viktor avatar Aug 13 '21 13:08 f-viktor

# update all packages (repo + AUR), continue on errors
yay -Quq | while read p; do yes | yay -S $p || echo $p >>yay-failed.log; done

This means if there's a number option (not yes/no) it loops forever telling you that's not one of the options. If you replace yes with yes '' (only newline instead of y), then it chooses the default every time there's a prompt and quits on a number option (or at least the one I ran into). In combination with the "make yay less interactive" options, this seems to work for me.

SafariMonkey avatar Aug 25 '21 22:08 SafariMonkey

I want to work on this but every time I pick it up I see a small part of the install phase that needs to be refactored to make it happen properly and be properly tested, sorry for the delay

Jguer avatar Aug 26 '21 13:08 Jguer

Simplifiying the response of @milahu:

Install AUR packages ignoring errors:

yay -Quq --aur | xargs -n 1 yay -S --noconfirm

Failed packages (not able to be installed):

yay -Quq --aur

adrianlzt avatar Mar 16 '22 10:03 adrianlzt

As @adrianlzt said (thanks), but for pacaur:

pacaur -Quq --aur | xargs -n 1 pacaur -S --noconfirm

JoshMcCullough avatar Nov 11 '22 16:11 JoshMcCullough

implemented in yay-git

  "newinstallengine": true,

in config will trigger this behavior (check yay -Pg for current config)

Jguer avatar Feb 20 '23 23:02 Jguer