You are not logged in.

#1 2023-11-04 19:00:32

Captain Athelas
Member
Registered: 2020-05-15
Posts: 33

Rebuilding an AUR package automatically

I'm trying to automatically recompile onedrive-abraunegg when liblphobos has been updated.

I have the following command:

yay -S --rebuild --answerclean None --nodiffmenu onedrive-abraunegg

But it asks me to select providers interactively for "d-compiler" and "d-runtime":

:: There are 2 providers available for d-compiler:
:: Repository extra
    1) dmd 2) ldc 

Enter a number (default=1): 
==> 2

I can't find how to preselect ldc and liblphobos. How do I do that, so that this can be scripted and doesn't require input?

For more context: I frequently encounter the following issue:

/usr/bin/onedrive: error while loading shared libraries: libphobos2-ldc-shared.so.104: cannot open shared object file: No such file or directory

Which is caused by dynamic linking and requires a recompilation. I'm trying to resolve this automatically through a pacman hook, in order no to be stuck with a broken OneDrive. I currently have "/etc/pacman.d/hooks/onedrive-recompile.hook":

[Trigger]
Operation = Upgrade
Type = Package
Target = liblphobos

[Action]
Description = Recompile onedrive-abraunegg with new liblphobos.
When = PostTransaction
Depends = onedrive-abraunegg
Exec = /usr/bin/yay -S --rebuild --answerclean None --nodiffmenu onedrive-abraunegg

Offline

#2 2023-11-04 21:01:08

seth
Member
Registered: 2012-09-03
Posts: 54,330

Re: Rebuilding an AUR package automatically

It's a make dependency, no idea whether yay has anything for that, but you could just explicitly install and remove the package around the build (if you don't want to keep it around all the time)?

Offline

#3 2023-11-04 23:54:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,879
Website

Re: Rebuilding an AUR package automatically

...
Exec = /usr/bin/pacman -S --asdeps ldc liblphobos
Exec = /usr/bin/yay -S --rebuild --answerclean None --nodiffmenu onedrive-abraunegg

However I doubt invoking pacman (or yay which is just a wrapper for pacman) from within a pacman hook is wise.  But if your yay command worked in that context, the additional installation of the build deps would work fine too.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2023-11-05 11:28:28

Captain Athelas
Member
Registered: 2020-05-15
Posts: 33

Re: Rebuilding an AUR package automatically

It's probably indeed not wise to have such a hook indeed, but what's a good alternative?

I could try to install those dependencies in the same command indeed, but the hook is also on that package.

Offline

#5 2023-11-05 11:37:05

seth
Member
Registered: 2012-09-03
Posts: 54,330

Re: Rebuilding an AUR package automatically

Schedule the update, eg. fork a script that first waits five minutes or so or add a systemd timer, atq job or a trigger for a cronjob.

Offline

#6 2023-11-05 11:49:22

Captain Athelas
Member
Registered: 2020-05-15
Posts: 33

Re: Rebuilding an AUR package automatically

Or maybe it's a good idea that I create a binary version of this package, so that this issue doesn't exist for me and other people anymore?

Offline

#7 2023-11-05 12:06:22

seth
Member
Registered: 2012-09-03
Posts: 54,330

Re: Rebuilding an AUR package automatically

How would that fix anything about the rebuild requirement - worse, you could not rebuild it b/c it's now some precompiled binary.

Offline

#8 2023-11-05 13:54:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,879
Website

Re: Rebuilding an AUR package automatically

A good alternative could be a hook just echoing a message telling you to rebuild that package.  In fact there are ready made tools just for this purpose (to list which foreign packages need to be rebuilt).

If you really wanted, you could then have a script that automated everything needed to rebuild/install it, though I don't know how much simpler it could be than:

cd /path/to/thing && makepkg -risc

Yay seems to make it more complicated.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2023-11-05 18:31:34

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

Re: Rebuilding an AUR package automatically

Another alternative is to statically link in the libraries from liblphobos as Arch still packages them;  based on [1] and build tested only,  the following diff shows the changes I made to the PKGBUILD:

diff --git a/PKGBUILD b/PKGBUILD
index 0eab432..016e6ed 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,14 +11,14 @@ license=('GPL')
 conflicts=('onedrive' 'onedrive-abraunegg-git' 'onedrive-bin' 'onedrive-git' 'onedrive-fork-git')
 source=("https://github.com/abraunegg/onedrive/archive/v$pkgver.tar.gz")
 provides=("onedrive=$pkgver")
-depends=('libnotify' 'sqlite' 'd-runtime')
-makedepends=('d-compiler')
+depends=('libnotify' 'sqlite')
+makedepends=('ldc' 'liblphobos')
 md5sums=('09a7b7be0f24006ec7afd10e2ba194da')
 
 build() {
        # Fix "W: ELF file ('usr/bin/onedrive') lacks FULL RELRO, check LDFLAGS."
         # https://bbs.archlinux.org/viewtopic.php?id=280157
-        export DCFLAGS='-L-zrelro -L-znow'
+        export DCFLAGS='-L-zrelro -L-znow -L--as-needed -L-l:libphobos2-ldc.a -L-l:libdruntime-ldc.a'
 
        cd "$_pkgname-$pkgver"
         ./configure --sysconfdir=/etc \

[1]: https://forum.dlang.org/thread/irvhgnbw … .dlang.org

Last edited by loqs (2023-11-05 18:32:10)

Offline

#10 2023-11-05 18:32:54

Captain Athelas
Member
Registered: 2020-05-15
Posts: 33

Re: Rebuilding an AUR package automatically

seth wrote:

How would that fix anything about the rebuild requirement - worse, you could not rebuild it b/c it's now some precompiled binary.

By static linking. So no rebuilds would be needed.

Offline

#11 2023-11-05 18:36:45

Captain Athelas
Member
Registered: 2020-05-15
Posts: 33

Re: Rebuilding an AUR package automatically

Trilby wrote:

A good alternative could be a hook just echoing a message telling you to rebuild that package.  In fact there are ready made tools just for this purpose (to list which foreign packages need to be rebuilt).

If you really wanted, you could then have a script that automated everything needed to rebuild/install it, though I don't know how much simpler it could be than:

cd /path/to/thing && makepkg -risc

Yay seems to make it more complicated.

This makes it seem like what I'm trying to do is an exotic use case. But this must pretty common, no?

Can you give an example of such a tool? So that tool would run as a pacman hook and then after pacman updates, that list can be used to do rebuilds?

Offline

#12 2023-11-05 18:38:03

Captain Athelas
Member
Registered: 2020-05-15
Posts: 33

Re: Rebuilding an AUR package automatically

loqs wrote:

Another alternative is to statically link in the libraries from liblphobos as Arch still packages them;  based on [1] and build tested only,  the following diff shows the changes I made to the PKGBUILD:

diff --git a/PKGBUILD b/PKGBUILD
index 0eab432..016e6ed 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,14 +11,14 @@ license=('GPL')
 conflicts=('onedrive' 'onedrive-abraunegg-git' 'onedrive-bin' 'onedrive-git' 'onedrive-fork-git')
 source=("https://github.com/abraunegg/onedrive/archive/v$pkgver.tar.gz")
 provides=("onedrive=$pkgver")
-depends=('libnotify' 'sqlite' 'd-runtime')
-makedepends=('d-compiler')
+depends=('libnotify' 'sqlite')
+makedepends=('ldc' 'liblphobos')
 md5sums=('09a7b7be0f24006ec7afd10e2ba194da')
 
 build() {
        # Fix "W: ELF file ('usr/bin/onedrive') lacks FULL RELRO, check LDFLAGS."
         # https://bbs.archlinux.org/viewtopic.php?id=280157
-        export DCFLAGS='-L-zrelro -L-znow'
+        export DCFLAGS='-L-zrelro -L-znow -L--as-needed -L-l:libphobos2-ldc.a -L-l:libdruntime-ldc.a'
 
        cd "$_pkgname-$pkgver"
         ./configure --sysconfdir=/etc \

[1]: https://forum.dlang.org/thread/irvhgnbw … .dlang.org

Nice, thanks. Could be useful to create e.g. "onedrive-abraunegg-bin" on AUR.

Offline

#13 2023-11-05 20:02:07

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

Re: Rebuilding an AUR package automatically

Captain Athelas wrote:

Nice, thanks. Could be useful to create e.g. "onedrive-abraunegg-bin" on AUR.

It was intended solely to help you.  As you have so much difficulty in maintaining your system with respect to the AUR package you use.

Offline

#14 2023-11-06 00:21:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,879
Website

Re: Rebuilding an AUR package automatically

Captain Athelas wrote:

Can you give an example of such a tool? So that tool would run as a pacman hook and then after pacman updates, that list can be used to do rebuilds?

https://archlinux.org/packages/extra/an … -detector/


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB