Check for updates: don't duplicate queue items.

Adding the updated packages to the build queue could put in the
queue the same package more than once (if it was already present
in there).
Use parse_queue() instead of the bare append to avoid this.

Signed-off-by: Mauro Giachero <mauro.giachero@gmail.com>
This commit is contained in:
mauro.giachero 2009-10-20 13:14:40 +00:00
parent 446bf5e830
commit 0d1720bc33

View file

@ -777,9 +777,7 @@ check_for_updates() {
echo " Repo version: " \ echo " Repo version: " \
$NAME-$NEWVER-$NEWARCH-${NEWBUILD}$REPO_TAG \ $NAME-$NEWVER-$NEWARCH-${NEWBUILD}$REPO_TAG \
>> $UPDATELIST >> $UPDATELIST
# NOTE: When changing, see the uncheck_installed() comment echo "$NAME" >> $SBOPKGTMP/sbopkg-update-queue
echo "$NAME \"Installed $PKG_VER\" ON" >> \
$SBOPKGTMP/sbopkg-update-queue
elif [[ $UPDATED -eq -1 ]]; then elif [[ $UPDATED -eq -1 ]]; then
if [[ $DEBUG -ge 1 ]]; then if [[ $DEBUG -ge 1 ]]; then
echo $NAME: >> $UPDATELIST echo $NAME: >> $UPDATELIST
@ -1972,8 +1970,7 @@ add_item_to_queue() {
fi fi
# Only display this if we are not loading a queue; otherwise getting this # Only display this if we are not loading a queue; otherwise getting this
# after each app was added to the queue may get annoying. # after each app was added to the queue may get annoying.
if [[ ! -e $USERQUEUE_LOCK && if [[ ! -e $USERQUEUE_LOCK ]]; then
! -e $UPDATEQUEUE ]]; then
dialog --title "Done" --msgbox "$(crunch "$APP has been added to \ dialog --title "Done" --msgbox "$(crunch "$APP has been added to \
the build queue.")" 8 40 the build queue.")" 8 40
fi fi
@ -4136,6 +4133,7 @@ main_updates() {
local APP VERSIONBUILD ONOFF PICK local APP VERSIONBUILD ONOFF PICK
local UPDATES_QUEUE=$SBOPKGTMP/sbopkg-update-queue local UPDATES_QUEUE=$SBOPKGTMP/sbopkg-update-queue
local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck
rm -f $UPDATES_QUEUE rm -f $UPDATES_QUEUE
check_for_updates check_for_updates
@ -4144,8 +4142,9 @@ 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
cat $UPDATES_QUEUE >> $TMPQUEUE touch $USERQUEUE_LOCK
rm -f $UPDATES_QUEUE parse_queue $UPDATES_QUEUE
rm -f $UPDATES_QUEUE $USERQUEUE_LOCK
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
fi fi