From patchwork Wed Mar 9 22:56:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 5334 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 4KDSJs2cTzz3xj2 for ; Wed, 9 Mar 2022 22:57:49 +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 4KDSJm75MMz5WR; 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 4KDSJm5XXZz2yj9; Wed, 9 Mar 2022 22:57:44 +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 4KDSJl36d5z30J1 for ; Wed, 9 Mar 2022 22:57:43 +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 4KDSJl2FWSz4jy for ; Wed, 9 Mar 2022 22:57:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 751B24008F for ; Wed, 9 Mar 2022 23:57:39 +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 1xaFiLp2hGQK for ; Wed, 9 Mar 2022 23:57:38 +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 86AC91B986; 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=ehSWeQgI952J8U1osQfWMCMAyLY2/lVpPccMej+Lo8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PjPsa83xC9JKI+i1aO4SHNCOGlCTHJdE7km4yp8hlsGpZcJLRg+AFBaHhdJrvQYCd 206YvuEyp9lRjv0ievmTeTjZ77EmpRlulKVhm23GpCr0u2IY3SksjLQeJruJkX2ucp MiWKlgPx7wbrS3jOZ+4c4jkdCbG2pV5b5bvT5/eaxLhsdgwLLfab8ft0cVBPsfqs7o V6mdw34EFHY2zh2mHQcWVwbrscd8QcBn/x+y5jQxKFVWt5lhjAcQSGN7TzjJZSBebg OsgyJk237BNrCHJuZEb/tLr6fE/HpusMzKAIHgrpCBuIndm0/79BBJCRyOQEAY/jC5 yOOVE3Bc6nzmA== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 6/9] pakfire: Add list upgrade functionality Date: Wed, 9 Mar 2022 23:56:52 +0100 Message-Id: <20220309225655.4472-7-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: 86AC91B986.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1647471432.06189@iadwyrvlamzsYZKPPxxU2g ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1646866663; a=rsa-sha256; cv=none; b=N0u1K7nA3jRtyyYtvcr/BZkR9hqqWRnhEwuCtkDTgnGEcnB8PmT2W00NxcBcWrNSRVVHhE 5/x6OzXRh/vjy+ekRv30Si3J+63y1GEDQovdA0Q21wFm7FZqqwwt4OCNBx3t09B7bhhMa+ h64zq3AVuDF4hcJKFSAeYESFvmrHVze/Tvy7NhNjJe6d8dijysXmmsxr68S1TUs5Bz2z3/ HLydorkSSZ3JDQW0ohoUKaK03KT2bdX3GlsQTdxlahuc9cLzb78U1O+V2j2KLJO53vqncJ Ig5w6BjODuBkOfFtnk9EL0j8hSipAADuULu1/hdtka43M+sIhH6ILEkRoEeDjQ== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=PjPsa83x; 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=1646866663; 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=RF1T45u7a8+JUpVjaHyZxRdc8DyjTM/6EQ0Mptadlig=; b=CgedAZPBDrhIQq/4xVe2dWD/KAa0u1CGsbsmDTXhKNizM8a7sGgA99Jh4/Hu5OUTzYJiTr ugfFO7if8uJwkPRmE8V06DrwlDlh79CHj4xP3LgDyhA9BpJFHbRGmYy7VBC2scrWjgqkHi BtribogNEWd4iUl2AqVDlnXWrZktYS1F7hzrZQPa8IeBuh9YhhbMM6NMt8WYXeyj26rXBD AZXdvq+IfExpTY0wiyKa2goXSy9vqiSpAwSYtzTqioXz8oJNVoYrhM+pooqSpAtwSDNR4L 4ReAGn76qQ0J1PLSViIW9UN4TFYC1seuznQzG7cTKfwRPlH0hPWXpMalxBQTbg== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=PjPsa83x; 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.984]; SPF_REPUTATION_HAM(-0.68)[-0.67731925485216]; 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: 4KDSJl2FWSz4jy 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" - Added possibility to list available upgrades from commandline using 'pakfire list upgrade'. - Bugfix: allow [options] between 'list' and [installed/notinstalled/ upgrade] Signed-off-by: Robin Roevens --- src/pakfire/lib/functions.pl | 2 +- src/pakfire/pakfire | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 6287367f5..b35aed6a3 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -114,7 +114,7 @@ sub usage { &Pakfire::message("Usage: pakfire [options] "); &Pakfire::message(" - Contacts the servers for new lists of paks."); &Pakfire::message(" - Installs the latest version of all paks."); - &Pakfire::message(" - Outputs a short list with all available paks."); + &Pakfire::message(" [installed/notinstalled/upgrade] - Outputs a list with all, installed, available or upgradeable paks."); &Pakfire::message(" - Outputs a summary about available core upgrades, updates and a required reboot"); &Pakfire::message(""); &Pakfire::message(" Global options:"); diff --git a/src/pakfire/pakfire b/src/pakfire/pakfire index 2fb9adce7..b529db77a 100644 --- a/src/pakfire/pakfire +++ b/src/pakfire/pakfire @@ -333,7 +333,9 @@ 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]); @@ -347,6 +349,16 @@ $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"; + } + } + foreach $pak (sort keys %paklist) { if ("$Pakfire::enable_colors" eq "1") { if ("$paklist{$pak}{'Installed'}" eq "yes") {