From patchwork Fri Dec 30 13:28:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: eduardo.barbosa@toradex.com X-Patchwork-Id: 17378 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88ED0C3DA7C for ; Fri, 30 Dec 2022 13:29:13 +0000 (UTC) Received: from de-smtp-delivery-113.mimecast.com (de-smtp-delivery-113.mimecast.com [194.104.109.113]) by mx.groups.io with SMTP id smtpd.web10.17906.1672406944587454022 for ; Fri, 30 Dec 2022 05:29:05 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toradex.com, ip: 194.104.109.113, mailfrom: eduardo.barbosa@toradex.com) Received: from CHE01-ZR0-obe.outbound.protection.outlook.com (mail-zr0che01lp2104.outbound.protection.outlook.com [104.47.22.104]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-11-GZPtOpDvPC6t03R-5bd2KQ-2; Fri, 30 Dec 2022 14:29:01 +0100 X-MC-Unique: GZPtOpDvPC6t03R-5bd2KQ-2 Received: from GV0P278MB0767.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:52::13) by GVAP278MB0812.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:57::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 13:28:58 +0000 Received: from GV0P278MB0767.CHEP278.PROD.OUTLOOK.COM ([fe80::dce:f3f3:5035:f9f6]) by GV0P278MB0767.CHEP278.PROD.OUTLOOK.COM ([fe80::dce:f3f3:5035:f9f6%6]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 13:28:58 +0000 From: eduardo.barbosa@toradex.com To: openembedded-core@lists.openembedded.org Cc: Eduardo Ferreira Subject: [OE-core][PATCH] systemd: fix SOURCE_DATE_EPOCH conflict with meta-updater Date: Fri, 30 Dec 2022 10:28:26 -0300 Message-Id: <20221230132826.35918-1-eduardo.barbosa@toradex.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: CP6P284CA0026.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:15d::18) To GV0P278MB0767.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:52::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV0P278MB0767:EE_|GVAP278MB0812:EE_ X-MS-Office365-Filtering-Correlation-Id: 32aa1723-394b-4f81-83e9-08daea69ceb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: uV4cEMmy1e0IxvVmLj3ru16Eize//fOzaJ7Sv8N/ubIouqkbpyK7PdzxZB8BFbm12aFJbmXz/BQDlKTVnLKXj6imwE+6Bt/2ikNHPpUtE+n6HUE3RVeRDyRYA5OCr4VaHhoiPvGIZzruGwR5rgY01GNMHb3gG20hqmZehrZxRZgGzceBvfbToqI+FOECJI6irBKXAW33svF5iZ9f8awOREWqwnnh3uKMtvzLCp/zISEUAMoJ4Dwxscbndnc8lLNUpOLNGkH5qu7vL33ExC++W1y8fvIcqGo0YsgaOEaGe8k6Oyg7gBpQ0BDjse2Th0lXWU2fCQh3dWBh9vO1HtbK/d9SkC93IutVck+HLcEVOI/hz3+UTsEvQPyM7d0Vj9tXDq467MKOh53vdvVmvpNHt53eMvFcHy7s1gzMRhuiPHnnMgdkcoSXv/sUPFKrPB9VYV2P0zmcM+HF7WYL4cH90E8UrGV9GXMbRBrJZNSLJy//8r1fMDZvgfzpnc7z/OMMGm9pZgQ56AjcPq/C+lD/LS/gKXE6w54DzHQrdCU0fNTeg1H6483vcd668KrCnaeA4rcsBs8gKtvuhlfQa6mXM+g8b5GN0Hun5ICadZJhcb6wWih/0A4FD5VyFvx2BrpLq8J33ukiKVrjvhND3h1SyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV0P278MB0767.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(346002)(376002)(366004)(39840400004)(396003)(451199015)(478600001)(2616005)(15650500001)(6486002)(52116002)(6916009)(36756003)(2906002)(316002)(6506007)(38100700002)(83380400001)(107886003)(86362001)(1076003)(6666004)(5660300002)(66556008)(66946007)(66476007)(8676002)(4326008)(8936002)(186003)(9686003)(6512007)(41300700001);DIR:OUT;SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pSIDqcmXF7lrzWFNrO3javfv88mMw4FWpoKVJ8NcStxbNDjTiXqBKwkHFsQc8+1xvaj6ELdBX2S4Rq3DLEFdzGMmyFkQ3t2mYJLsepCmRLOshMpQ2s4z4vZTp6EDuK0uRQAGTm00ySpw/I2Bf0xgzHl9e6oK6lc2DkA1OOmTYqQGfc4Y68g5ayv0V0Rs2dFUujVsTmB79pyP3dhVMvqnjopQlYkgKkCnX1YlDfVX+1apa4eAkluTw8lLvhC6h4ugrqR75Yk0n8uksnZdrz89z3hXKfPFA8xYfMSASsg3bWSfALc4RRhrjmHvS/cFVjIVQOaUXFV957f9VNu1VnvGX7L9piPzinGHBuboVFlnp+1h5QCrUQZG63f6HoRilOUr5Tm9waO2XRsAfJWWikYW6XKtbpW36yZfes9H33uQh0qbn6PUZajjfumHqkWffyU5J5HZs65WgN/OAERhsULimJLnm6rjzcVahelm61roxjuPENL9CU3yIyOFUWPtlJxUVf8N4E6mydZI6058UzYcithLpwL5pr/kb5jqeJQh4sdFeop9UwyR7TduiOUT4kxIL4m5Dz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Av04QhBvEC1uex+T3ckOJmMiLxJw== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32aa1723-394b-4f81-83e9-08daea69ceb0 X-MS-Exchange-CrossTenant-AuthSource: GV0P278MB0767.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 13:28:58.7736 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5jZXlkfq2i+fZ6yFT9ozxV7srDA217yAG7+p4/vd8jPt9m52vb32N4tjmn4PTdxpE7rpmla9kG+8pw5ZJdzV14MllvpVDBQoEpfyUG8ojAk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVAP278MB0812 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: toradex.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 30 Dec 2022 13:29:13 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175139 From: Eduardo Ferreira When we use the 'meta-updater' layer, we get a conflit on SOURCE_DATE_EPOCH variable. where sota.conf.inc exports, globally, SOURCE_DATE_EPOCH=0. This ends up in systemd's TIME_EPOCH constant, that is used clock_apply_epoch function to determine the difference to the system's clock. And since there's a big jump we get the following error message while booting up: systemd[1]: Current system time is further ahead 15y after build time, but cannot correct: Invalid argument So, instead of creating a function to read the environment variable, we can call get_source_date_epoch_value directly, since this is the way the variable SOURCE_DATE_EPOCH is populated inside the recipe. And, this way, SOURCE_DATE_EPOCH can still be used. If the packageconfig is not used, '-Dtime-epoch=0' will be passed and when time-epoch <= 0, meson build script will read the value of SOURCE_DATE_EPOCH before trying to calculate the timestamp via git or by stating the NEWS file. Signed-off-by: Eduardo Ferreira --- meta/recipes-core/systemd/systemd_252.4.bb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.34.1 [Toradex Logo] Embedded Computing Made Easy Choose Us | Products | Developer Center | Community | Careers Join our webinar: - Implementing Power-safe Atomic Over the Air Updates | January 20, 2023: Register Meet our engineers at: - Embedded World | Nuremberg, Germany | March 14-16, 2023 diff --git a/meta/recipes-core/systemd/systemd_252.4.bb b/meta/recipes-core/systemd/systemd_252.4.bb index eb6f5ecc17..e63b2bb681 100644 --- a/meta/recipes-core/systemd/systemd_252.4.bb +++ b/meta/recipes-core/systemd/systemd_252.4.bb @@ -191,10 +191,7 @@ PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" # When enabled use reproducble build timestamp if set as time epoch, # or build time if not. When disabled, time epoch is unset. -def build_epoch(d): - epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" - return '-Dtime-epoch=%d' % int(epoch) -PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0" +PACKAGECONFIG[set-time-epoch] = "${@get_source_date_epoch_value(d)},-Dtime-epoch=0" PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"