From patchwork Tue Jun 13 15:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Klaassen X-Patchwork-Id: 1794587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=tZ4K9+ju; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=tidylabs.app header.i=@tidylabs.app header.a=rsa-sha256 header.s=key2 header.b=O4HyA3OC; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QgY0J0Q59z20Wq for ; Wed, 14 Jun 2023 01:49:51 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: MIME-Version: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=pjHfRJT1l91II8pJS+ZLtt99go0cY9Ww3KsTxilVnk4=; b=tZ4 K9+juEXmjbRtF7yU8NsWkcYyF0gzbf/MtCK9XkFxG4SmeoMLRPb3OLyxMT658og/G2vAXFhtbTyPl cBafqX4uTk+Uww8zZ2Mn5COv3n4J8UcE5WSHV3qGnpBbDefkqJZP35ZIsNTigEYJGl3Yb4LRku0E9 i8kgYjp/jXvSaTa7J77wGiQB0HCUBa+O857ifsPyBPxQ3dpL3envxgrev+JKsmzXObjyYWfQXT3/G mATOPxNgi/j7GQtQ3cfISErhZ45CI1htk0ymZ8GNkFk8UcHoA67gwSQW5N3+PotBrNxR3DMUU4VsI 3Anv0GbHJPxo5/ChAlOqYlZk/gYYqVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q96ET-008Vpq-1s; Tue, 13 Jun 2023 15:46:57 +0000 Received: from relay.yourmailgateway.de ([188.68.63.98]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q96EO-008Vop-37 for openwrt-devel@lists.openwrt.org; Tue, 13 Jun 2023 15:46:55 +0000 Received: from mors-relay-2501.netcup.net (localhost [127.0.0.1]) by mors-relay-2501.netcup.net (Postfix) with ESMTPS id 4QgXwp5Lwbz5yJp for ; Tue, 13 Jun 2023 17:46:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tidylabs.app; s=key2; t=1686671210; bh=vSMA645IkDqg/diVBD3IW/wtow/aTSAIOn9aHUeIYvg=; h=From:Date:Subject:To:From; b=O4HyA3OCZM2V1MKOIzT1qyReHBjxreoooub5jMhc3oLGuPXwauflR8A5nTk2ve9Sy +PImsLPLQ/rOnsimIghSxQEx1B2/rw/yYWEshyeUxL6wzH5QYGF+ZPlMJ/2pke3mgN QmXMQdXEj/o4ok8UW4WkrK3/bhk7TZjaOMHPIhWFsPadbc/xzwE689NTob+DP3iRz8 QYJn0aNirkKK0IWvOygNAkaeI2ws3b+OZ3VbzctXARxNlNRWktEcH3RbzAHjuRABHR KYUvuOyGqXBpc+YROGiGgVGh1PNcJ8sglE/hvi2A7G7qVNm1VvBNvHgNCRAuxhvWg+ +t+5Hxr8EudxA== Received: from policy01-mors.netcup.net (unknown [46.38.225.35]) by mors-relay-2501.netcup.net (Postfix) with ESMTPS id 4QgXwp4cp7z4whY for ; Tue, 13 Jun 2023 17:46:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at policy01-mors.netcup.net X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 required=6.31 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from mx2ecc.netcup.net (unknown [10.243.12.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by policy01-mors.netcup.net (Postfix) with ESMTPS id 4QgXwg0496z8t42 for ; Tue, 13 Jun 2023 17:46:42 +0200 (CEST) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by mx2ecc.netcup.net (Postfix) with ESMTPSA id 8070C1A00B1 for ; Tue, 13 Jun 2023 17:46:38 +0200 (CEST) Authentication-Results: mx2ecc; spf=pass (sender IP is 209.85.208.41) smtp.mailfrom=justin@tidylabs.app smtp.helo=mail-ed1-f41.google.com Received-SPF: pass (mx2ecc: connection is authenticated) Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-51879487e18so1119453a12.3 for ; Tue, 13 Jun 2023 08:46:38 -0700 (PDT) X-Gm-Message-State: AC+VfDwiolYnwzOLVKd660NHlHjoqPPa7r/Fs6cUYbi6Q7L7xPYvErw/ vd5oi4nVtduNOo9d3gIL50IEFVetmJcYgcG6TKA= X-Google-Smtp-Source: ACHHUZ6ewuHV6qpneGrKwfkV1DXqdj5dRHFOzqlonFzjT4Oj1sLIsi9UWwMAV4hVpMiq1aRsQ0klSgNpdxZVkkkYvh8= X-Received: by 2002:aa7:db59:0:b0:514:9edb:829e with SMTP id n25-20020aa7db59000000b005149edb829emr8724646edt.18.1686671198301; Tue, 13 Jun 2023 08:46:38 -0700 (PDT) MIME-Version: 1.0 From: Justin Klaassen Date: Tue, 13 Jun 2023 08:46:27 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: [PATCH] libopkg: preserve package flags on upgrade To: openwrt-devel@lists.openwrt.org X-Rspamd-Queue-Id: 8070C1A00B1 X-Spamd-Result: default: False [-5.60 / 15.00]; BAYES_HAM(-5.50)[100.00%]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[openwrt-devel@lists.openwrt.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Server: rspamd-worker-8404 X-NC-CID: y5BmUbm15VA36fPL4oDmpcOwiWcOCNSkg0O315Tv2TL6M3I= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_084653_148419_84A40420 X-CRM114-Status: GOOD ( 12.13 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Previously the auto_installed flag was cleared and the user flag was set whenever a package is upgraded. This prevented upgraded dependent packages from being removed with e.g. --autoremove. This patch preserves the auto_installed and user flags when a package is upgraded enabling dependent packages to be identified as such after upgrade. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [188.68.63.98 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 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 Previously the auto_installed flag was cleared and the user flag was set whenever a package is upgraded. This prevented upgraded dependent packages from being removed with e.g. --autoremove. This patch preserves the auto_installed and user flags when a package is upgraded enabling dependent packages to be identified as such after upgrade. Signed-off-by: Justin Klaassen --- libopkg/opkg_upgrade.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libopkg/opkg_upgrade.c b/libopkg/opkg_upgrade.c index 2112674..b27faa4 100644 --- a/libopkg/opkg_upgrade.c +++ b/libopkg/opkg_upgrade.c @@ -74,7 +74,8 @@ int opkg_upgrade_pkg(pkg_t * old) free(old_version); free(new_version); - new->state_flag |= SF_USER; + new->auto_installed = old->auto_installed; + new->state_flag |= old->state_flag & SF_USER; return opkg_install_pkg(new, 1); }