Skip to main content
Topic: [SOLVED] Custom PKGBUILD leading to conflicts between packages in the same group (Read 728 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] Custom PKGBUILD leading to conflicts between packages in the same group

I am currently trying to make a custom PKGBUILD for the Java 17 JDK based on the one for the java-openjdk-xdg AUR group. For whatever reason, I keep running into the following situation.

Code: [Select]
==> WARNING: The package group has already been built, installing existing packages...
==> Installing java17-openjdk-xdg package group with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: jre17-openjdk-headless-xdg and jre17-openjdk-xdg are in conflict
==> WARNING: Failed to install built package(s).

Under normal circumstances, these would be able to install all at once, with the JRE depending on the headless JRE and the JDK in turn depending on the JRE. In spite of minimal editing — tacking on version numbers and fixing SHA256 sums — it ends up suffering from an irreconcilable conflict.

What could I be doing wrong here?

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #1
In the dir with the packages could you run and post
Code: [Select]
pacman -Qi --file *.zst

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #2
Sure thing.

Code: [Select]
Name            : jdk17-openjdk-xdg
Version         : 17.0.6.u10-1
Description     : OpenJDK Java 17 development kit - with improved Support for the XDG Base Directory Specification
Architecture    : x86_64
URL             : https://openjdk.java.net/
Licenses        : custom
Groups          : None
Provides        : java-environment=17  java-environment-openjdk=17  jdk17-openjdk=17.0.6.u10-1
Depends On      : jre17-openjdk=17.0.6.u10-1  java-environment-common=3  hicolor-icon-theme  libelf  glibc gcc-libs
Optional Deps   : None
Conflicts With  : jre17-openjdk-headless  jre17-openjdk  jdk17-openjdk  openjdk17-src  openjdk17-doc
Replaces        : None
Compressed Size : 238.17 MiB
Installed Size  : 248.29 MiB
Packager        : Unknown Packager
Build Date      : Tue 21 Mar 2023 19:07:38 GMT
Install Script  : Yes
Validated By    : None
Signatures      : None

Name            : jre17-openjdk-headless-xdg
Version         : 17.0.6.u10-1
Description     : OpenJDK Java 17 headless runtime environment - with improved Support for the XDG Base Directory Specification
Architecture    : x86_64
URL             : https://openjdk.java.net/
Licenses        : custom
Groups          : None
Provides        : java-runtime-headless=17  java-runtime-headless-openjdk=17 jre17-openjdk-headless=17.0.6.u10-1
Depends On      : java-runtime-common>=3  ca-certificates-utils  nss  libjpeg-turbo  libjpeg.so=8-64  lcms2 liblcms2.so=2-64  libnet freetype2  libfreetype.so=6-64  harfbuzz  libharfbuzz.so=0-64 glibc  gcc-libs
Optional Deps   : java-rhino: for some JavaScript support
Conflicts With  : jre17-openjdk-headless  jre17-openjdk  jdk17-openjdk  openjdk17-src  openjdk17-doc
Replaces        : None
Compressed Size : 50.99 MiB
Installed Size  : 171.17 MiB
Packager        : Unknown Packager
Build Date      : Tue 21 Mar 2023 19:07:38 GMT
Install Script  : Yes
Validated By    : None
Signatures      : None

Name            : jre17-openjdk-xdg
Version         : 17.0.6.u10-1
Description     : OpenJDK Java 17 full runtime environment - with improved Support for the XDG Base Directory Specification
Architecture    : x86_64
URL             : https://openjdk.java.net/
Licenses        : custom
Groups          : None
Provides        : java-runtime=17  java-runtime-openjdk=17  jre17-openjdk=17.0.6.u10-1
Depends On      : jre17-openjdk-headless=17.0.6.u10-1  giflib  libgif.so  glibc  gcc-libs  libpng
Optional Deps   : alsa-lib: for basic sound support
                  gtk2: for the Gtk+ 2 look and feel - desktop usage
                  gtk3: for the Gtk+ 3 look and feel - desktop usage
Conflicts With  : jre17-openjdk-headless  jre17-openjdk  jdk17-openjdk  openjdk17-src  openjdk17-doc
Replaces        : None
Compressed Size : 227.28 KiB
Installed Size  : 493.45 KiB
Packager        : Unknown Packager
Build Date      : Tue 21 Mar 2023 19:07:38 GMT
Install Script  : Yes
Validated By    : None
Signatures      : None

Name            : openjdk17-doc-xdg
Version         : 17.0.6.u10-1
Description     : OpenJDK Java 17 documentation - with improved Support for the XDG Base Directory Specification
Architecture    : x86_64
URL             : https://openjdk.java.net/
Licenses        : custom
Groups          : None
Provides        : openjdk17-doc=17.0.6.u10-1
Depends On      : jdk17-openjdk=17.0.6.u10-1
Optional Deps   : None
Conflicts With  : jre17-openjdk-headless  jre17-openjdk  jdk17-openjdk  openjdk17-src  openjdk17-doc
Replaces        : None
Compressed Size : 20.43 MiB
Installed Size  : 263.01 MiB
Packager        : Unknown Packager
Build Date      : Tue 21 Mar 2023 19:07:38 GMT
Install Script  : No
Validated By    : None
Signatures      : None

Name            : openjdk17-src-xdg
Version         : 17.0.6.u10-1
Description     : OpenJDK Java 17 sources - with improved Support for the XDG Base Directory Specification
Architecture    : x86_64
URL             : https://openjdk.java.net/
Licenses        : custom
Groups          : None
Provides        : openjdk17-src=17.0.6.u10-1
Depends On      : jdk17-openjdk=17.0.6.u10-1
Optional Deps   : None
Conflicts With  : jre17-openjdk-headless  jre17-openjdk  jdk17-openjdk  openjdk17-src  openjdk17-doc
Replaces        : None
Compressed Size : 45.76 MiB
Installed Size  : 49.35 MiB
Packager        : Unknown Packager
Build Date      : Tue 21 Mar 2023 19:07:38 GMT
Install Script  : No
Validated By    : None
Signatures      : None

...okay, it looks like everything is conflicting with everything else within this group.

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #3
And just to reiterate, the changes to the PKGBUILD for this version of Java over the one in the original group this was adapted from were still minimal. The diff attached should show that the bulk of the changes were made to the version number rather than anything else.

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #4
I did have a look at the PKGBUILD and couldn't see why they should conflict.
Afraid to say the pacman -Qi output says the same thing to me. I don't see why they do?

pacman -Uv might shed more light, though it's a bit hopeful.

Are these packages just for you or do you plan to publish somewhere ?
If the former I'd be tempted to just remove the 'conflicts=' line and see what happens.

Or try it anyway just to test. Logic suggests you'll still get the error.

Every package has the same conflicts
Code: [Select]
jre17-openjdk-headless  jre17-openjdk  jdk17-openjdk  openjdk17-src  openjdk17-doc

All your packages suffix -xdg so I can't why there should be any package conflicts ?
Sorry thinking out loud a bit.

I think the clue is
Code: [Select]
error: failed to prepare transaction (conflicting dependencies)
I can't spot it but maybe the issue stems from the various Provides= & Depends= lines not the Conflict= line ?

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #5
pacman -Uv might shed more light, though it's a bit hopeful.
Not much luck there either from what I can spot.

Code: [Select]
Root      : /
Conf File : /etc/pacman.conf
DB Path   : /var/lib/pacman/
Cache Dirs: /var/cache/pacman/pkg/ 
Hook Dirs : /usr/share/libalpm/hooks/  /etc/pacman.d/hooks/ 
Lock File : /var/lib/pacman/db.lck
Log File  : /var/log/pacman.log
GPG Dir   : /etc/pacman.d/gnupg/
Targets   : jdk17-openjdk-xdg-17.0.6.u10-1-x86_64.pkg.tar.zst  jre17-openjdk-xdg-17.0.6.u10-1-x86_64.pkg.tar.zst  jre17-openjdk-headless-xdg-17.0.6.u10-1-x86_64.pkg.tar.zst  openjdk17-src-xdg-17.0.6.u10-1-x86_64.pkg.tar.zst  openjdk17-doc-xdg-17.0.6.u10-1-x86_64.pkg.tar.zst
loading packages...
resolving dependencies...
looking for conflicting packages...
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: jdk17-openjdk-xdg and jre17-openjdk-headless-xdg are in conflict

Are these packages just for you or do you plan to publish somewhere ?
If the former I'd be tempted to just remove the 'conflicts=' line and see what happens.
For the time being just for myself, though I may intend on pushing this to the AUR as well at some point.

Or try it anyway just to test. Logic suggests you'll still get the error.
I'll give it a go right now without the conflicts line and with makepkg -sfi but I'm anticipating the same.

I can't spot it but maybe the issue stems from the various Provides= & Depends= lines not the Conflict= line ?
It'd still be odd given that this combination of provisions, dependencies and conflicts poses no issue for the original group.

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #6
It'd still be odd given that this combination of provisions, dependencies and conflicts poses no issue for the original group.
Does seem odd. But they often do until you figure it out then it's "Shit, of course".

I haven't studied the PKGBUILD. Do you actually need to rename packages.
I'm just thinking it might me easier to just change the version numbers, major minor etc, and nothing else ?
Unless you need the Java versions to coexist ?

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #7
It'd still be odd given that this combination of provisions, dependencies and conflicts poses no issue for the original group.
Does seem odd. But they often do until you figure it out then it's "Shit, of course".

I haven't studied the PKGBUILD. Do you actually need to rename packages.
I'm just thinking it might me easier to just change the version numbers, major minor etc, and nothing else ?
Unless you need the Java versions to coexist ?

I would rather they co-existed. Some software, I've found, still relies specifically on Java versions before 19 such as IntelliJ IDEA's debugger and — go figure — older versions of Minecraft. I'd generally prefer having LTS versions like 8 and 17 available alongside whatever is the most recent stable version.

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #8
Arch forum came back with the following answer:

Quote from: Scimmia
It's lines 38 and 39. In the global scope, that means that every package provides all of those and every package conflicts with all of those. You would never be able to install more than one package from that PKGBUILD because of that, except that some of the provides get overridden later in the package functions. Either way, it's wrong.

The only question that remains is how did this package then manage to do the exact same mistake I'm doing and still work just fine?

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #9
Quote
It's lines 38 and 39. In the global scope, that means that every package provides all of those and every package conflicts with all of those. You would never be able to install more than one package from that PKGBUILD because of that, except that some of the provides get overridden later in the package functions. Either way, it's wrong. 
That sounds wrong.
It's often the case that you want your version of a package to both 'provide' the original (to keep the dependencies of other packages happy) and 'conflict' with the original, as only one can be installed at a time.
I've done this exact thing many times in the past.

Proof of concept.
Code: [Select]
pkgname='food'
pkgver=0.1
pkgrel=1
arch=(any)
provides=(cakes tarts muffins)
conflicts=(cakes tarts muffins)
Builds and installs just fine.

What they are saying would make sense if the packages in the group had the same name as the package names in 'conflicts'. But they don't. All the packages in the group have the -xdg suffix.
But also I've just found the thread on the Arch forum.
You didn't post your PKGBUILD so aren't they just looking at the original on AUR ? I'm confused ?

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #10
I would guess from your first post and error message that the conflicting dependencies come from these bits for the individual packages:
Code: [Select]
package_jre17-openjdk-headless-xdg() {
  pkgdesc="OpenJDK Java ${_majorver} headless runtime environment - with improved Support for the XDG Base Directory Specification"
  depends=('java-runtime-common>=3' 'ca-certificates-utils' 'nss' 'libjpeg-turbo' 'libjpeg.so'
           'lcms2' 'liblcms2.so' 'libnet' 'freetype2' 'libfreetype.so' 'harfbuzz' 'libharfbuzz.so'
           'glibc' 'gcc-libs')

package_jre17-openjdk-xdg() {
  pkgdesc="OpenJDK Java ${_majorver} full runtime environment - with improved Support for the XDG Base Directory Specification"
  depends=("jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}" 'giflib' 'libgif.so'
           'glibc' 'gcc-libs' 'libpng')
You can delete depends OK and it should still build and even run if the depends are installed, so I would delete some selectively to find what is causing the trouble by simple trial and error. Also if you want to get the actual shell expansion of some value you can throw in something like
Code: [Select]
echo "jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}"
at any convenient point in the PKGBUILD after the relevant variables are set and it will (hopefully!) print it out during the build if you were trying to figure out whether it was expanding to what you expected.

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #11
Actually, it wasn't even the individual packages at fault. Another user over on Arch clarified that the conflicts line at the top in global scope was the culprit.

I went and removed that, moving individual conflicts to their respective packages, and they all built just fine. Now I've even got a custom build of the Java 8 and 17 JDK!  :D

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #12
Well I take it back then! They must be right. I'm still not fully understanding it in regard to why it worked in the original, but not your version. But you got it working so happy days.

 

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #13
The original explicitly specifies its own sub-package name in the depends while in yours this name is only in your provides / conflicts:
"jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}"
so this might also have worked if there was some internal makepkg confusion over the global provides / conflicts of as yet unbuilt sub packages, don't know though:
"jre${_majorver}-openjdk-headless-xdg=${pkgver}-${pkgrel}"
(And look at the end of that line, as it also demands openjdk-headless has the exact same pkgver and pkgrel as you  define in your PKGBUILD)

Re: Custom PKGBUILD leading to conflicts between packages in the same group

Reply #14
The original explicitly specifies its own sub-package name in the depends while in yours this name is only in your provides / conflicts:
"jre${_majorver}-openjdk-headless=${pkgver}-${pkgrel}"
so this might also have worked if there was some internal makepkg confusion over the global provides / conflicts of as yet unbuilt sub packages, don't know though:
"jre${_majorver}-openjdk-headless-xdg=${pkgver}-${pkgrel}"
(And look at the end of that line, as it also demands openjdk-headless has the exact same pkgver and pkgrel as you  define in your PKGBUILD)
Oh, interesting, I must have missed that originally then.

I'll have another look soon, but for now I'm pleased that I at least got these built. :)