From patchwork Thu Jul 28 11:21:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 5772 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LtpCd42mDz40W1 for ; Thu, 28 Jul 2022 11:22:37 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4LtpCV4kvHz4DB; Thu, 28 Jul 2022 11:22:30 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LtpCT6Fdzz30Gm; Thu, 28 Jul 2022 11:22:29 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4LtpCS5gpRz2yXK for ; Thu, 28 Jul 2022 11:22:28 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4LtpCS4ZTvz1Dp for ; Thu, 28 Jul 2022 11:22:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 6D55D40DC8 for ; Thu, 28 Jul 2022 13:22:28 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XL-41PmuWDPg for ; Thu, 28 Jul 2022 13:22:27 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id 3314B560AD; Thu, 28 Jul 2022 13:21:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1659007340; bh=CW5P7niQyfQQJKHfUDg5Psth+VrCVZ+6yO1VIqZYisM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FngmGXEGv5yz749h1nkWdp1Ypi3jyg+eMSOj+7pj6uaCSjQYGoAUlMVGajK/5jgMi 9V0LjSA/TNGRsS9norgR3FYW94f5jS4IHOyZ92sKal5zxAz+Ph7GOZh2S9RxjFe5ra 1oJDMtW8UL/9sOCHMp+BL9DbtN2LPrKXpjNavqeWUy3rx3loPl6STJDR/Jb7EVFsdT o3UNl53nabLJC8NXxOLHqVYkFqZbb+usT7xqRSnaqNSUEPYBor8cNWzIoqDy8lsrlI fpRHLSC+00pQ1FDenwaGnL4Awf65mRnRDlzSZQVroDqNlSdP8Sc/tI0bMNFe4gO7Z1 /ZzEr1KcxJoIg== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v2 05/10] pakfire: Optimize upgradecore function Date: Thu, 28 Jul 2022 13:21:31 +0200 Message-Id: <20220728112136.30218-6-robin.roevens@disroot.org> In-Reply-To: <20220728112136.30218-1-robin.roevens@disroot.org> References: <20220728112136.30218-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-sicho-MailScanner-ID: 3314B560AD.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1659612114.84174@udNY2CYiRyVPTBO8jaHtpw ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1659007348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nv0bW+j40YZVZWDwubeoZ9eZxRpLL3mcv0j4m4nJFIE=; b=vZy4xshccbbi3xKvRtfxtE48p2+hvo8/RA4mqg1eDn7k1s4dkaacOVy5pES6W7+uWsqGhm 831h/1FOns9IUZ/uDHyG45y37W/qKmqDku+ZqVfWB5sQEAeDFWkfpxGxIv5Voi2QxQVeoo mo0ut1yZ6APj3t0k/MczJ439Kct8njKmVnHu6NUV2CIrpjVLt0aQ8fbtCIqp4+KbKd0vKh LNqMf3WbFWNHqUWm8eyU8dJfm0+SHxAscIN90K1t9khDuJQ9Xp3+vUNj60MVXM/G1SKj1l BmzeoDX7lCkCIP36pR9Ysfi9QCwYPM6aA/PgtxQZAuCpMqI5P5EgDizNXkS1cQ== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=FngmGXEG; dmarc=pass (policy=quarantine) header.from=disroot.org; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1659007348; a=rsa-sha256; cv=none; b=xKhiUP6U6/0crQJaCRHjmI6lkVzq4zamIfQelMSfeXnWB4V3JdyoYCcEhYxHeW0rPzpuq5 wdefkhjzOd+GteITjBw4+h7sRSSjOtvAft9+EQElCp9KBQY0XUoeMe+oT0KCCbpONjYaVg +/62Qlb0fxUM3CSgDQG75gV1WZ61NkrLsz/u/Ghk1B7+GDAmzd0VzHKbQHJYA0LJotvhYn pDNG2QWWJv8+dhRBefDsFLw/geqaEZgwZCKComNoXUoTepPXZcrwrJDaRIa8h1FppT+Ghv aNTA3lBQ8MVmWh+i8H2bq5DdwOMVRK68Xv17TGqYypH56zpCHG5E0YqU9JJ7Gw== X-Rspamd-Queue-Id: 4LtpCS4ZTvz1Dp Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=FngmGXEG; dmarc=pass (policy=quarantine) header.from=disroot.org; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-3.84 / 11.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; SPF_REPUTATION_HAM(-0.82)[-0.81818744239513]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; R_MISSING_CHARSET(0.50)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+a:c]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; FROM_EQ_ENVFROM(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; DKIM_TRACE(0.00)[disroot.org:+]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[4]; ARC_NA(0.00)[] X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 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 971aa2d59..4f0515f62 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -773,35 +773,28 @@ sub setuppak { } 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 release - # to make sure that the tester has always been on the latest version. - my $tree = &get_tree(); - $Conf::core_mine-- if ($tree eq "testing" || $tree eq "unstable"); - - message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_release"); - - my @seq = `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 release + # to make sure that the tester has always been on the latest version. + my $tree = &get_tree(); + $Conf::core_mine-- if ($tree eq "testing" || $tree eq "unstable"); - } else { - message("CORE INFO: No new upgrades available. You are on release $Conf::core_mine."); + message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_release"); + + my @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"); } sub isinstalled { diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index f23110cf5..351d71216 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -266,7 +266,21 @@ $use_color = "$Pakfire::color{'lightpurple'}"; } - &Pakfire::upgradecore(); + &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 INFO: No new Core-Updates available. You are on release ".$coredb{'Release'}); + } + + &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")) {