Jguer / yay

Yet another Yogurt - An AUR Helper written in Go
GNU General Public License v3.0
11.27k stars 366 forks source link

Support for "yay hooks" to automatically rebuild packages which require a rebuild #1671

Open Photon89 opened 2 years ago

Photon89 commented 2 years ago

Is your feature request related to a problem? Please describe.

I am using compiz-easy-patch from the AUR. Whenever protobuf is updated, compiz only works with limited functionality till I rebuild the compiz-easy-patch package.

Describe the solution you'd like

I would like yay to recognize that compiz-easy-patch needs a rebuild and do the rebuild automatically. in #743 the task is considered too complex, but as far as I understand, the complex part is to detect which package to rebuild and which shared libraries should trigger the rebuild.

However, Pacman hooks provide a way to trigger commands whenever a given package is updated. Also there is now rebuild-detector (https://github.com/maximbaz/rebuild-detector) which already can do the detection part, such that no hook for a specific package needs to be present, which is triggered via a Pacman hook: https://github.com/maximbaz/rebuild-detector/blob/master/rebuild-detector.hook

Possibly the task considered complex in 2018 is more doable in 2022? Would be really great if this could be implemented! :smile:

Describe alternatives you've considered

Well, basically, Pacman hooks and rebuild-detector, but both of them need to somehow interact with an AUR helper to do the rebuild part...

Additional context

A similar problem is discussed here: https://bbs.archlinux.org/viewtopic.php?id=262683

Zebradil commented 2 years ago

As a workaround, something like this can be used:

yay -S --rebuild --answerclean A --answerdiff N $(checkrebuild | cut -d' ' -f2)
Photon89 commented 2 years ago

Thanks for the hint! For some reason on my machine the cut command doesn't work as expected though the syntax looks good:

$ checkrebuild | cut -d' ' -f2
foreign cairo-dock-plug-ins-git
foreign cairo-git
foreign notekit-clatexmath-git
foreign python2-gobject2
foreign syncthing-gtk-python3

As you can see it doesn't cut off the "foreign" field... Any thoughts? Thanks!

Zebradil commented 2 years ago

This is printed with pacman -Qqm | awk '{print "foreign", $0}'. On my machine it is space-delimited. In your snippet it is tab-delimited. I'm not sure why the difference, but you should be able to use cut -d$'\t' -f2.

Photon89 commented 2 years ago

That works great, thanks! So this command could be put as Exec line into https://github.com/maximbaz/rebuild-detector/blob/master/rebuild-detector.hook and the automatic check (and rebuild if necessary) would run automatically at each update, I guess? I wonder, if this could be integrated into yay itself, such that the functionality is available to everybody without adding a pacman hook by hand?

Jguer commented 2 years ago

Seems very interesting, I'll try and take a look at all the references posted. I wouldn't be against including this if we can do it. yay's interfaces have changed enough since 2018 for it to slightly easier to plug new things

Photon89 commented 2 years ago

Great, thanks for looking into it!

JimPix1 commented 2 years ago

As a workaround, something like this can be used:

yay -S --rebuild --answerclean A --answerdiff N $(checkrebuild | cut -d' ' -f2)

This does work but there is still no way of a post-update hook which would be very useful (and is what I'm looking for)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Photon89 commented 2 years ago

Activity! :smiley:

JimPix1 commented 2 years ago

Yep, I'm still very eager for yay hooks so it can run some commands after it updates.

marek22k commented 1 year ago

Hello, I hope it's okay if I ask my question here: Does the openness of this issue mean that if I run yay -Syu or yay -Sua I won't get any updates when new ones are available in the AUR?

renyuneyun commented 1 year ago

@marek22k If I understand you correct, no, you will correctly get updates.

This issue is about specific packages (in fact) required to be rebuilt although still with the same version number (thus yay won't know it in fact needs to be rebuilt). This is a result of, e.g., some packages being updated and the AUR package relies on specific ways to dynamically link with those (updated) packages (e.g. something depending on some versioned .so files), or some update (also) with changed paths (e.g. Python upgrading from, e.g., 3.9 to 3.10).