diff mbox series

[SRU,F/G/U,2/3] UBUNTU: [Config]: prepare to enforce all

Message ID 20200518133702.226714-3-cascardo@canonical.com
State New
Headers show
Series [SRU,F/G/U,1/3] UBUNTU: [Config]: do not enforce CONFIG_VERSION_SIGNATURE | expand

Commit Message

Thadeu Lima de Souza Cascardo May 18, 2020, 1:37 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1879327

Add an extra option to config-check script, which means to enforce all
options.  In case it's false, it behaves like before. In case it's true, it
treats all options as enforced.

By default, we call it with a false value, allowing that to be changed in
$(DEBIAN)/rules.d/hooks.mk, for example.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 debian/rules                     |  1 +
 debian/rules.d/4-checks.mk       |  3 ++-
 debian/scripts/config-check      | 10 ++++++----
 debian/scripts/misc/kernelconfig |  2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/debian/rules b/debian/rules
index 8585c1c95086..0b29cc7f4adc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,6 +38,7 @@  do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
 do_tools_common?=true
 do_tools_host?=false
 do_tools_perf_jvmti?=false
+do_enforce_all?=false
 
 # Don't build tools or udebs in a cross compile environment.
 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
diff --git a/debian/rules.d/4-checks.mk b/debian/rules.d/4-checks.mk
index 3ce7e6e6f8e2..b99a1023fe5b 100644
--- a/debian/rules.d/4-checks.mk
+++ b/debian/rules.d/4-checks.mk
@@ -23,5 +23,6 @@  checks-%: module-check-% abi-check-% retpoline-check-%
 config-prepare-check-%: $(stampdir)/stamp-prepare-tree-%
 	@echo Debug: $@
 	@perl -f $(DROOT)/scripts/config-check \
-		$(builddir)/build-$*/.config "$(arch)" "$*" "$(commonconfdir)" "$(skipconfig)"
+		$(builddir)/build-$*/.config "$(arch)" "$*" "$(commonconfdir)" \
+		"$(skipconfig)" "$(do_enforce_all)"
 
diff --git a/debian/scripts/config-check b/debian/scripts/config-check
index b7e37a38c207..df0cd52069b4 100755
--- a/debian/scripts/config-check
+++ b/debian/scripts/config-check
@@ -11,11 +11,11 @@  my $P = 'check-config';
 my $test = -1;
 if ($ARGV[0] eq '--test') {
 	$test = $ARGV[1] + 0;
-} elsif ($#ARGV != 4) {
-	die "Usage: $P <config> <arch> <flavour> <commonconfig> <warn-only>\n";
+} elsif ($#ARGV != 5) {
+	die "Usage: $P <config> <arch> <flavour> <commonconfig> <warn-only> <enforce-all>\n";
 }
 
-my ($configfile, $arch, $flavour, $commonconfig, $warn_only) = @ARGV;
+my ($configfile, $arch, $flavour, $commonconfig, $warn_only, $enforce_all) = @ARGV;
 
 my %values = ();
 
@@ -26,6 +26,8 @@  my $fail_exit = 1;
 $fail_exit = 0 if ($warn_only eq 'true' || $warn_only eq '1');
 my $exit_val = 0;
 
+$enforce_all = 0 if $enforce_all eq "no" or $enforce_all eq "false";
+
 # Load up the current configuration values -- FATAL if this fails
 print "$P: $configfile: loading config\n";
 open(CONFIG, "<$configfile") || die "$P: $configfile: open failed -- $! -- aborting\n";
@@ -109,7 +111,7 @@  my $pass = 0;
 my $total = 0;
 my ($config, $value, $options, $option, $check, $policy);
 for $config (keys %annot) {
-	$check = 0;
+	$check = $enforce_all;
 	$options = $annot{$config};
 
 	$policy = undef;
diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig
index 8fc1de62ab15..fc50c48df3b7 100755
--- a/debian/scripts/misc/kernelconfig
+++ b/debian/scripts/misc/kernelconfig
@@ -176,7 +176,7 @@  for arch in $archs; do
 		flavour="${config##*.}"
 		if [ -f $archconfdir/$config ]; then
 			fullconf="$tmpdir/CONFIGS/$arch-$config"
-			"$bindir/../config-check" "$fullconf" "$arch" "$flavour" "$confdir" "0" || let "fail=$fail+1"
+			"$bindir/../config-check" "$fullconf" "$arch" "$flavour" "$confdir" "0" "0" || let "fail=$fail+1"
 		fi
 	done
 done