From: Robin Roevens <robin.roevens@disroot.org>
To: development@lists.ipfire.org
Subject: [PATCH v2 01/10] pakfire: Refactor dblist seperating UI and logic
Date: Thu, 28 Jul 2022 13:21:27 +0200 [thread overview]
Message-ID: <20220728112136.30218-2-robin.roevens@disroot.org> (raw)
In-Reply-To: <20220728112136.30218-1-robin.roevens@disroot.org>
[-- Attachment #1: Type: text/plain, Size: 22584 bytes --]
- Removed UI code from dblist function and refactor it making it return
a hash representing the pak db for easier handling of this data.
- Moved core update check in dblist to new seperate dbcoreinfo function
making it return a hash with current and possibly available core
version info.
- Update existing calls to dblist
- Bring UI parts previously in dblist to pakfire program itself,
pakfire.cgi and index.cgi with a few small enhancements:
- Translations for 'Core-Update', 'Release', 'Update' and 'Version'
- Add currently installed version numbers to installed paks list in
pakfire.cgi
- Add 'Installed: yes/no' to pakfire list output so people not using
colors have this information too. (Partly fixes Bug #12868)
- Add update available details to pakfire list output if package has
updates available.
Signed-off-by: Robin Roevens <robin.roevens(a)disroot.org>
---
html/cgi-bin/index.cgi | 6 +-
html/cgi-bin/pakfire.cgi | 23 ++++-
langs/de/cgi-bin/de.pl | 4 +
langs/en/cgi-bin/en.pl | 4 +
langs/fr/cgi-bin/fr.pl | 4 +
langs/nl/cgi-bin/nl.pl | 4 +
src/pakfire/lib/functions.pl | 165 ++++++++++++++++++-----------------
src/pakfire/pakfire | 99 ++++++++++++++++-----
8 files changed, 202 insertions(+), 107 deletions(-)
diff --git a/html/cgi-bin/index.cgi b/html/cgi-bin/index.cgi
index 18c26942e..6fecae1ff 100644
--- a/html/cgi-bin/index.cgi
+++ b/html/cgi-bin/index.cgi
@@ -604,7 +604,11 @@ if ($warnmessage) {
&Header::closebox();
}
-&Pakfire::dblist("upgrade", "notice");
+my %coredb = &Pakfire::coredbinfo();
+if (defined $coredb{'AvailableRelease'}) {
+ print "<br /><br /><br /><a href='pakfire.cgi'>$Lang::tr{'core notice 1'} $coredb{'Release'} $Lang::tr{'core notice 2'} $coredb{'AvailableRelease'} $Lang::tr{'core notice 3'}</a>";
+}
+
if ( -e "/var/run/need_reboot" ) {
print "<div style='text-align:center; color:red;'>";
print "<br/><br/>$Lang::tr{'needreboot'}!";
diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi
index 3e8dc5460..cb1272c63 100644
--- a/html/cgi-bin/pakfire.cgi
+++ b/html/cgi-bin/pakfire.cgi
@@ -403,7 +403,16 @@ print <<END;
<select name="UPDPAKS" class="pflist" size="5" disabled>
END
- &Pakfire::dblist("upgrade", "forweb");
+ my %coredb = &Pakfire::coredbinfo();
+ if (defined $coredb{'AvailableRelease'}) {
+ print "<option value=\"core\">$Lang::tr{'core update'} -- $coredb{'CoreVersion'} -- $Lang::tr{'release'}: $coredb{'Release'} -> $coredb{'AvailableRelease'}</option>\n";
+ }
+
+ my %upgradelist = &Pakfire::dblist("upgrade");
+ foreach my $pak (sort keys %upgradelist) {
+ print "<option value=\"$pak\">$Lang::tr{'pak update'}: $pak -- $Lang::tr{'version'}: $upgradelist{$pak}{'ProgVersion'} -> $upgradelist{$pak}{'AvailableProgVersion'} -- $Lang::tr{'release'}: $upgradelist{$pak}{'Release'} -> $upgradelist{$pak}{'AvailableRelease'}</option>\n";
+ }
+
print <<END;
</select>
<input type='hidden' name='ACTION' value='upgrade' />
@@ -419,7 +428,11 @@ END
<select name="INSPAKS" class="pflist" size="10" multiple>
END
- &Pakfire::dblist("notinstalled", "forweb");
+ my %notinstalledlist = &Pakfire::dblist("notinstalled");
+ foreach my $pak (sort keys %notinstalledlist) {
+ print "<option value=\"$pak\">$pak-$notinstalledlist{$pak}{'ProgVersion'}-$notinstalledlist{$pak}{'Release'}</option>\n";
+ }
+
print <<END;
</select>
<input type='hidden' name='ACTION' value='install' />
@@ -431,7 +444,11 @@ END
<select name="DELPAKS" class="pflist" size="10" multiple>
END
- &Pakfire::dblist("installed", "forweb");
+ my %installedlist = &Pakfire::dblist("installed");
+ foreach my $pak (sort keys %installedlist) {
+ print "<option value=\"$pak\">$pak-$installedlist{$pak}{'ProgVersion'}-$installedlist{$pak}{'Release'}</option>\n";
+ }
+
print <<END;
</select>
<input type='hidden' name='ACTION' value='remove' />
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index 49c582a1e..179980716 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -653,6 +653,7 @@
'core notice 1' => '<strong>Hinweis:</strong> Es steht eine Aktualisierung von Core-Update',
'core notice 2' => 'auf',
'core notice 3' => 'zur Verfügung.',
+'core update' => 'Core-Update',
'could not be opened' => 'konnte nicht geöffnet werden',
'could not connect to' => 'Konnte keine Verbindung herstellen mit',
'could not connect to www ipcop org' => 'Keine Verbindung zu www.ipcop.org möglich',
@@ -2012,6 +2013,7 @@
'ovpnsys log' => 'OVPN-System-Protokoll',
'package failed to install' => 'Programmpaket konnte nicht installiert werden.',
'pagerefresh' => 'Seite wird aktualisiert. Bitte warten.',
+'pak update' => 'Paketupdate',
'pakfire accept all' => 'Möchten Sie der Installation aller Pakete zustimmen?',
'pakfire ago' => 'her.',
'pakfire already busy' => 'Pakfire führt bereits eine Aufgabe aus. Bitte versuchen Sie es später erneut.',
@@ -2157,6 +2159,7 @@
'refresh index page while connected' => 'Aktualisiere index.cgi Seite während der Verbindung',
'refresh update list' => 'Aktualisiere Update-Liste',
'registered user rules' => 'Talos VRT-Regelsatz für registrierte Benutzer',
+'release' => 'Release',
'released' => 'Freigegeben',
'reload' => 'neu laden',
'remark' => 'Anmerkung',
@@ -2868,6 +2871,7 @@
'valid till' => 'Gültig bis',
'vci number' => 'VCI-Nummer:',
'vendor' => 'Hersteller',
+'version' => 'Version',
'view log' => 'Protokoll anzeigen',
'virtual address' => 'Virtuelle Addresse',
'virtual private networking' => 'Virtuelles Privates Netzwerk',
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index ae233de8e..b51823177 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -684,6 +684,7 @@
'core notice 1' => '<strong>Notice:</strong> There is a core-update from',
'core notice 2' => 'to',
'core notice 3' => 'available.',
+'core update' => 'Core-Update',
'could not be opened' => 'could not be opened.',
'could not connect to' => 'Could not connect to',
'could not connect to www ipcop org' => 'Could not connect to www.ipfire.org',
@@ -2065,6 +2066,7 @@
'ovpnsys log' => 'OVPN-System-Log',
'package failed to install' => 'Package failed to install.',
'pagerefresh' => 'Page is beeing refreshed, please wait.',
+'pak update' => 'Update',
'pakfire accept all' => 'Do you want to install all packages?',
'pakfire ago' => 'ago.',
'pakfire already busy' => 'Pakfire is already performing a task. Please try again later.',
@@ -2211,6 +2213,7 @@
'refresh index page while connected' => 'Refresh index.cgi page while connected',
'refresh update list' => 'Refresh update list',
'registered user rules' => 'Talos VRT rules for registered users',
+'release' => 'Release',
'released' => 'Released',
'reload' => 'reload',
'remark' => 'Remark',
@@ -2935,6 +2938,7 @@
'valid till' => 'Valid till',
'vci number' => 'VCI number:',
'vendor' => 'Vendor',
+'version' => 'Version',
'view log' => 'view log',
'virtual address' => 'Virtual Address',
'virtual private networking' => 'Virtual Private Networking',
diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl
index 245ec62b6..560b4aa54 100644
--- a/langs/fr/cgi-bin/fr.pl
+++ b/langs/fr/cgi-bin/fr.pl
@@ -690,6 +690,7 @@
'core notice 1' => '<strong>Remarque :</strong> Une mise à jour est disponible depuis la version',
'core notice 2' => 'vers',
'core notice 3' => '',
+'core update' => 'Mise à jour du coeur',
'could not be opened' => 'ne peut pas être ouvert',
'could not connect to' => 'Impossible de se connecter à',
'could not connect to www ipcop org' => 'Impossible de se connecter à www.ipcop.org',
@@ -2074,6 +2075,7 @@
'ovpnsys log' => 'Journal système OVPN',
'package failed to install' => 'L\'installation du paquet a échoué.',
'pagerefresh' => 'La page est en cours d\'actualisation, veuillez patienter.',
+'pak update' => 'Mise à jour',
'pakfire accept all' => 'Voulez-vous installer ce(s) paquet(s) ?',
'pakfire ago' => '',
'pakfire already busy' => 'Pakfire est déjà en train d\'effectuer une tâche. Veuillez réessayer plus tard.',
@@ -2221,6 +2223,7 @@
'refresh index page while connected' => 'Actualiser la page index.cgi pendant la connexion',
'refresh update list' => 'Actualiser la liste des mises à jour',
'registered user rules' => 'Règles Sourcefire VRT pour les utilisateurs enregistrés',
+'release' => 'Révision',
'released' => 'Disponible',
'reload' => 'Recharger',
'remark' => 'Remarque ',
@@ -2946,6 +2949,7 @@
'valid till' => 'Valide jusqu\'au',
'vci number' => 'Nombre VCI :',
'vendor' => 'Vendeur',
+'version' => 'Version',
'view log' => 'Afficher log',
'virtual address' => 'Adresse virtuelle',
'virtual private networking' => 'Réseau privé virtuel (VPN)',
diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl
index 5979873bb..e50a95578 100644
--- a/langs/nl/cgi-bin/nl.pl
+++ b/langs/nl/cgi-bin/nl.pl
@@ -577,6 +577,7 @@
'core notice 1' => '<strong>Let op:</strong> Er is een core-update van',
'core notice 2' => 'naar',
'core notice 3' => 'beschikbaar.',
+'core update' => 'Core-Update',
'could not be opened' => 'kan niet worden geopend.',
'could not connect to' => 'Kan niet verbinden',
'could not connect to www ipcop org' => 'Kan niet verbinden met www.ipfire.org',
@@ -1690,6 +1691,7 @@
'ovpnsys log' => 'OVPN-Systeem-Log',
'package failed to install' => 'Pakket kon niet worden geïnstalleerd.',
'pagerefresh' => 'Pagina wordt ververst, wacht even a.u.b.',
+'pak update' => 'Opwaardering',
'pakfire accept all' => 'Wilt u alle pakketten installeren?',
'pakfire ago' => 'geleden.',
'pakfire available addons' => 'Beschikbare extensies:',
@@ -1817,6 +1819,7 @@
'refresh index page while connected' => 'Ververs de index.cgi pagina terwijl verbonden',
'refresh update list' => 'Ververs update-lijst',
'registered user rules' => 'Talos VRT regels voor geregistreerde gebruikers',
+'release' => 'Uitgave',
'released' => 'Released',
'reload' => 'herlaad',
'remark' => 'Opmerking',
@@ -2484,6 +2487,7 @@
'valid root certificate already exists' => 'Er bestaat al een geldig root certificaat.',
'valid till' => 'Geldig tot',
'vci number' => 'VCI nummer:',
+'version' => 'Versie',
'view log' => 'bekijk log',
'virtual address' => 'Virtueel adres',
'virtual private networking' => 'Virtual Private Networking',
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
index 505988af9..19160503e 100644
--- a/src/pakfire/lib/functions.pl
+++ b/src/pakfire/lib/functions.pl
@@ -44,7 +44,7 @@ my @VALID_KEY_FINGERPRINTS = (
);
# A small color-hash :D
-my %color;
+our %color;
$color{'normal'} = "\033[0m";
$color{'black'} = "\033[0;30m";
$color{'darkgrey'} = "\033[1;30m";
@@ -434,108 +434,113 @@ sub dbgetlist {
}
}
+sub coredbinfo {
+ ### This subroutine returns core db version information in a hash.
+ # Usage is without arguments
+
+ eval(`grep "core_" $Conf::dbdir/lists/core-list.db`);
+
+ my %coredb = (
+ CoreVersion => $Conf::version,
+ Release => $Conf::core_mine,
+ );
+
+ $coredb{'AvailableRelease'} = $core_release if ("$Conf::core_mine" < "$core_release");
+
+ return %coredb;
+}
+
sub dblist {
- ### This subroutine lists the packages.
- # You may also pass a filter: &Pakfire::dblist(filter)
- # Usage is always with two arguments.
- # filter may be: all, notinstalled, installed
+ ### This subroutine returns the packages from the packages_list db in a hash.
+ # It uses the currently cached version of packages_list. To ensure latest
+ # data, run Pakfire::dbgetlist first.
+ # You may also pass a filter: &Pakfire::dblist(filter)
+ # Usage is always with one argument.
+ # filter may be:
+ # - "all": list all known paks,
+ # - "notinstalled": list only not installed paks,
+ # - "installed": list only installed paks
+ # - "upgrade": list only upgradable paks
+ #
+ # Returned hash format:
+ # ( "<pak name>" => (
+ # "Installed" => "Yes" or "No" wether the pak is installed,
+ # "ProgVersion" => Installed program version when "Installed" => "Yes" or
+ # Available version when "Installed" => No,
+ # "Release" => Installed pak release number when "Installed" => "Yes" or
+ # Available pak release number when "Installed" => No,
+ # "AvailableProgVersion" => Available program version.
+ # Only defined if an upgrade to a higher version is available,
+ # "AvailableRelease" => Available pak release version.
+ # Only defined if an upgrade to a higher version is available
+ # ),
+ # ...
+ # )
+
my $filter = shift;
- my $forweb = shift;
- my @updatepaks;
+ my %paklist = ();
my $file;
my $line;
- my $prog;
my %metadata;
my @templine;
-
- ### Make sure that the list is not outdated.
- #dbgetlist("noforce");
-
+
open(FILE, "<$Conf::dbdir/lists/packages_list.db");
my @db = <FILE>;
close(FILE);
- if ("$filter" eq "upgrade") {
- if ("$forweb" ne "forweb" && "$forweb" ne "notice" ) {getcoredb("noforce");}
- eval(`grep "core_" $Conf::dbdir/lists/core-list.db`);
- if ("$core_release" > "$Conf::core_mine") {
- if ("$forweb" eq "forweb") {
- print "<option value=\"core\">Core-Update -- $Conf::version -- Release: $Conf::core_mine -> $core_release</option>\n";
- }
- elsif ("$forweb" eq "notice") {
- print "<br /><br /><br /><a href='pakfire.cgi'>$Lang::tr{'core notice 1'} $Conf::core_mine $Lang::tr{'core notice 2'} $core_release $Lang::tr{'core notice 3'}</a>";
- } else {
- my $command = "Core-Update $Conf::version\nRelease: $Conf::core_mine -> $core_release\n";
- if ("$Pakfire::enable_colors" eq "1") {
- print "$color{'lila'}$command$color{'normal'}\n";
- } else {
- print "$command\n";
- }
- }
- }
-
+ if ("$filter" ne "notinstalled") {
opendir(DIR,"$Conf::dbdir/installed");
my @files = readdir(DIR);
closedir(DIR);
+
foreach $file (@files) {
next if ( $file eq "." );
next if ( $file eq ".." );
next if ( $file =~ /^old/ );
%metadata = parsemetafile("$Conf::dbdir/installed/$file");
- foreach $prog (@db) {
- @templine = split(/\;/,$prog);
- if (("$metadata{'Name'}" eq "$templine[0]") && ("$metadata{'Release'}" < "$templine[2]" && "$forweb" ne "notice")) {
- push(@updatepaks,$metadata{'Name'});
- if ("$forweb" eq "forweb") {
- print "<option value=\"$metadata{'Name'}\">Update: $metadata{'Name'} -- Version: $metadata{'ProgVersion'} -> $templine[1] -- Release: $metadata{'Release'} -> $templine[2]</option>\n";
- } else {
- my $command = "Update: $metadata{'Name'}\nVersion: $metadata{'ProgVersion'} -> $templine[1]\nRelease: $metadata{'Release'} -> $templine[2]\n";
- if ("$Pakfire::enable_colors" eq "1") {
- print "$color{'lila'}$command$color{'normal'}\n";
- } else {
- print "$command\n";
- }
- }
+ foreach $line (@db) {
+ next unless ($line =~ /.*;.*;.*;/ );
+ @templine = split(/\;/,$line);
+ if (("$metadata{'Name'}" eq "$templine[0]") && ("$metadata{'Release'}" < "$templine[2]")) {
+ # Add all upgradable paks to list
+ $paklist{"$metadata{'Name'}"} = {
+ ProgVersion => $metadata{'ProgVersion'},
+ Release => $metadata{'Release'},
+ AvailableProgVersion => $templine[1],
+ AvailableRelease => $templine[2],
+ Installed => "yes"
+ };
+ last;
+ } elsif (("$metadata{'Name'}" eq "$templine[0]") && ("$filter" ne "upgrade")) {
+ # Add installed paks without an upgrade available to list
+ $paklist{"$metadata{'Name'}"} = {
+ ProgVersion => $metadata{'ProgVersion'},
+ Release => $metadata{'Release'},
+ Installed => "yes"
+ };
+ last;
}
}
}
- return @updatepaks;
- } else {
- my $line;
- my $use_color;
- my @templine;
- my $count;
- foreach $line (sort @db) {
+ }
+
+ # Add all not installed paks to list
+ if (("$filter" ne "upgrade") && ("$filter" ne "installed")) {
+ foreach $line (@db) {
next unless ($line =~ /.*;.*;.*;/ );
- $use_color = "";
@templine = split(/\;/,$line);
- if ("$filter" eq "notinstalled") {
- next if ( -e "$Conf::dbdir/installed/meta-$templine[0]" );
- } elsif ("$filter" eq "installed") {
- next unless ( -e "$Conf::dbdir/installed/meta-$templine[0]" );
- }
- $count++;
- if ("$forweb" eq "forweb")
- {
- if ("$filter" eq "notinstalled") {
- print "<option value=\"$templine[0]\">$templine[0]-$templine[1]-$templine[2]</option>\n";
- } else {
- print "<option value=\"$templine[0]\">$templine[0]</option>\n";
- }
- } else {
- if ("$Pakfire::enable_colors" eq "1") {
- if (&isinstalled("$templine[0]")) {
- $use_color = "$color{'red'}"
- } else {
- $use_color = "$color{'green'}"
- }
- }
- print "${use_color}Name: $templine[0]\nProgVersion: $templine[1]\nRelease: $templine[2]$color{'normal'}\n\n";
- }
+ next if ((defined $paklist{"$templine[0]"}) || (&isinstalled($templine[0]) == 0));
+
+ $paklist{"$templine[0]"} = {
+ ProgVersion => "$templine[1]",
+ Release => "$templine[2]",
+ Installed => "no"
+ };
}
- print "$count packages total.\n" unless ("$forweb" eq "forweb");
}
+
+ return %paklist;
}
sub resolvedeps_one {
@@ -910,10 +915,10 @@ sub progress_bar {
sub updates_available {
# Get packets with updates available
- my @upgradepaks = &Pakfire::dblist("upgrade", "noweb");
+ my %upgradepaks = &Pakfire::dblist("upgrade");
- # Get the length of the returned array
- my $updatecount = scalar @upgradepaks;
+ # Get the length of the returned hash
+ my $updatecount = keys %upgradepaks;
return "$updatecount";
}
diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire
index 6c77695c8..b4930e85d 100644
--- a/src/pakfire/pakfire
+++ b/src/pakfire/pakfire
@@ -270,14 +270,25 @@
&Pakfire::getcoredb("$force");
} elsif ("$ARGV[0]" eq "upgrade") {
+ my $use_color = "";
+ my $reset_color = "";
+
+ if ("$Pakfire::enable_colors" eq "1") {
+ $reset_color = "$Pakfire::color{'normal'}";
+ $use_color = "$Pakfire::color{'lightpurple'}";
+ }
+
&Pakfire::upgradecore();
- my @upgradepaks = &Pakfire::dblist("upgrade", "noweb");
+
my @deps = ();
-
- if (@upgradepaks) {
+ if (my %upgradepaks = &Pakfire::dblist("upgrade")) {
# Resolve the dependencies of the to be upgraded packages
- @deps = &Pakfire::resolvedeps_recursive(@upgradepaks);
+ @deps = &Pakfire::resolvedeps_recursive(keys %upgradepaks);
+ foreach $pak (sort keys %upgradepaks) {
+ print "${use_color}Update: $pak\nVersion: $upgradepaks{$pak}{'ProgVersion'} -> $upgradepaks{$pak}{'AvailableProgVersion'}\n";
+ print "Release: $upgradepaks{$pak}{'Release'} -> $upgradepaks{$pak}{'AvailableRelease'}${reset_color}\n";
+ }
&Pakfire::message("");
&Pakfire::message("PAKFIRE UPGR: We are going to install all packages listed above.");
if ($interactive) {
@@ -290,36 +301,78 @@
exit 1;
}
}
- }
+
+ # Download packages
+ foreach $pak (sort keys %upgradepaks) {
+ &Pakfire::getpak("$pak", "");
+ }
- # Download packages
- foreach $pak (@upgradepaks) {
- &Pakfire::getpak("$pak", "");
+ # Download dependencies
+ foreach $pak (@deps) {
+ &Pakfire::getpak("$pak", "");
+ }
+
+ # Install dependencies first
+ foreach $pak (@deps) {
+ &Pakfire::setuppak("$pak");
+ }
+
+ # Install all upgrades
+ foreach $pak (sort keys %upgradepaks) {
+ &Pakfire::upgradepak("$pak");
+ }
+ } else {
+ &Pakfire::message("PAKFIRE WARN: No new package upgrades available.");
}
- # Download dependencies
- foreach $pak (@deps) {
- &Pakfire::getpak("$pak", "");
+ } elsif ("$ARGV[0]" eq "list") {
+ my $count;
+ my $use_color = "";
+ my $reset_color = "";
+ my $filter = "all";
+
+ if ("$ARGV[1]" =~ /installed|notinstalled/) {
+ $filter = "$ARGV[1]";
+ } else {
+ &Pakfire::message("PAKFIRE WARN: Not a known option $ARGV[1]") if ($ARGV[1]);
}
- # Install dependencies first
- foreach $pak (@deps) {
- &Pakfire::setuppak("$pak");
+ my $pak;
+ my %paklist = &Pakfire::dblist($filter);
+
+ if ("$Pakfire::enable_colors" eq "1") {
+ $reset_color = "$Pakfire::color{'normal'}";
+ $use_color = "$Pakfire::color{'lightgreen'}";
}
- # Install all upgrades
- foreach $pak (@upgradepaks) {
- &Pakfire::upgradepak("$pak");
+ foreach $pak (sort keys %paklist) {
+ if ("$Pakfire::enable_colors" eq "1") {
+ if ("$paklist{$pak}{'Installed'}" eq "yes") {
+ if (defined $paklist{$pak}{'AvailableProgVersion'}) {
+ $use_color = "$Pakfire::color{'lightgreen'}";
+ } else {
+ $use_color = "$Pakfire::color{'green'}";
+ }
+ } else {
+ $use_color = "$Pakfire::color{'red'}";
+ }
+ }
+
+ print "${use_color}Name: $pak\nProgVersion: $paklist{$pak}{'ProgVersion'}\n";
+ print "Release: $paklist{$pak}{'Release'}\nInstalled: $paklist{$pak}{'Installed'}\n";
+ if (defined $paklist{$pak}{'AvailableProgVersion'}) {
+ print "Update available:\n Version: $paklist{$pak}{'ProgVersion'} -> $paklist{$pak}{'AvailableProgVersion'}\n Release: $paklist{$pak}{'Release'} -> $paklist{$pak}{'AvailableRelease'}\n";
+ }
+ print "${reset_color}\n";
+
}
- } elsif ("$ARGV[0]" eq "list") {
- if ("$ARGV[1]" =~ /installed|notinstalled/) {
- &Pakfire::dblist("$ARGV[1]", "noweb");
+ $count = keys %paklist;
+ if ($count > 0) {
+ print "$count packages total.\n";
} else {
- &Pakfire::message("PAKFIRE WARN: Not a known option $ARGV[1]") if ($ARGV[1]);
- &Pakfire::dblist("all", "noweb");
+ &Pakfire::message("PAKFIRE WARN: No packages where found using filter $filter.");
}
-
} elsif ("$ARGV[0]" eq "resolvedeps") {
foreach (@ARGV) {
next if ("$_" eq "resolvedeps");
--
2.36.1
--
Dit bericht is gescanned op virussen en andere gevaarlijke
inhoud door MailScanner en lijkt schoon te zijn.
next prev parent reply other threads:[~2022-07-28 11:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 11:21 [PATCH v2 00/10] pakfire: remove dup. code + seperate ui/logic Robin Roevens
2022-07-28 11:21 ` Robin Roevens [this message]
2022-07-28 11:21 ` [PATCH v2 02/10] pakfire: Translate WUI header/footer text Robin Roevens
2022-07-28 11:21 ` [PATCH v2 03/10] pakfire: Replace duplicate code with dblist functioncall Robin Roevens
2022-07-28 11:21 ` [PATCH v2 04/10] pakfire: Replace dbgetlist duplicate code Robin Roevens
2022-07-28 11:21 ` [PATCH v2 05/10] pakfire: Optimize upgradecore function Robin Roevens
2022-07-28 11:21 ` [PATCH v2 06/10] pakfire: Add list upgrade functionality Robin Roevens
2022-07-28 11:21 ` [PATCH v2 07/10] pakfire: Refactor status seperating UI and logic Robin Roevens
2022-07-28 11:21 ` [PATCH v2 08/10] pakfire: Replace status duplicate code Robin Roevens
2022-07-28 11:21 ` [PATCH v2 09/10] pakfire: Add getmetadata function Robin Roevens
2022-07-28 11:21 ` [PATCH v2 10/10] pakfire: Replace getmetadata duplicate code Robin Roevens
2022-07-28 13:51 ` [PATCH v2 00/10] pakfire: remove dup. code + seperate ui/logic Peter Müller
2022-07-29 20:11 ` Robin Roevens
2022-07-28 19:43 ` Michael Tremer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220728112136.30218-2-robin.roevens@disroot.org \
--to=robin.roevens@disroot.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox