yay icon indicating copy to clipboard operation
yay copied to clipboard

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

Open Photon89 opened this issue 4 years ago • 13 comments

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

Photon89 avatar Jan 14 '22 10:01 Photon89

As a workaround, something like this can be used:

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

Zebradil avatar Jan 21 '22 00:01 Zebradil

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!

Photon89 avatar Jan 21 '22 01:01 Photon89

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.

Zebradil avatar Jan 21 '22 02:01 Zebradil

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?

Photon89 avatar Jan 22 '22 09:01 Photon89

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

Jguer avatar Jan 24 '22 10:01 Jguer

Great, thanks for looking into it!

Photon89 avatar Jan 24 '22 10:01 Photon89

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)

JimPix1 avatar Mar 26 '22 19:03 JimPix1

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.

stale[bot] avatar Jul 25 '22 05:07 stale[bot]

Activity! :smiley:

Photon89 avatar Jul 25 '22 05:07 Photon89

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

JimPix1 avatar Jul 25 '22 09:07 JimPix1

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?

marek22k avatar Nov 29 '23 22:11 marek22k

@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).

renyuneyun avatar Nov 29 '23 22:11 renyuneyun