From patchwork Wed Mar 9 22:56:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 5330 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 4KDSJn42f7z3xq8 for ; Wed, 9 Mar 2022 22:57:45 +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 4KDSJm0bvMz5V3; Wed, 9 Mar 2022 22:57:44 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KDSJl3dRZz31Vx; Wed, 9 Mar 2022 22:57:43 +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 4KDSJj3P74z2yj9 for ; Wed, 9 Mar 2022 22:57:41 +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 4KDSJh6ht7z5VR for ; Wed, 9 Mar 2022 22:57:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id BB85C400AA for ; Wed, 9 Mar 2022 23:57:40 +0100 (CET) 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 oz-5EEj6a2k0 for ; Wed, 9 Mar 2022 23:57:39 +0100 (CET) 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 7FCBC1B983; Wed, 9 Mar 2022 23:57:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1646866657; bh=RU1AUmbFX1z7KTe1iodnW5vrOpGP735CY01NwbXvN74=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gH5iofkxw7kjXVepp4f/u6z4rtOL7pzMvOtgXuuh1gL0+y+H95+f+3IsmjZmsfJOj fE39TcdUohER2THqoqdqDHa7n9GcI9lqYgX8vsod3BbOIKF9OyVlW/1HRAlJPmK+EV 5Cm+2M8vdm/9H1Mnsexpo2xZc0Cems8I8f8OqXwxpV/lBLFCZPReRLuZ9jX2KQe2ZJ eyNYPB0zaVCfCMV0OgiY083yXyUSbIarniNPNS6uLIFMOXmfj4FgdtUEUnwWW4gGZp jL8Y3Lrjbr0CK9euVrqngYcyFXnG5TjiGD6RKLdMKom2rXokhO4S2JsRESB0V4Fxlu BBHD7wdw3jzkw== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 5/9] pakfire: Optimize upgradecore function Date: Wed, 9 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> References: <20220309225655.4472-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-sicho-MailScanner-ID: 7FCBC1B983.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1647471431.81407@ftcYfeWfw9ZDNoi2UxrMHw ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1646866660; a=rsa-sha256; cv=none; b=Wj/vppepKHgqZQ5cWD22DeBKpN6V/OW0ExzuTgPqMmv29vO5jONz21hvplNX6436iHoK9R gH3Y86tM7sRjh/5GjXcWgSJOZ6geTVPTln4AM6MzsOSSxc2h3hXnYXTy9wk1GnaMYroHdu S99O9u4hVWExSMeyrBfhaY9az2TknZkISBnxj+4odnlevJW8DnYATqk9uaC/95L4RyCL5R OFNvCdzkaHNFn66oi5s2YqxdnU4tcjh6TD2e1nU7j58URoyKWtoNT9ClffHoAy+WvRx+E/ 15LST0QAh6q1S5RS+3mQWiGdD68/cuJIsTEvqcHFu1o/m/9yofXUkuEdvOUW8Q== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=gH5iofkx; 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1646866660; 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=xCbSuxII76veFJm5xiTHSHKghzzoowc+e2Mf3imz/S8=; b=NojvL6g7X/PIaW7J5+vwhf/3sFwIuAs7WvzwfrJw3QdBMFi9DYrV+sKKzSd/pKepS8eGOQ DUGTWoQ298V5Ill/snpg+Ms6jjYq1FKflS/6T61f79/slkKduLGLgcQ2/ve9s9v3vl7wYr EElrunF0Dde2qkP3hs3LGMsmvvp4FONP2DmcqZfPwztaAHlzlvOlKJbquTrcFEiA4K//eK +LPIpRuLaGIYoNl0u1LcTcnR+1SMw+AVXDQUg8LBxUpyf8/24BSYfL/mZ5KKb/HcRm2SDM jsP38OMsoQzwAL60ZhsUUB7oMCyT5HOH/ejmJ4f22VVz7lf5TVehpZzbpRF78Q== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=gH5iofkx; 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 [-4.82 / 11.00]; BAYES_HAM(-3.00)[99.99%]; IP_REPUTATION_HAM(-1.15)[asn: 50673(-0.33), country: NL(-0.01), ip: 178.21.23.139(-0.82)]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-0.98)[-0.983]; SPF_REPUTATION_HAM(-0.68)[-0.67731760723277]; MV_CASE(0.50)[]; R_MISSING_CHARSET(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; 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)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4KDSJh6ht7z5VR 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 1e2729485..6287367f5 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -735,35 +735,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 ERROR: 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 = `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..2fb9adce7 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 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. + &Pakfire::dbgetlist("noforce"); my @deps = (); if (my %upgradepaks = &Pakfire::dblist("upgrade")) {