Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3291380rwo; Fri, 4 Aug 2023 02:29:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKlog2Qdyempxs9okiXRXHufFp9sfqTPSlLQ7BQNRXYsa+8FxHln38BRGN/UCWI4RHidKK X-Received: by 2002:a05:620a:b88:b0:767:eb51:acd6 with SMTP id k8-20020a05620a0b8800b00767eb51acd6mr1042931qkh.41.1691141394150; Fri, 04 Aug 2023 02:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691141394; cv=none; d=google.com; s=arc-20160816; b=v0B8Hsaj6tgQy2lIEVhDKAWzqmQ/WZUZxSq2ykHsB0gOzLx/8ooRkYDJkZnUc0EECr taQyNvR+6trNwgt1UFgrGWYS8o+6qTQQVu1OJAJnAYiAfXlhkpaZNNNFkv6x/yC3E7Kw h4JAeqowLLnHe4g4I1wPwy7tr9ntW5JqDAlBceIY9SCOAi/oafnIYt/ZhVPwPcnbRKjp YIKd93hvjUZWJRUW7wY6fkQhtJfcQYY4bKQKS6NViDKrSPuFX7/uo5ggvh822BSHLkyk VVVM4ZzY/SUzIGurVJHEJn/jLBNHE2juYXos0MQlRp9kjrA8P7//OPqoouRPSmImjsFg TbEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jBejK4dst+0tHUw0tmMe4YA1Hr4GLJIyFnAo/kX08Qg=; fh=tq5VaOBLOGLOKB+OGrfdKHHRvHpLZKXogMKwZdGp1LY=; b=1DRlmE9IFUVB4IZDBhm1jK6MXqfxYcHKKgPxiRb1qEUNsNMJFFL119LAyIcjTJvonY mxKmh16w+ldT0hTDJE7Rq7JNZTkKqDWsR/46JY7M5g/t5cKOkRrLOOYIQjpFhOZ0eCxW XCxkGgJ9wx1j09y9STCt3vbHleFWfliG5LQsYMnKpVLU/5OQ+5NVJj8xs8XMFT/2sCkC KsKKTzboTPhFavoy/ttHM4lNKnI029A3WJKm2RPElwfvnUnz1UcUYjVeGjvtq402/C+m XBqZRK8rVxCs2tO+9Vt2xeP5ILzVjcbhObNfZ05naC5Q4bTYMkz3dcu0BRfGEYLdFsJz uhCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mo0BW2Y+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a637f47000000b00564bcae8b74si925893pgn.870.2023.08.04.02.29.42; Fri, 04 Aug 2023 02:29:54 -0700 (PDT) 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=Mo0BW2Y+; 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 S229669AbjHDJBo (ORCPT + 99 others); Fri, 4 Aug 2023 05:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbjHDJBP (ORCPT ); Fri, 4 Aug 2023 05:01:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F9E65B7 for ; Fri, 4 Aug 2023 01:55:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAEB161F54 for ; Fri, 4 Aug 2023 08:55:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21EB0C433C7 for ; Fri, 4 Aug 2023 08:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691139336; bh=gIb5pPyU6hzvK3+2ycEARpvIiQ/V08O4nOswJIcFEig=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Mo0BW2Y+sJ4Q7R2SQ/FYzUm7L+4NWEeDWDuxBM2DPZhqUOFmEBjUsJg3WQEFnntXQ cHmH2MsmVQQABotaiydJj2I3wrV5lxSgyhOrN1vZ2XdDzaVwFOq6AvTi+92oAgkq9W 3irWunfRcFDUvclkhdyoPqFeNb6xKDydgJmrHMldKrH2wG3GEnnjX17EJxFOVphNME GAnESilcOmcLmuTGMSq6s7uJPOHj57QIBf7mMJIJ0so6yte1k2VZK0ZNH7m9V96rah wcXguhRxnoLqIz0KVttyDlhAM2luvYsdUkAOKtLo6a0An85JQGUdyXYkZvSYsVz2KA +4TB4QsDdBd+Q== Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-1bba1816960so1232553fac.3 for ; Fri, 04 Aug 2023 01:55:36 -0700 (PDT) X-Gm-Message-State: AOJu0YwluSsrwU3dCnczKMLMgrWvGqIrlttkNaQbBK8zIiMqxsM3S/wh kSALcr4q39NgPrSPTEcMQASrtQq9hP6/Bhbx2PI= X-Received: by 2002:a05:6870:c155:b0:1bf:8c9a:9a2f with SMTP id g21-20020a056870c15500b001bf8c9a9a2fmr1392559oad.25.1691139335359; Fri, 04 Aug 2023 01:55:35 -0700 (PDT) MIME-Version: 1.0 References: <20230803112042.2277172-1-linux@rasmusvillemoes.dk> In-Reply-To: <20230803112042.2277172-1-linux@rasmusvillemoes.dk> From: Masahiro Yamada Date: Fri, 4 Aug 2023 17:54:59 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] scripts/setlocalversion: also consider annotated tags of the form vx.y.z-${file_localversion} To: Rasmus Villemoes Cc: Nicolas Schier , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 3, 2023 at 8:20=E2=80=AFPM Rasmus Villemoes wrote: > > Commit 6ab7e1f95e96 ("setlocalversion: use only the correct release > tag for git-describe") was absolutely correct to limit which annotated > tags would be used to compute the -01234-gabcdef suffix. Otherwise, if > some random annotated tag exists closer to HEAD than the vX.Y.Z one, > the commit count would be too low. > > However, since the version string always includes the > ${file_localversion} part, now the problem is that the count can be > too high. For example, building an 6.4.6-rt8 kernel with a few patches > on top, I currently get > > $ make -s kernelrelease > 6.4.6-rt8-00128-gd78b7f406397 > > But those 128 commits include the 100 commits that are in > v6.4.6..v6.4.6-rt8, so this is somewhat misleading. > > Amend the logic so that, in addition to the linux-next consideration, > the script also looks for a tag corresponding to the 6.4.6-rt8 part of > what will become the `uname -r` string. With this patch (so 29 patches > on top of v6.4.6-rt8), one instead gets > > $ make -s kernelrelease > 6.4.6-rt8-00029-gd533209291a2 > > While there, note that the line > > git describe --exact-match --match=3D$tag $tag 2>/dev/null > > obviously asks if $tag is an annotated tag, but it does not actually > tell if the commit pointed to has any relation to HEAD. So remove both > uses of --exact-match, and instead just ask if the description > generated is identical to the tag we provided. Since we then already > have the result of > > git describe --match=3D$tag > > we also end up reducing the number of times we invoke "git describe". > > Signed-off-by: Rasmus Villemoes > --- > scripts/setlocalversion | 35 +++++++++++++++++++++++++---------- > 1 file changed, 25 insertions(+), 10 deletions(-) Very nice. Just a nit. Please initialize 'desc' to empty before ${desc} is referenced. desc=3D Thank you. --=20 Best Regards Masahiro Yamada