Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1865497rwb; Thu, 29 Sep 2022 03:22:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qzBAjGxxx9SyWq+/FX4lVier7DgF5sCWRxYx+/4vu+SSdBTJ1cG7yTIqs8bq46WagRTmQ X-Received: by 2002:a17:907:7f86:b0:787:7693:7947 with SMTP id qk6-20020a1709077f8600b0078776937947mr2126197ejc.621.1664446948074; Thu, 29 Sep 2022 03:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664446948; cv=none; d=google.com; s=arc-20160816; b=ner+V7jY7HWLmI9lXqlNsOaMrjZ7a8QbL4NEfYnFsNp8O4oYCW/ONf2hTC9uFVj2Jn dKqMJ2VVghKqkCT5h3YQV7UDFKzSt8DEnyazYze9lv9zEMiqnNCPSrc5x2HcHDuR/C2x pstdvw0aSmoY9dyQ12yPw5Bs4dtClF+6ixfbjZxt3WUsucd54W1OICS26aY0kaezgSgr E7Ax+iL1/WBLkWnE0DvVt/uI7GW3YGVAC3rCGhi9jl9FvopGnsNpqifh20naqINsR6oq HWUEBMZLL29geh/8JfGApSeNbdxa7sX57hlKVgh4kB1mr+p2qTc8mqS930O/hirY500F Bf9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=3QEF/811ApodGe4x+3NSt07Stuj4NhUcjhkMgvYHSG4=; b=cKwF6nAZ0RmCrHJjOZwjdyJSEvR46fCh9YB3aSk2dPZA/y4mY0fHkPXP46HsCk7HDE Ww9rtokIooa3NIbZQaUNAnAbbXrS9RRriorOjT50TOp2KADH2vMBdAWiVH4PI8tAE+Mf /LLpYA8SDO2ub2UIAYz0WuVi6TikwuB8vhFg3D+HZgYxEUc1V4JSXwIZV60oxV0vyPHE 3PZ8/ablPhy/Do4a3jdCx07Z7Qj5gwf+XbgZav8Gn5xLXPndrbIs1wWLn3yW3/A0ZM8Q xroIp/+hIw9wJtQ088C80lrg7MVt9k9bxerudkb/dx92iUkHrsD48NhvNMQ4LEnsHcq4 hpiA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a17090608c700b007788260dfdbsi6198987eje.862.2022.09.29.03.22.02; Thu, 29 Sep 2022 03:22:28 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235315AbiI2KJR (ORCPT + 99 others); Thu, 29 Sep 2022 06:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235327AbiI2KJN (ORCPT ); Thu, 29 Sep 2022 06:09:13 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77088148A30; Thu, 29 Sep 2022 03:09:12 -0700 (PDT) Received: from fraeml705-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MdTZL54HBz6H76J; Thu, 29 Sep 2022 18:07:54 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml705-chm.china.huawei.com (10.206.15.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Thu, 29 Sep 2022 12:09:09 +0200 Received: from [10.126.170.84] (10.126.170.84) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 11:09:09 +0100 Message-ID: <2a4a15a4-55cd-f98b-4b14-474f24e2c308@huawei.com> Date: Thu, 29 Sep 2022 11:09:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] perf tools: Fix empty version number when building outside of a git repo To: Will Chandler CC: , , , , , , , , References: <20220927195228.47304-1-wfc@wfchandler.org> <87A1F5B6-3F60-4988-8BA6-A993E5789C80@wfchandler.org> From: John Garry In-Reply-To: <87A1F5B6-3F60-4988-8BA6-A993E5789C80@wfchandler.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.126.170.84] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,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 28/09/2022 18:26, Will Chandler wrote: > On 28 Sep 2022, at 5:21, John Garry wrote: > >> This looks ok. But did you consider going back to same flow as pre-7572733b8499 to avoid a Makefile check, like: >> >> ---8<---- >> >> CID= >> TAG= >> if test -d ../../.git -o -f ../../.git >> then >> TAG=$(MAKEFLAGS= make -sC ../.. kernelversion) >> CID=$(git log -1 --abbrev=12 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID" >> elif test -f ../../PERF-VERSION-FILE >> then >> TAG=$(cut -d' ' -f3 ../../PERF-VERSION-FILE | sed -e 's/\"//g') >> fi >> if test -z "$TAG" >> then >> TAG=$(MAKEFLAGS= make -sC ../.. kernelversion) >> fi >> >> --->8--- >> >> The evaluation for $TAG is not really needed in the first leg since the fallback does the same thing, but just added for clarity. > > I think that would be fine as well. I don't have a strong opinion on which one > is easier to follow. > > Looking at this more closely, there is a slight difference between the two > approaches. In the problem scenario my patch will always use `make kernelversion`, > while pre-7572733b8499 starts with PERF-VERSION-FILE if available, falling > back to the Makefile. > > With the old approach PERF-VERSION-FILE could be used to manually > override the version, but this is inconsistent with how the version is > generated when building in a git repo. Is this relevant? Hmmm... maybe someone would want to customise PERF-VERSION-FILE for their own distro. Not sure. But then fiddling with PERF-VERSION-FILE might break the parsing so...I guess not. BTW, is there any other method of building the perf code not considered? So far I know: a. in git tree b. perf-tar-src-pkg c. tarball Thanks, John