Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp41620pxj; Wed, 16 Jun 2021 19:44:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFXkpg9RZ/+HqMGzVQBXmpG40fswepvCtD2sVCXcG21bv+wJeZVH/1QjSR4MHwJj7ktMNt X-Received: by 2002:a05:6402:51d1:: with SMTP id r17mr3401049edd.91.1623897891435; Wed, 16 Jun 2021 19:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623897891; cv=none; d=google.com; s=arc-20160816; b=e4+0QO5ZdYXbS9zmyMIZkR+CCpIUdxw0IrVxu/imETcjnUle2gSDxXohTnSxO76hbA G4PQ2kklsmX1lrbVyUNLaLf3TDGpqBYSv7LlS8CRLceI/tW1Gd/eEOvQzyIaz7gSCO4y QMmXURnLaHNTWTRtu1ItgY7T4JIvq4uNYLc3HN6e8wP3FtRj5ipM/vVMi+oEnqOIrcR6 yuu12+xu5LLkEbM9Lu1KWAcOXrKtrlE/rPqF6WK06SDK2yJxt+TzC7RPaD/qlDux5kJU llrbmj6bo8+URc9V5g+Um+jiW8d0AOSPzTtlVVzMdsWZGYLTG0KOIoGEsiyDTcH5qMB4 r6gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=Nes41jKPWaXsM5bgH+6WMq/TOgIPzhfZ+k/ThcLSQGo=; b=jD/68Y0gwC5fS6RBvRgY1GMz8OLPTv4Rzf+CW8lQe3JzGFTa3orgQXjq265lEwOWIL yrH8fTo7wbd0aEiqLfovO+9QkCR/5QADgVxIowhw/LsgAotr8cotDpsPpoQEVSlndqSz H3JfZ2LEgUvwL0Po9hve6MOkMTyd6+x9soQJPIPlHlmtjB1XEZ59xO5XA6wU3qQ372hY RFNEuC7CeiWSkCLBj8MsfheSicFEdJxc4MSQIUCrueGMMskCUej1LC4RB435h85eVehX MH690CryxOA63VPrlaFTEGoSZBYFD2DVg95b2Uljc7oY+RJ7gTjVnj7PuuYoD3m3N2PW tg9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=q2qZ1sa+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si3714376edb.255.2021.06.16.19.44.21; Wed, 16 Jun 2021 19:44:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=q2qZ1sa+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231758AbhFQBIY (ORCPT + 99 others); Wed, 16 Jun 2021 21:08:24 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:23279 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbhFQBIY (ORCPT ); Wed, 16 Jun 2021 21:08:24 -0400 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 15H163Ro023442; Thu, 17 Jun 2021 10:06:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 15H163Ro023442 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1623891964; bh=Nes41jKPWaXsM5bgH+6WMq/TOgIPzhfZ+k/ThcLSQGo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=q2qZ1sa+f4lJjn69nOuoVE9gasI0dpTozZZ89FsCxnukSJ6mR9DpwhERtEP1CUwQa UxNCoQNZiSXolVNXJo4Kfkc1vUxKIdd8ftG1jqdWKFjs/IgzP0Nh6SgoVh5Dc/0+Bp ihDW2CHlL30Sp124dWGJTjymddhUxrqTxbw1ppRbT4kpmYqEiRTdh4OIOeu5p6PCgg RLTCbAvfA0gsWLoyETEHJbQPOEaxH62BKLm2i6WVLvNn1aZunGxgRODoE0Ls3EcabL We7SU8+uc++1twvMOrzq9WQmXHPsWTdYsgtKZN6EnNt62GZL2UBuJUt8n+zRHHrXs6 V5u3BsHLKhYJA== X-Nifty-SrcIP: [209.85.216.43] Received: by mail-pj1-f43.google.com with SMTP id h16so2812720pjv.2; Wed, 16 Jun 2021 18:06:04 -0700 (PDT) X-Gm-Message-State: AOAM532lBAQE8sBz3Uxu6/bNS+b+jjnaEkvG7AhqdONAdTpv8LiqrKhR eDV9C7ajProk06aakfI6bSEn/XzBZL9qHelPZ4M= X-Received: by 2002:a17:90a:e2c6:: with SMTP id fr6mr13779995pjb.198.1623891963372; Wed, 16 Jun 2021 18:06:03 -0700 (PDT) MIME-Version: 1.0 References: <20210612141838.1073085-1-maennich@google.com> In-Reply-To: <20210612141838.1073085-1-maennich@google.com> From: Masahiro Yamada Date: Thu, 17 Jun 2021 10:05:26 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set To: Matthias Maennich Cc: Linux Kernel Mailing List , "Cc: Android Kernel" , Linux Kbuild mailing list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 12, 2021 at 11:18 PM Matthias Maennich wrote: > > To avoid unnecessary recompilations, mkcompile_h does not regenerate > compile.h if just the timestamp changed. > Though, if KBUILD_BUILD_TIMESTAMP is set, an explicit timestamp for the > build was requested, in which case we should not ignore it. > > If a user follows the documentation for reproducible builds [1] and > defines KBUILD_BUILD_TIMESTAMP as the git commit timestamp, a clean > build will have the correct timestamp. A subsequent cherry-pick (or > amend) changes the commit timestamp and if an incremental build is done > with a different KBUILD_BUILD_TIMESTAMP now, that new value is not taken > into consideration. But it should for reproducibility. > > Hence, whenever KBUILD_BUILD_TIMESTAMP is explicitly set, do not ignore > UTS_VERSION when making a decision about whether the regenerated version > of compile.h should be moved into place. > > [1] https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html > > Cc: Masahiro Yamada > Cc: linux-kbuild@vger.kernel.org > Signed-off-by: Matthias Maennich > --- Applied to linux-kbuild. Thanks. > scripts/mkcompile_h | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h > index 4ae735039daf..a72b154de7b0 100755 > --- a/scripts/mkcompile_h > +++ b/scripts/mkcompile_h > @@ -70,15 +70,23 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)" > # Only replace the real compile.h if the new one is different, > # in order to preserve the timestamp and avoid unnecessary > # recompilations. > -# We don't consider the file changed if only the date/time changed. > +# We don't consider the file changed if only the date/time changed, > +# unless KBUILD_BUILD_TIMESTAMP was explicitly set (e.g. for > +# reproducible builds with that value referring to a commit timestamp). > # A kernel config change will increase the generation number, thus > # causing compile.h to be updated (including date/time) due to the > # changed comment in the > # first line. > > +if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then > + IGNORE_PATTERN="UTS_VERSION" > +else > + IGNORE_PATTERN="NOT_A_PATTERN_TO_BE_MATCHED" > +fi > + > if [ -r $TARGET ] && \ > - grep -v 'UTS_VERSION' $TARGET > .tmpver.1 && \ > - grep -v 'UTS_VERSION' .tmpcompile > .tmpver.2 && \ > + grep -v $IGNORE_PATTERN $TARGET > .tmpver.1 && \ > + grep -v $IGNORE_PATTERN .tmpcompile > .tmpver.2 && \ > cmp -s .tmpver.1 .tmpver.2; then > rm -f .tmpcompile > else > -- > 2.32.0.272.g935e593368-goog > -- Best Regards Masahiro Yamada