From patchwork Tue Apr 5 07:09:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1613256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=KIK/RWc2; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23b; helo=mail-lj1-x23b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbvgwv6jamgqedqswf7y@googlegroups.com; receiver=) Received: from mail-lj1-x23b.google.com (mail-lj1-x23b.google.com [IPv6:2a00:1450:4864:20::23b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KXf173VJwz9sCD for ; Tue, 5 Apr 2022 17:10:18 +1000 (AEST) Received: by mail-lj1-x23b.google.com with SMTP id c12-20020a2ebf0c000000b0024af8f2794bsf3557906ljr.12 for ; Tue, 05 Apr 2022 00:10:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649142612; cv=pass; d=google.com; s=arc-20160816; b=udAXeO4/l4ENKSTscYMJD4WLTowqM06Mnzu2Ge2SxQhtXVOm6aV+2kMlcvUbOuOt0J TLZ44b4SwbEmRktRLYJ/7ZtKCNm87jmRJR6eNmSC1qEiOIFUhtZBEZtS2WM7YB0hbplF FFbjct0Ur7zBwOyoPg4DFDcF1Yz29wmoNdFGpa26og6RUWMLMX4C1QZmHBYeFFzR7eGc /yo2V7l+1ydwb18yLecPOC2UEk3nH+krknnyQdnb201jiIUUY4HySMvr3mg/+I8xT/eP BKks5u8kJN6+7BWaa9WIwTAsue98OdPKpPOUBxaa0pRS2jJQcQUegV0oMSKL5PypXCvd tUHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=P2+CfZ0gHKEcUFGio6G9bnqSzLizAnrjwP7uP/5UgoM=; b=DEC9itDPROrrgdtEqOAnlefZ/Hl4ucgPUmPARLO7ll7CQzGoB3uJx2PZyB4j1WpUZm VhE+7FewQNFWDI2wSsM7Pc0T+IDF3sIHY4sMlI4y4Bw8S9C+6tQLIlw6H+E9jCkh6dEU 0PjuJ5/ZzlQScXrTX3SXWUY/ZbjT8sjQTW+i63cU5FGLrACf9faLd3lmvryGr1tC+yQ9 sr806jH+UGoMCN5UjRwY1gUOpmMJCCWcH/JOy/uAOGuKKZlOcNavMrhChSCg/ZuVUf/d Lk1je6PYUv3ZpJvfKy7/zktM9Tdztmv5dxqOji3iyMV/J3tbF7hQ4LpyMFSAvCumLLpP gmEg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=P2+CfZ0gHKEcUFGio6G9bnqSzLizAnrjwP7uP/5UgoM=; b=KIK/RWc2p4AaiK/8sjDDCY0Ed6BZkXYEV28Fi2AsKu1yLHtKBdhmyKRjjx2NZzvS9M LzPvAOJ1nXKujM1D7sBQ/PXDarkF5bzZXnL4caDCN26MmnyjkJpoEtXzY7m3x8cFdbKW FVUfKTY3Q45aELIBRwbnFuqpl6VTKK0qmbTg3jS0b/n6RIOSGvWXXLuKx+STDbq7m5fL 01n/EpCUXSOHVZTaYp0zkjo1ZVzMzYs6YB+atnPD5bAN+FysqMVKHCRAJfW4nFjZfrGC 2nCOL+Jx6JGRdVV0Mgglu1o9kp4KSwHxT4e6Xd4yuNYXh8o9EGR8ziXkmA2Nu1njZ7ZU qrOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=P2+CfZ0gHKEcUFGio6G9bnqSzLizAnrjwP7uP/5UgoM=; b=y1a1LZeUkHqWw7ou5U8q1OvinurLHePx27X2JR+fy9bTyRTR5JVQb7zNsRHKqHMblK 25f2eujHwiLR5krNwv5BF44IsT+kPXaJaRMkb365k4qx9s6ocqb3W7zksLFO1T6/Jjzm YgtTDBPFud00Z+jDOCsjrDhtbDeSTxuYwaWGegxXPqpp2CnDj0OF9yxuSKgiL0+omrU8 Z/cXFaqNYPCOEuS4xItLuDAztv9ce0tNsjBx7mYEguWc4ABOxmZK/hFmgdNo3f+b07ZA /7LF/ax+f2sxGt4vMTC0jjgb/gahz7H235isMF1M8Fz4fFRxY2rEg9JTHwGIve5drich B3JA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM531t1MsUztcGU6M7uW9zPloBysGkTQWdWn7ckmDLP948UiHWZFpY IiRpUrzeSWogeonOVP1A2yw= X-Google-Smtp-Source: ABdhPJxxkycaQp2Y4lKX9fhywjoWBx28/BZDpArhDmv5gcSulbP8ELxit0GmUlbIycmuNSTig8Uy2w== X-Received: by 2002:a05:6512:4001:b0:44a:c386:aac9 with SMTP id br1-20020a056512400100b0044ac386aac9mr1703161lfb.12.1649142612589; Tue, 05 Apr 2022 00:10:12 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a2e:9943:0:b0:249:8590:75aa with SMTP id r3-20020a2e9943000000b00249859075aals1323916ljj.11.gmail; Tue, 05 Apr 2022 00:10:11 -0700 (PDT) X-Received: by 2002:a2e:7002:0:b0:249:b34a:69d3 with SMTP id l2-20020a2e7002000000b00249b34a69d3mr1300214ljc.474.1649142611541; Tue, 05 Apr 2022 00:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649142611; cv=none; d=google.com; s=arc-20160816; b=vALFgv0ese/4gKR6+CT4GzfAEi+0Vj79iARD4mrnWzmK1mMizJ5+BXWEQNrFXRBuh8 VUAbtAlB9GWsNc5Ym31KkWr5TuEzYbtO6izIxNIicLd9j5eZJrN4GP7sEtEVGqlNwv1i UXjEdVxC5YBspyqfVARDRA23cw4HxG58a4r0R3OvIQEj0SNs6gDKaSBjBvH+rlzbIg0k VuUDXkvMbrLEy5MxdX1jnKxVKHFLg5KOaFohuwlUkLtxQY6yzGVE3W/bFGv9oihXsyHX wdgyyEwA7vhGvqCYLkcEETivMgTsmWlDrrdLZ5ofc41lfhS0JUHJZkbUWqD4OBi739oF ty3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=kHRTIwucuu4tgy8XNyRS4HvR3CWWvZwreXl9ZujK+nY=; b=w/aYzcwQxdn4ti8C3vbFHaxXMY3i932+HB6cjG2RKtrC5ESY2Bu/n/GcsH95v8oJjO 9zZUHxwyJESspcgoAYmmgR1QwhPlR0JAzSPQ+HOlLELFmrs3ah6skeep9Vl+vRYH5zi1 oGcTJ6LaIZAFVCFcEmfMCT7wFwNFEL7ikTOro8Q60x7sUrs1c4g/PN+K9o551R5W1QCW sWkscoz5y2R4jcX0tzlnAqa7Q8bL++kX4nJJSTEPdpA2hswOjSv7imhrfWugAYgrr9c4 9acvt/wKiMN1dXroDwqLk+dgO+F93UShxgE+0X9DVj4AA7GGGZl3gP38UvaUMpNdJ2Av ZhnA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id s8-20020a2e98c8000000b002499fdca3e4si713361ljj.3.2022.04.05.00.10.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Apr 2022 00:10:11 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4KXf0y6cKgz1qyJ7; Tue, 5 Apr 2022 09:10:10 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4KXf0y6Rw4z1qqkD; Tue, 5 Apr 2022 09:10:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id Zz0587oap5Wb; Tue, 5 Apr 2022 09:10:10 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Tue, 5 Apr 2022 09:10:10 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B9BEE4540BD2; Tue, 5 Apr 2022 09:10:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ywfqNpuInETA; Tue, 5 Apr 2022 09:10:06 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.48]) by babic.homelinux.org (Postfix) with ESMTP id A3DA345407BD; Tue, 5 Apr 2022 09:10:06 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [meta swupdate] [ 00/12] Support to call functions inside sw-description Date: Tue, 5 Apr 2022 09:09:53 +0200 Message-Id: <20220405071005.3855186-1-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , sw-description is often generated from a template. There are several help functions to assign automatically values to attributes, like the generation of sha256 hash. Some other functions were added and more will be added in future, and this is done creating quirks and some unlogical matching rules when sw-description is parsed in the classes. This was done with '@', or '@SWU_VERSION', etc. To avoid to create any time new rules that are starting to conflict, implement a generic method to call a user defined function returning an attribute value. The syntax is: = "$()"; Example: sha256 = "$swupdate_get_sha256(rootfs)"; The series convert auto version and sha256 to the new rule, but maintain the old syntax for sha256 because this is large used to avoid compatibiity issues in the short time. Later, old syntax will be removed for sha256, too. Series adds a function to sign any aritifact, too. This shows also a method to add further functions and collect them in swupdate-lib.class Stefano Babic (12): Evaluate functions inside sw-description swupdate-common: factorize function get_pwd_file_args class: add a library file for generic function Make usage of library class class: add function that signs and returns hash of artifact Add SPDX identifier to classes file class: move swupdate_get_sha256 to library class: move swupdate_encrypt_file to lib class: move swupdate_extract_keys to lib class: rework autoversion to be more generic rename swupdate_auto_versions to swupdate_get_pkgvar Raise a warning if old syntax for sha256 is used classes/swupdate-common.bbclass | 144 +++++++------------------------- classes/swupdate-image.bbclass | 2 + classes/swupdate-lib.bbclass | 112 +++++++++++++++++++++++++ classes/swupdate.bbclass | 2 + 4 files changed, 148 insertions(+), 112 deletions(-) create mode 100644 classes/swupdate-lib.bbclass