Hello community,
here is the log from the commit of package perl-Package-Variant for
openSUSE:Factory checked in at 2015-08-11 08:26:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Package-Variant (Old)
and /work/SRC/openSUSE:Factory/.perl-Package-Variant.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Package-Variant"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Package-Variant/perl-Package-Variant.changes
2015-04-15 16:26:30.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Package-Variant.new/perl-Package-Variant.changes
2015-08-11 08:26:10.000000000 +0200
@@ -1,0 +2,16 @@
+Tue Aug 4 09:01:27 UTC 2015 - [email protected]
+
+- updated to 1.003002
+ see /usr/share/doc/packages/perl-Package-Variant/Changes
+
+ 1.003002 - 2015-07-25
+ - also switch the tests to strictures 2 (aaaaaaaaaaaaaaaaaaaaaaaaaa)
+
+ 1.003001 - 2015-07-25
+ - also switch the documentation to strictures 2 (slow clap for mst there)
+
+ 1.003000 - 2015-07-25
+ - switch to strictures 2
+ - add make_variant_package_name optional method
+
+-------------------------------------------------------------------
Old:
----
Package-Variant-1.002002.tar.gz
New:
----
Package-Variant-1.003002.tar.gz
cpanspec.yml
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Package-Variant.spec ++++++
--- /var/tmp/diff_new_pack.kT0tKJ/_old 2015-08-11 08:26:11.000000000 +0200
+++ /var/tmp/diff_new_pack.kT0tKJ/_new 2015-08-11 08:26:11.000000000 +0200
@@ -17,25 +17,26 @@
Name: perl-Package-Variant
-Version: 1.002002
+Version: 1.003002
Release: 0
%define cpan_name Package-Variant
Summary: Parameterizable packages
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Package-Variant/
-Source:
http://www.cpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz
+Source0:
http://www.cpan.org/authors/id/M/MS/MSTROUT/%{cpan_name}-%{version}.tar.gz
+Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
-BuildRequires: perl(Import::Into) >= 1
+BuildRequires: perl(Import::Into) >= 1.000000
BuildRequires: perl(Module::Runtime) >= 0.013
BuildRequires: perl(Test::Fatal)
-BuildRequires: perl(strictures) >= 1
-Requires: perl(Import::Into) >= 1
+BuildRequires: perl(strictures) >= 2.000000
+Requires: perl(Import::Into) >= 1.000000
Requires: perl(Module::Runtime) >= 0.013
-Requires: perl(strictures) >= 1
+Requires: perl(strictures) >= 2.000000
%{perl_requires}
%description
++++++ Package-Variant-1.002002.tar.gz -> Package-Variant-1.003002.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/Changes
new/Package-Variant-1.003002/Changes
--- old/Package-Variant-1.002002/Changes 2014-08-21 19:03:41.000000000
+0200
+++ new/Package-Variant-1.003002/Changes 2015-07-25 19:21:40.000000000
+0200
@@ -1,5 +1,15 @@
Revision history for Package-Variant
+1.003002 - 2015-07-25
+ - also switch the tests to strictures 2 (aaaaaaaaaaaaaaaaaaaaaaaaaa)
+
+1.003001 - 2015-07-25
+ - also switch the documentation to strictures 2 (slow clap for mst there)
+
+1.003000 - 2015-07-25
+ - switch to strictures 2
+ - add make_variant_package_name optional method
+
1.002002 - 2014-08-21
- fix license in metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/META.json
new/Package-Variant-1.003002/META.json
--- old/Package-Variant-1.002002/META.json 2014-08-21 19:04:02.000000000
+0200
+++ new/Package-Variant-1.003002/META.json 2015-07-25 19:21:44.000000000
+0200
@@ -4,7 +4,7 @@
"mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter
version 2.141520",
+ "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter
version 2.150001",
"license" : [
"perl_5"
],
@@ -28,10 +28,10 @@
"runtime" : {
"requires" : {
"Carp" : "0",
- "Import::Into" : "1",
+ "Import::Into" : "1.000000",
"Module::Runtime" : "0.013",
"perl" : "5.006",
- "strictures" : "1"
+ "strictures" : "2.000000"
}
},
"test" : {
@@ -52,5 +52,5 @@
"web" :
"http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Package-Variant.git"
}
},
- "version" : "1.002002"
+ "version" : "1.003002"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/META.yml
new/Package-Variant-1.003002/META.yml
--- old/Package-Variant-1.002002/META.yml 2014-08-21 19:04:02.000000000
+0200
+++ new/Package-Variant-1.003002/META.yml 2015-07-25 19:21:44.000000000
+0200
@@ -5,7 +5,7 @@
build_requires:
Test::Fatal: '0'
dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version
2.141520'
+generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version
2.150001'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -19,11 +19,11 @@
- string
requires:
Carp: '0'
- Import::Into: '1'
+ Import::Into: '1.000000'
Module::Runtime: '0.013'
perl: '5.006'
- strictures: '1'
+ strictures: '2.000000'
resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Package-Variant
repository: git://git.shadowcat.co.uk/p5sagit/Package-Variant.git
-version: '1.002002'
+version: '1.003002'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/Makefile.PL
new/Package-Variant-1.003002/Makefile.PL
--- old/Package-Variant-1.002002/Makefile.PL 2014-08-19 14:52:52.000000000
+0200
+++ new/Package-Variant-1.003002/Makefile.PL 2015-07-25 19:10:42.000000000
+0200
@@ -5,13 +5,13 @@
name => 'Package-Variant',
prereqs => {
test => { requires => {
- 'Test::Fatal' => 0,
+ 'Test::Fatal' => '0',
}, },
runtime => { requires => {
- 'perl' => 5.006,
- 'strictures' => 1,
- 'Carp' => 0,
- 'Import::Into' => 1,
+ 'perl' => '5.006',
+ 'strictures' => '2.000000',
+ 'Carp' => '0',
+ 'Import::Into' => '1.000000',
'Module::Runtime' => '0.013',
}, },
},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/README
new/Package-Variant-1.003002/README
--- old/Package-Variant-1.002002/README 2014-08-21 19:04:02.000000000 +0200
+++ new/Package-Variant-1.003002/README 2015-07-25 19:21:44.000000000 +0200
@@ -2,9 +2,11 @@
Package::Variant - Parameterizable packages
SYNOPSIS
+ Creation of anonymous variants:
+
# declaring a variable Moo role
package My::VariableRole::ObjectAttr;
- use strictures 1;
+ use strictures 2;
use Package::Variant
# what modules to 'use'
importing => ['Moo::Role'],
@@ -25,7 +27,7 @@
# using the role
package My::Class::WithObjectAttr;
- use strictures 1;
+ use strictures 2;
use Moo;
use My::VariableRole::ObjectAttr;
@@ -35,6 +37,50 @@
my $obj = My::Class::WithObjectAttr->new;
$obj->some_obj; # returns a Some::Class instance
+ And the same thing, only with named variants:
+
+ # declaring a variable Moo role that can be named
+ package My::VariableRole::ObjectAttrNamed;
+ use strictures 2;
+ use Package::Variant importing => ['Moo::Role'],
+ subs => [ qw(has around before after with) ];
+ use Module::Runtime 'module_notional_filename'; # only if you need
protection
+
+ # this method is run at variant creation time to determine its custom
+ # package name. it can use the arguments or do something entirely else.
+ sub make_variant_package_name {
+ my ($class, $package, %arguments) = @_;
+ $package = "Private::$package"; # you can munge the input here if you
like
+ # only if you *need* protection
+ die "Won't clobber $package" if $INC{module_notional_filename
$package};
+ return $package;
+ }
+
+ # same as in the example above, except for the argument list. in this
example
+ # $package is the user input, and
+ # $target_package is the actual package in which the variant gets
installed
+ sub make_variant {
+ my ($class, $target_package, $package, %arguments) = @_;
+ my $name = $arguments{name};
+ has $name => (is => 'lazy');
+ install "_build_${name}" => sub {return $arguments{class}->new};
+ }
+
+ # using the role
+ package My::Class::WithObjectAttr;
+ use strictures 2;
+ use Moo;
+ use My::VariableRole::ObjectAttrNamed;
+
+ # create the role under a specific name
+ ObjectAttrNamed "My::Role" => (name => 'some_obj', class =>
'Some::Class');
+ # and use it
+ with "Private::My::Role";
+
+ # using our class
+ my $obj = My::Class::WithObjectAttr->new;
+ $obj->some_obj; # returns a Some::Class instance
+
DESCRIPTION
This module allows you to build a variable package that contains a
package template and can use it to build variant packages at runtime.
@@ -180,6 +226,19 @@
This is a class method receiving the $target package and the @arguments
defining the requested variant.
+ make_variant_package_name
+ Some::Variant::Package->make_variant_package_name( @arguments );
+
+ You may optionally provide this method. If present, this method will be
+ used to determine the package name for a particular variant being
+ constructed.
+
+ If you do not implement it, a unique package name something like
+
+ Some::Variant::Package::_Variant_A003
+
+ will be created for you.
+
import
use Some::Variant::Package;
my $variant_package = Package( @arguments );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/lib/Package/Variant.pm
new/Package-Variant-1.003002/lib/Package/Variant.pm
--- old/Package-Variant-1.002002/lib/Package/Variant.pm 2014-08-21
19:03:01.000000000 +0200
+++ new/Package-Variant-1.003002/lib/Package/Variant.pm 2015-07-25
19:21:39.000000000 +0200
@@ -1,11 +1,11 @@
package Package::Variant;
-use strictures 1;
+use strictures 2;
use Import::Into;
use Module::Runtime qw(require_module);
use Carp qw(croak);
-our $VERSION = '1.002002';
+our $VERSION = '1.003002';
$VERSION = eval $VERSION;
@@ -94,9 +94,17 @@
};
}
+sub build_variant_package_name {
+ my ($me, $variable, @args) = @_;
+ if ($variable->can('make_variant_package_name')) {
+ return $variable->make_variant_package_name(@args);
+ }
+ return "${variable}::_Variant_".++$Variable{$variable}{anon};
+}
+
sub build_variant_of {
my ($me, $variable, @args) = @_;
- my $variant_name = "${variable}::_Variant_".++$Variable{$variable}{anon};
+ my $variant_name = $me->build_variant_package_name($variable, @args);
foreach my $to_import (@{$Variable{$variable}{args}{importing}}) {
my ($pkg, $args) = @$to_import;
require_module $pkg;
@@ -127,9 +135,11 @@
=head1 SYNOPSIS
+Creation of anonymous variants:
+
# declaring a variable Moo role
package My::VariableRole::ObjectAttr;
- use strictures 1;
+ use strictures 2;
use Package::Variant
# what modules to 'use'
importing => ['Moo::Role'],
@@ -150,7 +160,7 @@
# using the role
package My::Class::WithObjectAttr;
- use strictures 1;
+ use strictures 2;
use Moo;
use My::VariableRole::ObjectAttr;
@@ -160,6 +170,50 @@
my $obj = My::Class::WithObjectAttr->new;
$obj->some_obj; # returns a Some::Class instance
+And the same thing, only with named variants:
+
+ # declaring a variable Moo role that can be named
+ package My::VariableRole::ObjectAttrNamed;
+ use strictures 2;
+ use Package::Variant importing => ['Moo::Role'],
+ subs => [ qw(has around before after with) ];
+ use Module::Runtime 'module_notional_filename'; # only if you need protection
+
+ # this method is run at variant creation time to determine its custom
+ # package name. it can use the arguments or do something entirely else.
+ sub make_variant_package_name {
+ my ($class, $package, %arguments) = @_;
+ $package = "Private::$package"; # you can munge the input here if you like
+ # only if you *need* protection
+ die "Won't clobber $package" if $INC{module_notional_filename $package};
+ return $package;
+ }
+
+ # same as in the example above, except for the argument list. in this example
+ # $package is the user input, and
+ # $target_package is the actual package in which the variant gets installed
+ sub make_variant {
+ my ($class, $target_package, $package, %arguments) = @_;
+ my $name = $arguments{name};
+ has $name => (is => 'lazy');
+ install "_build_${name}" => sub {return $arguments{class}->new};
+ }
+
+ # using the role
+ package My::Class::WithObjectAttr;
+ use strictures 2;
+ use Moo;
+ use My::VariableRole::ObjectAttrNamed;
+
+ # create the role under a specific name
+ ObjectAttrNamed "My::Role" => (name => 'some_obj', class => 'Some::Class');
+ # and use it
+ with "Private::My::Role";
+
+ # using our class
+ my $obj = My::Class::WithObjectAttr->new;
+ $obj->some_obj; # returns a Some::Class instance
+
=head1 DESCRIPTION
This module allows you to build a variable package that contains a package
@@ -316,6 +370,19 @@
This is a class method receiving the C<$target> package and the
C<@arguments> defining the requested variant.
+=head2 make_variant_package_name
+
+ Some::Variant::Package->make_variant_package_name( @arguments );
+
+B<You may optionally provide this method.> If present, this method will be
+used to determine the package name for a particular variant being constructed.
+
+If you do not implement it, a unique package name something like
+
+ Some::Variant::Package::_Variant_A003
+
+will be created for you.
+
=head2 import
use Some::Variant::Package;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/maint/Makefile.PL.include
new/Package-Variant-1.003002/maint/Makefile.PL.include
--- old/Package-Variant-1.002002/maint/Makefile.PL.include 2013-09-18
08:11:19.000000000 +0200
+++ new/Package-Variant-1.003002/maint/Makefile.PL.include 2015-07-03
20:54:33.000000000 +0200
@@ -2,4 +2,5 @@
use lib "Distar/lib";
use Distar;
+use ExtUtils::MakeMaker 6.68; # ensure meta-spec v2 compatibility
author 'mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/t/01simple.t
new/Package-Variant-1.003002/t/01simple.t
--- old/Package-Variant-1.002002/t/01simple.t 2014-08-16 01:29:48.000000000
+0200
+++ new/Package-Variant-1.003002/t/01simple.t 2015-07-25 19:20:56.000000000
+0200
@@ -1,4 +1,4 @@
-use strictures 1;
+use strictures 2;
use Test::More;
use Test::Fatal;
use Package::Variant ();
@@ -131,4 +131,23 @@
);
}, qr/value.+2.+foo.+importing.+array/i, 'importing array invalid list';
+BEGIN {
+ package TestOverrideName;
+
+ use Package::Variant;
+
+ sub make_variant_package_name {
+ my (undef, @args) = @_;
+ return $args[0];
+ }
+
+ sub make_variant {
+ install hey => sub { 'hey' };
+ }
+}
+
+is(TestOverrideName::->build_variant('hey'), 'hey');
+
+is(hey->hey, 'hey', 'hey');
+
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/t/10argument-types.t
new/Package-Variant-1.003002/t/10argument-types.t
--- old/Package-Variant-1.002002/t/10argument-types.t 2013-09-18
08:11:19.000000000 +0200
+++ new/Package-Variant-1.003002/t/10argument-types.t 2015-07-25
19:20:56.000000000 +0200
@@ -1,4 +1,4 @@
-use strictures 1;
+use strictures 2;
use Test::More;
BEGIN {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/t/11dynamic-build.t
new/Package-Variant-1.003002/t/11dynamic-build.t
--- old/Package-Variant-1.002002/t/11dynamic-build.t 2013-09-18
08:11:19.000000000 +0200
+++ new/Package-Variant-1.003002/t/11dynamic-build.t 2015-07-25
19:20:56.000000000 +0200
@@ -1,4 +1,4 @@
-use strictures 1;
+use strictures 2;
use Test::More;
BEGIN {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/t/20moo-param-role.t
new/Package-Variant-1.003002/t/20moo-param-role.t
--- old/Package-Variant-1.002002/t/20moo-param-role.t 2013-09-18
08:11:19.000000000 +0200
+++ new/Package-Variant-1.003002/t/20moo-param-role.t 2015-07-25
19:20:56.000000000 +0200
@@ -1,4 +1,4 @@
-use strictures 1;
+use strictures 2;
use Test::More;
BEGIN {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Package-Variant-1.002002/t/30-pragma-leak.t
new/Package-Variant-1.003002/t/30-pragma-leak.t
--- old/Package-Variant-1.002002/t/30-pragma-leak.t 2013-09-27
18:31:24.000000000 +0200
+++ new/Package-Variant-1.003002/t/30-pragma-leak.t 2015-07-25
19:20:56.000000000 +0200
@@ -1,4 +1,4 @@
-use strictures 1;
+use strictures 2;
use Test::More;
use Test::Fatal;
use Package::Variant ();
++++++ cpanspec.yml ++++++
---
#description_paragraphs: 3
#no_testing: broken upstream
#sources:
# - source1
# - source2
#patches:
# foo.patch: -p1
# bar.patch:
#preamble: |-
# BuildRequires: gcc-c++
#post_prep: |-
# hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'`
# sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL
#post_install: |-
# sed on %{name}.files
#license: SUSE-NonFree
#skip_noarch: 1
#custom_build: |-
#./Build build flags=%{?_smp_mflags} --myflag
#custom_test: |-
#startserver && make test
#ignore_requires: Bizarre::Module