Message ID | 20220309225655.4472-5-robin.roevens@disroot.org |
---|---|
State | Superseded |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> 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 4KDSJr2Fzrz3xqY for <patchwork@web04.haj.ipfire.org>; Wed, 9 Mar 2022 22:57:48 +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 4KDSJm6Gdmz5Vh; 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 4KDSJl4zdXz32Kf; 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 4KDSJk10KBz2ymJ for <development@lists.ipfire.org>; Wed, 9 Mar 2022 22:57:42 +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 4KDSJk04X7z5V3 for <development@lists.ipfire.org>; Wed, 9 Mar 2022 22:57:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id CC052400A4 for <development@lists.ipfire.org>; Wed, 9 Mar 2022 23:57:41 +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 sJ2eG4QOActn for <development@lists.ipfire.org>; Wed, 9 Mar 2022 23:57:40 +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 6EEF71B980; 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=1646866658; bh=V43mGxnFaXjMRiAtpp6Be59qgvf7B2+P3Whr9YzTkFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dvy7wwKd07kASwdmhVAdw/+DG6KyLXykGH/facs++YWoL4RYerx06QwHeI0bEgZ1X 5bmEidGjPN9g6QbRrm5Jq/iWmzkUniaUNwo+G3wa3AsQOSiFY3E4GfDNVfDWmPLOGZ 5nZymP6QHy/pqm500ym5W1pr9tzM0zN8/BMayujarbuKy4EJR8dLS0MZfljEmXratu oW4g8Fa3x/CTq/xo/fSfbCOXAB6XY2MbR7AJlob+G7xcfOhjO1bPOBRZyEBFwk4umF RbbqvtlZvxwTWCJ4PKDWmW3vlxuG/bqCeeU/+AIv/kNlcg/NBPCxijwnxzvMseAKAs lEeT76XZ1n8+w== From: Robin Roevens <robin.roevens@disroot.org> To: development@lists.ipfire.org Subject: [PATCH 4/9] pakfire: Replace coreupdate_available duplicate code Date: Wed, 9 Mar 2022 23:56:50 +0100 Message-Id: <20220309225655.4472-5-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 Content-Transfer-Encoding: 8bit X-sicho-MailScanner-ID: 6EEF71B980.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1647471431.46596@0K2SyiUm5s6XnCsUWp/jeA ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1646866662; a=rsa-sha256; cv=none; b=Xv3e9TKj9UBdKCbPW8CAHaOiy1bWeYQux+0UQz/BsEReRbX2AAImq9SKxJO2IiQb2lJY08 U/vm29Q/cyTWmDSbl31yHyDuihmoiOWw/NrXTAGaoIUfUEoOvGwuG4fappK8vTXh4hJGV0 L2+aj6J+pKERTmYI+E1lxD0sDsXq2UvYyktvFrQWNqEtQ2jEzrdlY4LiTb+rya7zbkqL20 9pTYWW9KjnI5wLaYqTtNdX8jrxfNISjo3pXjm1tozXkElYCHUpmwZlY91nN9Kv6tVGD7eb 6usbzAsloypVryCsNBvhcgSWLxabA7u8DCICckAhM/9HAuuUxaKcRU7ZKyIaTA== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=dvy7wwKd; 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=1646866662; 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=F1aMzBIrlwsfZlR5kV0s/IkFwIR7qwqK+ngeiPmi83c=; b=hgNO611rxtDxl0zDwgL59eqlEa/32nzUA/MhndkOer9clDL+W0kUIAWlHlrDd0P3uF3Khc eEqe+3fSfxz4EqJ9xaT8FVHGcxyavDii08DSF4FF45T7u9zz+OMMUEX9jwgJGWmUdJEgtz xdIkHjim4JVnydoEQuFh4FVnSrugpzDp4BSKhOekZRH0PYyaUekJsIoI9bMZOitufcuewO ddxaXH5yr8+0sdCgz+1FDatNlk4zcIfW2wpIDlYybirLoK/HmXle65+5SEh/m7SYHZmjuK booDqq0LeWEYGVH2WumQmJ0JMMWpu3QCcwtbJHTtqajFEYzF6gQXAHQMG8TWrA== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=dvy7wwKd; 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.985]; 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: 4KDSJk04X7z5V3 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> List-Unsubscribe: <https://lists.ipfire.org/mailman/options/development>, <mailto:development-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/development/> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Subscribe: <https://lists.ipfire.org/mailman/listinfo/development>, <mailto:development-request@lists.ipfire.org?subject=subscribe> Errors-To: development-bounces@lists.ipfire.org Sender: "Development" <development-bounces@lists.ipfire.org> |
Series |
pakfire: remove dup. code + seperate ui/logic
|
|
Commit Message
Robin Roevens
March 9, 2022, 10:56 p.m. UTC
Replace coreupdate_available code duplicating coredbinfo
workings with call to actual coredbinfo function.
Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
---
src/pakfire/lib/functions.pl | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Comments
This is a lot nicer without eval(). > On 9 Mar 2022, at 22:56, Robin Roevens <robin.roevens@disroot.org> wrote: > > Replace coreupdate_available code duplicating coredbinfo > workings with call to actual coredbinfo function. > > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > --- > src/pakfire/lib/functions.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl > index 0caa4787e..1e2729485 100644 > --- a/src/pakfire/lib/functions.pl > +++ b/src/pakfire/lib/functions.pl > @@ -884,9 +884,10 @@ sub updates_available { > } > > sub coreupdate_available { > - eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); > - if ("$core_release" > "$Conf::core_mine") { > - return "yes ($core_release)"; > + my %coredb = &Pakfire::coredbinfo(); > + > + if ("$coredb{'AvailableRelease'}" > "$coredb{'Release'}") { > + return "yes ($coredb{'AvailableRelease'})"; > } > else { > return "no"; Is returning a string what we want here? > -- > 2.34.1 > > > -- > Dit bericht is gescanned op virussen en andere gevaarlijke > inhoud door MailScanner en lijkt schoon te zijn. >
Hi Michael Michael Tremer schreef op ma 21-03-2022 om 16:21 [+0000]: > This is a lot nicer without eval(). > > > On 9 Mar 2022, at 22:56, Robin Roevens <robin.roevens@disroot.org> > > wrote: > > > > Replace coreupdate_available code duplicating coredbinfo > > workings with call to actual coredbinfo function. > > > > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > > --- > > src/pakfire/lib/functions.pl | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/src/pakfire/lib/functions.pl > > b/src/pakfire/lib/functions.pl > > index 0caa4787e..1e2729485 100644 > > --- a/src/pakfire/lib/functions.pl > > +++ b/src/pakfire/lib/functions.pl > > @@ -884,9 +884,10 @@ sub updates_available { > > } > > > > sub coreupdate_available { > > - eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); > > - if ("$core_release" > "$Conf::core_mine") { > > - return "yes ($core_release)"; > > + my %coredb = &Pakfire::coredbinfo(); > > + > > + if ("$coredb{'AvailableRelease'}" > "$coredb{'Release'}") { > > + return "yes ($coredb{'AvailableRelease'})"; > > } > > else { > > return "no"; > > Is returning a string what we want here? Valid question.. I will look into it. In the light of moving UI out of the library functions that would certainly be the right thing to do (not returning strings here). > > > -- > > 2.34.1 > > > > > > -- > > Dit bericht is gescanned op virussen en andere gevaarlijke > > inhoud door MailScanner en lijkt schoon te zijn. > > > >
Hi Robin Roevens schreef op di 22-03-2022 om 13:42 [+0100]: > Hi Michael > > Michael Tremer schreef op ma 21-03-2022 om 16:21 [+0000]: > > This is a lot nicer without eval(). > > > > > On 9 Mar 2022, at 22:56, Robin Roevens > > > <robin.roevens@disroot.org> > > > wrote: > > > > > > Replace coreupdate_available code duplicating coredbinfo > > > workings with call to actual coredbinfo function. > > > > > > Signed-off-by: Robin Roevens <robin.roevens@disroot.org> > > > --- > > > src/pakfire/lib/functions.pl | 7 ++++--- > > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > > > diff --git a/src/pakfire/lib/functions.pl > > > b/src/pakfire/lib/functions.pl > > > index 0caa4787e..1e2729485 100644 > > > --- a/src/pakfire/lib/functions.pl > > > +++ b/src/pakfire/lib/functions.pl > > > @@ -884,9 +884,10 @@ sub updates_available { > > > } > > > > > > sub coreupdate_available { > > > - eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); > > > - if ("$core_release" > "$Conf::core_mine") { > > > - return "yes ($core_release)"; > > > + my %coredb = &Pakfire::coredbinfo(); > > > + > > > + if ("$coredb{'AvailableRelease'}" > "$coredb{'Release'}") > > > { > > > + return "yes ($coredb{'AvailableRelease'})"; > > > } > > > else { > > > return "no"; > > > > Is returning a string what we want here? > Valid question.. I will look into it. In the light of moving UI out > of > the library functions that would certainly be the right thing to do > (not returning strings here). I looked into it and found out that the only place where this function is actually used is in Pakfire::status which I rewrite a few patches later and this function becomes obsolete. So this patch is actually pointless :-).. I will remove it and remove the function coreupdate_available. This information is available from either function coredbinfo (wether key 'AvailableRelease' exists) of from the new status function (returns hash with a key 'CoreUpdateAvailable' = yes/no) Robin > > > > > > -- > > > 2.34.1 > > > > > > > > > -- > > > Dit bericht is gescanned op virussen en andere gevaarlijke > > > inhoud door MailScanner en lijkt schoon te zijn. > > > > > > > >
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 0caa4787e..1e2729485 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -884,9 +884,10 @@ sub updates_available { } sub coreupdate_available { - eval(`grep "core_" $Conf::dbdir/lists/core-list.db`); - if ("$core_release" > "$Conf::core_mine") { - return "yes ($core_release)"; + my %coredb = &Pakfire::coredbinfo(); + + if ("$coredb{'AvailableRelease'}" > "$coredb{'Release'}") { + return "yes ($coredb{'AvailableRelease'})"; } else { return "no";