From patchwork Tue May 9 14:29:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1778992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=GTTmi06x; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QG0tV31bxz214M for ; Wed, 10 May 2023 00:30:10 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pwOLq-0006Je-BN; Tue, 09 May 2023 14:30:02 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pwOLm-0006IX-1z for kernel-team@lists.ubuntu.com; Tue, 09 May 2023 14:29:58 +0000 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 41BD23F32E for ; Tue, 9 May 2023 14:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1683642597; bh=Je/cgwQoNe8lmEiNt0yYm7R6k5yaCZrGKKx6/cRqyLU=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=GTTmi06xYCznY6JGALqHhMTADEp88wdKTFtw7i/AclEfkcrCa/rgJbX7SfYfflQa7 rU5m0x2SwH++q0ECgFeh0+s9L8QKXUguUFHhA+FauU6E6sujNfAMCktOz5x9ytJPsY TungLheENbDXtEF9yLQ+nXbDC5GOynSR61LoCDsPN+oQRmgNzNVQxoml8ZNkOHQ1NH fwfY8u7DR7I7yOK3wmIpzuNTo8JhmtBIPQHnbgKeDvVprgLWf9jh5FM+cj7dXV2C0x gCUCxefv/MqG11KC3qxVVYpp8AUZ2fK2KxPCbXG18wYrKLsky6jchR3dSzq0jm8B2Y qQB24+cZOwSdg== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-969ea6699fdso112589666b.3 for ; Tue, 09 May 2023 07:29:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683642597; x=1686234597; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Je/cgwQoNe8lmEiNt0yYm7R6k5yaCZrGKKx6/cRqyLU=; b=KF1T2WoEOilYZ8D0nW99lkKRS77js5kfJcvYSmJzX+GV6gzM3I3fS3TudX8BOl6rQd m42NwrrMlzGgvhlbFO5LKvGDWUSLEGD7NGzAbHjM/kY1rFAKNw/8JCf7ngtoDXbh3GB4 wzjfNznZgB/fexPjPONPl+rTD1EqlxxwXQ7K7zrw/3yJtKcE3kRz/zHj24EmzD8vrj2D ZiT8DA90M1P3vjMnDz95Qql9dWBhZ69rO8/vfTF8UfPMFC5WonyseSlTjYj47YxGqySJ yx/dtHxPU/e6MhwkNh+ZqJSZ/9y69bTvm5Fpcghq24x2+3yEtmoVT3xHEjXCXMqYCT4J KY0w== X-Gm-Message-State: AC+VfDxKSDLccMvXo8qiCH20EVY9kqrpAG+g+lxHlazh1LTnepHDVLa+ 5gLfkXEvxzkwzIdiIueNb89aoql7c7JqrL9ayVr7uG7x5j7747fsJafgaBtqHPpHi19X5Aj0RQ3 nLm9uDVE1vvoiqyketgcNHJ/f+yMkpdy4chf88rIBC2YH+wF4YA== X-Received: by 2002:a17:906:730c:b0:969:19ca:b856 with SMTP id di12-20020a170906730c00b0096919cab856mr5808190ejc.54.1683642596819; Tue, 09 May 2023 07:29:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/2S64s+yhFarAyZ2R32qbB+51i6O30QspMN2+jWqU53o6pOWdhV1i+wB/liV0++2aIU6gnA== X-Received: by 2002:a17:906:730c:b0:969:19ca:b856 with SMTP id di12-20020a170906730c00b0096919cab856mr5808161ejc.54.1683642596353; Tue, 09 May 2023 07:29:56 -0700 (PDT) Received: from localhost.localdomain ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id d11-20020a05640208cb00b0050bd4b8ca8fsm817912edz.14.2023.05.09.07.29.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 07:29:55 -0700 (PDT) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [Unstable][PATCH] UBUNTU: [Packaging] Drop support of old config handling Date: Tue, 9 May 2023 16:29:51 +0200 Message-Id: <20230509142951.62580-1-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" All kernels and their derivatives have been migrated to the new annotations scheme by now so clean up the tree and drop the support of the old config handling. Signed-off-by: Juerg Haefliger Acked-by: Tim Gardner --- debian/rules.d/1-maintainer.mk | 22 --- debian/rules.d/4-checks.mk | 10 +- debian/scripts/checks/config-check | 163 ------------------ debian/scripts/misc/migrate-annotations | 35 ---- debian/scripts/misc/old-kernelconfig | 218 ------------------------ 5 files changed, 2 insertions(+), 446 deletions(-) delete mode 100755 debian/scripts/checks/config-check delete mode 100755 debian/scripts/misc/migrate-annotations delete mode 100644 debian/scripts/misc/old-kernelconfig diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk index 6eded3eb4626..2b72ffc56e72 100644 --- a/debian/rules.d/1-maintainer.mk +++ b/debian/rules.d/1-maintainer.mk @@ -10,7 +10,6 @@ help: @echo " defaultconfigs : Update core arch configs using defaults" @echo " genconfigs : Generate core arch configs in CONFIGS/*" @echo " editconfigs : Edit core arch configs" - @echo " migrateconfigs : Automatically import old configs into annotations" @echo " printchanges : Print the current changelog entries (from git)" @echo " insertchanges : Insert current changelog entries (from git)" @echo " startnewrelease : Start a new changelog set" @@ -25,34 +24,13 @@ help: printdebian: @echo "$(DEBIAN)" -.PHONY: migrateconfigs -migrateconfigs: -ifneq ($(wildcard $(DEBIAN)/config/config.common.ubuntu),) - dh_testdir - conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig genconfigs - rm -rf build - mkdir build - mv $(DEBIAN)/config/annotations build/.annotations - mv $(DEBIAN)/config/README.rst build/.README.rst 2>/dev/null || true - rm -rf $(DEBIAN)/config - mkdir -p $(DEBIAN)/config - debian/scripts/misc/migrate-annotations < build/.annotations > $(DEBIAN)/config/annotations - mv build/.README.rst $(DEBIAN)/config/README.rst 2>/dev/null || true - rm -rf build - kmake='$(kmake)' conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/kernelconfig updateconfigs -endif - configs-targets := updateconfigs defaultconfigs genconfigs editconfigs .PHONY: $(configs-targets) $(configs-targets): dh_testdir -ifneq ($(wildcard $(DEBIAN)/config/config.common.ubuntu),) - conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig $@ -else kmake='$(kmake)' skip_checks=$(do_skip_checks) conc_level=$(conc_level) \ $(SHELL) $(DROOT)/scripts/misc/kernelconfig $@ -endif .PHONY: printenv printenv: diff --git a/debian/rules.d/4-checks.mk b/debian/rules.d/4-checks.mk index 2f7853fd51e5..34b343189de5 100644 --- a/debian/rules.d/4-checks.mk +++ b/debian/rules.d/4-checks.mk @@ -31,12 +31,6 @@ checks-%: module-check-% module-signature-check-% abi-check-% retpoline-check-% config-prepare-check-%: $(stampdir)/stamp-prepare-tree-% @echo Debug: $@ ifneq ($(do_skip_checks),true) - if [ -e $(commonconfdir)/config.common.ubuntu ]; then \ - perl -f $(DROOT)/scripts/checks/config-check \ - $(builddir)/build-$*/.config "$(arch)" "$*" "$(commonconfdir)" \ - "$(skipconfig)" "$(do_enforce_all)"; \ - else \ - python3 $(DROOT)/scripts/misc/annotations -f $(commonconfdir)/annotations \ - --arch $(arch) --flavour $* --check $(builddir)/build-$*/.config; \ - fi + python3 $(DROOT)/scripts/misc/annotations -f $(commonconfdir)/annotations \ + --arch $(arch) --flavour $* --check $(builddir)/build-$*/.config endif diff --git a/debian/scripts/checks/config-check b/debian/scripts/checks/config-check deleted file mode 100755 index 845a649db7af..000000000000 --- a/debian/scripts/checks/config-check +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/perl -# -# check-config -- check the current config for issues -# -use strict; -use File::Basename; -use File::Spec; - -my $P = 'check-config'; - -my $test = -1; -if ($ARGV[0] eq '--test') { - $test = $ARGV[1] + 0; -} elsif ($#ARGV != 5) { - die "Usage: $P \n"; -} - -my ($configfile, $arch, $flavour, $commonconfig, $warn_only, $enforce_all) = @ARGV; - -my %values = (); - -# If we are in overridden then still perform the checks and emit the messages -# but do not return failure. Those items marked FATAL will alway trigger -# failure. -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"; -while () { - # Pull out values. - /^#*\s*(CONFIG_\w+)[\s=](.*)$/ or next; - if ($2 eq 'is not set') { - $values{$1} = 'n'; - } else { - $values{$1} = $2; - } -} -close(CONFIG); - -sub read_annotations { - my ($filename) = @_; - my %annot; - my $form = 1; - my ($config, $value, $options); - - # Keep track of the configs that shouldn't be appended because - # they were include_annot from another annotations file. - # That's a hash of undefs, aka a set. - my %noappend; - - print "$P: $filename loading annotations\n"; - open(my $fd, "<$filename") || - die "$P: $filename: open failed -- $! -- aborting\n"; - while (<$fd>) { - if (/^# FORMAT: (\S+)/) { - die "$P: $1: unknown annotations format\n" if ($1 != 2 && $1 != 3 && $1 != 4); - $form = $1; - } - - # Format #3 adds the include directive on top of format #2: - if ($form == 3 && /^\s*include(\s|$)/) { - # Include quoted or unquoted files: - if (/^\s*include\s+"(.*)"\s*$/ || /^\s*include\s+(.*)$/) { - # The include is relative to the current file - my $include_filename = File::Spec->join(dirname($filename), $1); - # Append the include files - my %include_annot = read_annotations($include_filename); - %annot = ( %annot, %include_annot ); - # And marked them to not be appended: - my %included_noappend; - # Discard the values and keep only the keys - @included_noappend{keys %include_annot} = (); - %noappend = ( %noappend, %included_noappend ); - next; - } else { - die "$P: Invalid include: $_"; - } - } - - /^#/ && next; - chomp; - /^$/ && next; - /^CONFIG_/ || next; - - if ($form == 1) { - ($config, $value, $options) = split(' ', $_, 3); - } elsif ($form >= 2) { - ($config, $options) = split(' ', $_, 2); - } - - if (exists $noappend{$config}) { - delete $annot{$config}; - delete $noappend{$config}; - } - $annot{$config} = $annot{$config} . ' ' . $options; - } - close($fd); - return %annot; -} - -# ANNOTATIONS: check any annotations marked for enforcement -my $annotations = "$commonconfig/annotations"; -my %annot = read_annotations($annotations); - -my $pass = 0; -my $total = 0; -my ($config, $value, $options, $option, $check, $policy); -for $config (keys %annot) { - $check = $enforce_all; - $options = $annot{$config}; - - $policy = undef; - while ($options =~ /\s*([^\s<]+)<(.*?)?>/g) { - ($option, $value) = ($1, $2); - - if ($option eq 'mark' && $value eq 'ENFORCED') { - $check = 1; - - } elsif ($option eq 'policy') { - if ($value =~ /^{/) { - $value =~ s/:/=>/g; - $policy = eval($value); - warn "$config: $@" if ($@); - } else { - $policy = undef; - } - } - } - if ($check == 1 && !defined($policy)) { - print "$P: INVALID POLICY (use policy<{...}>) $config$options\n"; - $total++; - $check = 0; - } - if ($check) { - # CONFIG_VERSION_SIGNATURE is dynamically set during the build - next if ($config eq "CONFIG_VERSION_SIGNATURE"); - my $is = '-'; - $is = $values{$config} if (defined $values{$config}); - - my $value = '-'; - for my $which ("$arch-$flavour", "$arch-*", "*-$flavour", "$arch", "*") { - if (defined $policy->{$which}) { - $value = $policy->{$which}; - last; - } - } - if ($is eq $value) { - $pass++; - } else { - print "$P: FAIL ($is != $value): $config$options\n"; - $exit_val = $fail_exit; - } - $total++; - } -} - -print "$P: $pass/$total checks passed -- exit $exit_val\n"; -exit $exit_val; diff --git a/debian/scripts/misc/migrate-annotations b/debian/scripts/misc/migrate-annotations deleted file mode 100755 index dc313c6d6c3d..000000000000 --- a/debian/scripts/misc/migrate-annotations +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -. debian/debian.env - -# We have to be in the top level kernel source directory -if [ ! -f MAINTAINERS ] || [ ! -f Makefile ]; then - echo "This does not appear to be the kernel source directory." 1>&2 - exit 1 -fi - -. ${DEBIAN}/etc/kernelconfig - -ARCH=$(echo $archs | tr " " "\n" | sort -u) -FLAVOUR=$(for arch in ${ARCH}; do - flavours=$(sed -ne 's/^flavours\s*=\s*\(.*\)$/\1/p' ${DEBIAN}/rules.d/${arch}.mk) - for flavour in ${flavours}; do - echo ${arch}-${flavour} - done -done | tr " " "\n" | sort -u) - -while read line; do - (echo $line | grep -q '^#') || break -done - -cat << EOF -# Menu: HEADER -# FORMAT: 4 -# ARCH: $(echo ${ARCH}) -# FLAVOUR: $(echo ${FLAVOUR}) - -EOF - -while read line; do - echo ${line} -done diff --git a/debian/scripts/misc/old-kernelconfig b/debian/scripts/misc/old-kernelconfig deleted file mode 100644 index b68676ea85c6..000000000000 --- a/debian/scripts/misc/old-kernelconfig +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/bash - -. debian/debian.env - -# Script to merge all configs and run 'make syncconfig' on it to wade out bad juju. -# Then split the configs into distro-commmon and flavour-specific parts - -# We have to be in the top level kernel source directory -if [ ! -f MAINTAINERS ] || [ ! -f Makefile ]; then - echo "This does not appear to be the kernel source directory." 1>&2 - exit 1 -fi - -mode=${1:?"Usage: $0 (oldconfig|editconfig) [do_enforce_all]"} -do_enforce_all=${2:-0} -yes=0 -case "$mode" in - update*configs) mode='syncconfig' ;; - default*configs) mode='oldconfig'; yes=1 ;; - edit*configs) ;; # All is good - gen*configs) mode='genconfigs' ;; # All is good - dump*configs) mode='config'; yes=1 ;; - *) echo "$0 called with invalid mode" 1>&2 - exit 1 ;; -esac - -if [ -z "$gcc" ]; then - echo "ERROR: gcc environment variable must be set" - exit 1 -fi - -kerneldir="`pwd`" -confdir="$kerneldir/${DEBIAN}/config" -variant="$2" - -. $DEBIAN/etc/kernelconfig - -bindir="`pwd`/${DROOT}/scripts/misc" -common_conf="$confdir/config.common.ubuntu" -tmpdir=`mktemp -d` -mkdir "$tmpdir/CONFIGS" - -if [ "$mode" = "genconfigs" ]; then - keep=1 - mode="oldconfig" - test -d CONFIGS || mkdir CONFIGS -fi - -warning_partial= - -for arch in $archs; do - rm -rf build - mkdir build - - # Map debian archs to kernel archs - case "$arch" in - ppc64|ppc64el) kernarch="powerpc" ;; - amd64) kernarch="x86_64" ;; - lpia) kernarch="x86" ;; - sparc) kernarch="sparc64" ;; - armel|armhf) kernarch="arm" ;; - s390x) kernarch="s390" ;; - riscv64) kernarch="riscv" ;; - *) kernarch="$arch" ;; - esac - - # Determine cross toolchain to use for Kconfig compiler tests - cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-" - - # Arch-specific compiler, if any - archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc) - - # Environment variables for 'make *config'. We omit CROSS_COMPILE - # for i386 since it is no longer supported after 19.04, however - # we maintain the configs for hwe. - modify_config=true - env="ARCH=$kernarch DEB_ARCH=$arch" - compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true) - if [ "$compiler_path" != '' ]; then - env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path" - else - echo "WARNING: ${cross_compile}gcc not installed" - modify_config= - warning_partial="$warning_partial $arch" - fi - - archconfdir=$confdir/$arch - flavourconfigs=$(cd $archconfdir && ls config.flavour.*) - - # Merge configs - # We merge config.common.ubuntu + config.common. + - # config.flavour. - - for config in $flavourconfigs; do - fullconf="$tmpdir/$arch-$config-full" - case $config in - *) - : >"$fullconf" - if [ -f $common_conf ]; then - cat $common_conf >> "$fullconf" - fi - if [ -f $archconfdir/config.common.$arch ]; then - cat $archconfdir/config.common.$arch >> "$fullconf" - fi - cat "$archconfdir/$config" >>"$fullconf" - if [ -f $confdir/OVERRIDES ]; then - cat $confdir/OVERRIDES >> "$fullconf" - fi - ;; - esac - done - - for config in $flavourconfigs; do - if [ -f $archconfdir/$config ]; then - fullconf="$tmpdir/$arch-$config-full" - cat "$fullconf" > build/.config - # Call oldconfig or menuconfig - if [ "$modify_config" ]; then - case "$mode" in - editconfigs) - # Interactively edit config parameters - while : ; do - echo -n "Do you want to edit config: $arch/$config? [Y/n] " - read choice - case "$choice" in - y* | Y* | "" ) - make O=`pwd`/build $conc_level $env menuconfig - break ;; - n* | N* ) - # 'syncconfig' prevents - # errors for '-' options set - # in common config fragments - make O=`pwd`/build $conc_level $env syncconfig - break ;; - *) - echo "Entry not valid" - esac - done - ;; - *) - echo "* Run $mode (yes=$yes) on $arch/$config ..." - if [ "$yes" -eq 1 ]; then - yes "" | make O=`pwd`/build $conc_level $env "$mode" - else - make O=`pwd`/build $conc_level $env "$mode" - fi ;; - esac - fi - cat build/.config > $archconfdir/$config - [ "$modify_config" ] && cat build/.config >"$tmpdir/CONFIGS/$arch-$config" - if [ "$keep" = "1" ]; then - cat build/.config > CONFIGS/$arch-$config - fi - else - echo "!! Config not found $archconfdir/$config..." - fi - done - - echo "Running splitconfig.pl for $arch" - echo - - # Can we make this more robust by avoiding $tmpdir completely? - # This approach was used for now because I didn't want to change - # splitconfig.pl - (cd $archconfdir; $bindir/splitconfig.pl config.flavour.*; mv config.common \ - config.common.$arch; cp config.common.$arch $tmpdir) -done - -rm -f $common_conf - -# Now run splitconfig.pl on all the config.common. copied to -# $tmpdir -(cd $tmpdir; $bindir/splitconfig.pl *) -( - cd $confdir; - rm -f *-full - grep -v 'is UNMERGABLE' <$tmpdir/config.common >$common_conf - for arch in $archs; do - grep -v 'is UNMERGABLE' <$tmpdir/config.common.$arch \ - >$arch/config.common.$arch - done -) - -echo "" -echo "Running config-check for all configurations ..." -echo "" -fail=0 -for arch in $archs; do - archconfdir=$confdir/$arch - flavourconfigs=$(cd $archconfdir && ls config.flavour.*) - for config in $flavourconfigs; do - flavour="${config##*.}" - if [ -f $archconfdir/$config ]; then - fullconf="$tmpdir/CONFIGS/$arch-$config" - [ ! -f "$fullconf" ] && continue - "$bindir/../checks/config-check" "$fullconf" "$arch" "$flavour" "$confdir" "0" "$do_enforce_all" || let "fail=$fail+1" - fi - done -done - -rc=0 -if [ "$fail" != 0 ]; then - rc=1 - echo "" - echo "*** ERROR: $fail config-check failures detected" - echo "" -fi - -rm -rf build - -if [ "$warning_partial" ]; then - rc=1 - echo "" - echo "WARNING: configuration operation applied only to a subset of architectures (skipped$warning_partial)" 1>&2 - echo "" -fi - -exit "${rc}"