Rework the options selection menu to avoid truncating the options.

Without this patch, the list of build options was placed on the
left side of a menu dialog entry. Since dialog entries cannot span
to multiple lines, very long option lists were (visually) truncated.
Rework the dialog to show the options in the menu text field, so
there's much more room for them.
Reported by Erik Hanson.

While at it, also make sure that there's no stale options.build
file lying around (which is a minor bugfix).

Signed-off-by: Mauro Giachero <mauro.giachero@gmail.com>
This commit is contained in:
mauro.giachero 2009-10-12 13:29:55 +00:00
parent 226fa1d95e
commit cad2731d34
2 changed files with 21 additions and 14 deletions

View file

@ -31,4 +31,6 @@ enhancements:
* Add a dialog and cli option to show all READMEs for the queued packages. * Add a dialog and cli option to show all READMEs for the queued packages.
This can come handy to do "final checks" on the active queue before This can come handy to do "final checks" on the active queue before
starting the build process. starting the build process.
* Reworked the options selection menu to avoid seeing only a truncated set
of the actual options.
+--------------------------+ +--------------------------+

View file

@ -3305,7 +3305,7 @@ pick_file() {
dialog --title "Choose $PKG $FILE file" --menu \ dialog --title "Choose $PKG $FILE file" --menu \
"$(crunch "A local $FILE file for $PKG was found in \ "$(crunch "A local $FILE file for $PKG was found in \
addition to the original file. Which one \ addition to the original file. Which one \
would you like to use?")" 11 60 3 \ would you like to use?")" 12 60 3 \
"Local" "Use the local $FILE" \ "Local" "Use the local $FILE" \
"Original" "Use the original $FILE" \ "Original" "Use the original $FILE" \
"Diff" "View a diff of the two" \ "Diff" "View a diff of the two" \
@ -3387,7 +3387,7 @@ use_options() {
local OPTAPP=$2 local OPTAPP=$2
local OPTCHOICE=$SBOPKGTMP/sbopkg_options_choice local OPTCHOICE=$SBOPKGTMP/sbopkg_options_choice
local OPTLIST=$SBOPKGTMP/sbopkg_options_list local OPTLIST=$SBOPKGTMP/sbopkg_options_list
local TMPOPTIONS LDOPTIONS CHOICE local TMPOPTIONS LDOPTIONS CHOICE OPTIONS_MSG
# By default (i.e. no options.sbopkg file) there are no build options. # By default (i.e. no options.sbopkg file) there are no build options.
unset BUILDOPTIONS unset BUILDOPTIONS
@ -3397,33 +3397,38 @@ use_options() {
if [[ -f $SBOPKGTMP/sbopkg_"$OPTAPP"_loadoptions ]]; then if [[ -f $SBOPKGTMP/sbopkg_"$OPTAPP"_loadoptions ]]; then
LDOPTIONS=$(< $SBOPKGTMP/sbopkg_"$OPTAPP"_loadoptions) LDOPTIONS=$(< $SBOPKGTMP/sbopkg_"$OPTAPP"_loadoptions)
fi fi
rm -f $PKGPATH/options.build
if [[ $TMPOPTIONS || $LDOPTIONS ]]; then if [[ $TMPOPTIONS || $LDOPTIONS ]]; then
if [[ $DIAG ]]; then if [[ $DIAG ]]; then
rm -f $OPTLIST $OPTCHOICE rm -f $OPTLIST $OPTCHOICE
echo "None \"Build with no options\"" >> $OPTLIST echo 'None "Build with no options"' >> $OPTLIST
if [[ $TMPOPTIONS ]]; then if [[ $TMPOPTIONS ]]; then
echo "\"$TMPOPTIONS\" \"Saved options\"" >> $OPTLIST echo 'Saved "Build with your saved options"' >> $OPTLIST
OPTIONS_MSG="\nSaved options:\n$TMPOPTIONS\n"
fi fi
if [[ $LDOPTIONS ]]; then if [[ $LDOPTIONS ]]; then
echo "\"$LDOPTIONS\" \"Queuefile options\"" >> $OPTLIST echo 'Queuefile "Build with the queuefile options"' \
>> $OPTLIST
OPTIONS_MSG+="\nQueuefile options:\n$LDOPTIONS\n"
fi fi
dialog --title "Build options" --menu "$(crunch "One or \ dialog --title 'Build options' --menu "$(crunch "One or \
more build option files for the $OPTAPP \ more build option files for the $OPTAPP \
SlackBuild were found. Please choose which you \ SlackBuild were found.\n$OPTIONS_MSG\nPlease choose \
would like to use.")" 12 50 3 \ whether to use them.")" 0 0 0 \
--file $OPTLIST 2> $OPTCHOICE --file $OPTLIST 2> $OPTCHOICE
CHOICE=$? CHOICE=$?
if [[ $CHOICE != 0 ]]; then if [[ $CHOICE != 0 ]]; then
rm -f $OPTLIST $OPTCHOICE rm -f $OPTLIST $OPTCHOICE
return 1 return 1
else else
if [[ $(< $OPTCHOICE) == "None" ]]; then if [[ $(< $OPTCHOICE) == 'Saved' ]]; then
rm -f $OPTLIST $OPTCHOICE echo "$TMPOPTIONS" > $PKGPATH/options.build
else BUILDOPTIONS="$TMPOPTIONS"
cp "$OPTCHOICE" $PKGPATH/options.build elif [[ $(< $OPTCHOICE) == 'Queuefile' ]]; then
BUILDOPTIONS=$(< "$OPTCHOICE") echo "$LDOPTIONS" > $PKGPATH/options.build
rm -f $OPTLIST $OPTCHOICE BUILDOPTIONS="$LDOPTIONS"
fi fi
rm -f $OPTLIST $OPTCHOICE
fi fi
else else
while :; do while :; do