From 5e36b3195c6a165a9ee64d8e6800c8b3b2902fa0 Mon Sep 17 00:00:00 2001 From: "mauro.giachero" Date: Fri, 28 Aug 2009 16:57:04 +0000 Subject: [PATCH] Fix the updates check for Slackware 13.0 In the updates check we split the package name expression (on the makepkg line) counting dashes. The 13.0 scripts now have, instead of 'tgz', the expression ${PKGTYPE:-tgz} at the end. This makes us pick up the ARCH field instead. Fix this by suppressing any ':-' operation found. This should be reasonably safe (no 12.2 script has such expression there). While at it, replace the old cut/rev dance with a single sed invocation. Signed-off-by: Mauro Giachero --- ChangeLog-current.txt | 2 +- src/usr/sbin/sbopkg | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog-current.txt b/ChangeLog-current.txt index aef83b3..54845ae 100644 --- a/ChangeLog-current.txt +++ b/ChangeLog-current.txt @@ -2,5 +2,5 @@ Mon Aug 24 18:13:53 UTC 2009 Sbopkg 0.XX.X released. This version contains the following fixes and enhancements: - * + * Fix the updates code for the 13.0 repo. +--------------------------+ diff --git a/src/usr/sbin/sbopkg b/src/usr/sbin/sbopkg index 02d70e4..1e67ce7 100755 --- a/src/usr/sbin/sbopkg +++ b/src/usr/sbin/sbopkg @@ -667,7 +667,16 @@ check_for_updates() { # This is harmless, and the proper cleanup is performed in # Step 4. VERSION_EXPRESSION=$(tac $NEWSB | grep -m1 \$OUTPUT/ | - cut -d\$ -f2- | cut -d- -f2- | rev | cut -d- -f3- | rev) + sed 's/[^$]*$\(.*\)$/\1/; + s/:-//; + s/^[^-]*-\(.*\)-[^-]*-[^-]*/\1/') + # Explanation of the above 'sed': + # - take from the first $ on (cuts "makepkg" with its + # options, if present + # - drop ':-', which is not present in any 12.2 script + # but is in every 13.0 script (${PKGTYPE:-tgz}) + # - narrow the thing a bit deleting everything before + # the first dash or after the penultimate one. echo "echo $VERSION_EXPRESSION" > $VERSION_FILE # Step 2 - find the used variables and their expressions