lkml.org 
[lkml]   [1997]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Miscellaneous compile problems in 2.1.31 - repost and additions
On Mon, 7 Apr 1997, Philip Blundell wrote:

> > or even better:
> > only ask about new options and use old ansers for all other questions...
>
> Er, I don't entirely understand. Isn't that what `make oldconfig' does
> already?

No, oldconfig only don't asks questions for parameters which you already
have in your .config.

FYI, you can check the behavor before and after appying the attached
patch,

which directs make config, oldconfig menuconfig and xconfig to
^^^^^^ ^^^^^^^^^ ^^^^^^^^^^ --- ^^^^^^^

use the values from the defconfig file if a bool-, tristate-, or
dep_tristate-option is to be configured.

Please mail me your comments.

Bernhard Kaindl
--- linux/scripts/Configure-2.1.32 Sun Apr 6 08:09:43 1997
+++ linux/scripts/Configure Sun Apr 6 16:41:26 1997
@@ -27,7 +27,7 @@
# 030995 (storner@osiris.ping.dk) - added support for tri-state answers,
# for selecting modules to compile.
#
-# 180995 Bernhard Kaindl (bkaindl@ping.at) - added dummy functions for
+# 180995 Bernhard Kaindl (bkaindl@netway.at) - added dummy functions for
# use with a config.in modified for make menuconfig.
#
# 301195 (boldt@math.ucsb.edu) - added help text support
@@ -46,6 +46,9 @@
#
# 090397 Axel Boldt (boldt@math.ucsb.edu) - avoid ? and + in regular
# expressions for GNU expr since version 1.15 and up use \? and \+.
+#
+# 060497 Bernhard Kaindl (bkaindl@netway.at) - get default values for
+# new bool, tristate and dep_tristate parameters from the defconfig file.

#
# Make sure we're really running bash.
@@ -61,6 +64,36 @@
set -f -h

#
+# Converts "# xxx is not..." to xxx=n
+#
+parse_config () {
+ sed -e 's/# \(.*\) is not.*/\1=n/'
+}
+
+#
+# Parses your defconfig to and set the default for a new parameter.
+#
+function get_def () {
+ parse_config < arch/$ARCH/defconfig | grep "^$1=" > /tmp/conf.$$
+ . /tmp/conf.$$
+ rm /tmp/conf.$$
+}
+
+#
+# Macro for setting the old and def varibles. get's def from defconfig
+# file if it's a new parameter.
+#
+function set_def () {
+ old=$(eval echo "\${$1}")
+ if [ "$old" ]; then
+ def="$old"
+ else
+ get_def "$1"
+ def=$(eval echo "\${$1}")
+ fi
+}
+
+#
# Dummy functions for use with a config.in modified for menuconf
#
function mainmenu_option () {
@@ -165,8 +198,7 @@
# bool question define
#
function bool () {
- old=$(eval echo "\${$2}")
- def=${old:-'n'}
+ set_def "$2"
case "$def" in
"y" | "m") defprompt="Y/n/?"
def="y"
@@ -196,8 +228,7 @@
if [ "$CONFIG_MODULES" != "y" ]; then
bool "$1" "$2"
else
- old=$(eval echo "\${$2}")
- def=${old:-'n'}
+ set_def "$2"
case "$def" in
"y") defprompt="Y/m/n/?"
;;
@@ -233,8 +264,7 @@
# tristate question define default
#
function dep_tristate () {
- old=$(eval echo "\${$2}")
- def=${old:-'n'}
+ set_def "$2"
if [ "$3" = "n" ]; then
define_bool "$2" "n"
elif [ "$3" = "y" ]; then
@@ -449,7 +479,7 @@
echo "# Using defaults found in" $DEFAULTS
echo "#"
. $DEFAULTS
- sed -e 's/# \(.*\) is not.*/\1=n/' < $DEFAULTS > /tmp/conf.$$
+ parse_config < $DEFAULTS > /tmp/conf.$$
. /tmp/conf.$$
rm /tmp/conf.$$
else
--- linux/scripts/Menuconfig-2.1.32 Sun Apr 6 21:52:33 1997
+++ linux/scripts/Menuconfig Mon Apr 7 01:23:10 1997
@@ -21,6 +21,9 @@
#
# Please send comments / questions / bug fixes to roadcapw@cfw.com
#
+# 070497 Bernhard Kaindl (bkaindl@netway.at) - get default values for
+# new bool, tristate and dep_tristate parameters from the defconfig file.
+# new configuration parameters are marked with '(NEW)' as in make config.
#----------------------------------------------------------------------------


@@ -40,9 +43,21 @@
#
set -h +o posix

+#
+# Converts "# xxx is not..." to xxx=n
+#
+parse_config () {
+ sed -e 's/# \(.*\) is not.*/\1=n/'
+}

-
-
+#
+# Parses the defconfig file to set the default for a new parameter.
+#
+function get_def () {
+ parse_config < arch/$ARCH/defconfig | grep "^$1=" > /tmp/conf.$$
+ . /tmp/conf.$$
+ rm /tmp/conf.$$
+}

#
# Load the functions used by the config.in files.
@@ -56,6 +71,19 @@
load_functions () {

#
+# Macro for setting the x and info varibles. get's default from defconfig
+# file if it's a new parameter.
+#
+function set_x () {
+ eval x=\$$1
+ if [ -z "$x" ]; then
+ get_def "$1"
+ eval x=\${$1:-'n'} INFO_$1="' (NEW)'"
+ fi
+ eval info="\$INFO_$1"
+}
+
+#
# Additional comments
#
function comment () {
@@ -75,14 +103,14 @@
# which calls our local bool function.
#
function bool () {
- eval $2=\${$2:-'n'} x=\$$2
+ set_x "$2"

case $x in
y|m) flag="*" ;;
n) flag=" " ;;
esac

- echo -ne "'$2' '[$flag] $1' " >>MCmenu
+ echo -ne "'$2' '[$flag] $1$info' " >>MCmenu

echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists
}
@@ -98,7 +126,7 @@
then
bool "$1" "$2"
else
- eval $2=\${$2:-'n'} x=\$$2
+ set_x "$2"

case $x in
y) flag="*" ;;
@@ -106,7 +134,7 @@
*) flag=" " ;;
esac

- echo -ne "'$2' '<$flag> $1' " >>MCmenu
+ echo -ne "'$2' '<$flag> $1$info' " >>MCmenu

echo -e "
function $2 () { l_tristate '$2' \"\$1\" ;}" >>MCradiolists
@@ -323,14 +351,14 @@
# Same as bool() except options are (Module/No)
#
function mod_bool () {
- eval $2=\${$2:-'n'} x=\$$2
+ set_x "$2"

case $x in
y|m) flag='M' ;;
*) flag=' ' ;;
esac

- echo -ne "'$2' '<$flag> $1' " >>MCmenu
+ echo -ne "'$2' '<$flag> $1$info' " >>MCmenu

echo -e "function $2 () { l_mod_bool '$2' \"\$1\" ;}" >>MCradiolists
}
@@ -882,31 +910,45 @@
--infobox "Saving your kernel configuration..." 3 40

#
+ # Macro for setting the newval varible. get's default from defconfig
+ # file if it's a new parameter and it has not been shown yet.
+ #
+ function set_newval () {
+ eval newval=\$$1
+ if [ -z "$newval" ]; then
+ get_def "$1"
+ eval newval=\${$1:-'n'}
+ fi
+ }
+
+ #
# Now, let's redefine the configuration functions for final
# output to the config files.
#
# Nested function definitions, YIPEE!
#
function bool () {
- eval define_bool "$2" "\${$2:-n}"
+ set_newval "$2"
+ eval define_bool "$2" "$newval"
}

function tristate () {
- eval define_bool "$2" "\${$2:-n}"
+ set_newval "$2"
+ eval define_bool "$2" "$newval"
}

function dep_tristate () {
- eval x=\${$2:-n}
+ set_newval "$2"

if eval [ "_$3" = "_m" ]
then
- if [ "$x" = "y" ]
+ if [ "$newval" = "y" ]
then
- x="m"
+ newval="m"
fi
fi

- define_bool "$2" "$x"
+ define_bool "$2" "$newval"
}

function int () {
--- linux/scripts/header.tk.old Wed Apr 9 00:49:51 1997
+++ linux/scripts/header.tk Wed Apr 9 01:02:57 1997
@@ -191,9 +191,8 @@
}
}

-proc read_config { filename } {
+proc get_config { filename } {
set file1 [open $filename r]
- clear_choices
while { [gets $file1 line] >= 0} {
if [regexp {([0-9A-Za-z_]+)=([ynm])} $line foo var value] {
if { $value == "y" } then { set cmd "global $var; set $var 1" }
@@ -211,9 +210,17 @@
}
}
close $file1
+}
+
+proc read_config { filename } {
+ global defaults
+ get_config $defaults
+ clear_choices
+ get_config $filename
update_choices
update_mainmenu .rdupd
}
+
proc write_comment { file1 file2 text } {
puts $file1 ""
puts $file1 "#"
\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.039 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site