From 62496f789fcb014cda6fdc84a05e5b1e5c242861 Mon Sep 17 00:00:00 2001 From: Don Zickus Date: Wed, 13 Dec 2017 16:19:06 -0500 Subject: 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. --- configs/build_configs.sh | 62 +++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'configs/build_configs.sh') diff --git a/configs/build_configs.sh b/configs/build_configs.sh index f345e2af7..15ab6b380 100755 --- a/configs/build_configs.sh +++ b/configs/build_configs.sh @@ -6,7 +6,7 @@ PACKAGE_NAME="${1:-kernel}" # defines the package name used 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)" OUTPUT_DIR="$PWD" SCRIPT_DIR="$(dirname $SCRIPT)" @@ -49,29 +49,31 @@ function merge_configs() archvar=$1 arch=$(echo "$archvar" | cut -f1 -d"-") configs=$2 + order=$3 name=$OUTPUT_DIR/$PACKAGE_NAME-$archvar.config echo -n "Building $name ... " touch config-merging config-merged - # apply base first - for config in $(echo $configs | sed -e 's/:/ /g') + # apply based on order + skip_if_missing="" + for o in $order do - perl merge.pl config-base-$config config-merging > config-merged - if [ ! $? -eq 0 ]; then - die "Failed to merge base" - fi - mv config-merged config-merging - 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 - if [ ! $? -eq 0 ]; then - die "Failed to merge configs" - fi - mv config-merged config-merging + for config in $(echo $configs | sed -e 's/:/ /g') + do + 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 + die "Failed to merge $cfile" + fi + mv config-merged config-merging + done + + # first configs in $order is baseline, all files should be + # there. second pass is overrides and can be missing. + skip_if_missing="1" done if [ "x$arch" == "xaarch64" ]; then echo "# arm64" > $name @@ -93,22 +95,22 @@ function merge_configs() 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 do if [ $(echo "$line" | grep -c "^#") -ne 0 ]; then continue elif [ $(echo "$line" | grep -c "^$") -ne 0 ]; then 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 arch=$(echo "$line" | cut -f1 -d"=") configs=$(echo "$line" | cut -f2 -d"=") @@ -117,7 +119,7 @@ do continue fi - merge_configs $arch $configs + merge_configs $arch $configs "$order" fi done < $control_file -- cgit