From patchwork Tue Nov 7 21:28:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 835476 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:c0c::23c; helo=mail-wr0-x23c.google.com; envelope-from=swupdate+bncbcxploxj6ikrb6wkrdiakgqe4g46pwi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="KHo14yEb"; dkim-atps=neutral Received: from mail-wr0-x23c.google.com (mail-wr0-x23c.google.com [IPv6:2a00:1450:400c:c0c::23c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yWjGQ2zJBz9s7F for ; Wed, 8 Nov 2017 08:28:29 +1100 (AEDT) Received: by mail-wr0-x23c.google.com with SMTP id 107sf288494wra.7 for ; Tue, 07 Nov 2017 13:28:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1510090107; cv=pass; d=google.com; s=arc-20160816; b=uXvbfuyWM8T20V3tIUbwzdWjJUolnbtOVh4RCHWw7U7IZSfpTFBh9lfeFRvILktajV mPHKaNfHHA/26bsTN0sKPQMSzu2BitQU2kO3bqGWO898AhicsVdNk/KCMIXe4rD4lM14 JKOj3ZeVith50pXQGaJbGxEtDsabr8ate3K/yab5ycEREpKW8eexSjC/JyBupzr3vHjI Wt3LAjsI1XEyrrzRVzrKKlaDboxit4G+FS19Kc3NUg1x5mItBRDygeURJGcu695/TVao pN/Z2QF3au+sDhoKry8b2vkiqpidhHYxBR0vApPwVH5mIBv0VvNheNgcXTxOwC98ZZzY Ivtw== 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:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=XSdlhI/hKQe5vC/kh+ZdybfcPyJJINK3soouVcS/XGY=; b=Kkdvt5ZFtFqmFBEjm86zrYS99x9BMmSiLwf8+l5AVA+PguHh08mmfxy5yO3P8nY3lf m36iL36WoBMvNO5oDPaMm2WQF0JumCnNwglWzpuk5DtUNnlErXqh5fWDDhiEtrcv4PrI AE89/qnOO7FIQWhio5AHFqpOoEoS8QBgSZHN9CNLkANCbti4bC2VJnZa1jqEew+NwuFu FfDsYzFHp/635H6CLKZQa59+7WhMrgr0yVTb6YT9iAuVDTIbltI3HKbgsT34zCXEvtEo 4qWq1vfek+NqiIK3mVNI7OESK2WhGMKv7BHWMP0cLZAfkEY4vEEOH7kieuLyu/YHdrc7 pe9A== 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 :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=XSdlhI/hKQe5vC/kh+ZdybfcPyJJINK3soouVcS/XGY=; b=KHo14yEbcj8Uj69IehTYYxEA/ozyLeftonHGOPCouiOCHBc3/iFCYuGIorKy2ev5EL f+7pSX3Qf87MtnrAwH2I7NnJxki63c7QHaNEUpO9/47brZ4CNlkLJwX7EWdTvIpsp/Z7 EPrQhj4jkmKV9MuRRlLeX5D14YeIW99H6YuVHRWLp69sn4sj4rjIMSyqqOxcovkzjRuq lv4WFY3r047aLyf5i78hpzcwMJ35BuA2P4rIj/Wsodb9Fw+zxX7eS4/85REcRworVWd2 hFNPh0zROZZN9yiZpa4OF9VdvaeDbbJjEbA+lx8PWLNd5mbiKkG3Az6K6jObqk1V54kA LOrA== 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: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=XSdlhI/hKQe5vC/kh+ZdybfcPyJJINK3soouVcS/XGY=; b=pk8akXsw++vtIWE8wXkKbsjImvLEtUXIzhw+lwpG3TDNAmA4WRlXYs+8aezblKRvuR l50J07YvoAEO9lx1ZwRNYw421anvxG0mN/gvuDxCfhJ/mmQuNiZqc9lpbTaMH8UEqmAB 2g9TsSwRBB7jjP3KfXEzJ4jSklUqAuigDKnDSDIYIQno6qXdzMvKYUALoothZ5zIriKb KOWatBWbfPWPmggYDn7t4aS17vTDahdG4he3wW/iLuuNpbva8JrJZz10ooiIYtN43qkV xXEdD2BvsT5ibE6GR3l1xb+RMNoXVyCi5ojBT4/wXGYbdUvoUtPcFPZDhNuyasTL/6CJ 0n9w== Sender: swupdate@googlegroups.com X-Gm-Message-State: AJaThX59aaPgx+WpUFnnID3DxTOn4kPf4iCc9h38UDoJJxk4sIzekwgM 99zqjAsGuIL0P9GhUS1rGdo= X-Google-Smtp-Source: ABhQp+Rc6oZ5bek3G74+BBa9W3shzTQ8nlhWaftlIDAwzuUC8zPTogVawBfcQRyxD8uHtRfuBYc9qw== X-Received: by 10.28.114.7 with SMTP id n7mr5601wmc.0.1510090107126; Tue, 07 Nov 2017 13:28:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.223.145.226 with SMTP id 89ls3469027wri.10.gmail; Tue, 07 Nov 2017 13:28:26 -0800 (PST) X-Received: by 10.223.134.175 with SMTP id 44mr5553wrx.11.1510090106620; Tue, 07 Nov 2017 13:28:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510090106; cv=none; d=google.com; s=arc-20160816; b=X/3s42ylUa2ufGMI5o8paM2Dv0i505A+K2RmbpsTqY95PC1dcTrObOqQ/ztA1UjYUa Vf2zAA8wik+6YJ1CKAs7AIMDZTpVf54RO+NY+n8SwySCbNK5RznoVzo1HQZAbMmrJFP0 dJXixI6wnD6DsKR6+JP+Dh9XHMYfvd0ae4N0W6qOBc0+ty+cHvuu1npeY/MuMuQlbE2s UjQXfrBMwts8slALF0hBZIuEGzQd+YBNL1aGIsy8tC5LLBipsEvJNXgJzdQj174z9Uyy /uP8Ba8EmBoxZJtpuHuc0/tbm8vhCAougm1OkTNpF/ynuY5gNFhgvqxEZrD7Ou+Zk+vL /Lsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=DX9U+f7VubQA3nTtF2mNJC6UzIpglwYxWsrqVjm9eZA=; b=t4Ej72+6f+WuxQaJbIAb15f+VlU1WNt74WHFMvCTz2he7+qXRXjA5QLi78bV4yl3Wz pd+3Ulacy+6vxcFnKZQZ+M/ayrsTif3pLtlzrf1nmPHRyvBVbSUjBSnrzHIEjFaiOIUa 5UNljp3l2HvywLm2C8sME+CcTfrqenEciLOM/8xsIzT3Wde5OwjCIVES3rvkv3uLbecj oY3uiL0I9c3dWQWeDzUkHlSVDJijygERQJtBaSmVEF696/VB9VtQ2qfy53MAG+lwm2Vg J+Y1WYYmrgb9Hw2zOge2irt1oQG7TV96pp4/wUoOaUSHTvvJYDA0qy5QGtuAZk4c5HP2 QifQ== 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 i76si171279wmd.0.2017.11.07.13.28.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Nov 2017 13:28:26 -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 3yWjGL2MXrz1qsTg; Tue, 7 Nov 2017 22:28:26 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3yWjGL1vFFz1rJhv; Tue, 7 Nov 2017 22:28:26 +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 ostZxz6MbC61; Tue, 7 Nov 2017 22:28:25 +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; Tue, 7 Nov 2017 22:28:25 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B3C844540690; Tue, 7 Nov 2017 22:28:24 +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 DgJH7VYwk1HI; Tue, 7 Nov 2017 22:28:21 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 4592E4540134; Tue, 7 Nov 2017 22:28:21 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: p.rosenberger@linutronix.de, torben.hohn@linutronix.de, afaustas@gmail.com, Stefano Babic Subject: [swupdate] [PATCH] Add a first-in, first-install order Date: Tue, 7 Nov 2017 22:28:13 +0100 Message-Id: <1510090093-27773-1-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 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: , Currently, files are installed before images and each entry in sw-description is installed in reverse order. In some applications, the installation relies on the order, for example if files are installed on a fresh burned image. To provide this use case, install "images" before "files" and ensures that they are installed in the same order they are put into the sw-description file. Signed-off-by: Stefano Babic --- parser/parser.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/parser/parser.c b/parser/parser.c index 591970c..fe70b3b 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -389,7 +389,7 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua count = get_array_length(p, setting); - for(i = 0; i < count; ++i) { + for(i = (count - 1); i >= 0; --i) { elem = get_elem_from_idx(p, setting, i); if (!elem) @@ -489,7 +489,8 @@ static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_ return 0; count = get_array_length(p, setting); - for(i = 0; i < count; ++i) { + + for(i = (count - 1); i >= 0; --i) { elem = get_elem_from_idx(p, setting, i); if (!elem) @@ -572,10 +573,10 @@ static int parser(parsertype p, void *cfg, struct swupdate_cfg *swcfg) /* Now parse the single elements */ ret = parse_hw_compatibility(p, cfg, swcfg) || + parse_files(p, cfg, swcfg, L) || parse_images(p, cfg, swcfg, L) || parse_scripts(p, cfg, swcfg) || - parse_bootloader(p, cfg, swcfg) || - parse_files(p, cfg, swcfg, L); + parse_bootloader(p, cfg, swcfg); /* * Move the partitions at the beginning to be processed