tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

OS_VERSION on Linux



I'm running Linux with a mostly vanilla kernel, but a couple of local
patches applied. This results in `uname -r` reporting something like
5.8.14+, where the '+' indicates that I the commit I'm on is not
exactly v5.8.14, but it is the closest parent tag.

So, I end up with OS_VERSION=5.8.14+ in the packages I build with
pkgsrc. However, when I install them, I get warnings like

  pkg_add: Warning: package `pkgin-20.8.0' was built for a platform:
  pkg_add: Linux/x86_64 5.8.14+ (pkg) vs. Linux/x86_64 5.8.14 (this host)

This is because on Linux, pkg_install is built with
NUMERIC_VERSION_ONLY, causing the version it reads from uname(3) to be
truncated at the first character that is not a digit or '.'. Looking
through change history, this was made to fix PR pkg/43622, which is
very similar to my problem.

In the end, there is a discrepancy between how pkg_install normalizes
the version (truncating at the first [^0-9.]), and how pkgsrc
normalizes the version (truncating at the first '-'). To reconcile
these two, I propose we change OS_VERSION on Linux to

  OS_VERSION:=	${OS_VERSION:C/[^0-9.].*$//}

Does this seem like the right resolution?


Home | Main Index | Thread Index | Old Index