- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 25
 
Description
Installing an older Crystal package from our OBS repo does not work on some RPM-based distributions such as Fedora. For example, dnf install crystal1.15 ends up installing crystal1.16.
Other distros, such as openSUSE are not affected. zypper install crystal1.15 installs version 1.15, despite all using essentially the same RPM spec file. It's not a problem for DEB packages either.
The reason for this is that the crystal package declares Obsoletes: crystal1.15. RPM treats Obsoletes as absolute, so it always replaces crystal1.15 with crystal (which in turn is a virtual package providing crystal1.16).
It's possible to work around this, for example with dnf install crystal1.15 --exclude=crystal or dnf --setopt obsoletes=false install crystal1.15. But this only holds until you run dnf upgrade which will replace crystal1.15 with crystal/crystal1.16.
An alternative approach used by other package on Fedora, explained by @refi64:
so it seems like what fedora does with other versioned packages like this is that the versioned and unversioned ones are actually completely separate packages
e.g. back when it was shipping java 21, java-21-openjdk existed, but so did java-latest-openjdk
and the latter Provides: java-21-openjdk to still satisfy dependencies
so in that case, if you installed latest and update, then it's updated w/o issues because there's no deps to replace
but if you installed the versioned one, it'll stay pinned forever
I've adapted the packages a bit in a branch project available at https://build.opensuse.org/project/show/home:straight-shoota:branches:devel:languages:crystal
You can pass OBS_PROJECT=home:straight-shoota:branches:devel:languages:crystal to the installer script in order to install from there. Basically removes the virtual package (and thus the obsoletes) and renames the current version to just crystal. Could be crystal-latest as well, not sure if there's any benefit to that.
Once 1.17 is released, the current state of the crystal/crystal-latest package at 1.16 would be split off into crystal1.16 and then we update latest to 1.17.
This mechanism doesn't seem to work for DEB packages because the Provides declaration does not inform installation commands, so if we only have a crystal package, apt install crystal1.16 wouldn't work. But we need an option to explicitly install version 1.16 instead of tracking latest.
So at least for DEB we'll need both crystal1.16 and crystal/crystal-latest package, whereas the former can point to the latter.
This was first reported on Discord