Hello community, here is the log from the commit of package perl-Graph for openSUSE:Factory checked in at 2020-11-09 13:58:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Graph (Old) and /work/SRC/openSUSE:Factory/.perl-Graph.new.11331 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Graph" Mon Nov 9 13:58:36 2020 rev:16 rq:847119 version:0.9708 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Graph/perl-Graph.changes 2020-11-03 15:17:26.956091061 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Graph.new.11331/perl-Graph.changes 2020-11-09 13:59:19.735713186 +0100 @@ -1,0 +2,11 @@ +Sat Nov 7 03:16:31 UTC 2020 - Tina Müller <timueller+p...@suse.de> + +- updated to 0.9708 + see /usr/share/doc/packages/perl-Graph/Changes + + 0.9708 2020-11-06 + - update metadata for Test::More version dep + - stringify hypervertices right + - add rename_vertex, rename_vertices + +------------------------------------------------------------------- Old: ---- Graph-0.9707.tar.gz New: ---- Graph-0.9708.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Graph.spec ++++++ --- /var/tmp/diff_new_pack.PE6Th0/_old 2020-11-09 13:59:20.483711555 +0100 +++ /var/tmp/diff_new_pack.PE6Th0/_new 2020-11-09 13:59:20.487711545 +0100 @@ -17,7 +17,7 @@ Name: perl-Graph -Version: 0.9707 +Version: 0.9708 Release: 0 %define cpan_name Graph Summary: Graph data structures and algorithms @@ -31,6 +31,7 @@ BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Heap) >= 0.80 +BuildRequires: perl(Test::More) >= 0.82 Requires: perl(Heap) >= 0.80 %{perl_requires} ++++++ Graph-0.9707.tar.gz -> Graph-0.9708.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/Changes new/Graph-0.9708/Changes --- old/Graph-0.9707/Changes 2020-10-31 18:50:52.000000000 +0100 +++ new/Graph-0.9708/Changes 2020-11-06 22:53:18.000000000 +0100 @@ -1,3 +1,8 @@ +0.9708 2020-11-06 +- update metadata for Test::More version dep +- stringify hypervertices right +- add rename_vertex, rename_vertices + 0.9707 2020-10-31 - can't use Safe, ergo Storable, on 5.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/MANIFEST new/Graph-0.9708/MANIFEST --- old/Graph-0.9707/MANIFEST 2020-10-31 18:51:38.000000000 +0100 +++ new/Graph-0.9708/MANIFEST 2020-11-06 22:53:59.000000000 +0100 @@ -24,6 +24,7 @@ MANIFEST This list of files README RELEASE +t/00-report-prereqs.t t/00_use.t t/01_isa.t t/02_trap.t @@ -124,8 +125,6 @@ t/MyDGraph.pm t/MyGraph.pm t/MyUGraph.pm -t/pod-coverage.t -t/pod.t t/simple.pl t/u_an_uf.t t/u_at1.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/META.json new/Graph-0.9708/META.json --- old/Graph-0.9707/META.json 2020-10-31 18:51:38.000000000 +0100 +++ new/Graph-0.9708/META.json 2020-11-06 22:53:59.000000000 +0100 @@ -30,6 +30,12 @@ "ExtUtils::MakeMaker" : "0" } }, + "develop" : { + "requires" : { + "Test::Pod" : "1.00", + "Test::Pod::Coverage" : "1.00" + } + }, "runtime" : { "requires" : { "Heap" : "0.80", @@ -43,7 +49,7 @@ "test" : { "requires" : { "Math::Complex" : "0", - "Test::More" : "0" + "Test::More" : "0.82" } } }, @@ -58,6 +64,6 @@ "web" : "https://github.com/neilb/Graph" } }, - "version" : "0.9707", + "version" : "0.9708", "x_serialization_backend" : "JSON::PP version 4.00" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/META.yml new/Graph-0.9708/META.yml --- old/Graph-0.9707/META.yml 2020-10-31 18:51:38.000000000 +0100 +++ new/Graph-0.9708/META.yml 2020-11-06 22:53:59.000000000 +0100 @@ -5,7 +5,7 @@ build_requires: ExtUtils::MakeMaker: '0' Math::Complex: '0' - Test::More: '0' + Test::More: '0.82' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 @@ -29,5 +29,5 @@ resources: bugtracker: https://github.com/neilb/Graph/issues repository: git://github.com/neilb/Graph.git -version: '0.9707' +version: '0.9708' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/Makefile.PL new/Graph-0.9708/Makefile.PL --- old/Graph-0.9707/Makefile.PL 2020-10-20 15:08:59.000000000 +0200 +++ new/Graph-0.9708/Makefile.PL 2020-11-06 16:34:57.000000000 +0100 @@ -49,9 +49,15 @@ }, }, prereqs => { + develop => { + requires => { + 'Test::Pod::Coverage' => '1.00', + 'Test::Pod' => '1.00', + }, + }, test => { requires => { - 'Test::More' => 0, + 'Test::More' => '0.82', # explain 'Math::Complex' => 0, }, }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/AdjacencyMap/Heavy.pm new/Graph-0.9708/lib/Graph/AdjacencyMap/Heavy.pm --- old/Graph-0.9707/lib/Graph/AdjacencyMap/Heavy.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/AdjacencyMap/Heavy.pm 2020-11-06 22:47:30.000000000 +0100 @@ -5,6 +5,7 @@ # ALMOST GUARANTEED TO CHANGE OR GO AWAY IN FUTURE RELEASES. use strict; +use warnings; # $SIG{__DIE__ } = sub { use Carp; confess }; # $SIG{__WARN__} = sub { use Carp; confess }; @@ -220,6 +221,37 @@ return 1; } +# $vertices = hash index => array-ref of vertex-names +# $this_path = tree-hash of vertex-name to next depth or leaf=index +sub _rename_path { + my ($from, $to, $vertices, $this_path, $depth, $found) = @_; + if (!ref $this_path) { + # at a leaf + return if !defined $found; + $vertices->{ $this_path }[ $found ] = $to; + return; + } + my %recurse = map +($_ => undef), keys %$this_path; + if (exists $recurse{ $from }) { + delete $recurse{ $from }; + my $tp = $this_path->{ $to } = delete $this_path->{ $from }; + # recurse with $found defined + _rename_path($from, $to, $vertices, $tp, $depth + 1, $depth); + } + # recurse with $found not further specified + _rename_path($from, $to, $vertices, $this_path->{ $_ }, $depth + 1, $found) + for keys %recurse; +} + +sub rename_path { + my ($m, $from, $to) = @_; + return 1 if $m->[ _a ] > 1; # arity > 1, all integers, no names + for my $node_length (0..$#{$m->[ _s ]}) { + next unless my $this_path = $m->[ _s ][$node_length]; + _rename_path($from, $to, $m->[ _i ], $this_path, 0); + } +} + sub del_path_by_multi_id { my $m = shift; my $f = $m->[ _f ]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/AdjacencyMap/Light.pm new/Graph-0.9708/lib/Graph/AdjacencyMap/Light.pm --- old/Graph-0.9707/lib/Graph/AdjacencyMap/Light.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/AdjacencyMap/Light.pm 2020-11-06 21:30:05.000000000 +0100 @@ -5,6 +5,7 @@ # ALMOST GUARANTEED TO CHANGE OR GO AWAY IN FUTURE RELEASES. use strict; +use warnings; use Graph::AdjacencyMap qw(:flags :fields); use base 'Graph::AdjacencyMap'; @@ -156,6 +157,20 @@ return 0; } +sub rename_path { + my ($m, $from, $to) = @_; + my ($n, $f, $a, $i, $s, $p) = @$m; + return 0 unless exists $s->{ $from }; + $s->{ $to } = delete $s->{ $from }; + if ($a == 2) { + $_->{ $to } = delete $_->{ $from } + for map $p->{ $_ }, keys %{ $s->{ $to } }; + } else { + $i->{ $s->{ $to } } = $to; + } + return 1; +} + sub __successors { my $E = shift; return wantarray ? () : 0 unless defined $E->[ _s ]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/AdjacencyMap/Vertex.pm new/Graph-0.9708/lib/Graph/AdjacencyMap/Vertex.pm --- old/Graph-0.9707/lib/Graph/AdjacencyMap/Vertex.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/AdjacencyMap/Vertex.pm 2020-11-06 22:47:22.000000000 +0100 @@ -5,6 +5,7 @@ # ALMOST GUARANTEED TO CHANGE OR GO AWAY IN FUTURE RELEASES. use strict; +use warnings; # $SIG{__DIE__ } = sub { use Carp; confess }; # $SIG{__WARN__} = sub { use Carp; confess }; @@ -147,6 +148,15 @@ return 1; } +sub rename_path { + my ($m, $from, $to) = @_; + my ($e, $n, $p, $k, $l) = $m->__get_path_node( $from ); + return unless $e; + $m->[ _i ]{ ref $n ? $n->[ _ni ] : $n } = $to; + $p->[ -1 ]->{ $to } = delete $p->[ -1 ]->{ $l }; + return 1; +} + sub del_path_by_multi_id { my $m = shift; my $f = $m->[ _f ]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/AdjacencyMap.pm new/Graph-0.9708/lib/Graph/AdjacencyMap.pm --- old/Graph-0.9707/lib/Graph/AdjacencyMap.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/AdjacencyMap.pm 2020-11-06 21:30:05.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::AdjacencyMap; use strict; +use warnings; require Exporter; use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS); @@ -466,6 +467,10 @@ Set the path in the Map by the multi id. +=item rename_path($from, $to) + +Rename the path. + =back =head1 AUTHOR AND COPYRIGHT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/AdjacencyMatrix.pm new/Graph-0.9708/lib/Graph/AdjacencyMatrix.pm --- old/Graph-0.9707/lib/Graph/AdjacencyMatrix.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/AdjacencyMatrix.pm 2020-10-31 22:35:44.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::AdjacencyMatrix; use strict; +use warnings; use Graph::BitMatrix; use Graph::Matrix; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Attribute.pm new/Graph-0.9708/lib/Graph/Attribute.pm --- old/Graph-0.9707/lib/Graph/Attribute.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Attribute.pm 2020-10-31 22:35:48.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::Attribute; use strict; +use warnings; sub _F () { 0 } sub _COMPAT02 () { 0x00000001 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/BitMatrix.pm new/Graph-0.9708/lib/Graph/BitMatrix.pm --- old/Graph-0.9707/lib/Graph/BitMatrix.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/BitMatrix.pm 2020-10-31 22:36:32.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::BitMatrix; use strict; +use warnings; # $SIG{__DIE__ } = sub { use Carp; confess }; # $SIG{__WARN__} = sub { use Carp; confess }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Directed.pm new/Graph-0.9708/lib/Graph/Directed.pm --- old/Graph-0.9707/lib/Graph/Directed.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Directed.pm 2020-10-31 22:36:25.000000000 +0100 @@ -3,6 +3,7 @@ use Graph; use base 'Graph'; use strict; +use warnings; =pod diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Matrix.pm new/Graph-0.9708/lib/Graph/Matrix.pm --- old/Graph-0.9707/lib/Graph/Matrix.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Matrix.pm 2020-10-31 22:36:30.000000000 +0100 @@ -4,6 +4,7 @@ # $SIG{__WARN__} = sub { use Carp; confess }; use strict; +use warnings; sub new { my ($class, $g) = @_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/TransitiveClosure/Matrix.pm new/Graph-0.9708/lib/Graph/TransitiveClosure/Matrix.pm --- old/Graph-0.9707/lib/Graph/TransitiveClosure/Matrix.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/TransitiveClosure/Matrix.pm 2020-10-31 22:35:37.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::TransitiveClosure::Matrix; use strict; +use warnings; use Graph::AdjacencyMatrix; use Graph::Matrix; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/TransitiveClosure.pm new/Graph-0.9708/lib/Graph/TransitiveClosure.pm --- old/Graph-0.9707/lib/Graph/TransitiveClosure.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/TransitiveClosure.pm 2020-10-31 22:35:50.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::TransitiveClosure; use strict; +use warnings; # COMMENT THESE OUT FOR TESTING AND PRODUCTION. # $SIG{__DIE__ } = sub { use Carp; confess }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Traversal/BFS.pm new/Graph-0.9708/lib/Graph/Traversal/BFS.pm --- old/Graph-0.9707/lib/Graph/Traversal/BFS.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Traversal/BFS.pm 2020-10-31 22:35:58.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::Traversal::BFS; use strict; +use warnings; use Graph::Traversal; use base 'Graph::Traversal'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Traversal/DFS.pm new/Graph-0.9708/lib/Graph/Traversal/DFS.pm --- old/Graph-0.9707/lib/Graph/Traversal/DFS.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Traversal/DFS.pm 2020-10-31 22:36:01.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::Traversal::DFS; use strict; +use warnings; use Graph::Traversal; use base 'Graph::Traversal'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Traversal.pm new/Graph-0.9708/lib/Graph/Traversal.pm --- old/Graph-0.9707/lib/Graph/Traversal.pm 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Traversal.pm 2020-10-31 22:35:41.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::Traversal; use strict; +use warnings; # $SIG{__DIE__ } = sub { use Carp; confess }; # $SIG{__WARN__} = sub { use Carp; confess }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/Undirected.pm new/Graph-0.9708/lib/Graph/Undirected.pm --- old/Graph-0.9707/lib/Graph/Undirected.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/Undirected.pm 2020-10-31 22:36:35.000000000 +0100 @@ -3,6 +3,7 @@ use Graph; use base 'Graph'; use strict; +use warnings; =pod diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph/UnionFind.pm new/Graph-0.9708/lib/Graph/UnionFind.pm --- old/Graph-0.9707/lib/Graph/UnionFind.pm 2020-10-19 18:28:54.000000000 +0200 +++ new/Graph-0.9708/lib/Graph/UnionFind.pm 2020-10-31 22:36:37.000000000 +0100 @@ -1,6 +1,7 @@ package Graph::UnionFind; use strict; +use warnings; sub _PARENT () { 0 } sub _RANK () { 1 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph.pm new/Graph-0.9708/lib/Graph.pm --- old/Graph-0.9707/lib/Graph.pm 2020-10-31 18:51:03.000000000 +0100 +++ new/Graph-0.9708/lib/Graph.pm 2020-11-06 22:53:05.000000000 +0100 @@ -3,9 +3,6 @@ use strict; use warnings; -# Need to get my head around all those redefines! -NEILB -no warnings 'redefine'; - BEGIN { if (0) { # SET THIS TO ZERO FOR TESTING AND RELEASES! $SIG{__DIE__ } = \&__carp_confess; @@ -16,7 +13,7 @@ use Graph::AdjacencyMap qw(:flags :fields); -our $VERSION = '0.9707'; +our $VERSION = '0.9708'; require 5.006; # Weak references are absolutely required. @@ -97,20 +94,21 @@ sub _COMPAT02 () { 0x00000001 } +sub _stringify_vertex { + return "$_[0]" unless ref($_[0]) eq 'ARRAY'; + "[" . join(" ", @{ $_[0] }) . "]"; +} + sub stringify { my $g = shift; my $u = $g->is_undirected; my $e = $u ? '=' : '-'; my @e = map { - my @v = - map { - ref($_) eq 'ARRAY' ? "[" . join(" ", @$_) . "]" : "$_" - } - @$_; + my @v = map _stringify_vertex($_), @$_; join($e, $u ? sort { "$a" cmp "$b" } @v : @v) } $g->edges05; my @s = sort { "$a" cmp "$b" } @e; - push @s, sort { "$a" cmp "$b" } $g->isolated_vertices; + push @s, sort { "$a" cmp "$b" } map _stringify_vertex($_), $g->isolated_vertices; join(",", @s); } @@ -488,7 +486,7 @@ push @e, $V->[ _s ]->{ $v }; } } else { - my $h = $g->[ _V ]->_is_HYPER; + my $h = $V->_is_HYPER; for my $v ( @_ ) { my @v = ref $v eq 'ARRAY' && $h ? @$v : $v; $g->add_vertex( @v ) unless $V->has_path( @v ); @@ -532,7 +530,7 @@ push @e, $V->[ _s ]->{ $v }; } } else { - my $h = $g->[ _V ]->_is_HYPER; + my $h = $V->_is_HYPER; for my $v ( @_ ) { my @v = ref $v eq 'ARRAY' && $h ? @$v : $v; return () unless $V->has_path( @v ); @@ -1712,6 +1710,29 @@ } return $g; } + +sub rename_vertex { + my $g = shift; + $g->[ $_ ]->rename_path(@_) for _V, _E; + return $g; +} + +sub rename_vertices { + my ($g, $code) = @_; + my %seen; + for ($g->vertices) { + my $from; + if (ref) { + next if @$_ > 1; + ($from) = @$_; + } else { + $from = $_; + } + next if $seen{$from}++; + $g->rename_vertex($from, $code->($from)); + } + return $g; +} ### # More constructors. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/lib/Graph.pod new/Graph-0.9708/lib/Graph.pod --- old/Graph-0.9707/lib/Graph.pod 2020-10-20 04:53:15.000000000 +0200 +++ new/Graph-0.9708/lib/Graph.pod 2020-11-06 22:40:50.000000000 +0100 @@ -603,6 +603,23 @@ (1st, 3rd, 5th, ...) are the corresponding end vertices. Returns the graph. +=item rename_vertex + + $g->rename_vertex('d', 'e') + +Renames a vertex. It retains all of its edges. Throws exception if +doesn't exist. + +Returns the graph. + +=item rename_vertices + + $g->rename_vertices(sub { uc $_[0] }) + +Calls a function for each vertex-name, renaming it to the return value. + +Returns the graph. + =back =head2 Accessors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/t/00-report-prereqs.t new/Graph-0.9708/t/00-report-prereqs.t --- old/Graph-0.9707/t/00-report-prereqs.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Graph-0.9708/t/00-report-prereqs.t 2020-11-06 16:28:16.000000000 +0100 @@ -0,0 +1,187 @@ +#!perl + +use strict; +use warnings; + +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.020 +# THEN modified with more info by Ed J for PDL project + +use Test::More tests => 1; + +use ExtUtils::MakeMaker; +use File::Spec; + +# from $version::LAX +my $lax_version_re = + qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? + | + (?:\.[0-9]+) (?:_[0-9]+)? + ) | (?: + v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? + | + (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? + ) + )/x; + +# hide optional CPAN::Meta modules from prereq scanner +# and check if they are available +my $cpan_meta = "CPAN::Meta"; +my $cpan_meta_pre = "CPAN::Meta::Prereqs"; +my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic + +# Verify requirements? +my $DO_VERIFY_PREREQS = 1; + +sub _max { + my $max = shift; + $max = ( $_ > $max ) ? $_ : $max for @_; + return $max; +} + +sub _merge_prereqs { + my ($collector, $prereqs) = @_; + + # CPAN::Meta::Prereqs object + if (ref $collector eq $cpan_meta_pre) { + return $collector->with_merged_prereqs( + CPAN::Meta::Prereqs->new( $prereqs ) + ); + } + + # Raw hashrefs + for my $phase ( keys %$prereqs ) { + for my $type ( keys %{ $prereqs->{$phase} } ) { + for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { + $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; + } + } + } + + return $collector; +} + +my @include = qw( + +); + +my @exclude = qw( + +); + +# Add static prereqs to the included modules list +my $static_prereqs = do 't/00-report-prereqs.dd'; + +# Merge all prereqs (either with ::Prereqs or a hashref) +my $full_prereqs = _merge_prereqs( + ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), + $static_prereqs +); + +# Add dynamic prereqs to the included modules list (if we can) +my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; +if ( $source && $HAS_CPAN_META ) { + if ( my $meta = eval { CPAN::Meta->load_file($source) } ) { + $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); + } +} +else { + $source = 'static metadata'; +} + +my @full_reports; +my @dep_errors; +my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; + +# Add static includes into a fake section +for my $mod (@include) { + $req_hash->{other}{modules}{$mod} = 0; +} + +for my $phase ( qw(configure build test runtime develop other) ) { + next unless $req_hash->{$phase}; + next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); + + for my $type ( qw(requires recommends suggests conflicts modules) ) { + next unless $req_hash->{$phase}{$type}; + + my $title = ucfirst($phase).' '.ucfirst($type); + my @reports = [qw/Module Want Have Where Howbig/]; + + for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { + next if $mod eq 'perl'; + next if grep { $_ eq $mod } @exclude; + + my $file = $mod; + $file =~ s{::}{/}g; + $file .= ".pm"; + my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; + + my $want = $req_hash->{$phase}{$type}{$mod}; + $want = "undef" unless defined $want; + $want = "any" if !$want && $want == 0; + + my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; + + if ($prefix) { + my $filename = File::Spec->catfile($prefix, $file); + my $have = MM->parse_version( $filename ); + $have = "undef" unless defined $have; + push @reports, [$mod, $want, $have, $prefix, (-s $filename)]; + + if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { + if ( $have !~ /\A$lax_version_re\z/ ) { + push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; + } + elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { + push @dep_errors, "$mod version '$have' is not in required range '$want'"; + } + } + } + else { + push @reports, [$mod, $want, "missing", '', 0]; + + if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { + push @dep_errors, "$mod is not installed ($req_string)"; + } + } + } + + if ( @reports ) { + push @full_reports, "=== $title ===\n\n"; + + my $ml = _max( map { length $_->[0] } @reports ); + my $wl = _max( map { length $_->[1] } @reports ); + my $hl = _max( map { length $_->[2] } @reports ); + my $ll = _max( map { length $_->[3] } @reports ); # location + my $sl = _max( map { length $_->[4] } @reports ); # size + + if ($type eq 'modules') { + splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl, "-" x $ll, "-" x $sl]; + push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; + } + else { + splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl, "-" x $ll, "-" x $sl]; + push @full_reports, map { sprintf(" %*s %*s %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2], -$ll, $_->[3], $sl, $_->[4]) } @reports; + } + + push @full_reports, "\n"; + } + } +} + +if ( @full_reports ) { + diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; +} + +if ( @dep_errors ) { + diag join("\n", + "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n", + "The following REQUIRED prerequisites were not satisfied:\n", + @dep_errors, + "\n" + ); +} + +pass; + +# vim: ts=4 sts=4 sw=4 et: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/t/99_misc.t new/Graph-0.9708/t/99_misc.t --- old/Graph-0.9707/t/99_misc.t 2020-10-20 05:11:50.000000000 +0200 +++ new/Graph-0.9708/t/99_misc.t 2020-11-06 22:46:16.000000000 +0100 @@ -1,18 +1,15 @@ use strict; use warnings; -use Test::More tests => 27; +use Test::More tests => 34; use Graph::Directed; use Graph::Undirected; my $g0 = Graph::Directed->new; -$g0->add_edge(qw(a b)); -$g0->add_edge(qw(a c)); -$g0->add_edge(qw(b d)); -$g0->add_edge(qw(b e)); -$g0->add_edge(qw(c f)); -$g0->add_edge(qw(c g)); +my @E = ([qw(a b)], [qw(a c)], [qw(b d)], [qw(b e)], [qw(c f)], [qw(c g)]); + +$g0->add_edge(@$_) for @E; my $da0 = $g0->subgraph_by_radius('a', 0); my $da1 = $g0->subgraph_by_radius('a', 1); @@ -34,6 +31,25 @@ is($db2, "b-d,b-e"); is($db3, "b-d,b-e"); +{ + my $gh = Graph->new(hypervertexed => 1); + $gh->add_vertex(@$_) for ( + ['a'], [qw(a c)], [qw(a b c)], [qw(a c e)], [qw(a c d)], [], + ); + $gh->add_edge('a', 'b'); + $gh->add_edge('c', 'd'); + is $gh, "a-b,c-d,[],[a b c],[a c d],[a c e],[a c],[a],[b],[c],[d],[e]"; +} + +for ({}, {countvertexed => 1}, {hypervertexed => 1}) { + my $gr = Graph::Directed->new(%$_); + $gr->add_edge(@$_) for @E; + $gr->rename_vertex('b', 'b1'); + is $gr->subgraph_by_radius('a', 3), "a-b1,a-c,b1-d,b1-e,c-f,c-g"; + $gr->rename_vertices(sub { uc $_[0] }); + is $gr->subgraph_by_radius('A', 3), "A-B1,A-C,B1-D,B1-E,C-F,C-G"; +} + my $g1 = Graph::Undirected->new; $g1->add_edge(qw(a b)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/t/pod-coverage.t new/Graph-0.9708/t/pod-coverage.t --- old/Graph-0.9707/t/pod-coverage.t 2020-10-20 05:06:19.000000000 +0200 +++ new/Graph-0.9708/t/pod-coverage.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -use strict; use warnings; -use Test::More; -eval "use Test::Pod::Coverage 1.00"; -plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; -plan tests => 1; -pod_coverage_ok("Graph"); - - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Graph-0.9707/t/pod.t new/Graph-0.9708/t/pod.t --- old/Graph-0.9707/t/pod.t 2020-10-20 05:06:19.000000000 +0200 +++ new/Graph-0.9708/t/pod.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -use strict; use warnings; -use Test::More; -eval "use Test::Pod 1.00"; -plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; -all_pod_files_ok();