download-only, pt.3: add dialog ui; more cleanup

This primarily revises start_dialog_queue() to provide a download-only
dialog UI.

* global: make many more minor textual changes which replace 'build' and
  'build queue' references with more general references including
  'queue'
* info_item(): rename the 'Build' option to 'Process' (moving 'build'
  into the new description of 'Download/build/install') as it always
  could build or install and can now download, too.
* add_item_to_queue(),process_queue(): tweaked size of dialog widget
* start_dialog_queue(), process_queue(), main: rewrite
  start_dialog_queue() as a menu which provides the download-only option
  in addition to build, install, and cancel. Combine the two error
  handling instances in it (which would have been three) and the one in
  main into one chunk in process_queue().
* usr/doc/README{,-queuefiles}, usr/man/man*: more 'build'-related
  textual tweaks
* usr/doc/THANKS: remembered to add the r905 RFE credit

Thanks to Mauro for discussion and review.
This commit is contained in:
slakmagik 2011-05-26 19:18:02 +00:00
parent b6a42615f2
commit 82274dec88
6 changed files with 80 additions and 86 deletions

View File

@ -28,12 +28,12 @@ ABOUT
Sbopkg will also allow the user to select packages to build and it Sbopkg will also allow the user to select packages to build and it
will download the source code, check the md5sum and GPG signature, will download the source code, check the md5sum and GPG signature,
build a Slackware package, and optionally install the package. The build a Slackware package, and optionally install the package. The
user can also build and optionally install more than one package by user can also download, optionally build, and optionally install
using the 'build queue' feature. Sbopkg will not check dependencies more than one package by using the 'queue' feature. Sbopkg will not
since that is not a feature native to Slackware, but since the build check dependencies since that is not a feature native to Slackware,
queue will process packages in the order listed, it is possible to but since the queue will process packages in the order listed, it is
build and install dependencies in order prior to building and possible to build and install dependencies in order prior to
installing the final, desired package. building and installing the final, desired package.
Sbopkg can also be used strictly from the command line without the Sbopkg can also be used strictly from the command line without the
dialog(1)-provided menu interface to do most of the above items. dialog(1)-provided menu interface to do most of the above items.

View File

@ -1,7 +1,7 @@
README-queuefiles README-queuefiles
Sbopkg queuefiles are very simple to create, maintain, and share with Sbopkg queuefiles are very simple to create, maintain, and share with
other users. Each queuefile can contain a list of packages to build in other users. Each queuefile can contain a list of packages to process in
order, from top to bottom, and should be named with a .sqf extension. order, from top to bottom, and should be named with a .sqf extension.
Several sample queuefiles are provided in the ./contrib/queuefiles Several sample queuefiles are provided in the ./contrib/queuefiles
directory. Please note that these queuefiles are, in fact, only samples directory. Please note that these queuefiles are, in fact, only samples

View File

@ -77,3 +77,4 @@ Thank you!
864 Bill Kirkpatrick (bug report) 864 Bill Kirkpatrick (bug report)
875 dmotaleite (suggestion) 875 dmotaleite (suggestion)
894 Sergey V. (bash completion) 894 Sergey V. (bash completion)
905 Kristoffer Karlsson (suggestion)

View File

@ -67,8 +67,7 @@ change the branch of a git repository when another instance is using it
(this caveat does not apply to rsync repositories) (this caveat does not apply to rsync repositories)
.TP .TP
\(bu \(bu
simultaneously build or install the same package from different simultaneously process the same package from different instances
instances
.TP .TP
\(bu \(bu
save a queue file while using it from another instance save a queue file while using it from another instance

View File

@ -113,7 +113,7 @@ directory, then
will automatically add a new menu entry allowing the user to install the will automatically add a new menu entry allowing the user to install the
package if he chooses. package if he chooses.
Alternatively, the user can choose to automatically download, build, or Alternatively, the user can choose to automatically download, build, or
install individual packages or several packages in a build queue. install individual packages or several packages in a queue.
Finally, if Finally, if
.B KEEPLOG .B KEEPLOG
is set to is set to
@ -223,7 +223,7 @@ A way to avoid this is to specify the queuefile with its
extension. extension.
Also, a mix of both packages and queuefiles may be given. Also, a mix of both packages and queuefiles may be given.
The tokens (package names or queuefiles) are processed in the order they The tokens (package names or queuefiles) are processed in the order they
are specified on the command line, and the build order specified in the are specified on the command line, and the order specified in the
queuefiles is retained. queuefiles is retained.
If a package is specified more than once, it gets queued only the first If a package is specified more than once, it gets queued only the first
time it is encountered. time it is encountered.
@ -252,7 +252,7 @@ containing the local SBo repository.
.B \-e ask\fR|\fPcontinue\fR|\fPstop .B \-e ask\fR|\fPcontinue\fR|\fPstop
Specify what Specify what
.B sbopkg .B sbopkg
should do when it encounters an error while building a package. should do when it encounters an error while processing a package.
Valid options are: Valid options are:
.IP .IP
.BR ask : .BR ask :
@ -310,9 +310,8 @@ option for details since, other than the installation, these two options
operate similarly. operate similarly.
.IP .IP
Note that by carefully considering the order of the packages listed Note that by carefully considering the order of the packages listed
and/or using queuefiles, the user may be able to build and install and/or using queuefiles, the user may be able to install dependencies in
dependencies in the right order before the final application is built the right order before the final application is built.
and installed.
.\"--------------------------------------------------------------------- .\"---------------------------------------------------------------------
.TP .TP
.B \-k .B \-k

View File

@ -1278,8 +1278,8 @@ info_item() {
"Options" "Edit Build Options/Flavors" \ "Options" "Edit Build Options/Flavors" \
"Check GPG" "Check the GPG signature of the $REPO_NAME tarball" \ "Check GPG" "Check the GPG signature of the $REPO_NAME tarball" \
"Extract" "Re-extract the $REPO_NAME tarball" \ "Extract" "Re-extract the $REPO_NAME tarball" \
"Queue" "Add $APP to build queue" \ "Queue" "Add $APP to queue" \
"Build" "Build a package for $APP" \ "Process" "Download/build/install $APP" \
$MENUPACKAGE \ $MENUPACKAGE \
2> $SBOPKGTMP/sbopkg_info_selection 2> $SBOPKGTMP/sbopkg_info_selection
case $? in case $? in
@ -1353,7 +1353,7 @@ info_item() {
fi fi
;; ;;
Queue ) add_item_to_queue $APP ;; Queue ) add_item_to_queue $APP ;;
Build ) Process )
echo "$APP" > $STARTQUEUE echo "$APP" > $STARTQUEUE
start_dialog_queue ;; start_dialog_queue ;;
Install ) Install )
@ -1544,14 +1544,14 @@ view_perm_log() {
} }
empty_queue() { empty_queue() {
# This function tests whether the temporary build queue is empty. # This function tests whether the temporary queue is empty.
if [[ ! -e $TMPQUEUE ]]; then if [[ ! -e $TMPQUEUE ]]; then
if [[ $DIAG ]]; then if [[ $DIAG ]]; then
dialog --title "Empty Queue" --msgbox \ dialog --title "Empty Queue" --msgbox \
"The build queue is empty." 8 30 "The queue is empty." 8 30
else else
echo "The build queue is empty." echo "The queue is empty."
fi fi
return 0 return 0
else else
@ -1560,7 +1560,7 @@ empty_queue() {
} }
sort_queue() { sort_queue() {
# This function sorts the build queue in $TMPQUEUE. # This function sorts the queue in $TMPQUEUE.
local PARTIALSORT=$SBOPKGTMP/sbopkg_sort_tempfile local PARTIALSORT=$SBOPKGTMP/sbopkg_sort_tempfile
local TMPSORTQUEUE=$SBOPKGTMP/sbopkg-tmp-sort-queue local TMPSORTQUEUE=$SBOPKGTMP/sbopkg-tmp-sort-queue
@ -1821,7 +1821,7 @@ stripcom() {
} }
save_user_queue() { save_user_queue() {
# This function saves the build queue to the filename the user specifies. # This function saves the queue to the filename the user specifies.
# If --end is specified as first parameter, assume that the user is # If --end is specified as first parameter, assume that the user is
# exiting sbopkg and that this call is about saving the currently active # exiting sbopkg and that this call is about saving the currently active
# queue. In that case, show the filename dialog only if there actually is # queue. In that case, show the filename dialog only if there actually is
@ -1927,11 +1927,11 @@ remove_from_queue() {
if [[ $(wc -w < $REMOVEQUEUE) -eq 0 ]]; then if [[ $(wc -w < $REMOVEQUEUE) -eq 0 ]]; then
echo '"" "The queue is empty."' > $REMOVEQUEUE echo '"" "The queue is empty."' > $REMOVEQUEUE
fi fi
dialog --title "Remove From Build Queue" --ok-label "Delete" \ dialog --title "Remove From Queue" --ok-label "Delete" \
--extra-button --extra-label "Clear" --help-button \ --extra-button --extra-label "Clear" --help-button \
--help-label "Done" --cancel-label "Cancel" \ --help-label "Done" --cancel-label "Cancel" \
--menu "$(crunch "The following packages are currently in \ --menu "$(crunch "The following packages are currently in \
the build queue. You can remove individual items from the build \ the queue. You can remove individual items from the \
queue by highlighting them and pressing <Delete>. Press <Done> \ queue by highlighting them and pressing <Delete>. Press <Done> \
when you are finished and the individual deletions will be \ when you are finished and the individual deletions will be \
committed. Otherwise, press <Cancel> at any time to abort your \ committed. Otherwise, press <Cancel> at any time to abort your \
@ -1966,13 +1966,13 @@ remove_from_queue() {
rm -f $TMPQUEUE rm -f $TMPQUEUE
fi fi
dialog --title "Done" --msgbox \ dialog --title "Done" --msgbox \
"The items have been removed from the build queue." 8 30 "The items have been removed from the queue." 8 30
return 0 return 0
;; ;;
3) 3)
rm -f $REMOVEQUEUE $TMPQUEUE $QUEUELIST rm -f $REMOVEQUEUE $TMPQUEUE $QUEUELIST
dialog --title "Done" --msgbox \ dialog --title "Done" --msgbox \
"The build queue has been cleared." 8 30 "The queue has been cleared." 8 30
return 0 return 0
;; ;;
esac esac
@ -2130,7 +2130,7 @@ add_item_to_queue() {
# 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 ]]; then if [[ ! -e $USERQUEUE_LOCK ]]; 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 queue.")" 6 40
fi fi
return 0 return 0
} }
@ -2147,7 +2147,7 @@ uncheck_installed() {
} }
view_queue() { view_queue() {
# This function displays the contents of the build queue. # This function displays the contents of the queue.
# Returns 0 if the user choose OK, nonzero otherwise # Returns 0 if the user choose OK, nonzero otherwise
local ANSQUEUE=$SBOPKGTMP/sbopkg-ans-queue local ANSQUEUE=$SBOPKGTMP/sbopkg-ans-queue
@ -2157,17 +2157,17 @@ view_queue() {
empty_queue && return 1 empty_queue && return 1
cp $TMPQUEUE $ORIGINALQUEUE cp $TMPQUEUE $ORIGINALQUEUE
while :; do while :; do
dialog --title "Viewing Build Queue" --separate-output \ dialog --title "Viewing Queue" --separate-output \
--extra-button --extra-label "View READMEs" \ --extra-button --extra-label "View READMEs" \
--help-button --help-label "Clear inst'd" --help-status \ --help-button --help-label "Clear inst'd" --help-status \
--cancel-label "Back" --checklist "$(crunch "The \ --cancel-label "Back" --checklist "$(crunch "The \
following packages are currently \ following packages are currently \
in the build queue. Please note that when the build queue \ in the queue. Please note that when the queue \
is processed, the packages selected below will be built, and \ is processed, the packages selected below will be processed \
optionally installed, in the order listed from top to \ in the order listed from top to \
bottom.\n\nPlease select or unselect those packages you wish \ bottom.\n\nPlease select or unselect those packages you wish \
to keep in the build queue and then press <OK> to continue \ to keep in the queue and then press <OK> to continue \
or press <Back> to go back.")" 23 70 9 \ or press <Back> to go back.")" 23 70 11 \
--file $TMPQUEUE 2> $ANSQUEUE --file $TMPQUEUE 2> $ANSQUEUE
CHOICE=$? CHOICE=$?
@ -2275,7 +2275,7 @@ tin_text() {
add_all_to_queue() { add_all_to_queue() {
# This function adds all currently installed repo packages to the # This function adds all currently installed repo packages to the
# build queue. # queue.
local SBOPKGLIST=$SBOPKGTMP/sbopkg_pkglist local SBOPKGLIST=$SBOPKGTMP/sbopkg_pkglist
local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck local USERQUEUE_LOCK=$SBOPKGTMP/sbopkg_user_queue.lck
@ -2322,7 +2322,7 @@ EOF
echo $((PROGRESS*100/NUM_PACKAGES)) echo $((PROGRESS*100/NUM_PACKAGES))
done done
} | progressbar "Queuing installed packages" \ } | progressbar "Queuing installed packages" \
"Loading all installed $REPO_NAME packages into the build queue.\ "Loading all installed $REPO_NAME packages into the queue.\
This may take a few moments depending on how many $REPO_NAME\ This may take a few moments depending on how many $REPO_NAME\
packages you have installed, so please be patient..." packages you have installed, so please be patient..."
if [[ -f $PROGRESSBAR_INTERRUPTED ]]; then if [[ -f $PROGRESSBAR_INTERRUPTED ]]; then
@ -2530,7 +2530,7 @@ gen_search_package() {
--help-button --help-label "Main Menu" \ --help-button --help-label "Main Menu" \
--extra-label "Add to Queue" --menu "$(crunch "Please \ --extra-label "Add to Queue" --menu "$(crunch "Please \
select an item you wish to view, press <Add to Queue> \ select an item you wish to view, press <Add to Queue> \
to add it to the build queue, or press <Back> to \ to add it to the queue, or press <Back> to \
go back.")" 22 70 14 --file \ go back.")" 22 70 14 --file \
$SEARCH_RESULTS 2> $SEARCH_CHOICE $SEARCH_RESULTS 2> $SEARCH_CHOICE
CHOICE=$? CHOICE=$?
@ -2634,7 +2634,7 @@ string_search() {
--extra-button --extra-label "Add to Queue" \ --extra-button --extra-label "Add to Queue" \
--cancel-label "Back" \ --cancel-label "Back" \
--menu "$(crunch "Please select an item you wish to view or \ --menu "$(crunch "Please select an item you wish to view or \
press <Add to Queue> to add it to the build queue or \ press <Add to Queue> to add it to the queue or \
press <Back> to go back.")" 0 0 0 \ press <Back> to go back.")" 0 0 0 \
--file $MENU_FILE 2> $PICKED_FILE --file $MENU_FILE 2> $PICKED_FILE
@ -3401,7 +3401,7 @@ process_package() {
echo echo
echo "$PKGNAME:" echo "$PKGNAME:"
echo "Would you like to continue processing the rest of the" echo "Would you like to continue processing the rest of the"
echo "build queue or would you like to abort? If this failed" echo "queue or would you like to abort? If this failed"
echo "package is a dependency of another package in the queue" echo "package is a dependency of another package in the queue"
echo "then it may not make sense to continue." echo "then it may not make sense to continue."
echo echo
@ -3872,10 +3872,16 @@ process_queue() {
done done
echo "+++++++++++++++++++++++++++++++++++++++++++" >> $TMPLOG echo "+++++++++++++++++++++++++++++++++++++++++++" >> $TMPLOG
if [[ ! -e $FINALQUEUE ]]; then if [[ ! -e $FINALQUEUE ]]; then
return 1 if [[ $DIAG ]]; then
dialog --title "Error" --msgbox "No valid packages found." 5 40
return 1
else
echo "No valid packages found. Exiting."
exit 1
fi
fi fi
if [[ $DIAG ]]; then if [[ $DIAG ]]; then
dialog --title "Pre-Check Log" --ok-label "Start Build" \ dialog --title "Pre-Check Log" --ok-label "Start" \
--extra-button --extra-label "Back" --no-cancel \ --extra-button --extra-label "Back" --no-cancel \
--textbox $TMPLOG 0 0 --textbox $TMPLOG 0 0
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
@ -3956,7 +3962,7 @@ process_queue() {
else else
echo >> $TMPSUMMARYLOG echo >> $TMPSUMMARYLOG
echo "$PKGBUILD:" >> $TMPSUMMARYLOG echo "$PKGBUILD:" >> $TMPSUMMARYLOG
echo " Not processed - build queue aborted." >> $TMPSUMMARYLOG echo " Not processed - queue aborted." >> $TMPSUMMARYLOG
echo >> $TMPSUMMARYLOG echo >> $TMPSUMMARYLOG
fi fi
done done
@ -3991,12 +3997,12 @@ process_queue() {
rm $TMPLOG rm $TMPLOG
if [[ -f $TMPQUEUE ]]; then if [[ -f $TMPQUEUE ]]; then
dialog --title "Clear Queue?" --yes-label "Keep" --no-label \ dialog --title "Clear Queue?" --yes-label "Keep" --no-label \
"Clear" --yesno "$(crunch "Would you like to keep the build \ "Clear" --yesno "$(crunch "Would you like to keep the \
queue or would you like to clear it?")" 8 35 queue or would you like to clear it?")" 8 35
if [[ $? == 1 ]]; then if [[ $? == 1 ]]; then
rm $TMPQUEUE rm $TMPQUEUE
dialog --title "Done" --msgbox \ dialog --title "Done" --msgbox \
"The build queue has been cleared." 8 35 "The queue has been cleared." 5 35
fi fi
fi fi
rm -f $SBOPKGTMP/sbopkg-ans-queue rm -f $SBOPKGTMP/sbopkg-ans-queue
@ -4005,32 +4011,25 @@ process_queue() {
start_dialog_queue() { start_dialog_queue() {
# This kick-starts the queue processing when using the dialog interface. # This kick-starts the queue processing when using the dialog interface.
# When using cli, the -b or -i option will determine whether we build or # When using cli, the -b, -d, or -i option will determine whether we
# build and install. # download, build, or install.
dialog --title "Install Package(s)" \ local PROCTYPE_FILE=$SBOPKGTMP/proctype
--help-button --help-label "Cancel" --yesno \ local PROCTYPE
"$(crunch "Would you like to install the packages as they are \
built? Press <Yes> to install, <No> to build only, or <Cancel> \ dialog --title "Process Type" --default-item Install --menu \
to exit.")" 8 50 "Please select how you wish the item(s) to be processed." \
case $? in 11 50 3 \
0 ) # Build and install Download "Download only" \
process_queue install Build "Download and build" \
if [[ $? == 1 ]]; then Install "Download, build, and install" 2> $PROCTYPE_FILE
dialog --title "Error" --msgbox "$(crunch "No valid \ PROCTYPE=$(< $PROCTYPE_FILE)
packages found.")" 8 40
fi case $PROCTYPE in
;; Install) process_queue install ;;
1 ) # Build only Build) process_queue build ;;
process_queue build Download) process_queue download ;;
if [[ $? == 1 ]]; then *) return 0 ;;
dialog --title "Error" --msgbox "$(crunch "No valid \
packages found.")" 8 40
fi
;;
* ) # Cancel, or the user pressed ESC
return 0
;;
esac esac
} }
@ -4141,20 +4140,20 @@ queue_menu() {
local ANSWERFILE=$SBOPKGTMP/sbopkg_queue_menu_answer local ANSWERFILE=$SBOPKGTMP/sbopkg_queue_menu_answer
while :; do while :; do
dialog --title "Build Queue Menu" --backtitle \ dialog --title "Queue Menu" --backtitle \
"$(eval echo $BACKTITLE)" \ "$(eval echo $BACKTITLE)" \
--cancel-label "Back" --default-item "$DEFAULTITEM" --menu \ --cancel-label "Back" --default-item "$DEFAULTITEM" --menu \
"Choose one of the following or press <Back> to go back.\n" \ "Choose one of the following or press <Back> to go back.\n" \
16 60 9 \ 16 60 9 \
"View" "View the current build queue" \ "View" "View the current queue" \
"Sort" "Sort items in build queue" \ "Sort" "Sort items in the queue" \
"Remove" "Remove items in build queue" \ "Remove" "Remove items in the queue" \
"Load" "Load a saved build queue" \ "Load" "Load a saved queue" \
"Save" "Save the current build queue" \ "Save" "Save the current queue" \
"Rename" "Rename a saved build queue" \ "Rename" "Rename a saved queue" \
"Delete" "Delete a saved build queue" \ "Delete" "Delete a saved queue" \
"Add" "Add all installed packages to the queue" \ "Add" "Add all installed packages to the queue" \
"Process" "Process the current build queue" 2> $ANSWERFILE "Process" "Process the current queue" 2> $ANSWERFILE
DEFAULTITEM=$(< $ANSWERFILE) DEFAULTITEM=$(< $ANSWERFILE)
@ -4370,14 +4369,14 @@ main_updates() {
if [[ -f $UPDATES_QUEUE ]]; then if [[ -f $UPDATES_QUEUE ]]; then
dialog --title "Add Updates to Queue?" --yesno \ dialog --title "Add Updates to Queue?" --yesno \
"$(crunch "Would you like to add the flagged updates to \ "$(crunch "Would you like to add the flagged updates to \
the build queue?\\n\\nApparent downgrades will be added to the \ the queue?\\n\\nApparent downgrades will be added to the \
queue but will be kept disabled.")" 9 50 queue but will be kept disabled.")" 9 50
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
touch $USERQUEUE_LOCK touch $USERQUEUE_LOCK
parse_queue $UPDATES_QUEUE parse_queue $UPDATES_QUEUE
rm -f $UPDATES_QUEUE $USERQUEUE_LOCK 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 queue.")" 8 30
fi fi
fi fi
} }
@ -4411,7 +4410,7 @@ main_menu() {
"List potential updates to installed $REPO_NAME packages" \ "List potential updates to installed $REPO_NAME packages" \
"Browse" "Browse the active repository" \ "Browse" "Browse the active repository" \
"Search" "Search the active repository" \ "Search" "Search the active repository" \
"Queue" "Manage the build queue" \ "Queue" "Manage the queue" \
"Utilities" "Go to the utilities menu" \ "Utilities" "Go to the utilities menu" \
"Help" "Where to get sbopkg help" 2> $ANSWER_FILE "Help" "Where to get sbopkg help" 2> $ANSWER_FILE
@ -4838,10 +4837,6 @@ else
done < $TMPQUEUE done < $TMPQUEUE
rm -f $TMPQUEUE rm -f $TMPQUEUE
process_queue $TYPE process_queue $TYPE
if [[ $? == 1 ]]; then
echo "No valid packages found, or no packages to build. Exiting."
exit 1
fi
fi fi
if [[ $CHK_UPDATES ]]; then if [[ $CHK_UPDATES ]]; then