From patchwork Tue Dec 3 22:26:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1203878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47SGp06pJcz9sPh; Wed, 4 Dec 2019 09:27:52 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1icGe4-0004nl-LA; Tue, 03 Dec 2019 22:27:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1icGds-0004eA-SN for kernel-team@lists.ubuntu.com; Tue, 03 Dec 2019 22:27:37 +0000 Received: from mail-yb1-f197.google.com ([209.85.219.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1icGdr-0001M2-6c for kernel-team@lists.ubuntu.com; Tue, 03 Dec 2019 22:27:35 +0000 Received: by mail-yb1-f197.google.com with SMTP id p4so3321078ybp.7 for ; Tue, 03 Dec 2019 14:27:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=njxcGAD8yuR+6dNXay8aVq2NyEGJebpvYlUdkp+bBZQ=; b=NsnMZNsmj1d4f9D0cCKuo4H+gnmA8PwYW8N1W4MGvsmVwGpD0a+iePUY76f/6cRYue jPLwWVAnOizIds7S2jTqef6UlvgjHpaF4gtEfjoeGFIXALhi2FC/2WZXkyjn5vNbG/pC wfaVwiKvr5UyzOQYTFVcOmBOTw5qibSBxZEBEqY1uS0Yy+kfqgZVN7o0IcY2M8NeR5Qo HfMcGA08cGKA67TQwR7suoqAi98QAlIHS1eUjBqHU6EZLo6dLxh5empHmiDY015kfnro vX7E0QLeSofJIvv5Q2PHVeqqnF6S7denRNZJaJ4/KT8N2k36TlvfQYh8O8yRrkqHYs00 pTTA== X-Gm-Message-State: APjAAAUKRfdI246yuo3ES1W6frPJwkmbUISVCDO2Hd5XU/nka3V94LFg MV5q5JtbnOCCcYrJRQgbqxT7jzbc/I76yN8lp1RWz16nSh2YJRIVGpbCIY5e43tfhOOPwUWqUM8 tkOZMCfPcE5Vh/TYwM2PJrdbWu0RInti5pC6jw4Fpmw== X-Received: by 2002:a25:cb09:: with SMTP id b9mr153858ybg.294.1575412053944; Tue, 03 Dec 2019 14:27:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzLDLfQnjsTzF0XnyducQ03eprx//GeBSXxHHgrZD5lzTGmy8BfIBE0ME2nz2LYYmhPXX9vMg== X-Received: by 2002:a25:cb09:: with SMTP id b9mr153840ybg.294.1575412053553; Tue, 03 Dec 2019 14:27:33 -0800 (PST) Received: from localhost ([136.37.150.243]) by smtp.gmail.com with ESMTPSA id c84sm2253060ywa.1.2019.12.03.14.27.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 14:27:33 -0800 (PST) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [REVIEW 4/6][linux-restricted-modules] UBUNTU: [Packaging] Support variant substitutions in control files Date: Tue, 3 Dec 2019 16:26:55 -0600 Message-Id: <20191203222657.1152249-22-seth.forshee@canonical.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203222657.1152249-1-seth.forshee@canonical.com> References: <20191203222657.1152249-1-seth.forshee@canonical.com> 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" Support substitution patterns for variant information in control files. Also update debian/control.d/meta-nvidia to use these variablesso to produce meta packages for all variants. Signed-off-by: Seth Forshee --- debian/control.d/meta-nvidia | 8 +++---- debian/rules | 42 ++++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/debian/control.d/meta-nvidia b/debian/control.d/meta-nvidia index d090f08fcebf..2a10a70cc7ba 100644 --- a/debian/control.d/meta-nvidia +++ b/debian/control.d/meta-nvidia @@ -1,4 +1,4 @@ -Package: linux-modules-nvidia-390-generic +Package: linux-modules-nvidia-390-generic${variant:suffix} Build-Profiles: Architecture: amd64 Section: kernel @@ -6,7 +6,7 @@ Depends: ${misc:Depends}, linux-modules-nvidia-390-ABI-generic (= ${binary:Versi Description: Extra drivers for nvidia-390 for the generic flavour Install extra signed nvidia-390 modules compatible with the generic flavour. -Package: linux-modules-nvidia-390-lowlatency +Package: linux-modules-nvidia-390-lowlatency${variant:suffix} Build-Profiles: Architecture: amd64 Section: kernel @@ -14,7 +14,7 @@ Depends: ${misc:Depends}, linux-modules-nvidia-390-ABI-lowlatency (= ${binary:Ve Description: Extra drivers for nvidia-390 for the lowlatency flavour Install extra signed nvidia-390 modules compatible with the lowlatency flavour. -Package: linux-modules-nvidia-440-generic +Package: linux-modules-nvidia-440-generic${variant:suffix} Build-Profiles: Architecture: amd64 Section: kernel @@ -22,7 +22,7 @@ Depends: ${misc:Depends}, linux-modules-nvidia-440-ABI-generic (= ${binary:Versi Description: Extra drivers for nvidia-440 for the generic flavour Install extra signed nvidia-440 modules compatible with the generic flavour. -Package: linux-modules-nvidia-440-lowlatency +Package: linux-modules-nvidia-440-lowlatency${variant:suffix} Build-Profiles: Architecture: amd64 Section: kernel diff --git a/debian/rules b/debian/rules index 1e611e68ece8..913148e835fd 100755 --- a/debian/rules +++ b/debian/rules @@ -14,29 +14,49 @@ src_abi = $(shell echo "$(src_fullversion)" | sed -ne 's/\([0-9]*\.[0-9]*\.[0-9] src_version = $(shell echo $(src_fullversion) | sed -e 's/+[0-9][0-9]*//') series = $(shell dpkg-parsechangelog | sed -ne 's/^Distribution: *//p' | sed -e 's/-\(security\|updates\|proposed\)$$//') +VARIANT_PROVIDES=$(shell echo "$(src_package)" | sed -e 's/linux-restricted-modules-//') + dkms_nvidia_390_version=$(shell gawk '/^nvidia-graphics-drivers-390/ { print $$2; }' debian/dkms-versions) dkms_nvidia_440_version=$(shell gawk '/^nvidia-graphics-drivers-440/ { print $$2; }' debian/dkms-versions) +# Get variants, assumng primary if debian/variants is not present +variants = -- +ifneq (,$(wildcard debian/variants)) + variants := $(shell cat debian/variants) +endif + control_files := debian/control.common -control_files += $(filter-out $(primary_control_files),$(shell LC_ALL=C ls -d debian/control.d/*)) +control_files += $(shell LC_ALL=C ls -d debian/control.d/*) test: echo "$(src_fullversion) $(src_version)" +define variant_payload +variant="$$(echo '$(variant)' | sed -e 's/--//')"; \ +sed -e "s/\$${variant:suffix}/$$variant/g" -e "s/\$${variant:provides\(\|-image\|-headers\)}/$${variant_provides:+linux\1-$$variant_provides}/" <$$i; \ +variant_provides=''; \ +echo ""; +endef + # We build our control file. This has to be done before dh runs otherwise # we have no binary files and we will not run the appropriate targets. pre-clean: $(control_files) rm -f debian/control.tmp - for i in $^; do \ - sed \ - -e 's/LRM_SOURCE/$(src_package)/g' \ - -e "s/ABI/$(src_abi)/g" \ - -e "s/VERSION/$(src_version)/g" \ - -e "s/@SERIES@/$(series)/g" \ - $$i >>debian/control.tmp; \ - echo "" >>debian/control.tmp; \ - done - rm -f $@ + for i in $^; do \ + if grep -q "{variant:" $$i; then \ + variant_provides="$(VARIANT_PROVIDES)"; \ + $(foreach variant,$(variants),$(variant_payload)) \ + else \ + cat $$i; \ + echo ""; \ + fi; \ + done | sed \ + -e 's/LRM_SOURCE/$(src_package)/g' \ + -e "s/ABI/$(src_abi)/g" \ + -e "s/VERSION/$(src_version)/g" \ + -e "s/@SERIES@/$(series)/g" \ + >debian/control.tmp + rm -f debian/control mv debian/control.tmp debian/control rm -rf ./$(src_version) UNSIGNED SIGNED rm -f debian/linux-modules-*.install \