From patchwork Thu Apr 20 17:35:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasun Maiti X-Patchwork-Id: 1771573 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=IIHXsFZR; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=oP0/l1Kx; 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 4Q2PzF4sR0z1ybF for ; Fri, 21 Apr 2023 03:39:05 +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: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=gKDTTWp3AnfNxGEvw/VQqbIKfe2hCPtW4J+8oo0eSvs=; b=IIHXsFZRQXXsa4 WCtmkflxtocMOe4sjXKCJvQiT9BFP/p5cWbtW3UlyYMEcfzYHPaKGGcWQaabTvtm34DDPwCYDBl80 tVy+vQ3k/mIqBH69YexS5cQgsRhq9V+9g8aQwZfywM0Nf7GRW0mczeJB+BrwRxcmLlZqqqgWw1n/b KyID639RyMGyiai2mhFia1VGz/I3nid6lKLkZaEWxnyT+f4AacwwBEcce+b7mGnMQuqAl3X3kobTA xBVqGF01kKqBPzpIYZe3RhvLJr7vtfu7/hcO3GhPQGNWxJsHcqanrVb5WysK4I1DdDMtuiRHJYmwu YhAcbSxkk7JWvDpi/RmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppYCy-008eZg-1t; Thu, 20 Apr 2023 17:36:36 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppYCv-008eYy-2O for openwrt-devel@lists.openwrt.org; Thu, 20 Apr 2023 17:36:34 +0000 Received: by mail-wm1-x334.google.com with SMTP id o9-20020a05600c510900b003f17012276fso3424734wms.4 for ; Thu, 20 Apr 2023 10:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682012191; x=1684604191; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=lTnelAYJaoYbEt+jj0ssOCWllqWhdGdQpXdcoL+s0Eg=; b=oP0/l1KxBbtrh1z6T3ALTu+qlr4whF/dv316rzx64aS4gKSNBaK8UdEaM86pAF7+f2 Y5XIOLbc5LozAeJL0PeH9sjdjz7MYUmCqHArwsdW62rCNxdBnsz+RFNFPxzyFsvFbMZk BnvW7IRwqm58MD8w/GImRug8ieOHWNW5NqNmloM2C+dQ/DgJcSEC3OkrkTr3M+aD0fYg gWry/T282smBoGhoXnWhqscydQYYfwDTf0WBT7AGMAQlXZCzVg6CwVQ+bZZGFAJtpop/ VR2+F6g9fgNEjqO5+TOZjd1gDpP3HCcAn8dArRZYI72Ed961jYxqslOIy7yqj6jCp/UJ B9gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682012191; x=1684604191; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lTnelAYJaoYbEt+jj0ssOCWllqWhdGdQpXdcoL+s0Eg=; b=kF3GfahubKgUjPoHMQnfJp/xTrNkEQEyqj4oKtWWeGxZDDy5L3BX6QNrAxp+P6yJv4 2Qe9JouypomSO2OlX0n2JyTW31QwYCab62BVX77r9Dq2jnyaz21fqHQG+9UA6+43WygS j1V9ayzqOL56evN9YDwNStAQfU1nXPCpS+tsX4WqiD8EWOTtsMN0oVOSbInoRKD5xvQF lk0iAwr53bfOkMAh8QKY0aArtC6SNZZ9Xy5Snog0Bvn5Bjc3HsZZ2NeQwCSwcDXehqlC ygiuhC2pVtGN9aDLgG7O8VUKcV0y76byJ+UkhBm13TGVBl22oZfUtrX/WU4/AUhTAKe7 71ew== X-Gm-Message-State: AAQBX9dgEDP0diBBXU3wFmcAKUJB8Vkb7QAD2c0XMB4FiNuerNT/zF1u CS/590isEHZphAcaReXikVi9JvRATwI= X-Google-Smtp-Source: AKy350ZIhPieJsqRsP6uyVU+wmxPcDInIU9668hJmEH7AVcyJLfM3ySD+UaxQ2lCVkJRcmEDoXOf4w== X-Received: by 2002:a7b:c8c1:0:b0:3ed:418a:ec06 with SMTP id f1-20020a7bc8c1000000b003ed418aec06mr1821891wml.28.1682012190650; Thu, 20 Apr 2023 10:36:30 -0700 (PDT) Received: from BALT-PMAITI.maxlinear.com ([116.206.202.159]) by smtp.gmail.com with ESMTPSA id k25-20020a05600c081900b003f17122587bsm5898277wmp.36.2023.04.20.10.36.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 10:36:30 -0700 (PDT) From: Prasun Maiti To: OpenWrt Development List Subject: [PATCH] scripts/feeds: remove target/linux/feeds dir if no target Date: Thu, 20 Apr 2023 23:05:52 +0530 Message-Id: <20230420173552.489-1-prasunmaiti87@gmail.com> X-Mailer: git-send-email 2.36.0.windows.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230420_103633_777236_8C8CB020 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.1 (/) 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: From: "Maiti, Prasun" If we uninstall last target from target/linux/feeds/ then feeds dir will be empty. So, feeds dir is not needed anymore. Content analysis details: (0.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:334 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 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [prasunmaiti87[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [prasunmaiti87[at]gmail.com] -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 From: "Maiti, Prasun" If we uninstall last target from target/linux/feeds/ then feeds dir will be empty. So, feeds dir is not needed anymore. Signed-off-by: Maiti, Prasun --- scripts/feeds | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/feeds b/scripts/feeds index aee73e793f..5fca78fc8d 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -497,6 +497,12 @@ sub is_core_src($) { return 0; } +sub is_dir_empty { + my $dir = shift; + opendir(my $dh, $dir); + return scalar(grep { $_ ne "." && $_ ne ".." } readdir($dh)); +} + sub install_target { my $feed = shift; my $name = shift; @@ -771,6 +777,10 @@ sub uninstall { system("rm -f ./package/feeds/*/$name"); $uninstall = 1; } + my $count = is_dir_empty("target/linux/feeds"); + if (!$count) { + system("rm -rvf ./target/linux/feeds"); + } } $uninstall and refresh_config(); return 0;