From patchwork Tue May 11 12:15:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haemmerle X-Patchwork-Id: 1477102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::437; helo=mail-wr1-x437.google.com; envelope-from=swupdate+bncbaabbzxk5gcamgqe4zkl2ty@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=R/ciq9bA; dkim-atps=neutral Received: from mail-wr1-x437.google.com (mail-wr1-x437.google.com [IPv6:2a00:1450:4864:20::437]) (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 ozlabs.org (Postfix) with ESMTPS id 4FfcML609zz9sWC for ; Tue, 11 May 2021 22:15:40 +1000 (AEST) Received: by mail-wr1-x437.google.com with SMTP id c13-20020a5d6ccd0000b029010ec741b84bsf13067wrc.23 for ; Tue, 11 May 2021 05:15:40 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1620735335; cv=pass; d=google.com; s=arc-20160816; b=o3V0NCFR7gchzcWwo+T9bpyShZsLx2OTu3iLmf+QfYX9Gf8hT7wKr3WF8cBwgcVJ/M DlKlhzz0sM0phiUCuXqcHG15asZJIeDQ+moNr2EuspNwo00ExfpsucROfuj5FU0TuotB g2qG/5fnIldqXc6kfPkvX1F6buDgO9eVVpXNMk2mklDeWhRts7cf8C+YCBqjqRa4vMZ9 mI4tqVf/fhgD7RD9ARHOtqkbeG3jy0zeHq3u6iqAbpSOaXhiblisxVO+7JNkez91HJCu gW4qMBSPsMpHXRNViKmE2HRg5X6MqOU+YH4gSuuLSp/TBcZT5/pvN0EGI4PypC0bYLr3 QBTg== ARC-Message-Signature: i=3; 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:reply-to:mime-version:message-id :date:subject:cc:to:from:dkim-signature; bh=acdaRAly/AYqIHxOYJ0wU3UwOwhClm3RLqnKO8DXsG4=; b=Ls/77f3kzEvrK0HguYRFBxhI8lsUxFFGLJlimasLiCoOyry3gs4wKo+8AOYvx3Hrhe wNq6rp2XrYRsyx2MYvx6HeAYlcgY12QbLIWBIeC7WMCs12cdEr2FaMPquDgEDLenehTD Ow3VXf16zq2AbQWRjKSw8ANq0unEGaL8t7yXeOWu3oMFTvyPBNHTPLwrwdkYi/j23wgo URp2D8tWQEaqkFRxNmqMNAqFoeToF+wH1jojO+menLugtklWsKyeyRWJ3WoCINRCRdoz 9wP0zdvn7LcHlYQZ96t+dO4GXtL3IHg/jV22EnLEszPCATYSkWSl16/IUjZMJt/xR11O r/zg== ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@leica-geosystems.com header.s=selector1 header.b=bJ5QPNWT; arc=pass (i=1 spf=pass spfdomain=leica-geosystems.com dmarc=pass fromdomain=leica-geosystems.com); spf=pass (google.com: domain of thomas.haemmerle@leica-geosystems.com designates 40.107.6.119 as permitted sender) smtp.mailfrom=thomas.haemmerle@leica-geosystems.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=leica-geosystems.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=acdaRAly/AYqIHxOYJ0wU3UwOwhClm3RLqnKO8DXsG4=; b=R/ciq9bAoFqQjo3e0/rEA1IxDDHKidh7q99YdsltE57s4RFK4dJUydf3P+zNq12ofG SRJMs9iaXSRXJsdQ6PnqNbKhIuGcRAmgR6Adc1q0GOew1Q+7/CsVcSWEjUq4c5Zv0ZvX m/iPPtjl+12w+0aLZkkPXtnFzESSTqXzLue7xhQtSO2SgfTWPgzDa+Jad7JJ2GNVJ+QL gRs3JBcixfJePZB07auEfNAbLaGQqyVEtZcge6oBFKx6o4FTg4aYkZ9k9ockd3ynSHny QTkuEvgXeEUrWRq5FiwvuR9Tagpe+nD00+r2AmMiXm3OMxJLdFt1Xsrsxk7Ek0qPq9LJ soTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=acdaRAly/AYqIHxOYJ0wU3UwOwhClm3RLqnKO8DXsG4=; b=LJI041aNXaj7LKx6KhRXJERRueuFbMrxbxhYnzl0S/RLaS2bT4N1EMEVhPOS6cRElc t0rDKH3uy6t2+ZqQp29sGYCwq4gElbx7rp9dA9FPwO545u6NJBEUA7s5Nwrz7jjYTAui V7i3foHlou9b5U8+DFYeW6Mj9J78q6My2Z8JmNFU88HFBGJ155/OaIwgfy+oq90ioe2s a7ppTZWxxZq5/lLllWOocehcGSZAS8OOll5GimSR5MAdr6tvNDI82yc94YpZxllgvjhL uRiGylWwkCLk5I3yeMWf7SBxjbKxMzO8/4ZjkxsIL8izKzxlK6UkJzMSjP8bgMX3OQrI I+hw== X-Gm-Message-State: AOAM530S5mJz+waFCLNMRGUNqhmUTaNJ8km6vMakxYutmaNFqLRT0PX4 oD0uRFAN4vTmMdy2EMs55HQ= X-Google-Smtp-Source: ABdhPJzvRuFNqgGeNzz12b/t8qlS+IdBBFYRzljUEg8TvVruwPXwuMwzOEX8skOI+zeDx+YK/xNCKQ== X-Received: by 2002:a1c:2090:: with SMTP id g138mr31964416wmg.33.1620735335216; Tue, 11 May 2021 05:15:35 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:f844:: with SMTP id d4ls3976935wrq.3.gmail; Tue, 11 May 2021 05:15:34 -0700 (PDT) X-Received: by 2002:a05:6000:180a:: with SMTP id m10mr37254328wrh.215.1620735334364; Tue, 11 May 2021 05:15:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620735334; cv=pass; d=google.com; s=arc-20160816; b=K18DX3UqAkawfgGBN040rJz6c69p39BkcIiIrkOGmhRY1KAKjQ8CKBf1i1nJN3NZqK J8CCBYtbo1pJCKoDsCkOnNSFz0gO4+XWGamzJHBDPWPYuIgNXfMutLABZlieD+nXr0go dpEr6gFSBU3MA771WaOY2MFzyB4fQfjToRtbVgzb9XG7CGOgUbSyU1CEDAPwF9MLCcFY 3xR2ZyUODLxKK0avNUkGuOH2S/oBeQEyHED+P4nCzScxOSAMXLZ2BSwwz5ekyLcsS9/e 9YqzRBl4x4htVAYbcNcIlZrcqBoItQSmaxyKg/JpTMe6p08nX8oWyhmAjxmF5N7Xmk93 y5fg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Omhn3Tk2zZhy3xR/lywNM4aEbUG4c4goH3qXdHZlPc4=; b=bwdI8zib3LiCkgcEvRnTXaWbOs8t17sreG8VfIYnJfzL2pnsVZ38vVkRMZbSNT/rCj yokrxZsqyJwlbeHtH9BwC3iGQc+w5x5JxOMftQr7EPOhoBPBq23lW0/yOXoNMYrzrogH Yp8ZFGBYKaIecYIdIZ0zLedik9hGvQwZWbcEj5aCMkQW3J9LfdUSwdJD5lnkTvmyxLem 1U42LvOrjTddSrLYsEyY2hIxbu0Gfb4zqbHTuNS8XPRg82b1zqR+HLZofW2M6qPUk2n4 HbWMXqoBGHJXZYAPq9NFY/kYmZrR14LL4/6rqx6/1P5wfzRpkeyNclh8/8ZzJgQlwh8/ SguQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@leica-geosystems.com header.s=selector1 header.b=bJ5QPNWT; arc=pass (i=1 spf=pass spfdomain=leica-geosystems.com dmarc=pass fromdomain=leica-geosystems.com); spf=pass (google.com: domain of thomas.haemmerle@leica-geosystems.com designates 40.107.6.119 as permitted sender) smtp.mailfrom=thomas.haemmerle@leica-geosystems.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=leica-geosystems.com Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60119.outbound.protection.outlook.com. [40.107.6.119]) by gmr-mx.google.com with ESMTPS id e4si970222wrj.5.2021.05.11.05.15.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 May 2021 05:15:34 -0700 (PDT) Received-SPF: pass (google.com: domain of thomas.haemmerle@leica-geosystems.com designates 40.107.6.119 as permitted sender) client-ip=40.107.6.119; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=en0D6ee8TCeCLssPYzC4brlP8LwQWDxSqIf8/ZB4ffdJrUrl+Yelqcd/YqOJNogbJJipIL8IE4yWdo7C7abIbgq14npMg06p3Sa8o8vCxIdm+BJS2xI1u7i/vQ9/dRYMgkppS/ROXaS6ALpjQCWqRjuwgNf34hvRbPE/OdN8cYPlPnioS9sEJXTCjbz/UViqt+q338HY3HZDEhFbhRl+RmGsGpVB5pfg5MjuSTAiN0Wy0JdEtDoOIwVmQIgvZlV9lgqSEPZLH1+tpgFoZNxys6SU9CKva1/JjYlisRJK7XtcYB+K8yrkn1iZqnUYxRLZOcEHqBu/OXuvEFeqg4fB1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Omhn3Tk2zZhy3xR/lywNM4aEbUG4c4goH3qXdHZlPc4=; b=neE5i6OTWenupYMPhJfLXjLwLyE79yNBJ03NwyiJhlzrqIdHGPAq66q3XRRaMF3DrKEos1WC1ubO/nEAmS3T61pQmiKBpcoqivkto4G2yO4TdYiCYlUtyGsAKxcKlnWCbpn8KDMIskVFPkSig71IjP45NhGHmyXVRdVL4WQqN2PMhI7DDJVDxyMM1z7Kx/ShaEJj1dhJS2aYMNHIUm12Mdpy6JzqW8g7T31txSblk/rv9usP//tQpWXogNf5a2hbjsNZvT2NFROqjHy/hFC27vK3pXX6MwXSa1BRV4R4k5DK5sloY+oAERkYBzWqTYlFAE6AUAn9DTra2D+uD6tp4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=leica-geosystems.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=leica-geosystems.com; dkim=none (message not signed); arc=none Received: from AM6P195CA0085.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::26) by AM9PR06MB7202.eurprd06.prod.outlook.com (2603:10a6:20b:2d3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Tue, 11 May 2021 12:15:32 +0000 Received: from HE1EUR02FT013.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:86:cafe::90) by AM6P195CA0085.outlook.office365.com (2603:10a6:209:86::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 12:15:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com; googlegroups.com; dkim=none (message not signed) header.d=none;googlegroups.com; dmarc=pass action=none header.from=leica-geosystems.com; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=hexagon.com; Received: from hexagon.com (193.8.40.94) by HE1EUR02FT013.mail.protection.outlook.com (10.152.10.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 12:15:31 +0000 Received: from aherlnxbspsrv01.lgs-net.com ([10.60.34.56]) by hexagon.com with Microsoft SMTPSVC(10.0.17763.1697); Tue, 11 May 2021 14:15:30 +0200 X-Patchwork-Original-From: "'Thomas Haemmerle' via swupdate" From: Thomas Haemmerle To: swupdate@googlegroups.com Cc: andrey.zhizhikin@leica-geosystems.com, Thomas Haemmerle Subject: [swupdate] [meta-swupdate][PATCH] Introduce functionality for automatically fetching package versions Date: Tue, 11 May 2021 12:15:24 +0000 Message-Id: <20210511121524.20266-1-thomas.haemmerle@leica-geosystems.com> X-Mailer: git-send-email 2.17.1 X-OriginalArrivalTime: 11 May 2021 12:15:30.0768 (UTC) FILETIME=[55E5CD00:01D7465F] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 125a7766-c95d-4db4-3637-08d9147678cf X-MS-TrafficTypeDiagnostic: AM9PR06MB7202: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1417; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v8R3Ic6vtsC0Q4HlAkJh/ALICg9QbIANyccKSU2isYjhh1vwPqWO2F+uAA9ALY7T+MAUGnkqoTJs/zhsZ3kW0Pkv7dvNe2Tcoe3JXmXKPetSMob3owqVP1yzZWMVwo/QEsTt6NXMhz7jS+yEf1rHi4ZyGHkDteC2oYcD+wdxg6nls3Ip8bVmWh51mcv1TZPu5lOAcRgx6QqO4h74rwx7WQn3LgtDHHDvLMdtrH8ObkJmQbRAPwz2svLSFC14/tLRArgOtLj2vWHKeBJiMiZKW8tQK1U6WGeHGDCN+Vf0DTAO/LLFOfUdcUKqXOVwxaf4tI8u8bA4J75F5UfAyMMFuRSfylB6H80cf2Tj9PX5etE9sKXRvS6mBROsr7aksZSvgd1Gunl22Wg8pcXiLuTxeGn3VgYE8I6ZcBgAtRCfNKSuXpm7VcUoU3UK95FyIwNnFcol7sUtYRv6jdpk+nwhGxFI6Ufyx2uRNJ/ADWjhDI/0/VYqukno8BBZdpkHjoIHoNdo6odx/Gkz4dbRLOpuSPqzZFHCoppAX+2VbaY0Gp+rv5gT95DCdFM7PTZeggd82hNiOMRJGZD0fK3PJyVs5YbPpMPJG35ZttHwjOasUiiuAztaZrsIkouGIxiss7K8UeDtPwGJBtgfVTuLC8IDSyG3BEoHHzLvtAqXCbJ+O7NK3q1l3CraFmcIIGgf6ppYFIzuD+jfKn6v4PZGutCP5/KdR240DJJjtpHq5b0pylvvS45IxutqE4H5mNCql4eI7XOZTE7W/E67CsudSoPt0g== X-Forefront-Antispam-Report: CIP:193.8.40.94;CTRY:CH;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:hexagon.com;PTR:ahersrvdom50.leica-geosystems.com;CAT:NONE;SFS:(4636009)(346002)(376002)(39860400002)(136003)(396003)(46966006)(36840700001)(107886003)(316002)(4326008)(8676002)(6666004)(47076005)(70586007)(70206006)(6916009)(82740400003)(356005)(5660300002)(8936002)(36756003)(36860700001)(1076003)(478600001)(83380400001)(81166007)(82310400003)(34070700002)(186003)(26005)(966005)(44832011)(2616005)(86362001)(2906002)(336012);DIR:OUT;SFP:1102; X-OriginatorOrg: leica-geosystems.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2021 12:15:31.4508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 125a7766-c95d-4db4-3637-08d9147678cf X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a;Ip=[193.8.40.94];Helo=[hexagon.com] X-MS-Exchange-CrossTenant-AuthSource: HE1EUR02FT013.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR06MB7202 X-Original-Sender: thomas.haemmerle@leica-geosystems.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@leica-geosystems.com header.s=selector1 header.b=bJ5QPNWT; arc=pass (i=1 spf=pass spfdomain=leica-geosystems.com dmarc=pass fromdomain=leica-geosystems.com); spf=pass (google.com: domain of thomas.haemmerle@leica-geosystems.com designates 40.107.6.119 as permitted sender) smtp.mailfrom=thomas.haemmerle@leica-geosystems.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=leica-geosystems.com X-Original-From: Thomas Haemmerle Reply-To: Thomas Haemmerle 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: , Versions of the packages included in update file needs to be entered manually in sw-description file or provided in as a bitbake variable. This patch searches for a group[1] in sw-description file containing the tag `"SWU_AUTO_VERSION"`. If found, the version of the corresponding package is fetched from it's package-data-file (`PV`) and the tag is replaced with the version. Possible trailing strings in `PV` starting with `+` (e.g. "+gitAUTOINC+...") are dropped to keep semantic versions. Since the filenames not always belong to the package name (deployed with another name or the file is a container for the real package) support providing the correct package name by appending the tag with `:`. [1]: http://www.hyperrealm.com/libconfig/libconfig_manual.html#Groups Signed-off-by: Thomas Haemmerle --- classes/swupdate-common.bbclass | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/classes/swupdate-common.bbclass b/classes/swupdate-common.bbclass index 578f305..c973307 100644 --- a/classes/swupdate-common.bbclass +++ b/classes/swupdate-common.bbclass @@ -88,10 +88,60 @@ def swupdate_expand_bitbake_variables(d, s): for line in write_lines: f.write(line) +def swupdate_expand_auto_versions(d, s, list_for_cpio): + import re + import oe.packagedata + AUTO_VERSION_TAG = "SWU_AUTO_VERSION" + + with open(os.path.join(s, "sw-description"), 'r') as f: + data = f.read() + + def get_package_name(group, file_list): + m = re.search(r"%s:(?P.+?(?=\"))" % (AUTO_VERSION_TAG), group) + if m: + package = m.group('package') + return (package, True) + + for filename in file_list: + if filename in group: + package = filename + + if not package: + bb.fatal("Failed to find %s in group with \"%s\"" % (filename, AUTO_VERSION_TAG)) + + return (package, False) + + regexp = re.compile(r"\{[^\{]*%s.[^\}]*\}" % (AUTO_VERSION_TAG)) + while True: + m = regexp.search(data) + if not m: + break + + group = data[m.start():m.end()] + + (package, pkg_name_defined) = get_package_name(group, list_for_cpio) + + pkg_info = os.path.join(d.getVar('PKGDATA_DIR'), 'runtime-reverse', package) + pkgdata = oe.packagedata.read_pkgdatafile(pkg_info) + + if not "PV" in pkgdata.keys(): + bb.fatal("Failed to find version for package %s" % (package)) + + replace_str = AUTO_VERSION_TAG + if pkg_name_defined: + replace_str = replace_str + ":" + package + + group = group.replace(replace_str, pkgdata['PV'].split('+')[0]) + data = data[:m.start()] + group + data[m.end():] + + with open(os.path.join(s, "sw-description"), 'w+') as f: + f.write(data) + def prepare_sw_description(d, s, list_for_cpio): import shutil swupdate_expand_bitbake_variables(d, s) + swupdate_expand_auto_versions(d, s, list_for_cpio) for file in list_for_cpio: if file != 'sw-description' and swupdate_is_hash_needed(s, file):