From: Ben Hutchings <ben@decadent.org.uk> To: linux-kbuild@vger.kernel.org Cc: debian-kernel@lists.debian.org Subject: [PATCH 04/12] builddeb: Introduce functions to simplify kconfig tests in set_debarch Date: Thu, 26 Jul 2018 11:21:01 +0100 [thread overview] Message-ID: <20180726102101.GX14131@decadent.org.uk> (raw) In-Reply-To: <20180726101934.GT14131@decadent.org.uk> [-- Attachment #1: Type: text/plain, Size: 1526 bytes --] We now have many repetitive greps over the kernel config. Refactor them into functions. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- scripts/package/mkdebian | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index f4449b575379..ada3c73d1493 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -6,6 +6,18 @@ set -e +is_enabled() { + grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG +} + +if_enabled_echo() { + if is_enabled "$1"; then + echo -n "$2" + elif [ $# -ge 3 ]; then + echo -n "$3" + fi +} + set_debarch() { if [ -n "$KBUILD_DEBARCH" ] ; then debarch="$KBUILD_DEBARCH" @@ -23,22 +35,18 @@ set_debarch() { s390*) debarch=s390x ;; ppc*) - debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; + debarch=$(if_enabled_echo CPU_LITTLE_ENDIAN ppc64el powerpc) ;; parisc*) debarch=hppa ;; mips*) - debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; + debarch=mips$(if_enabled_echo CPU_LITTLE_ENDIAN el) ;; aarch64|arm64) debarch=arm64 ;; arm*) - if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then - if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then - debarch=armhf - else - debarch=armel - fi + if is_enabled AEABI; then + debarch=arm$(if_enabled_echo VFP hf el) else - debarch=arm + debarch=arm fi ;; *) [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 811 bytes --]
next prev parent reply other threads:[~2018-07-26 11:37 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-26 10:19 [PATCH 00/12] Update architecture detection Ben Hutchings 2018-07-26 10:20 ` [PATCH 01/12] builddeb: Skip architecture detection when KBUILD_DEBARCH is set Ben Hutchings 2018-07-26 10:20 ` [PATCH 02/12] builddeb: Change architecture detection fallback to use dpkg-architecture Ben Hutchings 2018-07-26 10:20 ` [PATCH 03/12] builddeb: Drop check for 32-bit s390 Ben Hutchings 2018-07-26 10:21 ` Ben Hutchings [this message] 2018-07-26 10:21 ` [PATCH 05/12] builddeb: Add automatic support for ppc64 and powerpcspe architectures Ben Hutchings 2018-07-26 10:21 ` [PATCH 06/12] builddeb: Add automatic support for mips64el architecture Ben Hutchings 2018-07-26 10:22 ` [PATCH 07/12] builddeb: Add automatic support for mips{,64}r6{,el} architectures Ben Hutchings 2018-07-26 10:22 ` [PATCH 08/12] builddeb: Add automatic support for sparc64 architecture Ben Hutchings 2018-07-26 10:22 ` [PATCH 09/12] builddeb: Add automatic support for or1k architecture Ben Hutchings 2018-07-26 10:22 ` [PATCH 10/12] builddeb: Add automatic support for m68k architecture Ben Hutchings 2018-07-26 10:22 ` [PATCH 11/12] builddeb: Add automatic support for riscv* architectures Ben Hutchings 2018-07-26 10:22 ` [PATCH 12/12] builddeb: Add automatic support for sh{3,4}{,eb} architectures Ben Hutchings 2018-08-01 23:10 ` [PATCH 00/12] Update architecture detection Masahiro Yamada
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180726102101.GX14131@decadent.org.uk \ --to=ben@decadent.org.uk \ --cc=debian-kernel@lists.debian.org \ --cc=linux-kbuild@vger.kernel.org \ --subject='Re: [PATCH 04/12] builddeb: Introduce functions to simplify kconfig tests in set_debarch' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.