From patchwork Fri Oct 13 04:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1847859 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=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (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 4S6DJD0JLBz1yyb for ; Fri, 13 Oct 2023 15:37:31 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qr9vP-0007u6-1k; Fri, 13 Oct 2023 04:37:23 +0000 Received: from mail-ot1-f43.google.com ([209.85.210.43]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qr9vH-0007tV-W4 for kernel-team@lists.ubuntu.com; Fri, 13 Oct 2023 04:37:16 +0000 Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6c64c2c0f97so1079585a34.3 for ; Thu, 12 Oct 2023 21:37:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697171834; x=1697776634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xplg1BbNbC0X7kDaISwARuUd7xa2BRe0hy7z9+8yCqM=; b=BQBsWwxoetaUzFkkJpn4HussOAdMOaTi6urXoeB64kT1FlyD5wJpNKgkcwWUZtCQk9 Vl4ze67KD4Dl1Gia/FxWvbzpra8b0FtBC/UelUDiJ4tRBI+SrEW2TVHQzz6MC1ufxWor K/RHyFeIEqu+DU2mxJu/cXvMyRm7uE8BJ3zJqBlwPB4gyLLm/9qm9eolPpzhm3We4iy2 2FN+3TZv76vjboD+R446dxWWYIHR5MxeKGO0gGiz6H/1MYzvZrTu+OTk9pKy/e6g+TY+ ZRiQiguCg8TA7adWw7GLhc66eW6cLZvglc+/w3ELZMCphcAJGUdFfSrRB5h9QpxSOngW Chaw== X-Gm-Message-State: AOJu0YxQs2yxKOpYRpV0bA4bQJsVT2zEBWXkR5PKwENklRcxCf5mpLze PY6UR8cNeUqeRU0Muzr5QXmx6fr56bM= X-Google-Smtp-Source: AGHT+IEm7rPhRjhaXsCoVYCR8lYddwuitBs8jqYL8y2NQSvS3hKd7nI8a1ggG2IBzQrL5SqsIlpO2A== X-Received: by 2002:a9d:6a93:0:b0:6b8:dc53:9efd with SMTP id l19-20020a9d6a93000000b006b8dc539efdmr28126001otq.3.1697171834102; Thu, 12 Oct 2023 21:37:14 -0700 (PDT) Received: from localhost.localdomain (125-229-129-140.hinet-ip.hinet.net. [125.229.129.140]) by smtp.gmail.com with ESMTPSA id c4-20020a62e804000000b00690c9fda0fesm12555921pfi.169.2023.10.12.21.37.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 21:37:13 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][Lunar] UBUNTU: [Packaging] support modaliases for standalone dkms packages Date: Fri, 13 Oct 2023 12:36:30 +0800 Message-Id: <20231013043630.1667443-2-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231013043630.1667443-1-vicamo.yang@canonical.com> References: <20231013043630.1667443-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.210.43; envelope-from=vicamo@gmail.com; helo=mail-ot1-f43.google.com 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" BugLink: https://bugs.launchpad.net/bugs/2021740 Signed-off-by: You-Sheng Yang --- debian.master/control.stub.in | 1 + debian/control.d/flavour-module.stub | 1 + debian/rules | 1 + debian/rules.d/2-binary-arch.mk | 10 +++++++++- debian/scripts/dkms-build | 9 +++++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/debian.master/control.stub.in b/debian.master/control.stub.in index cf8164ebba26..7c8660ad433a 100644 --- a/debian.master/control.stub.in +++ b/debian.master/control.stub.in @@ -35,6 +35,7 @@ Build-Depends: uuid-dev , libnuma-dev [amd64 arm64 ppc64el s390x] , dkms , + dh-modaliases , curl , zstd [amd64 s390x] , pahole [amd64 arm64 armhf ppc64el s390x riscv64] | dwarves (>= 1.21) [amd64 arm64 armhf ppc64el s390x riscv64] , diff --git a/debian/control.d/flavour-module.stub b/debian/control.d/flavour-module.stub index 2810f83bb361..d3a7b2ca1030 100644 --- a/debian/control.d/flavour-module.stub +++ b/debian/control.d/flavour-module.stub @@ -7,6 +7,7 @@ Priority: optional Depends: ${misc:Depends}, linux-image-PKGVER-ABINUM-FLAVOUR | linux-image-unsigned-PKGVER-ABINUM-FLAVOUR, +XB-Modaliases: ${modaliases} Built-Using: ${linux:BuiltUsing} Description: Linux kernel MODULE modules for version PKGVER-ABINUM This package provides the Linux kernel MODULE modules for version diff --git a/debian/rules b/debian/rules index 034aa2b789a6..a5ca75ac998d 100755 --- a/debian/rules +++ b/debian/rules @@ -152,6 +152,7 @@ clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs. # Remove generated intermediate files rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub rm -f $(DROOT)/scripts/fix-filenames + rm -f $(DROOT)/*.modaliases .PHONY: distclean distclean: clean diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index aa790f98f000..af43aa0455f1 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -451,6 +451,9 @@ endif $(foreach _m,$(all_dkms_modules), \ $(if $(enable_$(_m)), \ $(call build_dkms,$(dkms_$(_m)_pkg_name)-$*,$(dkms_$(_m)_pkgdir)/lib/modules/$(abi_release)-$*/$(dkms_$(_m)_subdir),$(dbgpkgdir_dkms),$(_m),$(dkms_$(_m)_debpath)); \ + $(if $(filter $(_m),$(all_standalone_dkms_modules)), \ + if [ -f "$(dkms_dir)/$(_m).modaliases" ]; then cp "$(dkms_dir)/$(_m).modaliases" "$(CURDIR)/debian/$(dkms_$(_m)_pkg_name)-$*.modaliases"; fi; \ + ) \ ) \ ) @@ -672,7 +675,12 @@ ifeq ($(do_extras_package),true) endif $(foreach _m,$(all_standalone_dkms_modules), \ - $(if $(enable_$(_m)),$(call dh_all,$(dkms_$(_m)_pkg_name)-$*);)\ + $(if $(enable_$(_m)), \ + if [ -f "$(CURDIR)/debian/$(dkms_$(_m)_pkg_name)-$*.modaliases" ]; then \ + dh_modaliases -p$(dkms_$(_m)_pkg_name)-$*; \ + fi; \ + $(call dh_all,$(dkms_$(_m)_pkg_name)-$*); \ + )\ ) $(call dh_all,$(pkgbldinfo)) diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build index f85a6557a8e0..0b9c3df3fde3 100755 --- a/debian/scripts/dkms-build +++ b/debian/scripts/dkms-build @@ -91,6 +91,15 @@ do fi dpkg -x "$lpackage"_*.deb "$package" + if [ -n "$(dpkg-deb -f "$lpackage"_*.deb Modaliases)" ]; then + echo "II: dkms-build $package modaliases:" + dpkg-deb -f "$lpackage"_*.deb Modaliases | \ + sed -e 's/\([^(]\+\)(\([^)]\+\))\(, \)\?/\1 \2\n/g' | \ + sed -e '/,/bx' -e 's/\([^ ]\+\) \([^ ]\+\)/alias \2 \1/' \ + -e 'bend' -e ':x' -e 's/\([^ ]\+\) \([^ ]\+\), \(.*\)/alias \2 \1\n\1 \3/' -e 'P;D' -e ':end' | \ + grep -v '^$' | \ + sort | tee "$package".modaliases + fi lversion=$( echo "$lpackage_path" | sed -e 's@.*/@@' -e 's@_[^_]*$@@' -e 's@.*_@@') #built_using_record "$srcdir/debian/$pkgname.substvars" "$built_using$lpackage (= $lversion)"