Duble check generated configuration files in order to avoid
discrepancies like this one:

https://bugzilla.redhat.com/show_bug.cgi?id=1347454

Signed-off-by: Miguel Flores Silverio <[email protected]>
---
* PATCHv1
   - Check config files at compilation time

 * PATCHv2
   - Check config files before and after oldconfig is aplied
   - Save log of mismatches in logs directory in tree

 * PATCHv3
   - save mismatches in .mismatches and exit compilation if
     there any.
   - Display error message and config options in .mismatches
   - Fixed bug in awk statment
   - Only save mismatches of enabled config options
   - Delete temporary files outside function to avoid confusion
   
 kernel.spec | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/kernel.spec b/kernel.spec
index 8d3587d..431a17c 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -1231,9 +1231,21 @@ rm -f kernel-%{version}-*debug.config
 
 %define make make %{?cross_opts}
 
+# Check configuration files for any discrepancies
+CheckConfigs(){
+    awk 'NR==FNR{configs[$0]++;next;}
+    NR!=FNR && !($0 in configs)' $1 $2 | egrep '^CONFIG_' > .mismatches
+    if [ -s .mismatches ]
+    then
+       echo "Error: Mismatches found in configuration files"
+       cat .mismatches
+       exit 1
+    fi
+}
 # now run oldconfig over all the config files
 for i in *.config
 do
+  cat $i > temp-$i
   mv $i .config
   Arch=`head -1 .config | cut -b 3-`
   make ARCH=$Arch listnewconfig | grep -E '^CONFIG_' >.newoptions || true
@@ -1247,6 +1259,8 @@ do
   make ARCH=$Arch oldnoconfig
   echo "# $Arch" > configs/$i
   cat .config >> configs/$i
+  CheckConfigs configs/$i temp-$i
+  rm temp-$i
 done
 # end of kernel config
 %endif
--
2.7.4
_______________________________________________
kernel mailing list
[email protected]
https://lists.fedoraproject.org/admin/lists/[email protected]

Reply via email to