FS#73889 - spirv-headers versioning is broken

Attached to Project: Community Packages
Opened by Alex Wood (ajw107) - Saturday, 19 February 2022, 16:57 GMT
Last edited by Bruno Pagani (ArchangeGabriel) - Friday, 04 March 2022, 22:37 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Package: spirv-headers
Due to bad versioning code different package managers would get confused (e.g. spirv-headers 1.5.4.raytracing.fixed-1 is lexicographically the highest version, but spirv-headers 1.5.4.r106+ge71fedd-1 was the lastest). This can result in the package being upgraded and downgraded if you switch between package managers.
This is caused by pkgver() being set to the github tag, which was not the full version. The main version is stored in CMakeList.txt, so this should be added to the start of the verion from github to create the full version.

Also the sed commands to sanitise the version numbers are not correct, they do not remove all '-' or any '/'

Additional info:
* package version(s)
If the package continues to use the github tags, you get the following version (in order from oldest to newest):
- 1.5.4.raytracing.fixed-1
- 1.5.4.r106+ge71fedd-1 (as this is a random commit version)
- sdk-1.2.198.0.r1-g814e72-1 (this will look like a downgrade, but is an upgrade)
- sdk-1.3.204.0.r1.gb42ba6-1
- sdk-1.3.204.0.r1.6a55fad-1 (latest commit, as of 19/02/2022)

Adding the version number from CMakeList.txt at the start of this would mean we would have parsable version numbers again:
- 1.5.4.1.5.4.raytracing.fixed-1
- 1.5.4.1.5.4.r106+ge71fedd-1
- 1.5.5.sdk-1.2.198.0.r1-g814e72-1
- 1.5.5.sdk-1.3.204.0.r1.gb42ba6-1
- 1.5.5.sdk-1.3.204.0.r1.6a55fad-1

* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
- Update/install spirv-headers in pacman/pamac/yay/paru/etc (updates to 1.5.4.r106+ge71fedd-1)
- Open Discover, states an update is available to 1.5.4.raytracing.fixed-1 (the previous version)

I am unable to attach a PKGBUILD with code in to correct this, so here is the diff (Note this also updates the package to the latest commit):

--- spirv-headers/PKGBUILD 2021-10-23 09:24:10.000000000 +0100
+++ spirv-headers_PKGBUILD 2022-02-19 16:53:51.649914363 +0000
@@ -3,8 +3,8 @@

_pkg=SPIRV-Headers
pkgname=spirv-headers
-pkgver=1.5.4.r106+ge71fedd
-pkgrel=2
+pkgver=1.5.5.sdk.1.3.204.0.r1.g6a55fad
+pkgrel=1
pkgdesc="SPIR-V Headers"
arch=(any)
url="https://www.khronos.org/registry/spir-v/"
@@ -13,13 +13,15 @@
# From either https://github.com/KhronosGroup/SPIRV-Tools/blob/master/DEPS
# or https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/master/spirv-headers-tag.conf
# using whatever is newest for latest release
-_commit=e71feddb3f17c5586ff7f4cfb5ed1258b800574b
+_commit=6a55fade62dec6a406a5a721148f88a2211cbefa
source=(git+https://github.com/KhronosGroup/${_pkg}.git#commit=${_commit})
sha512sums=(SKIP)

pkgver() {
cd ${_pkg}
- git describe --tags --exclude '*raytracing*' | sed 's/\([^-]*-g\)/r\1/;s/-/./;s/-/+/'
+ _full_ver="$(grep "SPIRV-Headers VERSION" CMakeLists.txt | awk '{print $3}' | tr --delete '()')"
+ _sub_ver="$(git describe --tags --exclude '*raytracing*' | sed 's/\([^-]*-g\)/r\1/')"
+ echo "${_full_ver}.${_sub_ver}" | sed 's/-/./g;s/-/+/g;s|/|_|g'
}

build() {
This task depends upon

Closed by  Bruno Pagani (ArchangeGabriel)
Friday, 04 March 2022, 22:37 GMT
Reason for closing:  Fixed
Additional comments about closing:  I’ve actually switched to sdk versionning and added an epoch for the switch.
Comment by Alex Wood (ajw107) - Saturday, 19 February 2022, 16:59 GMT
Just seeing if I can attack the updated PKGBUILD now
Comment by Alex Wood (ajw107) - Sunday, 20 February 2022, 00:56 GMT
Sorry, refreshed page and accidently resent form

Loading...