Modify format so we just use per line and not to make some code simpler and sbopkg itself a little bit faster. Thanks to Mauro for the suggestion and review. Also update ChangeLog-current.txt re: same

This commit is contained in:
chess.griffin 2009-06-06 19:38:58 +00:00
parent 7b92764155
commit 6ca3e9df3a
2 changed files with 49 additions and 69 deletions

View file

@ -102,3 +102,6 @@ enhancements:
queuefile is parsed, it will recursively go down into the 'bar.sboq' queuefile is parsed, it will recursively go down into the 'bar.sboq'
queuefile as well. The '@' symbol is used in front of an entry in a queuefile as well. The '@' symbol is used in front of an entry in a
queuefile to denote another queuefile. queuefile to denote another queuefile.
* Remove the old "$APP $VERSION$BUILD $ONOFF" format for the temporary queue
and instead make all queue formats "$APP" only. This simplifies some code
and results in a small speed increase.

View file

@ -671,7 +671,7 @@ check_for_updates() {
echo " Repo version: " \ echo " Repo version: " \
$NAME-$NEWVER-$NEWARCH-${NEWBUILD}$REPO_TAG \ $NAME-$NEWVER-$NEWARCH-${NEWBUILD}$REPO_TAG \
>> $UPDATELIST >> $UPDATELIST
echo "$NAME $NEWVER-$NEWBUILD ON" >> \ echo "$NAME Found ON" >> \
$SBOPKGTMP/sbopkg-update-queue $SBOPKGTMP/sbopkg-update-queue
elif [[ $UPDATED -eq -1 ]]; then elif [[ $UPDATED -eq -1 ]]; then
if [[ $DEBUG -ge 1 ]]; then if [[ $DEBUG -ge 1 ]]; then
@ -716,6 +716,8 @@ check_for_updates() {
# Permanent log of the updatelist is saved when DEBUG is enabled. # Permanent log of the updatelist is saved when DEBUG is enabled.
if [[ $DEBUG -ge 1 ]]; then if [[ $DEBUG -ge 1 ]]; then
cp $UPDATELIST $SBOPKGTMP/sbopkg-debug-updatelist cp $UPDATELIST $SBOPKGTMP/sbopkg-debug-updatelist
else
rm $UPDATELIST
fi fi
else else
rm -f $PROGRESSBAR_INTERRUPTED rm -f $PROGRESSBAR_INTERRUPTED
@ -1122,7 +1124,7 @@ info_item() {
break break
fi fi
;; ;;
Queue ) add_item_to_queue $APP $CURVERSION-$CURBUILD ON ;; Queue ) add_item_to_queue $APP ;;
Build ) Build )
echo "$APP" > $SBOPKGTMP/sbopkg-start-queue echo "$APP" > $SBOPKGTMP/sbopkg-start-queue
start_dialog_queue ;; start_dialog_queue ;;
@ -1748,77 +1750,58 @@ EOF
} }
add_item_to_queue() { add_item_to_queue() {
# This function can take up to three arguments: APP, VERSIONBUILD, and # This function takes one argument: APP. When loading a userqueue, some
# ONOFF and normally does when items are added to the build queue from the # APPS may have a '-' or a '@' as the first character, which means to set
# dialog menus. However, saved user queues only have one item per line, # the APP to 'OFF' in the dialog menu, or to recursively load another
# which is the application name. If the application was deselected when # queuefile, respectively. If an APP is found in the repo, then add it to
# the queue was saved, then a '-' is appended to the front of the # TMPQUEUE.
# application name in the queuefile. This means that, when
# load_user_queue reads each line of a saved queuefile and sends it to
# add_item_to_queue, the second and third arguments will be empty.
# Therefore, the start of this function first tests to see if the second
# argument is empty. If so, then it proceeds to gather information about
# the application like the VERSION and BUILD, and then sets ONOFF to 'OFF'
# if the first character was '-' otherwise it is set to 'ON'. If we
# have all three arguments, then we continue on. If APP is already in the
# queue and is of a different version, ask user if they want to replace it
# (so updated pkgs will get updated in the queue).
#
# If an obsolete name is used, add_item_to_queue() automatically retrieves # If an obsolete name is used, add_item_to_queue() automatically retrieves
# and uses the current name. # and uses the current name.
# #
# This function returns 0 if the insertion was successful, 1 otherwise. # This function returns 0 if the insertion was successful, 1 otherwise.
local APP=$1 local APP=$1
local VERSIONBUILD=$2
local ONOFF=$3
local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck
local UPDATEQUEUE=$SBOPKGTMP/sbopkg-update-queue local UPDATEQUEUE=$SBOPKGTMP/sbopkg-update-queue
local MISSING_LIST_FILE=$SBOPKGTMP/sbopkg_addall_missing local MISSING_LIST_FILE=$SBOPKGTMP/sbopkg_addall_missing
local TESTONOFF PRGNAM VERSION HOMEPAGE DOWNLOAD MD5SUM MAINTAINER EMAIL local FILE ONOFF
local APPROVED BUILD FILE
if [[ -z $VERSIONBUILD ]]; then # This next if is for legacy queuefiles with $APP $VERSION$BUILD $ONOFF
if [[ ${APP:0:1} == "-" ]]; then if [[ $3 =~ "[Oo][Ff][Ff]" ]]; then
if [[ $DIAG ]]; then APP=-$APP
APP=${APP:1} fi
ONOFF=OFF if [[ ${APP:0:1} == "-" ]]; then
else APP=${APP:1}
return 0 ONOFF=OFF
fi elif [[ ${APP:0:1} == "@" ]]; then
elif [[ ${APP:0:1} == "@" ]]; then APP=${APP:1}
APP=${APP:1} FILE="$QUEUEDIR/$APP.sboq"
FILE="$QUEUEDIR/$APP.sboq" # FIXME: This next line unset APP is there to apparently fix an
# FIXME: This next line unset APP is there to apparently fix an # issue where a recursive queue with a @ in front of it would
# issue where a recursive queue with a @ in front of it would # finish up and then cut off the first letter of the next package
# finish up and then cut off the first letter of the next package # listed in the original queue, i.e. a queue with @foo on line 1
# listed in the original queue, i.e. a queue with @foo on line 1 # and openbox on line 2, would cut off the first 'o' in openbox
# and openbox on line 2, would cut off the first 'o' in openbox # upon @foo returning from parse_queue.
# upon @foo returning from parse_queue. unset APP
unset APP if [[ -r $FILE ]]; then
if [[ -r $FILE ]]; then parse_queue $FILE
parse_queue $FILE
else
return 1
fi
return 0
else else
ONOFF=ON return 1
fi fi
if ! search_package $APP; then return 0
get_new_name APP $APP else
search_package $APP || return 1 ONOFF=ON
fi fi
. $PKGPATH/$APP.info if ! search_package $APP; then
BUILD=$(egrep -m1 "^BUILD" $PKGPATH/$APP.SlackBuild | get_new_name APP $APP
sed -e 's/^.*[=-]//;s/\"//;s/[ #}\t].*$//g;s/\"//g') search_package $APP || return 1
VERSIONBUILD="$VERSION-$BUILD"
fi fi
if grep -q "^$APP " $TMPQUEUE 2> /dev/null; then if grep -q "^$APP " $TMPQUEUE 2> /dev/null; then
: # it's the same app and version so toss it : # it's the same app and version so toss it
else else
if [[ $DIAG ]]; then if [[ $DIAG ]]; then
echo "$APP $VERSIONBUILD $ONOFF" >> $TMPQUEUE echo "$APP Found $ONOFF" >> $TMPQUEUE
else else
echo "$APP" >> $TMPQUEUE echo "$APP" >> $TMPQUEUE
fi fi
@ -2190,7 +2173,7 @@ gen_search_package() {
break break
fi fi
else # $CHOICE = 3 else # $CHOICE = 3
add_item_to_queue $SRCHPKG $RVERSION-$RBUILD ON add_item_to_queue $SRCHPKG
break break
fi fi
done done
@ -2292,7 +2275,7 @@ string_search() {
cut -d= -f2 | sed s/\"//g) cut -d= -f2 | sed s/\"//g)
RBUILD=$(egrep -m1 "^BUILD" $SHORTPATH/$SRCHPKG.SlackBuild | RBUILD=$(egrep -m1 "^BUILD" $SHORTPATH/$SRCHPKG.SlackBuild |
sed -e 's/^.*[=-]//;s/\"//;s/[ #}\t].*$//g;s/\"//g') sed -e 's/^.*[=-]//;s/\"//;s/[ #}\t].*$//g;s/\"//g')
add_item_to_queue $SRCHPKG $RVERSION-$RBUILD ON add_item_to_queue $SRCHPKG
continue continue
;; ;;
*) *)
@ -3051,15 +3034,12 @@ check_asc() {
local GPGNAME=$(basename $CHKPKG) local GPGNAME=$(basename $CHKPKG)
local CATEGORY=$(echo $CHKPKG | cut -d/ -f2) local CATEGORY=$(echo $CHKPKG | cut -d/ -f2)
echo
echo "Checking GPG for $GPGNAME..."
if [[ ! -e $CHKPKG.tar.gz ]]; then if [[ ! -e $CHKPKG.tar.gz ]]; then
echo "GPG check skipped! No tarball found." | tee -a $TMPLOG echo "GPG check skipped! No tarball found." | tee -a $TMPLOG
return 0 return 0
fi fi
echo
if ! gpg --verify $CHKPKG.*.asc > /dev/null 2>&1; then if ! gpg --verify $CHKPKG.*.asc > /dev/null 2>&1; then
echo "GPG check failed!" | tee -a $TMPLOG echo "$GPGNAME: GPG check failed!" | tee -a $TMPLOG
while :; do while :; do
cat << EOF cat << EOF
@ -3097,7 +3077,7 @@ EOF
esac esac
done done
else else
echo "GPG check passed." | tee -a $TMPLOG echo "GPG check passed." >> $TMPLOG
fi fi
tar -C ./$CATEGORY -zxf $CHKPKG.tar.gz tar -C ./$CATEGORY -zxf $CHKPKG.tar.gz
return 0 return 0
@ -3127,6 +3107,8 @@ process_queue() {
echo "Queue process: build" >> $TMPLOG echo "Queue process: build" >> $TMPLOG
fi fi
echo >> $TMPLOG echo >> $TMPLOG
echo "Checking GPG signatures. Please be patient..."
echo
COUNTER=1 COUNTER=1
for CHKBUILD in $(< $STARTQUEUE); do for CHKBUILD in $(< $STARTQUEUE); do
# FIXME: This section still needs to be reviewed # FIXME: This section still needs to be reviewed
@ -3636,12 +3618,7 @@ main_updates() {
"$(crunch "Would you like to add the flagged updates to \ "$(crunch "Would you like to add the flagged updates to \
the build queue?")" 8 35 the build queue?")" 8 35
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
# Reading from $UPDATES_QUEUE... cat $UPDATES_QUEUE >> $TMPQUEUE
while read PICK; do
eval $(sed "s/^\(.*\) \(.*\) \(.*\)\$/\
APP=\\1 VERSIONBUILD=\\2 ONOFF=\\3/g" <<< $PICK)
add_item_to_queue $APP $VERSIONBUILD $ONOFF
done < $UPDATES_QUEUE
rm -f $UPDATES_QUEUE rm -f $UPDATES_QUEUE
dialog --title "Done" --msgbox "$(crunch "The flagged \ dialog --title "Done" --msgbox "$(crunch "The flagged \
updates have been added to the build queue.")" 8 30 updates have been added to the build queue.")" 8 30