public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] pakfire.cgi: Suppress display of dependencies for install and remove boxes
@ 2025-05-15  9:20 Stephen Cuka
  0 siblings, 0 replies; only message in thread
From: Stephen Cuka @ 2025-05-15  9:20 UTC (permalink / raw)
  To: development; +Cc: Stephen Cuka

 - For the install <select> box, suppress the display of package
   names starting with lib, perl, and python3.  This does not
   suppress the display of all dependencies, but does remove
   68 packages from the display.
   - As a special case, keep libvirt in the display.  It is a
     top level package.

 - For the remove <select> box, suppress the display of package
   dependencies.
   - As a special case, keep rsync in the display.  It is a top
     level package as well as a dependency of rsnapshot.

 - lfs/freeradius: Remove samba as a dependency of freeradius.
   While commonly used with samba, freeradius is a standalone package.

 - lfs/libvirt: Remove qemu as a dependency of libvirt.
   While commonly used with qemu, libvirt is a standalone package.

 - lfs/mpc: Remove mpd as a dependency of mpc.
   While only used with mpd, mpc is a standalone package.

 - lfs/mympd: Remove mpd as a dependency of mympd.
   While only used with mpd, mympd is a standalone package.

 - lfs/vdradmin: Remove vdr as a dependency of vdradmin.
   While only used with vdr, vdradmin is a standalone package.

Signed-off-by: Stephen Cuka <stephen@firemypi.org>
---
 html/cgi-bin/pakfire.cgi | 35 ++++++++++++++++++++++++++++++++---
 lfs/freeradius           |  2 +-
 lfs/libvirt              |  2 +-
 lfs/mpc                  |  2 +-
 lfs/mympd                |  2 +-
 lfs/vdradmin             |  2 +-
 6 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi
index 159d63c9d..dcf2ee2c9 100644
--- a/html/cgi-bin/pakfire.cgi
+++ b/html/cgi-bin/pakfire.cgi
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2025  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -786,6 +786,18 @@ END
 END
 
 	my %notinstalledlist = &Pakfire::dblist("notinstalled");
+
+	# remove dependencies which start with lib, perl, python3
+	# from list to display
+	# special case - keep libvirt as a top level package
+	my %keep;
+	@keep{libvirt} = @notinstalledlist{libvirt} if exists $notinstalledlist{libvirt};
+	for (keys %notinstalledlist)
+	{
+		delete $notinstalledlist{$_} if $_ =~ /^lib|^perl|^python3/;
+	}
+	@notinstalledlist{libvirt} = @keep{libvirt} if exists $keep{libvirt};
+
 	foreach my $pak (sort keys %notinstalledlist) {
 		print "<option value=\"$pak\">$pak-$notinstalledlist{$pak}{'ProgVersion'}-$notinstalledlist{$pak}{'Release'}</option>\n";
 	}
@@ -798,6 +810,24 @@ END
 END
 
 	my %installedlist = &Pakfire::dblist("installed");
+
+	# remove dependencies packages from list to display
+	# special case - keep rsync as a top level package
+	my $instdir = "/opt/pakfire/db/installed";
+	my @inst_deps = deps_from_metafiles($instdir);
+	my @inst_deps_noparent;
+	foreach (@inst_deps)
+	{
+		push @inst_deps_noparent, $_ =~ /.+:(.+)/;
+	}
+	my %keep;
+	@keep{rsync} = @installedlist{rsync} if exists $installedlist{rsync};
+	foreach (@inst_deps_noparent)
+	{
+		delete $installedlist{$_};
+	}
+	@installedlist{rsync} = @keep{rsync} if exists $keep{rsync};
+
 	foreach my $pak (sort keys %installedlist) {
 		print "<option value=\"$pak\">$pak-$installedlist{$pak}{'ProgVersion'}-$installedlist{$pak}{'Release'}</option>\n";
 	}
@@ -967,8 +997,7 @@ sub arrow_format
         return $line;
 }
 
-# build dependencies tree from array of package
-# dependencies
+# build dependencies tree from array of package dependencies
 sub build_tree
 {
 	my $pref = $_[0];
diff --git a/lfs/freeradius b/lfs/freeradius
index e45e41aa4..111776486 100644
--- a/lfs/freeradius
+++ b/lfs/freeradius
@@ -36,7 +36,7 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = freeradius
 PAK_VER    = 23
 
-DEPS       = libtalloc samba
+DEPS       = libtalloc
 
 SERVICES   = freeradius
 
diff --git a/lfs/libvirt b/lfs/libvirt
index df8d2b224..1b6b233de 100644
--- a/lfs/libvirt
+++ b/lfs/libvirt
@@ -37,7 +37,7 @@ SUP_ARCH   = x86_64 aarch64
 PROG       = libvirt
 PAK_VER    = 38
 
-DEPS       = ebtables libpciaccess ovmf qemu
+DEPS       = ebtables libpciaccess ovmf
 
 SERVICES   = libvirtd virtlogd
 
diff --git a/lfs/mpc b/lfs/mpc
index 3bf4914e1..f6109877f 100644
--- a/lfs/mpc
+++ b/lfs/mpc
@@ -36,7 +36,7 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = mpc
 PAK_VER    = 10
 
-DEPS       = mpd libmpdclient
+DEPS       = libmpdclient
 
 SERVICES   =
 
diff --git a/lfs/mympd b/lfs/mympd
index 81e270fab..550f7e62d 100644
--- a/lfs/mympd
+++ b/lfs/mympd
@@ -36,7 +36,7 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = mympd
 PAK_VER    = 10
 
-DEPS       = mpd libmpdclient
+DEPS       = libmpdclient
 
 SERVICES   = mympd
 
diff --git a/lfs/vdradmin b/lfs/vdradmin
index 1fe38aa5c..a8abbba98 100644
--- a/lfs/vdradmin
+++ b/lfs/vdradmin
@@ -37,7 +37,7 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = vdradmin
 PAK_VER    = 7
 
-DEPS       = perl-gettext vdr vdr_epgsearch
+DEPS       = perl-gettext vdr_epgsearch
 
 SERVICES   = vdradmin
 
-- 
2.43.0



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-15  9:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-15  9:20 [PATCH] pakfire.cgi: Suppress display of dependencies for install and remove boxes Stephen Cuka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox