Replace dbgetlist code duplicating dblist and getmetafile workings with call to actual dblist and getmetafile functions.
Signed-off-by: Robin Roevens robin.roevens@disroot.org --- src/pakfire/lib/functions.pl | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl index 19160503e..971aa2d59 100644 --- a/src/pakfire/lib/functions.pl +++ b/src/pakfire/lib/functions.pl @@ -410,9 +410,7 @@ sub dbgetlist { my %metadata; my @templine;
- open(FILE, "<$Conf::dbdir/lists/packages_list.db"); - my @db = <FILE>; - close(FILE); + my %paklist = &Pakfire::dblist("all");
opendir(DIR,"$Conf::dbdir/meta"); my @files = readdir(DIR); @@ -424,12 +422,12 @@ sub dbgetlist { next if ( $file =~ /^old/ ); %metadata = parsemetafile("$Conf::dbdir/meta/$file");
- foreach $prog (@db) { - @templine = split(/;/,$prog); - if (("$metadata{'Name'}" eq "$templine[0]") && ("$metadata{'Release'}" ne "$templine[2]")) { - move("$Conf::dbdir/meta/meta-$metadata{'Name'}","$Conf::dbdir/meta/old_meta-$metadata{'Name'}"); - getmetafile($metadata{'Name'}); - } + if ((defined $paklist{"$metadata{'Name'}"}) && ( + ("$paklist{"$metadata{'Name'}"}{'Release'}" ne "$metadata{'Release'}") || + (defined $paklist{"$metadata{'Name'}"}{'AvailableRelease'})) + ) { + move("$Conf::dbdir/meta/meta-$metadata{'Name'}","$Conf::dbdir/meta/old_meta-$metadata{'Name'}"); + getmetafile($metadata{'Name'}); } } }