say goodbye to old update code :-)

This commit is contained in:
chess.griffin 2009-01-27 19:16:05 +00:00
parent 2b278c7294
commit fedbca2b32

View file

@ -571,220 +571,6 @@ function updates__compare_versions() {
echo $RESULT
}
# FIXME CLEANUP This is old stuff, and should be deleted if the new version
# works reliably.
check_for_updates_old () {
# Check to see if there are any updates to installed SBo pkgs. This
# is is pretty ugly code and is not really 100% reliable due to the
# many ways upstream tags software names, versions, etc. Consider
# this a continual work-in-progress. :-)
check_if_repo_exists
UPDATELIST=$TMP/sbopkg_updatelist
rm -f $UPDATELIST
if [ "$DIAG" = 1 ]; then
dialog --title "Check for updates?" --yesno "Would you like to \
check for updates? This is an experimental feature and should not \
be used as a substitute for reading the SBo ChangeLog.txt. If you \
proceed, it might take a few seconds to process, depending on the \
number of SlackBuilds.org packages you have installed.\n\n\
If you encounter any errors or strange behavior, please read the \
document entitled 'UPDATELIST-DEBUGGING' in the sbopkg doc \
directory to assist with bug reporting.\n\nSelect \
YES to continue or NO to cancel." 19 50
if [ $? = 1 ]; then
continue
fi
else
while true; do
echo "Would you like to check for updates? This is an"
echo "experimental feature and should not be used as a"
echo "substitute for reading the SBo ChangeLog.txt."
echo
echo "If you encounter any errors or strange behavior, please"
echo "read the document entitled 'UPDATELIST-DEBUGGING' in"
echo "the sbopkg doc directory to assist with bug reporting."
echo
echo "If you proceed, it might take a few moments to process."
echo "Press Y to continue or N to cancel."
read ANS
case $ANS in
y* | Y* ) break
;;
n* | N* ) exit 0
;;
* ) echo "Unknown response."
;;
esac
done
fi
cd /var/log/packages
PKGS=$(ls *SBo* 2>/dev/null)
if [ -z "$PKGS" ]; then
echo "No SlackBuilds.org packages detected." >> $UPDATELIST
else
echo "Building list of potential updates..."
echo "Listing installed SlackBuilds.org packages and flagging \
potential updates..." >> $UPDATELIST
echo >> $UPDATELIST
for i in $PKGS; do
# This next code is borrowed and modified from pkgtool
#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
# Ugly hack #1 for artwiz-aleczapka
if $(echo $NAME | grep -q "^artwiz"); then
OLDNAME=$NAME
NAME="artwiz-aleczapka"
fi
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/[ #}\t].*$//;s/^.*[=-]//;s/\"//g')
NEWSRCVER=$(egrep -m1 "^SRCVER" $NEWSB | sed -e 's/[ #}\t].*$//;s/^.*[=-]/_/;s/\"//g')
NEWBUILD=$(egrep -m1 "^BUILD" $NEWSB | sed -e 's/^.*[=-]//;s/\"//;s/[ #}\t].*$//g;s/\"//g')
# Three hacks for names that changed during 12.1 repo cycle
if $(echo $NAME | grep -q "^libsigcxx"); then
NAME="libsigc++"
PRGNAM="libsigc++"
fi
if $(echo $NAME | grep -q "^libxmlxx"); then
NAME="libxml++"
PRGNAM="libxml++"
fi
if $(echo $NAME | grep -q "^TiMidityxx"); then
NAME="TiMidity++"
PRGNAM="TiMidity++"
fi
# Ugly hack for acroread
if [ $PRGNAM = "acroread" ]; then
NEWSRCVER=$(egrep -m1 "^ADOBE_LANG" $NEWSB | sed -e 's/[ #}\t].*$//;s/^.*://;s/-/_/g')
fi
# Ugly hack for openoffice.org
if [ $PRGNAM = "openoffice.org" ]; then
NEWSRCVER=$(egrep -m1 "^OOLANG" $NEWSB | sed -e 's/[ #}\t].*$//;s/^.*://;s/-/_/g')
fi
# Ugly hack for mplayer
if [[ "$PRGNAM" == "MPlayer" || "$PRGNAM" == "mplayer" || "$NAME" == "MPlayer" ]]; then
PRGNAM="mplayer"
NAME="mplayer"
if $(echo $VER | grep -q "^svn_r"); then
VER=$(echo $VER | sed -e 's/r//;s/_/_000/')
fi
fi
# Ugly hack for openarena ... is there a trend here? :-)
if [ $PRGNAM = "openarena" ]; then
VERSION=$(egrep -m1 "^FINAL_VERSION" $NEWSB | sed -e 's/[ #}\t].*$//;s/^.*-//;s/\"//g')
fi
# Ugly hack #2 for artwiz-aleczapka :-(
if [ $PRGNAM = "artwiz-aleczapka" ]; then
NAME=$OLDNAME
PRGNAM="$PRGNAM$(egrep -m1 "^FONTLANG" $NEWSB | sed -e 's/[ #}\t].*$//;s/^.*://;s/_/-/g')"
fi
# Ugly hack for djvulibre
if [ $PRGNAM = "djvulibre" ]; then
VERSION=$(echo $VERSION | sed -e 's/[ #}\t].*$//;s/^.*://;s/-/./g')
NEWSRCVER=""
fi
if [[ $NAME == "virtualbox-kernel" || $NAME == "nvidia-kernel" ]]; then
UNAME="$(echo $(uname -r) | sed -e 's/-/_/')"
VERSION="$(echo ${VERSION}_${UNAME})"
fi
# Ugly hack for several SlackBuilds that use $SRCVER
# but not in the final package name, so we need to
# blank out $NEWSRCVER
if [[ "$PRGNAM" == "ctorrent" || "$PRGNAM" == "argtable" || "$PRGNAM" == "libevent" || "$PRGNAM" == "graveman" || "$PRGNAM" == "hugin" || "$PRGNAM" == "lame" || "$PRGNAM" == "kchmviewer" || "$PRGNAM" == "aircrack-ng" || "$PRGNAM" == "pygame" || "$PRGNAM" == "gnubg" || "$PRGNAM" == "ubuntulooks" || "$PRGNAM" == "xerces-c" || "$PRGNAM" == "ksmoothdock" ]]; then
NEWSRCVER=""
fi
CURPKG=$(echo $NAME-$VER-$ARCH-$BUILD)
# Okay, these next three lines were added as an attempt to
# fix the so-called 'decimal' problem that exists in bash,
# since bash typically compares strings using their ascii
# values, which is why 3.9 will show up as greater than
# 3.11. Essentially, these lines look for a single number
# that is surrounded by dots, or a single number at the
# start of a line, and then puts a 0 in front of it.
TESTVERSION=$(echo $VERSION | sed -e 's/[_.]\([1-9]\)\b/\.0\1/g;s/^\([1-9]\)\.\b/0\1\./')
TESTNEWSRCVER=$(echo $NEWSRCVER | sed -e 's/[_.]\([1-9]\)\b/\.0\1/g;s/^\([1-9]\)\.\b/0\1\./')
TESTVER=$(echo $VER | sed -e 's/[_.]\([1-9]\)\b/\.0\1/g;s/^\([1-9]\)\.\b/0\1\./')
if [ $PRGNAM = "acroread" ]; then
TESTVER=$(echo $VER | sed -e 's/[_.]\([1-9]\)/\.0\1/g;s/^\([1-9]\)\.\b/0\1\./')
fi
if [ $PRGNAM = "tmux" ]; then
TESTVERSION=$(echo $VERSION | sed -e 's/[_.]\([1-9]\)/\.0\1/g;s/^\([1-9]\)\.\b/0\1\./')
fi
#if [[ $VERSION$NEWSRCVER > $VER || ( $VERSION$NEWSRCVER = $VER && $NEWBUILD > $BUILD ) ]]; then
if [[ $TESTVERSION$TESTNEWSRCVER > $TESTVER || ( $TESTVERSION$TESTNEWSRCVER = $TESTVER && $NEWBUILD > $BUILD ) ]]; then
echo $NAME: >> $UPDATELIST
echo " POTENTIAL UPDATE" >> $UPDATELIST
echo " Installed version: " $CURPKG >> $UPDATELIST
echo " Repo version: " $PRGNAM-$VERSION$NEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo "$PRGNAM $VERSION$NEWSRCVER-$NEWBUILD ON" >> $TMP/sbopkg-update-queue
if [ "$DEBUG" -eq "2" ]; then
echo " Debug: " $VERSION$NEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Debug2: " $TESTVERSION$TESTNEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Debug3: " $VER >> $UPDATELIST
echo " Debug4: " $TESTVER >> $UPDATELIST
fi
#elif [[ $VERSION$NEWSRCVER < $VER || ( $VERSION$NEWSRCVER = $VER && $NEWBUILD < $BUILD ) ]]; then
elif [[ $TESTVERSION$TESTNEWSRCVER < $TESTVER || ( $TESTVERSION$TESTNEWSRCVER = $TESTVER && $NEWBUILD < $BUILD ) ]]; then
if [ "$DEBUG" -ge "1" ]; then
echo $NAME: >> $UPDATELIST
echo " INSTALLED PACKAGE IS NEWER THAN REPO" >> $UPDATELIST
echo " Installed version: " $CURPKG >> $UPDATELIST
#echo " Repo version: " $PRGNAM$NEWSRCVER-$VERSION-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Repo version: " $PRGNAM-$VERSION$NEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
if [ "$DEBUG" -eq "2" ]; then
echo " Debug: " $VERSION$NEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Debug2: " $TESTVERSION$TESTNEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Debug3: " $VER >> $UPDATELIST
echo " Debug4: " $TESTVER >> $UPDATELIST
fi
fi
#elif [[ $VERSION$NEWSRCVER = $VER && $NEWBUILD = $BUILD ]]; then
elif [[ $TESTVERSION$TESTNEWSRCVER = $TESTVER && $NEWBUILD = $BUILD ]]; then
#if [[ "$DEBUG" -ge "1" && "$FULL_DEBUG" = 1 ]]; then
if [ "$DEBUG" -eq "2" ]; then
echo $NAME: >> $UPDATELIST
echo " No update." >> $UPDATELIST
echo " Debug: " $VERSION$NEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Debug2: " $TESTVERSION$TESTNEWSRCVER-$NEWARCH-$NEWBUILD >> $UPDATELIST
echo " Debug3: " $VER >> $UPDATELIST
echo " Debug4: " $TESTVER >> $UPDATELIST
fi
fi
else
if [ "$DEBUG" -ge "1" ]; then
echo $NAME: >> $UPDATELIST
echo " Not in the repository." >> $UPDATELIST
fi
fi
done
echo >> $UPDATELIST
echo "Potential update list complete." >> $UPDATELIST
fi
if [ "$DIAG" = 1 ]; then
dialog --title "Viewing potential updates." --textbox \
$UPDATELIST 0 0
else
${PAGER:-more} $UPDATELIST
fi
# Permanent log of the updatelist is saved when DEBUG is enabled.
if [ "$DEBUG" -ge "1" ]; then
cp $UPDATELIST $TMP/sbopkg-debug-updatelist
fi
}
get_category_list () {
# This function displays the list of SBo categories in the dialog.
check_if_repo_exists