Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-Net-DNS-Resolver-Mock for 
openSUSE:Factory checked in at 2023-02-21 15:35:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Net-DNS-Resolver-Mock (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Net-DNS-Resolver-Mock.new.22824 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Net-DNS-Resolver-Mock"

Tue Feb 21 15:35:42 2023 rev:4 rq:1066841 version:1.20230216

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/perl-Net-DNS-Resolver-Mock/perl-Net-DNS-Resolver-Mock.changes
    2022-08-25 15:33:05.755924342 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-Net-DNS-Resolver-Mock.new.22824/perl-Net-DNS-Resolver-Mock.changes
 2023-02-21 15:35:43.616178346 +0100
@@ -1,0 +2,6 @@
+Fri Feb 17 03:06:24 UTC 2023 - Tina Müller <timueller+p...@suse.de>
+
+- updated to 1.20230216
+   see /usr/share/doc/packages/perl-Net-DNS-Resolver-Mock/Changes
+
+-------------------------------------------------------------------

Old:
----
  Net-DNS-Resolver-Mock-1.20220817.tar.gz

New:
----
  Net-DNS-Resolver-Mock-1.20230216.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Net-DNS-Resolver-Mock.spec ++++++
--- /var/tmp/diff_new_pack.IJ3uwb/_old  2023-02-21 15:35:44.064180920 +0100
+++ /var/tmp/diff_new_pack.IJ3uwb/_new  2023-02-21 15:35:44.068180943 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Net-DNS-Resolver-Mock
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %define cpan_name Net-DNS-Resolver-Mock
 Name:           perl-Net-DNS-Resolver-Mock
-Version:        1.20220817
+Version:        1.20230216
 Release:        0
 License:        Artistic-1.0 OR GPL-1.0-or-later
 Summary:        Mock a DNS Resolver object for testing

++++++ Net-DNS-Resolver-Mock-1.20220817.tar.gz -> 
Net-DNS-Resolver-Mock-1.20230216.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Net-DNS-Resolver-Mock-1.20220817/Changes 
new/Net-DNS-Resolver-Mock-1.20230216/Changes
--- old/Net-DNS-Resolver-Mock-1.20220817/Changes        2022-08-17 
05:33:53.000000000 +0200
+++ new/Net-DNS-Resolver-Mock-1.20230216/Changes        2023-02-17 
00:31:49.000000000 +0100
@@ -1,6 +1,9 @@
 Revision history for Net::DNS::Resolver::Mock
 
-1.20220817 2022-08-17 03:33:52+00:00 UTC
+1.20230216 2023-02-16 23:31:47+00:00 UTC
+  - Build a zonefile cache hash to speed up multiple lookups
+
+1.20220817
   - Fix issue when looking up record at the root
 
 1.20200215 2020-02-15 15:07:49+00:00 UTC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Net-DNS-Resolver-Mock-1.20220817/META.yml 
new/Net-DNS-Resolver-Mock-1.20230216/META.yml
--- old/Net-DNS-Resolver-Mock-1.20220817/META.yml       2022-08-17 
05:33:53.000000000 +0200
+++ new/Net-DNS-Resolver-Mock-1.20230216/META.yml       2023-02-17 
00:31:49.000000000 +0100
@@ -23,7 +23,7 @@
   base: '0'
   strict: '0'
   warnings: '0'
-version: '1.20220817'
+version: '1.20230216'
 x_generated_by_perl: v5.34.0
 x_serialization_backend: 'YAML::Tiny version 1.73'
 x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Net-DNS-Resolver-Mock-1.20220817/Makefile.PL 
new/Net-DNS-Resolver-Mock-1.20230216/Makefile.PL
--- old/Net-DNS-Resolver-Mock-1.20220817/Makefile.PL    2022-08-17 
05:33:53.000000000 +0200
+++ new/Net-DNS-Resolver-Mock-1.20230216/Makefile.PL    2023-02-17 
00:31:49.000000000 +0100
@@ -29,7 +29,7 @@
     "Test::Exception" => 0,
     "Test::More" => 0
   },
-  "VERSION" => "1.20220817",
+  "VERSION" => "1.20230216",
   "test" => {
     "TESTS" => "t/*.t"
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Net-DNS-Resolver-Mock-1.20220817/lib/Net/DNS/Resolver/Mock.pm 
new/Net-DNS-Resolver-Mock-1.20230216/lib/Net/DNS/Resolver/Mock.pm
--- old/Net-DNS-Resolver-Mock-1.20220817/lib/Net/DNS/Resolver/Mock.pm   
2022-08-17 05:33:53.000000000 +0200
+++ new/Net-DNS-Resolver-Mock-1.20230216/lib/Net/DNS/Resolver/Mock.pm   
2023-02-17 00:31:49.000000000 +0100
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.20220817'; # VERSION
+our $VERSION = '1.20230216'; # VERSION
 
 use base 'Net::DNS::Resolver';
 
@@ -49,15 +49,34 @@
     return;
 }
 
+sub build_cache {
+    my ( $self ) = @_;
+    my $cache = {};
+    my $FakeZone = $self->{ 'zonefile' };
+    foreach my $Item ( @$FakeZone ) {
+        my $itemname = lc $Item->name();
+        my $itemtype = lc $Item->type();
+        my $key = join( ':', $itemname, $itemtype );
+        if ( ! exists $cache->{$key} ) {
+            $cache->{$key} = [];
+        }
+        push @{ $cache->{$key} }, $Item;
+    }
+    $self->{ 'zonefile_cache' } = $cache;
+    return;
+}
+
 sub zonefile_read {
     my ( $self, $zonefile ) = @_;
     $self->{ 'zonefile' } = Net::DNS::ZoneFile->read( $zonefile );
+    $self->build_cache();
     return;
 }
 
 sub zonefile_parse {
     my ( $self, $zonefile ) = @_;
     $self->{ 'zonefile' } = Net::DNS::ZoneFile->parse( $zonefile );
+    $self->build_cache();
     return;
 }
 
@@ -72,8 +91,6 @@
 
     $name =~ s/\.$// unless $name eq '.';
 
-    my $FakeZone = $self->{ 'zonefile' };
-
     my $origname = $name;
     if ( lc $type eq 'ptr' ) {
         if ( index( lc $name, '.in-addr.arpa' )  == -1 ) {
@@ -85,16 +102,14 @@
     }
     my $Packet = Net::DNS::Packet->new();
     $Packet->push( 'question' => Net::DNS::Question->new( $origname, $type, 
'IN' ) );
-    foreach my $Item ( @$FakeZone ) {
-        my $itemname = $Item->name();
-        my $itemtype = $Item->type();
-        if ( ( lc $itemname eq lc $name ) && ( lc $itemtype eq lc $type ) ) {
-        $Packet->push( 'answer' => $Item );
-        }
-        elsif ( ( lc $itemname eq lc $name ) && ( lc $itemtype eq lc 'cname' ) 
) {
-            $Packet->push( 'answer' => $Item );
-        }
+    my $key = join( ':', lc $name, lc $type );
+    my $cname_key = join( ':', lc $name, 'cname' );
+    if ( exists( $self->{ 'zonefile_cache' }->{ $cname_key } ) ) {
+        $Packet->push( 'answer' => @{ $self->{ 'zonefile_cache' }->{ 
$cname_key } } );
+    } elsif ( exists( $self->{ 'zonefile_cache' }->{ $key } ) ) {
+        $Packet->push( 'answer' => @{ $self->{ 'zonefile_cache' }->{ $key } } 
);
     }
+
     $Packet->{ 'answerfrom' } = '127.0.0.1';
     $Packet->{ 'status' } = 33152;
     return $Packet;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Net-DNS-Resolver-Mock-1.20220817/t/01-test.t 
new/Net-DNS-Resolver-Mock-1.20230216/t/01-test.t
--- old/Net-DNS-Resolver-Mock-1.20220817/t/01-test.t    2022-08-17 
05:33:53.000000000 +0200
+++ new/Net-DNS-Resolver-Mock-1.20230216/t/01-test.t    2023-02-17 
00:31:49.000000000 +0100
@@ -7,7 +7,7 @@
 
 use Net::DNS::Resolver::Mock;
 
-plan tests => 24;
+plan tests => 30;
 
 {
     my $Resolver = Net::DNS::Resolver::Mock->new();
@@ -50,6 +50,14 @@
     is( ref $Reply->{ 'answer' }->[0], 'Net::DNS::RR::A', 'New::DNS::RR::A 
object returned' );
     is( $Reply->{ 'answer' }->[0]->rdatastr(), '5.6.7.8', 'Correct IP Address 
returned' );;
 
+    $Reply = $Resolver->query( 'multi.example.com', 'A' );
+    is( defined( $Reply ), 1, 'Valid multiple entry returns set' );
+    is( ref $Reply, 'Net::DNS::Packet', 'Net::DNS::Packet object returned' );
+    is( ref $Reply->{ 'answer' }->[0], 'Net::DNS::RR::A', 'New::DNS::RR::A 
object returned' );
+    is( ref $Reply->{ 'answer' }->[1], 'Net::DNS::RR::A', 'New::DNS::RR::A 
object returned' );
+    is( $Reply->{ 'answer' }->[0]->rdatastr(), '1.2.3.4', 'Correct IP Address 
returned' );;
+    is( $Reply->{ 'answer' }->[1]->rdatastr(), '5.6.7.8', 'Correct IP Address 
returned' );;
+
     $Reply = $Resolver->query( '8.6.4.2', 'PTR' );
     is( ref $Reply->{ 'answer' }->[0], 'Net::DNS::RR::PTR', 'New::DNS::RR::PTR 
object returned' );
     is( $Reply->{ 'answer' }->[0]->rdatastr(), 'reverse.example.com.', 
'Correct Address returned' );;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Net-DNS-Resolver-Mock-1.20220817/t/zonefile 
new/Net-DNS-Resolver-Mock-1.20230216/t/zonefile
--- old/Net-DNS-Resolver-Mock-1.20220817/t/zonefile     2022-08-17 
05:33:53.000000000 +0200
+++ new/Net-DNS-Resolver-Mock-1.20230216/t/zonefile     2023-02-17 
00:31:49.000000000 +0100
@@ -2,4 +2,6 @@
 3.5.7.9.in-addr.arpa. 3600 IN CNAME 2.4.6.8.in-addr.arpa.
 2.4.6.8.in-addr.arpa. 3600 IN PTR reverse.example.com.
 cnameptr.example.com 3600 IN PTR reverse.example.com.
+multi.example.com 3600 A 1.2.3.4
+multi.example.com 3600 A 5.6.7.8
 

Reply via email to