configs: Update config generation script to use configs/fedora

The previous patch moved the configs/base-{generic,debug} to configs/fedora.
Now we update the scripts to reflect that change.  Changing the scripts
was straightforward.  Handling overrides that didn't use generic names
was a little trickier.

To handle random override names (well rhel), I added some extra logic
in the config_generation script called "ORDER".  This tells the scripts
which configs to lay down first and which one overrides it.

Through some testing, I realized I could simplify things and just create
an outer 'order' loop.  This removed some duplicated code.

The other change is the 'skip_if_missing' flag.  The overrides directory
will not mimic the baseline directory layout 100%.  Ensure the baseline
config files are all there, but allow the overrides to have missing files.

Tested on my Fedora and my RHEL tree with success.
This commit is contained in:
Don Zickus 2017-12-13 16:19:06 -05:00 committed by Laura Abbott
parent 4d6d8cc5c1
commit 62496f789f
2 changed files with 36 additions and 29 deletions

View File

@ -6,7 +6,7 @@
PACKAGE_NAME="${1:-kernel}" # defines the package name used PACKAGE_NAME="${1:-kernel}" # defines the package name used
KVERREL="${2:-}" KVERREL="${2:-}"
SUBARCH="${3:-}" # defines a specific arch for use with rh-configs-arch-prep target SUBARCH="${3:-}" # defines a specific arch
SCRIPT="$(readlink -f $0)" SCRIPT="$(readlink -f $0)"
OUTPUT_DIR="$PWD" OUTPUT_DIR="$PWD"
SCRIPT_DIR="$(dirname $SCRIPT)" SCRIPT_DIR="$(dirname $SCRIPT)"
@ -49,29 +49,31 @@ function merge_configs()
archvar=$1 archvar=$1
arch=$(echo "$archvar" | cut -f1 -d"-") arch=$(echo "$archvar" | cut -f1 -d"-")
configs=$2 configs=$2
order=$3
name=$OUTPUT_DIR/$PACKAGE_NAME-$archvar.config name=$OUTPUT_DIR/$PACKAGE_NAME-$archvar.config
echo -n "Building $name ... " echo -n "Building $name ... "
touch config-merging config-merged touch config-merging config-merged
# apply base first # apply based on order
skip_if_missing=""
for o in $order
do
for config in $(echo $configs | sed -e 's/:/ /g') for config in $(echo $configs | sed -e 's/:/ /g')
do do
perl merge.pl config-base-$config config-merging > config-merged cfile="config-$o-$config"
test -n "$skip_if_missing" && test ! -e $cfile && continue
perl merge.pl $cfile config-merging > config-merged
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
die "Failed to merge base" die "Failed to merge $cfile"
fi fi
mv config-merged config-merging mv config-merged config-merging
done done
for config in $(echo $configs | sed -e 's/:/ /g')
do
# not all override files exist
test -e config-$config || continue
perl merge.pl config-$config config-merging > config-merged # first configs in $order is baseline, all files should be
if [ ! $? -eq 0 ]; then # there. second pass is overrides and can be missing.
die "Failed to merge configs" skip_if_missing="1"
fi
mv config-merged config-merging
done done
if [ "x$arch" == "xaarch64" ]; then if [ "x$arch" == "xaarch64" ]; then
echo "# arm64" > $name echo "# arm64" > $name
@ -93,22 +95,22 @@ function merge_configs()
echo "done" echo "done"
} }
glist=$(find base-generic -type d)
dlist=$(find base-debug -type d)
gllist=$(test -d generic && find generic -type d)
dllist=$(test -d debug && find debug -type d)
for d in $glist $dlist $gllist $dllist
do
combine_config_layer $d
done
while read line while read line
do do
if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then
continue continue
elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then
continue continue
elif [ $(echo "$line" | grep -c "^ORDER") -ne 0 ]; then
order=$(echo "$line" | cut -f2 -d"=")
for o in $order
do
glist=$(find $o -type d)
for d in $glist
do
combine_config_layer $d
done
done
else else
arch=$(echo "$line" | cut -f1 -d"=") arch=$(echo "$line" | cut -f1 -d"=")
configs=$(echo "$line" | cut -f2 -d"=") configs=$(echo "$line" | cut -f2 -d"=")
@ -117,7 +119,7 @@ do
continue continue
fi fi
merge_configs $arch $configs merge_configs $arch $configs "$order"
fi fi
done < $control_file done < $control_file

View File

@ -3,6 +3,11 @@
# the first arg is arch and variant, the second is a hierarchy of # the first arg is arch and variant, the second is a hierarchy of
# config options, lowest priority to highest # config options, lowest priority to highest
# tells the build_configs.sh which order to build the configs.
# this is useful when providing a separate overrides directory.
# do not use quotes and space separate the directories.
ORDER=fedora
# x86_64 # x86_64
x86_64=generic:generic-x86:generic-x86-x86_64 x86_64=generic:generic-x86:generic-x86-x86_64
x86_64-debug=generic:generic-x86:generic-x86-x86_64:debug:debug-x86:debug-x86-x86_64 x86_64-debug=generic:generic-x86:generic-x86-x86_64:debug:debug-x86:debug-x86-x86_64