mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
pakfire: Add list upgrade functionality
- Added possibility to list available upgrades from commandline using 'pakfire list upgrade'. - Added exitcode to 'pakfire list' - Moved 'Pakfire has finished' log message inside END block to always log when pakfire exited. - Fix: allow [options] between 'list' and [installed/notinstalled/ upgrade] parameters (Partly fixes Bug #12868) Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
This commit is contained in:
committed by
Peter Müller
parent
5e1dbc95f7
commit
2b921b796d
@@ -114,7 +114,7 @@ sub usage {
|
||||
&Pakfire::message("Usage: pakfire <install|remove> [options] <pak(s)>");
|
||||
&Pakfire::message(" <update> - Contacts the servers for new lists of paks.");
|
||||
&Pakfire::message(" <upgrade> - Installs the latest version of all paks.");
|
||||
&Pakfire::message(" <list> - Outputs a short list with all available paks.");
|
||||
&Pakfire::message(" <list> [installed/notinstalled/upgrade] - Outputs a list with all, installed, available or upgradeable paks.");
|
||||
&Pakfire::message(" <status> - Outputs a summary about available core upgrades, updates and a required reboot");
|
||||
&Pakfire::message("");
|
||||
&Pakfire::message(" Global options:");
|
||||
|
||||
@@ -329,14 +329,18 @@
|
||||
|
||||
} elsif ("$ARGV[0]" eq "list") {
|
||||
my $count;
|
||||
my $coreupdate = 0;
|
||||
my $use_color = "";
|
||||
my $reset_color = "";
|
||||
my $filter = "all";
|
||||
|
||||
if ("$ARGV[1]" =~ /installed|notinstalled/) {
|
||||
shift if ("$ARGV[1]" =~ "^-");
|
||||
|
||||
if ("$ARGV[1]" =~ /installed|notinstalled|upgrade/) {
|
||||
$filter = "$ARGV[1]";
|
||||
} else {
|
||||
&Pakfire::message("PAKFIRE WARN: Not a known option $ARGV[1]") if ($ARGV[1]);
|
||||
} elsif ($ARGV[1]) {
|
||||
&Pakfire::message("PAKFIRE ERROR: Not a known option $ARGV[1]");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $pak;
|
||||
@@ -347,6 +351,17 @@
|
||||
$use_color = "$Pakfire::color{'lightgreen'}";
|
||||
}
|
||||
|
||||
# Check for available core upgrade first if list of upgrades is requested
|
||||
if ("$filter" eq "upgrade") {
|
||||
my %coredb = &Pakfire::coredbinfo();
|
||||
|
||||
if (defined $coredb{'AvailableRelease'}) {
|
||||
print "${use_color}Core-Update $coredb{'CoreVersion'}\n";
|
||||
print "Release: $coredb{'Release'} -> $coredb{'AvailableRelease'}${reset_color}\n\n";
|
||||
$coreupdate = 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach $pak (sort keys %paklist) {
|
||||
if ("$Pakfire::enable_colors" eq "1") {
|
||||
if ("$paklist{$pak}{'Installed'}" eq "yes") {
|
||||
@@ -373,7 +388,10 @@
|
||||
if ($count > 0) {
|
||||
print "$count packages total.\n";
|
||||
} else {
|
||||
&Pakfire::message("PAKFIRE WARN: No packages where found using filter $filter.");
|
||||
if (! $coreupdate) {
|
||||
&Pakfire::message("PAKFIRE WARN: No packages where found using filter $filter.");
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
} elsif ("$ARGV[0]" eq "resolvedeps") {
|
||||
foreach (@ARGV) {
|
||||
@@ -399,9 +417,9 @@
|
||||
&Pakfire::usage;
|
||||
}
|
||||
|
||||
&Pakfire::logger("PAKFIRE INFO: Pakfire has finished. Closing.");
|
||||
|
||||
END {
|
||||
&Pakfire::logger("PAKFIRE INFO: Pakfire has finished. Closing.");
|
||||
|
||||
# Check if pakfire has been locked in this session.
|
||||
if ($locked) {
|
||||
# Remove lockfile.
|
||||
|
||||
Reference in New Issue
Block a user