From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Roevens To: development@lists.ipfire.org Subject: Re: [PATCH 4/9] pakfire: Replace coreupdate_available duplicate code Date: Wed, 23 Mar 2022 22:50:43 +0100 Message-ID: <0797afa9274536985f5adbe1c213dfc28993ec0a.camel@sicho.home> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1559214970462316526==" List-Id: --===============1559214970462316526== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Robin Roevens schreef op di 22-03-2022 om 13:42 [+0100]: > Hi Michael >=20 > Michael Tremer schreef op ma 21-03-2022 om 16:21 [+0000]: > > This is a lot nicer without eval(). > >=20 > > > On 9 Mar 2022, at 22:56, Robin Roevens > > > > > > wrote: > > >=20 > > > Replace coreupdate_available code duplicating coredbinfo > > > workings with call to actual coredbinfo function. > > >=20 > > > Signed-off-by: Robin Roevens > > > --- > > > src/pakfire/lib/functions.pl | 7 ++++--- > > > 1 file changed, 4 insertions(+), 3 deletions(-) > > >=20 > > > 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 { > > > } > > >=20 > > > sub coreupdate_available { > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0eval(`grep "core_" $Conf::db= dir/lists/core-list.db`); > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ("$core_release" > "$Conf= ::core_mine") { > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0return "yes ($core_release)"; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my %coredb =3D &Pakfire::cor= edbinfo(); > > > + > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ("$coredb{'AvailableRelea= se'}" > "$coredb{'Release'}") > > > { > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0return "yes ($coredb{'AvailableRelease'})"; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0else { > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0return "no"; > >=20 > > 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' =3D yes/no) Robin >=20 > >=20 > > > --=20 > > > 2.34.1 > > >=20 > > >=20 > > > --=20 > > > Dit bericht is gescanned op virussen en andere gevaarlijke > > > inhoud door MailScanner en lijkt schoon te zijn. > > >=20 > >=20 > >=20 >=20 --=20 Dit bericht is gescanned op virussen en andere gevaarlijke inhoud door MailScanner en lijkt schoon te zijn. --===============1559214970462316526==--