thanks to some suggestions from Erik Hanson, I have modified the update code to make it more accurate and (hopefully) quicker; also updated sbopkg(8) man page to include the new -c option to check for updates; thanks Erik!

This commit is contained in:
chess.griffin 2008-07-16 14:24:33 +00:00
parent 37b461233f
commit 6fc9636fa5
2 changed files with 46 additions and 29 deletions

View File

@ -28,14 +28,15 @@
#
# Other contributors: Bob Lounsbury, Robby Workman, Alan Hicks, Paul
# Wisehart, slakmagik (thanks for your diff!), Eric Hameleers,
# Michiel van Wessem, hba
# Michiel van Wessem, hba, Erik Hanson. This script would not be
# where it is without the help of these folks. Thank you!
# Variables
SCRIPT=${0##*/}
DIAG=""
SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}"
CWD="$(pwd)"
VER=SVN
SBOVER=SVN
UPDATE_DEBUG="1"
sanity_checks () {
@ -188,23 +189,34 @@ else
echo "Listing installed SlackBuilds.org packages and flagging \
potential updates..." >> $UPDATELIST
for i in $PKGS; do
SHORT=$(echo $i | sed -e 's/-[0-9].*$//')
FULL=$(echo $i | sed -e 's/-noarch.*$\|-i[0-9].*$//')
SBOLD=$(find $LOCALREPO/$SLACKVER -name "$SHORT.SlackBuild")
INFO=$(find $LOCALREPO/$SLACKVER -name "$SHORT.info")
CAT=$(echo $INFO | sed -e "s|$LOCALREPO/$SLACKVER/||" | sed -e "s|/$SHORT.info||" | sed -e "s|$SHORT||")
echo $CAT$FULL >> $UPDATELIST
if [ -n "$INFO" ]; then
PRGNAM=$(cat $SBOLD | egrep -m1 "PRGNAM" | sed -e 's/\"//g' | sed -e 's/^.*=//' | sed -e 's/[ \t]*$//')
VERSION=$(cat $SBOLD | egrep -m1 "VERSION" | sed -e 's/\"//g' | sed -e 's/^.*[=-]//' | sed -e 's/[ }\t]*$//')
ARCH=$(cat $SBOLD | egrep -m1 "ARCH" | sed -e 's/^.*[=-]//' | sed -e 's/[ }\t]*$//g')
BUILD=$(cat $SBOLD | egrep -m1 "BUILD" | sed -e 's/^.*-//' | sed -e 's/[ }\t]*$//g')
TAG=$(cat $SBOLD | egrep -m1 "TAG" | sed -e 's/^.*-//' | sed -e 's/[ }\t]*$//g')
echo $i > $TMP/sbopkg_full
if ! grep -q "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG" $TMP/sbopkg_full; then
# This next code is borrowed and modified from pktool
#echo $i | sed 's/_SBo$//;s/-[^-]*-[^-]*-[^-]*$//'
STRING=$(basename $i _SBo)
INDEX="$(echo $STRING | tr -d -c -)"
INDEX="$(expr length $INDEX + 1)"
NAME=$(expr $INDEX - 3)
NAME="$(echo $STRING | cut -f 1-$NAME -d -)"
VER=$(expr $INDEX - 2)
VER="$(echo $STRING | cut -f $VER -d -)"
ARCH=$(expr $INDEX - 1)
ARCH="$(echo $STRING | cut -f $ARCH -d -)"
BUILD="$(echo $STRING | cut -f $INDEX -d -)"
# End pkgtool code
echo $NAME: >> $UPDATELIST
CURPKG=$(echo $NAME-$VER-$ARCH-$BUILD)
NEWSB=$(find $LOCALREPO/$SLACKVER -name "$NAME.SlackBuild")
NEWINFO=$(find $LOCALREPO/$SLACKVER -name "$NAME.info")
if [ -n "$NEWINFO" ]; then
. $NEWINFO
NEWARCH=$(egrep -m1 "^ARCH" $NEWSB | sed -e 's/^.*[=-]//;s/[ }\t]*$//g')
NEWBUILD=$(egrep -m1 "^BUILD" $NEWSB | sed -e 's/^.*-//;s/[ }\t]*$//g')
echo $CURPKG > $TMP/sbopkg_full
if ! grep -q "$PRGNAM-$VERSION-$NEWARCH-$NEWBUILD" $TMP/sbopkg_full; then
echo " POTENTIAL UPDATE" >> $UPDATELIST
echo " Installed version: " $i >> $UPDATELIST
echo " Repo version: " $PRGNAM-$VERSION-$ARCH-$BUILD$TAG >> $UPDATELIST
echo " Installed version: " $CURPKG >> $UPDATELIST
echo " Repo version: " $PRGNAM-$VERSION-$NEWARCH-$NEWBUILD >> $UPDATELIST
else
echo " No update." >> $UPDATELIST
fi
else
echo " Not in the repo." >> $UPDATELIST
@ -218,7 +230,7 @@ else
cat $UPDATELIST
fi
# Next is for debugging. See variable at top of script to turn on or
# off.
# off. I am going to keep it on in SVN and during RC stages.
if [ "$UPDATE_DEBUG" = 1 ]; then
cp $UPDATELIST $TMP/sbopkg-debug-updatelist
fi
@ -664,7 +676,7 @@ main_menu () {
# This is the main dialog menu.
while [ 0 ]; do
dialog --title "SlackBuilds.org Package Browser \
(sbopkg version $VER)" --menu \
(sbopkg version $SBOVER)" --menu \
"\nChoose one of the following or press <Cancel> to exit\n" \
15 65 9 \
"Rsync" "Rsync with SlackBuilds.org" \
@ -776,7 +788,7 @@ while getopts ":b:cd:f:hlq:rs:v:" OPT; do
;;
h|* )
echo
echo "$SCRIPT v$VER"
echo "$SCRIPT v$SBOVER"
echo "Usage: $SCRIPT [OPTIONS] <packagename(s)>"
echo "Options are:"
echo " -b package Build a package."

View File

@ -23,14 +23,15 @@ Sbopkg can be run from the command line by simply invoking "sbopkg."
Doing so will launch the dialog-based interface, and the menus
provided should be fairly self-explanatory. The main menu allows the
user to rsync with the SlackBuilds.org repository, view the
SlackBuilds.org Changelog, display the contents of the local cache
directory where source tarballs are saved, display the permanent build
log, and browse or search the local copy of the SBo repository. Once
the browse function is chosen, the user can select the category of
software to view. After choosing a category, the user can then view
the various software packages available in that category within the
local SBo repository. Selecting a package will display another menu
allowing the user to view the package's README, SlackBuild, .info, or
SlackBuilds.org Changelog, check for potential updates to SBo
packages, display the contents of the local cache directory where
source tarballs are saved, display the permanent build log, and browse
or search the local copy of the SBo repository. Once the browse
function is chosen, the user can select the category of software to
view. After choosing a category, the user can then view the various
software packages available in that category within the local SBo
repository. Selecting a package will display another menu allowing
the user to view the package's README, SlackBuild, .info, or
slack-desc files. The user can also edit the SlackBuild and the
edited SlackBuild will remain after doing an rsync. Additionally, if
sbopkg is run with root privileges, then the user can choose to build
@ -64,6 +65,10 @@ than one package is specified, they must be in quotes. For example:
will build foo and then bar.
.TP 5
.B -c
Display list of installed SBo packages and potential updates.
.TP 5
.B -d DIRECTORY
Manually specify the full path to the DIRECTORY containing the