minor whitespace fix; add a new 'add_item_to_queue' that will be a function called from several places -- it takes APP and VERSIONBUILD as arguments, and then tests to see if APP is already in the queue; if not, add it; if so, then ask user if they want to replace or skip. See the comment to this function for more info. This function is not finished and is not called anywhere yet.

This commit is contained in:
chess.griffin 2009-01-20 03:35:45 +00:00
parent 4c37d528ee
commit 2578c33894

View file

@ -811,8 +811,7 @@ empty_queue () {
# This function tests whether the temporary build queue is empty.
TMPQUEUE=$TMP/sbopkg-tmp-queue
if [ ! -e $TMPQUEUE ]; then
dialog --title "Empty Queue" --msgbox \
"The build queue is empty." 8 30
dialog --title "Empty Queue" --msgbox "The build queue is empty." 8 30
return 0
else
return 1
@ -1021,6 +1020,33 @@ clear_build_queue () {
fi
}
add_item_to_queue () {
# This function takes $1 and puts in the TMPQUEUE. If it is already in
# the queue, just replace it (so updated pkgs will get updated in the
# queue). NOTE: this is a work-in-progress; this function is not called
# yet. The idea is that whenever an item is added to the queue, whether
# after the update run, or when an individual item is added from the
# info_item menu, or when a backup or user's queue is loaded, then each
# APP and VERSION+BUILD is sent to this function for processing. Once
# this is working remove this NOTE from this comment.
$APP=$1
$VERBUILD=$2
TMPQUEUE=$TMP/sbopkg-tmp-queue
if $(cat $TMP/sbopkg-tmp-queue | grep -q "^$APP "); then
dialog --title "ERROR" --yesno "$(crunch "$APP is already in the \
queue. Do you want to replace it? Press <Yes> to replace or \
press <No> to skip.")" 10 30
if [ $? = 0 ]; then
continue # need to add the replace code here
else
return
fi
else
echo "$APP $RVERSION-$RBUILD ON" >> $TMP/sbopkg-tmp-queue
fi
dialog --title "Done" --msgbox "$APP has been added to the build queue." 8 30
}
view_queue () {
# This function displays the contents of the build queue.
TMPQUEUE=$TMP/sbopkg-tmp-queue