From patchwork Mon Nov 20 11:09:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 839510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23f; helo=mail-wm0-x23f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbj7qzliakgqer2x2zci@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="q9EWOYPn"; dkim-atps=neutral Received: from mail-wm0-x23f.google.com (mail-wm0-x23f.google.com [IPv6:2a00:1450:400c:c09::23f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ygQxQ37Z4z9s4s for ; Mon, 20 Nov 2017 22:10:34 +1100 (AEDT) Received: by mail-wm0-x23f.google.com with SMTP id b189sf6205862wmd.5 for ; Mon, 20 Nov 2017 03:10:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1511176231; cv=pass; d=google.com; s=arc-20160816; b=T6Gi5bdHQWLmr7ZUt/FRmTFUuMtGVcwxn49VekiESRQQUMKLPVvYni6UYoLz1SuDwL DkMyRFYPUwOBilxn4iYMZo68bstvI0RzxAu6UKRtaXNTDlmKY0WeBmFObCVxsZTxXld1 fQZVGGHcp80E0By31zV90EIsN4+nHqGlC1f56d88GvOnF0vhkU7nwd9MilbKFCD8MTi/ +5Ri+y79FvzDXgUajdT7oE2Ghv01/gIhXyHZkBkxNxCdWkPY87bRCrXQYahnSSD1DvwG PiJP4MDR1PenKT8XDdVbm3s0I+UFZtjjErR++Ts7xgQ7BMgeMBJxuWgQp+PHkPSCKijY iiGw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=iwGfbvXhcnB8P2687z0Zgxms4hLZPqL/gt57wy24yLw=; b=mVlS3J7xKYCSxijHrVBWzV5IGz169xbMHW63wA6wOXqgvl2w43RqNEJoD54nr6hoND DlAz8HlbW8XVRjZGFJpLj2tstUjg2SKZv+MUEixqZd9fIArqBWwwFfRFYDAk7a9Wf5By nzJSQt6Ock1ALGq3AmfRlZT218yrl95hUNmbR0dOPdzm1MwJTD/95qaFQaGJWf1D6Y95 akJTsXXjDRhv6pNMLzWsQiT45giLaeZ556dg4dV/jI1i0YeIFp+uhQnxxbuR+pFQA8/B JGH9QTy5KRWsPVxTyVTdlnw8VItxwazZy3SJiI922LnDw2mNZDT8iUQyPAx+im8KqF6g 6rWg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=iwGfbvXhcnB8P2687z0Zgxms4hLZPqL/gt57wy24yLw=; b=q9EWOYPnpop0SAf1c+cc5bJ36sqiVgZc1LKoJQIth096q2Ak/Ay6mQJxvW/mYYjTJS WLNKy956lrzf+2qxNsiO4Zg7QXC868tgkbha0zdWIZDOq0Ajvgjk+V1yN1ztFcC32oPR hqx5SpybtKHMopTeSnCh9owQWAsGozQ3aYbiJLkrv7aT54jqZBt08tpnDmziP4U+ODFL 9FkvqRgS5zktWlqn16xFMp+VB6ZxLOM+WgAFSjdN1EaKkSclXu6XkmmT5M5OKPAHd5TR w1/HbFHNlXBUtrT0nPMbgrEWokmQ1ugPT18U+oCnT7D9cX5SydwAJ1gScHo7K7TiN8Df xfiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references: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=iwGfbvXhcnB8P2687z0Zgxms4hLZPqL/gt57wy24yLw=; b=I3Ai0FlRdOBha7g7DwgJdksSsPlku5hzlOTnfy2a44zPaNLIobKtSRAdwkjuUz9/Jw PZ8Kr9WXqqqPWTvV7xJl7VsrDfgQuWO8rwdX2cdUceoEQTWzd8IEQTLwmmTRVPY63ixo 9O3Io+Hij0TepcD86x09BL4DxYdVOlxaBfWrlT9+AkKdao2LkGRTuMQ+NUsdf82aH92G jYrotpSZI3zhwEwFUPvWIXDhDs+ODhcaSoW1l7Ogl85lE9mhwTOrCAQYQAln+pZ9yE0m B4mDDLUYl1tL/HbTADqPsH1PLNeb8WI58jmqtDIKzBI5RvbbuxdXDoCYfAbI6SvWVWYv 0Z/Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: AJaThX4jPbNSctFwjKQTHeGuSd+gQTWd1JRiBOGNTNplw+imeu03I7FW T4ucxyRZfhjO7NMZbAVn4ZU= X-Google-Smtp-Source: AGs4zMYn2Te4EYAvlLhHitVHnHs+VjbSPMKpGwH8nFMits9oW5dg2FxCpAnjhsCf4GjBiCATvtR2cQ== X-Received: by 10.28.198.67 with SMTP id w64mr117481wmf.6.1511176231582; Mon, 20 Nov 2017 03:10:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.197.15 with SMTP id v15ls893250wmf.2.canary-gmail; Mon, 20 Nov 2017 03:10:31 -0800 (PST) X-Received: by 10.223.151.204 with SMTP id t12mr1117864wrb.20.1511176231187; Mon, 20 Nov 2017 03:10:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511176231; cv=none; d=google.com; s=arc-20160816; b=HkwFYFWoTBrH+pKHwWgP4um/l4dBPLNZeVlQ302i2oWPAyILT5Q75bfl+bFOa8Iyqn CtaD6JZjBSRG7iTzCVXcS6Uul024OhIzTsQArUoU3Py05zH5aQuh1hq/8pDnrxZodNVx OBGY8a+1LHxuXmbbVKuPouJeZfO8pdSs9/5+tCJ8tpg2dirnb6b815v7GW//yphKmS// 8fHQ/iEvvTavR+XHkD+UaYGWMY56F401nmdj6mi3ERGPC+n2mnLU8xOGTF1shujhp0S9 ojOh5MlSnfr6+7bBvdzPUi/oWYDmtu45DSMXBaktMpA6CvHmU92rh4rqbeFpPa4QiJsi 4XSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KV74lM1gW13tCzC4fBeR6gZjlPOLD9KjvoC2PsB5etM=; b=iGTFYTgTLfWpxGgf63PMkcmWxAD6h7ATymgzIh86MxZACYV4O4jPLe8PkwigvCEtbn SNG7SuACL6x9/+Q0lhKCgFp6IZ7FulbULHHic/p4Mt5tWDPACvN08sxvpoAEN8L+juj2 R8oWYfs9jusKa6AB08aQ3jYVi7n7XwjTn0gGVnpT966gPj/0+FUGo7wytcY7FiwqeZJb 9k+osRP9MuGuNvIKLpKtlaK+gwpXPZ9XhBvZF9hyKlSEm1Xwvb6emUx72L++RYXvVpoF iGnqo4Mp62pknaGqj5/1ABc0rtRHMHmyioKV1GsVbKXbKDTD4qpAM3pVSUhCVIXi/KLB 4jMg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for 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 j26si769426wmh.0.2017.11.20.03.10.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 03:10:31 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for 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 3ygQxL6xTQz1qsDt; Mon, 20 Nov 2017 12:10:30 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3ygQxL62Gpz1qqkj; Mon, 20 Nov 2017 12:10:30 +0100 (CET) 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 ShntdQRTyDUw; Mon, 20 Nov 2017 12:10:27 +0100 (CET) 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; Mon, 20 Nov 2017 12:10:27 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 1F54D4540378; Mon, 20 Nov 2017 12:10:27 +0100 (CET) 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 MY-hZJIgGT_q; Mon, 20 Nov 2017 12:10:24 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 57F024540623; Mon, 20 Nov 2017 12:10:19 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 04/17] Add set of properties for each image Date: Mon, 20 Nov 2017 12:09:57 +0100 Message-Id: <1511176210-28928-4-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511176210-28928-1-git-send-email-sbabic@denx.de> References: <1511176210-28928-1-git-send-email-sbabic@denx.de> 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 best guess record for 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: , Support free to be set attributes for each image. They are set as forbootloader with a couple of , and put into a dictionary for each image. They are not used by the installer, but can be retrieved by the handler to trim the installation. Signed-off-by: Stefano Babic --- include/swupdate.h | 1 + parser/parser.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/swupdate.h b/include/swupdate.h index 09e81d5..f0a6c28 100644 --- a/include/swupdate.h +++ b/include/swupdate.h @@ -77,6 +77,7 @@ struct img_type { int install_directly; int is_script; int is_partitioner; + struct dictlist properties; long long partsize; int fdin; /* Used for streaming file */ off_t offset; /* offset in cpio file */ diff --git a/parser/parser.c b/parser/parser.c index fe70b3b..8dfb326 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -152,6 +152,35 @@ static void *find_node(parsertype p, void *root, const char *node, return NULL; } +static void add_properties(parsertype p, void *node, struct img_type *image) +{ + + void *properties, *prop; + int count, i; + + properties = get_child(p, node, "properties"); + if (properties) { + count = get_array_length(p, properties); + + TRACE("Found %d properties for %s:", count, image->fname); + + for (i = 0; i < count; i++) { + char key[255]; + char value[255]; + prop = get_elem_from_idx(p, properties, i); + GET_FIELD_STRING(p, prop, "name", key); + GET_FIELD_STRING(p, prop, "value", value); + TRACE("\t\tProperty %d: name=%s val=%s ", i, + key, + value + ); + if (dict_insert_entry(&image->properties, key, value)) + ERROR("Property not stored, skipping..."); + + } + } +} + #ifdef CONFIG_HW_COMPATIBILITY /* * Check if the software can run on the hardware @@ -466,7 +495,10 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua "Version must be checked" : "" ); + add_properties(p, elem, image); + if (run_embscript(p, elem, image, L, swcfg->embscript)) { + dict_drop_db(&image->properties); free(image); return -1; } @@ -537,7 +569,10 @@ static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_ (strlen(file->id.name) && file->id.install_if_different) ? "Version must be checked" : ""); + add_properties(p, elem, file); + if (run_embscript(p, elem, file, L, swcfg->embscript)) { + dict_drop_db(&file->properties); free(file); return -1; }