From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 5/9] pakfire: Optimize upgradecore function Date: Wed, 09 Mar 2022 23:56:51 +0100 Message-ID: <20220309225655.4472-6-robin.roevens@disroot.org> In-Reply-To: <20220309225655.4472-1-robin.roevens@disroot.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6172066951398140206==" List-Id: --===============6172066951398140206== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable upgradecore function should just upgrade the core: Moved check if upgrade is necessary to pakfire upgrade code, removing code from upgradecore function duplicating codedbinfo workings. Also adding more vebosity to pakfire upgrade. Signed-off-by: Robin Roevens --- src/pakfire/lib/functions.pl | 47 +++++++++++++++--------------------- src/pakfire/pakfire | 16 +++++++++++- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 1e2729485..6287367f5 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -735,35 +735,28 @@ sub setuppak { } =20 sub upgradecore { - getcoredb("noforce"); - eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); - if ("$core_release" > "$Conf::core_mine") { - # Safety check for lazy testers: - # Before we upgrade to the latest release, we re-install the previous rele= ase - # to make sure that the tester has always been on the latest version. - my $tree =3D &get_tree(); - $Conf::core_mine-- if ($tree eq "testing" || $tree eq "unstable"); - - message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_relea= se"); - - my @seq =3D `seq $Conf::core_mine $core_release`; - shift @seq; - my $release; - foreach $release (@seq) { - chomp($release); - getpak("core-upgrade-$release"); - } - - foreach $release (@seq) { - chomp($release); - upgradepak("core-upgrade-$release"); - } - - system("echo $core_release > $Conf::coredir/mine"); + # Safety check for lazy testers: + # Before we upgrade to the latest release, we re-install the previous relea= se + # to make sure that the tester has always been on the latest version. + my $tree =3D &get_tree(); + $Conf::core_mine-- if ($tree eq "testing" || $tree eq "unstable"); =20 - } else { - message("CORE ERROR: No new upgrades available. You are on release $Conf::= core_mine."); + message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_releas= e"); +=09 + my @seq =3D `seq $Conf::core_mine $core_release`; + shift @seq; + my $release; + foreach $release (@seq) { + chomp($release); + getpak("core-upgrade-$release"); } +=09 + foreach $release (@seq) { + chomp($release); + upgradepak("core-upgrade-$release"); + } +=09 + system("echo $core_release > $Conf::coredir/mine"); } =20 sub isinstalled { diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index f23110cf5..2fb9adce7 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -266,7 +266,21 @@ $use_color =3D "$Pakfire::color{'lightpurple'}"; } =20 - &Pakfire::upgradecore(); + &Pakfire::message("CORE INFO: Checking for Core updates..."); + + ### Make sure that the core db is not outdated.=20 + &Pakfire::getcoredb("noforce"); + my %coredb =3D &Pakfire::coredbinfo(); + + if (defined $coredb{'AvailableRelease'}) { + &Pakfire::upgradecore(); + } else { + &Pakfire::message("CORE WARN: No new Core upgrades available. You are on = release ".$coredb{'Release'}); + } + + &Pakfire::message("PAKFIRE INFO: Checking for package updates..."); + ### Make sure that the package list is not outdated.=20 + &Pakfire::dbgetlist("noforce"); =09 my @deps =3D (); if (my %upgradepaks =3D &Pakfire::dblist("upgrade")) { --=20 2.34.1 --=20 Dit bericht is gescanned op virussen en andere gevaarlijke inhoud door MailScanner en lijkt schoon te zijn. --===============6172066951398140206==--