You are not logged in.

#1 2023-05-14 10:19:42

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

[Solved] how to use same trunk snapshot in multiple packages ?

https://docs.mesa3d.org/rusticl.html

Attempting to build rusticl for mesa trunk exposed a challenge.
libclc requires spirv-llvm-translator which requires llvm at buildtime and clang at checktime.

The llvm/clang/libclc version should be the same for all 3, which is easy to achieve with released versions.
For vcs packages this is different.

Lordheavy and I both solved this the same way : build llvm/clang & spirv-llvm-translator first, then build libclc separately .
The llvm-project sees a lot of activity and by the time libclc build starts several commits have been added. If those commits change libclc the build will fail or (worse) finish but have runtime issues.

Fortunately (for this usecase) libclc itself sees little activity which reduces the chance for issues. Unfortunately  every person that tries to build these packages faces the same risk.
At some point things will break.

One approach to avoid this would be to stop building from trunk and use a code snapshot instead.

This could be done by creating a separate sourcecode package that is used by all, but that requires llvm/clang & libclc to use the package version from the sourcecode package as their pkgver .

Manually putting a specific commit hash in multiple PKGBUILDs is possible, but prone to error.
Using an envvar to store the hash and use that in the PKGBUILDs is less error prone but will make it hard to build in clean chroots .

I have never tried something like this before and haven't found other packages with similar usecases. How would you deal with this ?

Last edited by Lone_Wolf (2023-06-15 08:07:57)


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

#2 2023-05-23 11:34:48

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

Re: [Solved] how to use same trunk snapshot in multiple packages ?

I have though about this more and also experimented a bit.

I know lean to  a 3rd method:

In the body of the PKGBUILD (above the source= array)

Use the version of installed llvm-minimal-git to get the commit hash it was build from into llvm_minimal_git_hash

Use #commit=llvm_minimal_git_hash in the source= line of the PKGBUILD .

This keeps the amount of changes needed to  a minimum and does not seem error prone .


One possible (very minor) issue  this approach may bring with it is related to aur helpers.
I do know those use .SRCINFO to determine dependencies, no idea if they completely ignore the body of a PKGBUILD .


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

#3 2023-05-25 12:34:35

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

Re: [Solved] how to use same trunk snapshot in multiple packages ?

I've experimented a bit and am testing the new approach now .

_llvm_minimal_git_hash=$(echo $(pacman -Q llvm-minimal-git) | | cut -d' ' -f2 |  cut -d'-' -f1 | cut -d'.' -f4)

source=("git+https://github.com/llvm/llvm-project.git#commit=$_llvm_minimal_git_hash"

Piping cut into itself to split off the parts of the llvm-minimal_git pkgver I don 't need may not be the ideal method, but does work and seems  readable .


Edit : changed cut paramaters to make them more consistent with the $pkgname $pkgver $pkgrel structure.

Last edited by Lone_Wolf (2023-05-25 13:18:33)


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

#4 2023-05-26 09:25:00

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

Re: [Solved] how to use same trunk snapshot in multiple packages ?

The above code snippet works fine IF the package it checks for is installed before the build starts, but fails if it isn't .

This is because makepkg / devtools execute code in the body before installing  dependencies.

I moved the code to prepare() and use git reset --hard to ensure the sourcetree is at the right commit .
I've uploaded a PKGBUILD with the new code to https://aur.archlinux.org/packages/libclc-minimal-git and will wait a few days for feedback before declaring this thread solved.


ADDED

No feedback of any kind here or on AUR and it's been 20 days. prepinding title with solved.

Last edited by Lone_Wolf (2023-06-15 08:07:36)


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

Board footer

Powered by FluxBB