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 # Other contributors: Bob Lounsbury, Robby Workman, Alan Hicks, Paul
# Wisehart, slakmagik (thanks for your diff!), Eric Hameleers, # 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 # Variables
SCRIPT=${0##*/} SCRIPT=${0##*/}
DIAG="" DIAG=""
SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}" SBOPKG_CONF="${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf}"
CWD="$(pwd)" CWD="$(pwd)"
VER=SVN SBOVER=SVN
UPDATE_DEBUG="1" UPDATE_DEBUG="1"
sanity_checks () { sanity_checks () {
@ -188,23 +189,34 @@ else
echo "Listing installed SlackBuilds.org packages and flagging \ echo "Listing installed SlackBuilds.org packages and flagging \
potential updates..." >> $UPDATELIST potential updates..." >> $UPDATELIST
for i in $PKGS; do for i in $PKGS; do
SHORT=$(echo $i | sed -e 's/-[0-9].*$//') # This next code is borrowed and modified from pktool
FULL=$(echo $i | sed -e 's/-noarch.*$\|-i[0-9].*$//') #echo $i | sed 's/_SBo$//;s/-[^-]*-[^-]*-[^-]*$//'
SBOLD=$(find $LOCALREPO/$SLACKVER -name "$SHORT.SlackBuild") STRING=$(basename $i _SBo)
INFO=$(find $LOCALREPO/$SLACKVER -name "$SHORT.info") INDEX="$(echo $STRING | tr -d -c -)"
CAT=$(echo $INFO | sed -e "s|$LOCALREPO/$SLACKVER/||" | sed -e "s|/$SHORT.info||" | sed -e "s|$SHORT||") INDEX="$(expr length $INDEX + 1)"
echo $CAT$FULL >> $UPDATELIST NAME=$(expr $INDEX - 3)
if [ -n "$INFO" ]; then NAME="$(echo $STRING | cut -f 1-$NAME -d -)"
PRGNAM=$(cat $SBOLD | egrep -m1 "PRGNAM" | sed -e 's/\"//g' | sed -e 's/^.*=//' | sed -e 's/[ \t]*$//') VER=$(expr $INDEX - 2)
VERSION=$(cat $SBOLD | egrep -m1 "VERSION" | sed -e 's/\"//g' | sed -e 's/^.*[=-]//' | sed -e 's/[ }\t]*$//') VER="$(echo $STRING | cut -f $VER -d -)"
ARCH=$(cat $SBOLD | egrep -m1 "ARCH" | sed -e 's/^.*[=-]//' | sed -e 's/[ }\t]*$//g') ARCH=$(expr $INDEX - 1)
BUILD=$(cat $SBOLD | egrep -m1 "BUILD" | sed -e 's/^.*-//' | sed -e 's/[ }\t]*$//g') ARCH="$(echo $STRING | cut -f $ARCH -d -)"
TAG=$(cat $SBOLD | egrep -m1 "TAG" | sed -e 's/^.*-//' | sed -e 's/[ }\t]*$//g') BUILD="$(echo $STRING | cut -f $INDEX -d -)"
echo $i > $TMP/sbopkg_full # End pkgtool code
if ! grep -q "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG" $TMP/sbopkg_full; then 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 " POTENTIAL UPDATE" >> $UPDATELIST
echo " Installed version: " $i >> $UPDATELIST echo " Installed version: " $CURPKG >> $UPDATELIST
echo " Repo version: " $PRGNAM-$VERSION-$ARCH-$BUILD$TAG >> $UPDATELIST echo " Repo version: " $PRGNAM-$VERSION-$NEWARCH-$NEWBUILD >> $UPDATELIST
else
echo " No update." >> $UPDATELIST
fi fi
else else
echo " Not in the repo." >> $UPDATELIST echo " Not in the repo." >> $UPDATELIST
@ -218,7 +230,7 @@ else
cat $UPDATELIST cat $UPDATELIST
fi fi
# Next is for debugging. See variable at top of script to turn on or # 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 if [ "$UPDATE_DEBUG" = 1 ]; then
cp $UPDATELIST $TMP/sbopkg-debug-updatelist cp $UPDATELIST $TMP/sbopkg-debug-updatelist
fi fi
@ -664,7 +676,7 @@ main_menu () {
# This is the main dialog menu. # This is the main dialog menu.
while [ 0 ]; do while [ 0 ]; do
dialog --title "SlackBuilds.org Package Browser \ 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" \ "\nChoose one of the following or press <Cancel> to exit\n" \
15 65 9 \ 15 65 9 \
"Rsync" "Rsync with SlackBuilds.org" \ "Rsync" "Rsync with SlackBuilds.org" \
@ -776,7 +788,7 @@ while getopts ":b:cd:f:hlq:rs:v:" OPT; do
;; ;;
h|* ) h|* )
echo echo
echo "$SCRIPT v$VER" echo "$SCRIPT v$SBOVER"
echo "Usage: $SCRIPT [OPTIONS] <packagename(s)>" echo "Usage: $SCRIPT [OPTIONS] <packagename(s)>"
echo "Options are:" echo "Options are:"
echo " -b package Build a package." 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 Doing so will launch the dialog-based interface, and the menus
provided should be fairly self-explanatory. The main menu allows the provided should be fairly self-explanatory. The main menu allows the
user to rsync with the SlackBuilds.org repository, view the user to rsync with the SlackBuilds.org repository, view the
SlackBuilds.org Changelog, display the contents of the local cache SlackBuilds.org Changelog, check for potential updates to SBo
directory where source tarballs are saved, display the permanent build packages, display the contents of the local cache directory where
log, and browse or search the local copy of the SBo repository. Once source tarballs are saved, display the permanent build log, and browse
the browse function is chosen, the user can select the category of or search the local copy of the SBo repository. Once the browse
software to view. After choosing a category, the user can then view function is chosen, the user can select the category of software to
the various software packages available in that category within the view. After choosing a category, the user can then view the various
local SBo repository. Selecting a package will display another menu software packages available in that category within the local SBo
allowing the user to view the package's README, SlackBuild, .info, or 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 slack-desc files. The user can also edit the SlackBuild and the
edited SlackBuild will remain after doing an rsync. Additionally, if edited SlackBuild will remain after doing an rsync. Additionally, if
sbopkg is run with root privileges, then the user can choose to build 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. will build foo and then bar.
.TP 5
.B -c
Display list of installed SBo packages and potential updates.
.TP 5 .TP 5
.B -d DIRECTORY .B -d DIRECTORY
Manually specify the full path to the DIRECTORY containing the Manually specify the full path to the DIRECTORY containing the