Fix: debian kernel version parsing
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 9 Jan 2018 20:43:19 +0000 (15:43 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 9 Jan 2018 21:28:02 +0000 (16:28 -0500)
The debian version script only worked for ckt kernels and that was fine
until now because we only had checks for those versions in the code.

ckt (Canonical Kernel Team) kernels were used for a while during the jessie
cycle, their versionning is a bit different. They track the upstream vanilla
stable updates but they don't update the minor version number and instead add
an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
switched back to upstream style at 3.16.36.

Knowing that, we can compare regular debian and ckt kernel versions
using this scheme :

  MAJOR.PATCHLEVEL.SUBLEVEL.CKT.DEBABI.DEBPATCH

And setting CKT to zero for non-ckt kernels.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
abi-debian-version.sh

index 310d6a802fbc228609d81f61daa62d4a702c4d85..36da2129dabf84f26eee8c7f071da7cb0a19b56f 100755 (executable)
@@ -12,24 +12,26 @@ fi
 
 # Assuming KPATH is the target kernel headers directory
 DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian (.*)"/\1/p' ${KPATH}/include/generated/package.h)
+
 # Ignore backports part
 DEB_PACKAGE_VERSION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/~(bpo|deb).*//')
+
+# ckt (Canonical Kernel Team) kernels were used for a while during the jessie
+# cycle, their versionning is a bit different. They track the upstream vanilla
+# stable updates but they don't update the minor version number and instead add
+# an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
+# switched back to upstream style at 3.16.36.
+
 # Get -ckt update number, if present
 KERNEL_CKT_UPDATE=$(echo ${DEB_PACKAGE_VERSION} | sed -rn 's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')
-
-# Only care about the rest if it is a -ckt kernel, making sure we do not
-# clash with older Debian kernels (e.g. Debian 3.2.65-1+deb7u2).
-if [ -z "${KERNEL_CKT_UPDATE}" ]; then
-       echo 0
-       exit 0
-fi
+test -n "${KERNEL_CKT_UPDATE}" || KERNEL_CKT_UPDATE=0
 
 # Get package revision
 DEB_PACKAGE_REVISION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/.*-([^-]+)$/\1/')
 # Get non-sec update number
 DEB_PACKAGE_REVISION_BASE=$(echo ${DEB_PACKAGE_REVISION} | sed -r 's/^([0-9]+).*/\1/')
 # Get security update number, if present
-DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 's/.*\+(squeeze|deb[0-9])+u([0-9]+)$/\1/p')
+DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
 test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
 # Combine all update numbers into one
 DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 10000 + DEB_PACKAGE_REVISION_BASE * 100 + DEB_PACKAGE_REVISION_SECURITY))
This page took 0.026098 seconds and 4 git commands to generate.