From: Robin Roevens <robin.roevens@disroot.org>
To: development@lists.ipfire.org
Subject: [PATCH 9/9] pakfire: Redesign update output and workflow
Date: Wed, 09 Mar 2022 23:56:55 +0100 [thread overview]
Message-ID: <20220309225655.4472-10-robin.roevens@disroot.org> (raw)
In-Reply-To: <20220309225655.4472-1-robin.roevens@disroot.org>
[-- Attachment #1: Type: text/plain, Size: 5141 bytes --]
- Revamped 'pakfire update' more in the style of 'pakfire
install' for a more consistent look and feel.
- Add core update details to output
- Add new dependencies to install to output
- First collect all upgrade info, then perform core update
together with available package updates and after user
confirmation (without -y).
Signed-off-by: Robin Roevens <robin.roevens(a)disroot.org>
---
src/pakfire/pakfire | 79 +++++++++++++++++++++++++++++----------------
1 file changed, 51 insertions(+), 28 deletions(-)
diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire
index 9935481a5..0a144c517 100644
--- a/src/pakfire/pakfire
+++ b/src/pakfire/pakfire
@@ -258,51 +258,76 @@
&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::message("CORE INFO: Checking for Core updates...");
-
### Make sure that the core db is not outdated.
&Pakfire::getcoredb("noforce");
- my %coredb = &Pakfire::coredbinfo();
- if (defined $coredb{'AvailableRelease'}) {
- &Pakfire::upgradecore();
- } else {
- &Pakfire::message("CORE WARN: No new Core upgrades available. You are on release ".$coredb{'Release'});
- }
+ my %coredb = &Pakfire::coredbinfo();
+ &Pakfire::message("CORE WARN: No new Core upgrades available. You are on release ".$coredb{'Release'}) unless (defined $coredb{'AvailableRelease'});
&Pakfire::message("PAKFIRE INFO: Checking for package updates...");
### Make sure that the package list is not outdated.
&Pakfire::dbgetlist("noforce");
my @deps = ();
- if (my %upgradepaks = &Pakfire::dblist("upgrade")) {
- # Resolve the dependencies of the to be upgraded packages
- @deps = &Pakfire::resolvedeps_recursive(keys %upgradepaks);
+ my %upgradepaks = &Pakfire::dblist("upgrade");
- 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";
- }
+ # Resolve the dependencies of the to be upgraded packages
+ @deps = &Pakfire::resolvedeps_recursive(keys %upgradepaks) if (%upgradepaks);
+ &Pakfire::message("PAKFIRE WARN: No new package upgrades available.") unless (@deps);
+
+ if (defined $coredb{'AvailableRelease'} || %upgradepaks) {
+ &Pakfire::message("");
&Pakfire::message("");
- &Pakfire::message("PAKFIRE UPGR: We are going to install all packages listed above.");
+ &Pakfire::message("PAKFIRE INFO: Upgrade summary:");
+ &Pakfire::message("");
+
+ if (defined $coredb{'AvailableRelease'}) {
+ &Pakfire::message("CORE INFO: Core-Update $coredb{'CoreVersion'} to install:");
+ &Pakfire::message("CORE UPGR: Release: $coredb{'Release'} -> $coredb{'AvailableRelease'}");
+ &Pakfire::message("");
+ }
+
+ if (@deps) {
+ &Pakfire::message("PAKFIRE INFO: New dependencies to install:");
+ my $totalsize = 0;
+ foreach $pak (@deps) {
+ unless (defined $upgradepaks{$pak} || &Pakfire::isinstalled($pak) == 0) {
+ my $size = &Pakfire::getsize("$pak");
+ $totalsize += $size;
+ $size = &Pakfire::beautifysize($size);
+ &Pakfire::message("PAKFIRE INFO: $pak \t - $size");
+ }
+ }
+ $totalsize = &Pakfire::beautifysize($totalsize);
+ &Pakfire::message("");
+ &Pakfire::message("PAKFIRE INFO: Total size: \t ~ $totalsize");
+ &Pakfire::message("");
+ }
+
+ if (%upgradepaks) {
+ &Pakfire::message("PAKFIRE INFO: Packages to upgrade:");
+ foreach $pak (sort keys %upgradepaks) {
+ &Pakfire::message("PAKFIRE UPGR: $pak\t$upgradepaks{$pak}{'ProgVersion'}-$upgradepaks{$pak}{'Release'} -> $upgradepaks{$pak}{'AvailableProgVersion'}-$upgradepaks{$pak}{'AvailableRelease'}");
+ }
+ &Pakfire::message("");
+ }
+
if ($interactive) {
- &Pakfire::message("PAKFIRE INFO: Is this okay? [y/N]");
+ &Pakfire::message("PAKFIRE INFO: Is this okay? [y/N]");
my $ret = <STDIN>;
chomp($ret);
&Pakfire::logger("PAKFIRE INFO: Answer: $ret");
if ( $ret ne "y" ) {
- &Pakfire::message("PAKFIRE ERROR: Installation aborted.");
- exit 1;
+ &Pakfire::message("PAKFIRE ERROR: Installation aborted.");
+ exit 1;
}
}
+
+ # Perform core update
+ if (defined $coredb{'AvailableRelease'}) {
+ &Pakfire::upgradecore();
+ }
# Download packages
foreach $pak (sort keys %upgradepaks) {
@@ -323,8 +348,6 @@
foreach $pak (sort keys %upgradepaks) {
&Pakfire::upgradepak("$pak");
}
- } else {
- &Pakfire::message("PAKFIRE WARN: No new package upgrades available.");
}
} elsif ("$ARGV[0]" eq "list") {
--
2.34.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-03-09 22:56 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-09 22:56 [PATCH 0/9] pakfire: remove dup. code + seperate ui/logic Robin Roevens
2022-03-09 22:56 ` [PATCH 1/9] pakfire: Refactor dblist seperating UI and logic Robin Roevens
2022-03-21 16:18 ` Michael Tremer
2022-03-22 12:39 ` Robin Roevens
2022-03-23 19:18 ` Robin Roevens
2022-03-23 20:49 ` Michael Tremer
2022-03-09 22:56 ` [PATCH 2/9] pakfire: Replace duplicate code with dblist functioncall Robin Roevens
2022-03-21 16:20 ` Michael Tremer
2022-03-09 22:56 ` [PATCH 3/9] pakfire: Replace dbgetlist duplicate code Robin Roevens
2022-03-21 16:21 ` Michael Tremer
2022-03-09 22:56 ` [PATCH 4/9] pakfire: Replace coreupdate_available " Robin Roevens
2022-03-21 16:21 ` Michael Tremer
2022-03-22 12:42 ` Robin Roevens
2022-03-23 21:50 ` Robin Roevens
2022-03-09 22:56 ` [PATCH 5/9] pakfire: Optimize upgradecore function Robin Roevens
2022-03-21 16:24 ` Michael Tremer
2022-03-22 12:58 ` Robin Roevens
2022-03-22 15:16 ` Michael Tremer
2022-03-09 22:56 ` [PATCH 6/9] pakfire: Add list upgrade functionality Robin Roevens
2022-03-21 16:33 ` Michael Tremer
2022-03-22 12:59 ` Robin Roevens
2022-03-09 22:56 ` [PATCH 7/9] pakfire: Refactor status function separating UI and logic Robin Roevens
2022-03-21 16:28 ` Michael Tremer
2022-03-23 19:56 ` Robin Roevens
2022-03-23 20:48 ` Michael Tremer
2022-03-09 22:56 ` [PATCH 8/9] pakfire: Add getmetadata function Robin Roevens
2022-03-21 16:32 ` Michael Tremer
2022-03-22 13:28 ` Robin Roevens
2022-03-23 11:28 ` Michael Tremer
2022-03-09 22:56 ` Robin Roevens [this message]
2022-03-21 16:36 ` [PATCH 9/9] pakfire: Redesign update output and workflow Michael Tremer
2022-03-22 18:32 ` Robin Roevens
2022-03-23 10:30 ` Michael Tremer
2022-03-09 23:46 ` [PATCH 0/9] pakfire: remove dup. code + seperate ui/logic Tom Rymes
2022-03-09 23:56 ` Paul Simmons
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=20220309225655.4472-10-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