From patchwork Thu Jul 9 18:14:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1326131 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=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=adrianschmutzler.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=loLqPR7v; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4B2ktV0Mynz9sRk for ; Fri, 10 Jul 2020 04:17:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dIYoOQOoOqF5cqvulaBcbns8Km5McoeLIsil6O8Ir7k=; b=loLqPR7vP5jvX6NAkbN7SwWkmv bipgABvRDnlxXA9zwwxcZ6CYIjgbyOkLJwqcCKRVRTYVHWdZBub8vaANAlJO9H86NRlG1tJ8NYfZY fTR6egsyZ6g9UfsVNgTILn5Or43p+wlP02UWrLrssWFh0qOltZBNWxVaPNOn4AzZ4eN+QpA9mKi7n MDqK/yQ/i2gcJmpO9Gccgrhfoe23+2f/sJBzplBM1vgkLFZkrpxx7sI+kzvD3df80TS1qdObYtJpl QNrdFgJbs50qdgU0083/LDGTVdmiKZ7SWUl8XyEGq5zkCpTS37zjynNJXcaWBw43BoASFuq2mASbs dEpvICSg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtb5N-0000C4-ML; Thu, 09 Jul 2020 18:15:53 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtb5I-000097-MB for openwrt-devel@lists.openwrt.org; Thu, 09 Jul 2020 18:15:50 +0000 Received: from buildfff.adridolf.com ([188.192.134.246]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N3sZs-1ktIOF1yGO-00zpBc for ; Thu, 09 Jul 2020 20:15:43 +0200 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Subject: [PATCH 0/5] sysupgrade: introduce compatibility version for devices Date: Thu, 9 Jul 2020 20:14:55 +0200 Message-Id: <20200709181500.10948-1-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:Ly8uaEBoSQh/+VB4zDEKRdYw8t1eKUEITvHWcxfzblz2NOMHR6k +ouYvGnwueskUojyxGhCll14Picx714jRwHpA0WVqMyw88yb5Sc8VDf+JJI3ogD2Wr2C0a5 luWr5BzOehxuamGKahwR7sIvr4+HcFlEm2rN4cKnoWCjrnkCyW0bDgVPmS2r9u+C8f1pbxr ie6CXtM2rMm7uBJ2OIsSQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:fyIhbEvK8AQ=:kAALDkplM9pnkgnGAeIHdW lB8aeZ/RGwiA5BeiUf9mxTz5ydxhzHEggJRtWCsfSOxWf/4+FBOsvjBx52GBY/+Z4sxcGAi4M i5OOM2JKcCXFV1Qv5YTtg5FfuM52MQLhLa63zICVdQKJ4gl9vvw9VoVRux0Z1tz7awmhFX/Qv RNIVQx/2LwAHX1ZhHTzcszZYSUefUJ4jGhmvJwXhjuMXA2FkVRYaWq3vwroV4NRw/29m7pQDf xVYbm3Yl2v7i8oZTa8aWttTgrPRQ6QE+rnMJQp1r61ghmDFMksinwyzSH2VFu3CtRmoB9zTyC LleNp3HGQzs7iapmMfRBVUR+msSjjL4Zn+GQDSXDlwHrQ5pj+iwxln+UDLLzxmtcE+b5E2vHY pXylugx3PFIGyrp78IvhH7ncYOliM2FfSzLyx9AWlzd/0FlOUC7Dc+G/qIP6hyLn2DSplYDnp AUBPrT8gT3rTMGuxt+1WHFMC+3GQd4qZMIJSlih3IonaM+YPMJKLI9jar5In0ftxuaYCKHpyP zbZfmtiFXFM73U53Sw8Ix87/8KvCqvpuHH2XTFJGVTWT8J+Js51EStD7kdUM2xCkDsd/P6iMU z4ig2bB2HQb6Q1s6YDZr1cf94rC8+vUl1SYu1vzLpLksFTYXek8BGYQMNGPXbFvsUIUdeHlV/ Ldk8CZ9vi79vQJWhQijWP9dg+W99AKKx/xYPNhZCdEFcb5WJE9rvLwnh8/VwW8aiC+hakHqj9 SDcrArXRo+xP5HUTSPb3N1309AF0TGWMKKqZo9C8d/hgd4zxvU4eeAuoCFFDZQEJuHw5klPG2 6aXHbQVn0BD7OsQAqNSBVN4XR9DLRkhLdbbSQlZ1981mnZAVbN740Gwd1cEFEKvl7SfQr4qxa l9M9janL66fHEGlBUt/w== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_141548_933768_D5758BE0 X-CRM114-Status: GOOD ( 11.08 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.126.135 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.135 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org We regularly encounter the situation that devices are subject to changes that will make them incompatible to previous versions. Removing SUPPORTED_DEVICES will not really be helpful in most of these cases, as this only helps after a rename. To solve this situation, this patchset introduces a compatibility version for devices. It is implemented by a compat_version set for the device and in image metadata, where old images default to 1.0. If an incompatible change is introduced, one can increase either the minor version (1.0->1.1) or the major version (1.0->2.0). Minor version increment: This will still allow sysupgrade, but require to reset config (-n or SAVE_CONFIG=0). If sysupgrade is called without -n, a corresponding message will be printed. If sysupgrade is called with -n, it will just pass, with supported devices being checked as usual. (Which will allow us to add back SUPPORTED_DEVICES for many cases.) Major version increment: This is meant for potential (rare) cases where sysupgrade is not possible at all, because it would break the device. In this case, a warning will be printed, and -n won't help. If image check fails because of one of the versions parts not matching, the content of DEVICE_COMPAT_MESSAGE is printed in addition to the generic message (if set). For both cases, upgrade can still be forced with -F as usual. By a small trick, this is also applied in a way that will work sufficiently well for old devices not having the updated fwtool.sh I hope that this will allow to improve the update experience for incompatible changes beyond just removing SUPPORTED_DEVICES as it has been done in the past. This has been tested on device and appear to work. I have no idea what this will do with LuCI... Adrian Schmutzler (5): build: add DEVICE_COMPAT_VERSION and DEVICE_COMPAT_MESSAGE base-files: add support for compat_version on device base-files: fwtool: implement compatibility check for images base-files: fwtool: make compat_version backward compatible example: implement compat_version for devices include/image-commands.mk | 9 +++++-- include/image.mk | 3 +++ package/base-files/files/bin/config_generate | 7 +++++ .../files/lib/functions/uci-defaults.sh | 6 +++++ .../base-files/files/lib/upgrade/fwtool.sh | 27 ++++++++++++++++++- .../generic/base-files/etc/board.d/02_network | 12 +++++++-- target/linux/ath79/image/generic-tp-link.mk | 3 +++ 7 files changed, 62 insertions(+), 5 deletions(-)