Message ID | 20221115220453.3463096-1-maz@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2962692wru; Tue, 15 Nov 2022 14:06:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yoLlE57V4TZPKn1X3XimKfWTrXa2vu3R3KpH0F0PkNtSHXB+xeWpMjIHAKLnXxyd/epQW X-Received: by 2002:a17:906:3798:b0:78d:8b89:caaa with SMTP id n24-20020a170906379800b0078d8b89caaamr15338706ejc.431.1668549985307; Tue, 15 Nov 2022 14:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668549985; cv=none; d=google.com; s=arc-20160816; b=B2obe1c2ec2Jrh38KHwEYqQylhBpYUvJFHFRy6eWd7W76T9EuIxRoV5VwS1nFrUlRS xTEVy1ievkeCsz3P1dLeRemoSf/htSt0CRfBhgrwBXiS/KDoqoBFhWYx6SSd6Bxb4NIC d6xe1kaqm72Nn4Mhma8QndB1EP/ztHjksHHduzJuHigLxmOTMpaBL5vj7bGIXkYAdxsw dt4z21K/m31di/EYf1fmj5lgTDl4SQP6KMTIedmyjH5OEGm5I+xYbrT59iemZC1h/7/a T9TSlHTqRw/pVLPIwdp7XM3DT3QtVFZm5qU8u+Rcb7Y1DqEBCF6B9zo7U+JNfE8/mabM 0p+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ORX0eF/eL9+yOMlVs5MdzWcW75SF9DMRp3n1WFTsRXI=; b=BOhqoZihBNuC3zAsblu7vRN2UsEW+rfZacYBXHUeBzo6QfV1YZJ2oZJA+Qn+Zzfpau If175YkEwJX264PeBf7yH03e8OZL1nCB8056d2F2qoqudhkfCLPRTCWViEqv4dCFXnT9 zJ1zbyZ07O/bg+qUVs7ERTIC72xgVyNC/O95YCQx/093joeUdCG1MWc9jizfOgRkI58b f2lm6WFLpEq0HOU69ice4QzSn3jDOuvfDEIujNoQStHgPpndcCI/cvILKvOiLbEDybmG PF69aBjtiOGT+yPZsDEy9XCEbGLZYdWDba3zbVYWrJcRLqjr3oHd3jR/sY1HTFBra/uI n0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o45sbarp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a170906300500b0078ae5192906si10499188ejz.193.2022.11.15.14.06.01; Tue, 15 Nov 2022 14:06:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o45sbarp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238029AbiKOWFK (ORCPT <rfc822;maxim.cournoyer@gmail.com> + 99 others); Tue, 15 Nov 2022 17:05:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232010AbiKOWFI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 15 Nov 2022 17:05:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D26820BE7; Tue, 15 Nov 2022 14:05:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ACE2DB81B61; Tue, 15 Nov 2022 22:05:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57C0FC433C1; Tue, 15 Nov 2022 22:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668549904; bh=A8hKVJDELpSDaM76TOxGC8jzHZnsHhPxgoYTVJKtqvw=; h=From:To:Cc:Subject:Date:From; b=o45sbarpGs0nSr/r8wCDwhN/6lr470p23hgVSasjyfDWsYnqf1ebnWOnep5EK0gSf dhMfsJs4K52ME3k0yXIH/HS8jyt6cmyFe1gIMaxL/tdXaTp0FU8QyUltCfsztLr8LS p4naDPHQY8WKXPK3BRoFyBZgbqp3S/0klQAchJ2ebVRtB/DvIjTHkoSwswlDHeKIjm K4jm8W2UsqTI9Xx8pu6FIxtVdD+hUsWibPCQHEado0nnJnA9rVjbgpz1pO8fiDSYnN kYzYUqcRhtPMsRWj0eIWUDWBAxww0RcXw30L2E4NntgoV4nWat/2kgFdHkkAX5vVta oABb4WlhbR0pw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from <maz@kernel.org>) id 1ov43B-006Jl2-SZ; Tue, 15 Nov 2022 22:05:01 +0000 From: Marc Zyngier <maz@kernel.org> To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Masahiro Yamada <masahiroy@kernel.org>, Michal Marek <michal.lkml@markovi.net>, Nick Desaulniers <ndesaulniers@google.com> Subject: [PATCH] kbuild: Restore .version auto-increment behaviour for Debian packages Date: Tue, 15 Nov 2022 22:04:53 +0000 Message-Id: <20221115220453.3463096-1-maz@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, masahiroy@kernel.org, michal.lkml@markovi.net, ndesaulniers@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749601469846835132?= X-GMAIL-MSGID: =?utf-8?q?1749601469846835132?= |
Series |
kbuild: Restore .version auto-increment behaviour for Debian packages
|
|
Commit Message
Marc Zyngier
Nov. 15, 2022, 10:04 p.m. UTC
Since 2df8220cc511 ("kbuild: build init/built-in.a just once"),
generating Debian packages using 'make bindeb-pkg' results in
packages that are stuck to the same .version, leading to unexpected
behaviours (multiple packages with the same version).
That's because the mkdebian script samples the build version
before building the kernel, and forces the use of that version
number for the actual build.
Restore the previous behaviour by calling init/build-version
instead of reading the .version file. This is likely to result
in too many .version bumps, but this is what was happening before
(although the bump was affecting builds made after the current one).
Eventually, this script should be turned into something that
is a bit less counter-intuitive (building the kernel first
and only then generating the packaging artefacts).
Fixes: 2df8220cc511 ("kbuild: build init/built-in.a just once")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Nick Desaulniers <ndesaulniers@google.com>
---
Notes:
v2: Drop the RPM version which was wrong, and make the path
relative to $srctree.
scripts/package/mkdebian | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Nov 16, 2022 at 7:05 AM Marc Zyngier <maz@kernel.org> wrote: > > Since 2df8220cc511 ("kbuild: build init/built-in.a just once"), > generating Debian packages using 'make bindeb-pkg' results in > packages that are stuck to the same .version, leading to unexpected > behaviours (multiple packages with the same version). > > That's because the mkdebian script samples the build version > before building the kernel, and forces the use of that version > number for the actual build. > > Restore the previous behaviour by calling init/build-version > instead of reading the .version file. This is likely to result > in too many .version bumps, but this is what was happening before > (although the bump was affecting builds made after the current one). What do you mean by "too many .version bumps"? Every "make bindeb-pkg" increments the version by one. Is there any case where it increases more? > Eventually, this script should be turned into something that > is a bit less counter-intuitive (building the kernel first > and only then generating the packaging artefacts). How to achieve this? The version is recorded in debian/chanegelog. Without it, dpkg-buildpackage fails. In my understanding, the version must be fixed before building the kernel. > > Fixes: 2df8220cc511 ("kbuild: build init/built-in.a just once") > Signed-off-by: Marc Zyngier <maz@kernel.org> > Cc: Masahiro Yamada <masahiroy@kernel.org> > Cc: Michal Marek <michal.lkml@markovi.net> > Cc: Nick Desaulniers <ndesaulniers@google.com> > --- > > Notes: > v2: Drop the RPM version which was wrong, and make the path > relative to $srctree. > > scripts/package/mkdebian | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian > index 60a2a63a5e90..a3ac5a716e9f 100755 > --- a/scripts/package/mkdebian > +++ b/scripts/package/mkdebian > @@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then > packageversion=$KDEB_PKGVERSION > revision=${packageversion##*-} > else > - revision=$(cat .version 2>/dev/null||echo 1) > + revision=$($srctree/init/build-version) > packageversion=$version-$revision > fi > sourcename=$KDEB_SOURCENAME > -- > 2.34.1 > -- Best Regards Masahiro Yamada
On Wed, 16 Nov 2022 06:09:31 +0000, Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Wed, Nov 16, 2022 at 7:05 AM Marc Zyngier <maz@kernel.org> wrote: > > > > Since 2df8220cc511 ("kbuild: build init/built-in.a just once"), > > generating Debian packages using 'make bindeb-pkg' results in > > packages that are stuck to the same .version, leading to unexpected > > behaviours (multiple packages with the same version). > > > > That's because the mkdebian script samples the build version > > before building the kernel, and forces the use of that version > > number for the actual build. > > > > Restore the previous behaviour by calling init/build-version > > instead of reading the .version file. This is likely to result > > in too many .version bumps, but this is what was happening before > > (although the bump was affecting builds made after the current one). > > > What do you mean by "too many .version bumps"? > > Every "make bindeb-pkg" increments the version by one. And isn't that a problem? We increase the build number pointlessly, even if there is *nothing* to change. > > Is there any case where it increases more? No, but that's bad enough IMHO. > > Eventually, this script should be turned into something that > > is a bit less counter-intuitive (building the kernel first > > and only then generating the packaging artefacts). > > > How to achieve this? By building the kernel *before* sampling the version number, just like RPM does. > > The version is recorded in debian/chanegelog. > Without it, dpkg-buildpackage fails. And again, nothing forces us to do it in that order. > In my understanding, the version must be fixed before building the kernel. Can't immediately see what mandates it, but I'm sure you know better. Anyway, the current situation needs fixing. If you're unhappy with the patch, feel free to replace it with something that you consider more appropriate. M.
On Wed, Nov 16, 2022 at 9:28 PM Marc Zyngier <maz@kernel.org> wrote: > > On Wed, 16 Nov 2022 06:09:31 +0000, > Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > On Wed, Nov 16, 2022 at 7:05 AM Marc Zyngier <maz@kernel.org> wrote: > > > > > > Since 2df8220cc511 ("kbuild: build init/built-in.a just once"), > > > generating Debian packages using 'make bindeb-pkg' results in > > > packages that are stuck to the same .version, leading to unexpected > > > behaviours (multiple packages with the same version). > > > > > > That's because the mkdebian script samples the build version > > > before building the kernel, and forces the use of that version > > > number for the actual build. > > > > > > Restore the previous behaviour by calling init/build-version > > > instead of reading the .version file. This is likely to result > > > in too many .version bumps, but this is what was happening before > > > (although the bump was affecting builds made after the current one). > > > > > > What do you mean by "too many .version bumps"? > > > > Every "make bindeb-pkg" increments the version by one. > > And isn't that a problem? We increase the build number pointlessly, > even if there is *nothing* to change. I think "make *-pkg" should increment the version every time. The .version is incremented only when vmlinux is updated. When you change module code, only *.ko is relinked. The .version stays because it is embedded in vmlinux. Even if you build the kernel first, and .version has no change, the package contents may have some changes. > > > > Is there any case where it increases more? > > No, but that's bad enough IMHO. > > > > Eventually, this script should be turned into something that > > > is a bit less counter-intuitive (building the kernel first > > > and only then generating the packaging artefacts). > > > > > > How to achieve this? > > > By building the kernel *before* sampling the version number, just like > RPM does. > > > > > The version is recorded in debian/chanegelog. > > Without it, dpkg-buildpackage fails. > > And again, nothing forces us to do it in that order. > > > In my understanding, the version must be fixed before building the kernel. > > Can't immediately see what mandates it, but I'm sure you know better. > > Anyway, the current situation needs fixing. If you're unhappy with the > patch, feel free to replace it with something that you consider more > appropriate. > > M. > > -- > Without deviation from the norm, progress is not possible.
On Wed, 16 Nov 2022 20:56:38 +0000, Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Wed, Nov 16, 2022 at 9:28 PM Marc Zyngier <maz@kernel.org> wrote: > > > > On Wed, 16 Nov 2022 06:09:31 +0000, > > Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > On Wed, Nov 16, 2022 at 7:05 AM Marc Zyngier <maz@kernel.org> wrote: > > > > > > > > Since 2df8220cc511 ("kbuild: build init/built-in.a just once"), > > > > generating Debian packages using 'make bindeb-pkg' results in > > > > packages that are stuck to the same .version, leading to unexpected > > > > behaviours (multiple packages with the same version). > > > > > > > > That's because the mkdebian script samples the build version > > > > before building the kernel, and forces the use of that version > > > > number for the actual build. > > > > > > > > Restore the previous behaviour by calling init/build-version > > > > instead of reading the .version file. This is likely to result > > > > in too many .version bumps, but this is what was happening before > > > > (although the bump was affecting builds made after the current one). > > > > > > > > > What do you mean by "too many .version bumps"? > > > > > > Every "make bindeb-pkg" increments the version by one. > > > > And isn't that a problem? We increase the build number pointlessly, > > even if there is *nothing* to change. > > > I think "make *-pkg" should increment the version every time. But that's not what the rpm package builder does. > > > The .version is incremented only when vmlinux is updated. > > When you change module code, only *.ko is relinked. > The .version stays because it is embedded in vmlinux. > > > Even if you build the kernel first, and .version has no change, > the package contents may have some changes. And again, isn't that an inconsistency? Anyway, enough idle arguing. What do want me to do about this bug? M.
On Thu, Nov 17, 2022 at 6:40 AM Marc Zyngier <maz@kernel.org> wrote: > > On Wed, 16 Nov 2022 20:56:38 +0000, > Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > On Wed, Nov 16, 2022 at 9:28 PM Marc Zyngier <maz@kernel.org> wrote: > > > > > > On Wed, 16 Nov 2022 06:09:31 +0000, > > > Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > > > On Wed, Nov 16, 2022 at 7:05 AM Marc Zyngier <maz@kernel.org> wrote: > > > > > > > > > > Since 2df8220cc511 ("kbuild: build init/built-in.a just once"), > > > > > generating Debian packages using 'make bindeb-pkg' results in > > > > > packages that are stuck to the same .version, leading to unexpected > > > > > behaviours (multiple packages with the same version). > > > > > > > > > > That's because the mkdebian script samples the build version > > > > > before building the kernel, and forces the use of that version > > > > > number for the actual build. > > > > > > > > > > Restore the previous behaviour by calling init/build-version > > > > > instead of reading the .version file. This is likely to result > > > > > in too many .version bumps, but this is what was happening before > > > > > (although the bump was affecting builds made after the current one). > > > > > > > > > > > > What do you mean by "too many .version bumps"? > > > > > > > > Every "make bindeb-pkg" increments the version by one. > > > > > > And isn't that a problem? We increase the build number pointlessly, > > > even if there is *nothing* to change. > > > > > > I think "make *-pkg" should increment the version every time. > > But that's not what the rpm package builder does. > > > > > > > The .version is incremented only when vmlinux is updated. > > > > When you change module code, only *.ko is relinked. > > The .version stays because it is embedded in vmlinux. > > > > > > Even if you build the kernel first, and .version has no change, > > the package contents may have some changes. > > And again, isn't that an inconsistency? Yes, it is inconsistent. Basically, I want all *-pkg targets working in the same way. Changing binrpm-pkg is easy (Bump the version first), but the opposite way is impossible (at least, I cannot come up with a good solution). > > Anyway, enough idle arguing. What do want me to do about this bug? > > M. > > -- > Without deviation from the norm, progress is not possible. I dropped the last paragraph, and applied. Thanks.
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 60a2a63a5e90..a3ac5a716e9f 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then packageversion=$KDEB_PKGVERSION revision=${packageversion##*-} else - revision=$(cat .version 2>/dev/null||echo 1) + revision=$($srctree/init/build-version) packageversion=$version-$revision fi sourcename=$KDEB_SOURCENAME