From patchwork Thu Aug 6 14:12:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1341737 X-Patchwork-Delegate: freifunk@adrianschmutzler.de 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=J3uECaiu; 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 4BMr9c3Hdhz9sPC for ; Fri, 7 Aug 2020 00:15:16 +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:References:In-Reply-To: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:List-Owner; bh=sxNL5BEO6ynfZ8ImpGuPDyXGjPDGHzCDr3LSJvn1qUs=; b=J3uECaiuGKrKSKgpwIWc3sc0qp vXJLVW0ttFlbbejY6dxnWnklWnXMJLSyNnRAfjqXCx1nf7IUoS5mQEluUFkhJcNxT0Q2UPJsWGVZU 5/JNkEjNs7iaKd8aIbTYk854j0GT2t/9sdLOsSB3boluxI+FzQajdw+GdxlYmvZjX3RFpMni04LT0 +YNyShrtUXauEDLrjRdnfhg1YyLcxB3Ok/IowL2M9/dhu/fCR9F06El9032b/JuC+Oyl+Rvg3M6QI 8QN1UXM2HjoT//EEs95mOo+KUgl3K0diqW6IPv/oTROaeqKAwJMHblsew4CVZTzB4FwiRrmhMBe1/ g9dzfywA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3geH-0001RS-Qk; Thu, 06 Aug 2020 14:13:37 +0000 Received: from mout.kundenserver.de ([217.72.192.73]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3geC-0001PR-DD for openwrt-devel@lists.openwrt.org; Thu, 06 Aug 2020 14:13:33 +0000 Received: from buildfff.adridolf.com ([188.192.134.246]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MIdaF-1jyU852JOf-00EdoH for ; Thu, 06 Aug 2020 16:13:28 +0200 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Subject: [PATCH 4/4] build: improve message for incompatible image on "legacy" devices Date: Thu, 6 Aug 2020 16:12:40 +0200 Message-Id: <20200806141241.34383-4-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806141241.34383-1-freifunk@adrianschmutzler.de> References: <20200806141241.34383-1-freifunk@adrianschmutzler.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:yu5yWYQdwZKVtUaIE6Yrtwy1jN2bTHNy993iQZIKH5zUfSey5pL tB/F8SvFDVTIbvX0d4ccuSlJl41/RgOEbHmXHNB48uSX8qCLmhez9DKqfCE4ABfOh1+HBcI SjUoErOtlh6I+8P3R77h8v9uJKlTi8DvxltWv/+4rVmmVJSJNm0zox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-CRM114-CacheID: sfid-20200806_101332_657843_B6BEC699 X-CRM114-Status: GOOD ( 14.18 ) 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_MSPIKE_H2 RBL: Average reputation (+2) [217.72.192.73 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [217.72.192.73 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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 It has been reported that the current message displayed during upgrade with compat_version change is misleading for "legacy" devices, i.e. those without the "new" fwtool. This is partially caused by the fact that we need to exploit the supported_devices string to get some message text displayed for these devices. This patch modifies the message to make it more helpful and include additional information, e.g. Device linksys,wrt3200acm not supported by this image Supported devices: linksys,wrt3200acm linksys-whateverelse - Image version mismatch: image 1.1, device 1.0. Please wipe config during upgrade (force required) or reinstall. Reason: Config cannot be migrated from swconfig to DSA Note that the line breaks (except the one before Supported devices) are added manually here, I hesitate to hack \n into the supported_devices as well. The "Reason:" will only be displayed if DEVICE_COMPAT_MESSAGE is set for the device, otherwise "Please check documentation ..." will be shown instead. While at it, also rearrange the code in image-commands.mk to make lines shorter and remove the double filter-out command. Signed-off-by: Adrian Schmutzler --- include/image-commands.mk | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 089ed93c67..74d9877698 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -382,15 +382,19 @@ endef compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0) json_quote=$(subst ','\'',$(subst ",\",$(1))) +legacy_supported_message=$(SUPPORTED_DEVICES) - Image version mismatch: image $(compat_version), \ + device 1.0. Please wipe config during upgrade (force required) or reinstall. \ + $(if $(DEVICE_COMPAT_MESSAGE),Reason: $(DEVICE_COMPAT_MESSAGE),Please check documentation ...) + metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) metadata_json = \ '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ "metadata_version": "1.1", \ "compat_version": "$(call json_quote,$(compat_version))", \ $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \ - $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \ - $(if $(filter-out 1.0,$(compat_version)),"supported_devices": \ - ["$(call json_quote,Image version $(compat_version) incompatible to device: $(if $(DEVICE_COMPAT_MESSAGE),$(DEVICE_COMPAT_MESSAGE),Please check documentation ...))"]$(comma)) \ + $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \ + [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \ + "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \ $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \ "version": { \ "dist": "$(call json_quote,$(VERSION_DIST))", \