From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH 3/9] pakfire: Replace dbgetlist duplicate code Date: Wed, 09 Mar 2022 23:56:49 +0100 Message-ID: <20220309225655.4472-4-robin.roevens@disroot.org> In-Reply-To: <20220309225655.4472-1-robin.roevens@disroot.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4108319274149105505==" List-Id: --===============4108319274149105505== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Replace dbgetlist code duplicating dblist and getmetafile workings with call to actual dblist and getmetafile functions. Signed-off-by: Robin Roevens --- src/pakfire/lib/functions.pl | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index f08f43622..0caa4787e 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -401,9 +401,7 @@ sub dbgetlist { my %metadata; my @templine; =20 - open(FILE, "<$Conf::dbdir/lists/packages_list.db"); - my @db =3D ; - close(FILE); + my %paklist =3D &Pakfire::dblist("all"); =20 opendir(DIR,"$Conf::dbdir/meta"); my @files =3D readdir(DIR); @@ -415,13 +413,9 @@ sub dbgetlist { next if ( $file =3D~ /^old/ ); %metadata =3D parsemetafile("$Conf::dbdir/meta/$file"); =20 - foreach $prog (@db) { - @templine =3D split(/\;/,$prog); - if (("$metadata{'Name'}" eq "$templine[0]") && ("$metadata{'Release'}" ne= "$templine[2]")) { - move("$Conf::dbdir/meta/meta-$metadata{'Name'}","$Conf::dbdir/meta/old_m= eta-$metadata{'Name'}"); - fetchfile("meta/meta-$metadata{'Name'}", ""); - move("$Conf::cachedir/meta-$metadata{'Name'}", "$Conf::dbdir/meta/meta-$= metadata{'Name'}"); - } + if ((defined $paklist{"$metadata{'Name'}"}) && ("$paklist{\"$metadata{'Nam= e'}\"}{'Release'}" ne "$metadata{'Release'}")) { + move("$Conf::dbdir/meta/meta-$metadata{'Name'}","$Conf::dbdir/meta/old_me= ta-$metadata{'Name'}"); + getmetafile($metadata{'Name'}); } } } --=20 2.34.1 --=20 Dit bericht is gescanned op virussen en andere gevaarlijke inhoud door MailScanner en lijkt schoon te zijn. --===============4108319274149105505==--