8
0

- initial package 1.010

* created by cpanspec 1.78.03

OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Perl-Version?expand=0&rev=1
This commit is contained in:
Stephan Kulow
2011-01-14 11:33:48 +00:00
committed by Git OBS Bridge
commit c16f9aa5d6
5 changed files with 328 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:26ce3f08208e82e8c7dd17dbf1dc5c8dbb3e6f9202a1b90ce0c779514fa96bc8
size 22127

View File

@@ -0,0 +1,6 @@
-------------------------------------------------------------------
Fri Jan 14 11:33:26 UTC 2011 - coolo@novell.com
- initial package 1.010
* created by cpanspec 1.78.03

295
perl-Perl-Version.spec Normal file
View File

@@ -0,0 +1,295 @@
#
# spec file for package perl-Perl-Version (Version 1.010)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Perl-Version
Version: 1.010
Release: 1
License: GPL+ or Artistic
%define cpan_name Perl-Version
Summary: Parse and manipulate Perl version strings
Url: http://search.cpan.org/dist/Perl-Version/
Group: Development/Libraries/Perl
#Source: http://www.cpan.org/authors/id/A/AN/ANDYA/Perl-Version-%{version}.tar.gz
Source: %{cpan_name}-%{version}.tar.bz2
BuildRequires: perl(File::Slurp) >= 9999.12
BuildRequires: perl(Getopt::Long) >= 2.34
BuildRequires: perl(Scalar::Util)
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Module::Build)
Requires: perl(File::Slurp) >= 9999.12
Requires: perl(Getopt::Long) >= 2.34
Requires: perl(Scalar::Util)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%{perl_requires}
%description
Perl::Version provides a simple interface for parsing, manipulating and
formatting Perl version strings.
Unlike version.pm (which concentrates on parsing and comparing version
strings) Perl::Version is designed for cases where you'd like to parse a
version, modify it and get back the modified version formatted like the
original.
For example:
my $version = Perl::Version->new( '1.2.3' );
$version->inc_version;
print "$version\n";
prints
1.3.0
whereas
my $version = Perl::Version->new( 'v1.02.03' );
$version->inc_version;
print "$version\n";
prints
v1.03.00
Both are representations of the same version and they'd compare equal but
their formatting is different.
Perl::Version tries hard to guess and recreate the format of the original
version and in most cases it succeeds. In rare cases the formatting is
ambiguous. Consider
1.10.03
Do you suppose that second component '10' is zero padded like the third
component? Perl::Version will assume that it is:
my $version = Perl::Version->new( '1.10.03' );
$version->inc_revision;
print "$version\n";
will print
2.00.00
If all of the components after the first are the same length (two
characters in this case) and any of them begins with a zero Perl::Version
will assume that they're all zero padded to the same length.
The first component and any alpha suffix are handled separately. In each
case if either of them starts with a zero they will be zero padded to the
same length when stringifying the version.
Version Formats
Perl::Version supports a few different version string formats.
* 1, 1.2
Versions that look like a number. If you pass a numeric value its
string equivalent will be parsed:
my $version = Perl::Version->new( 1.2 );
print "$version\n";
prints
1.2
In fact there is no special treatment for versions that resemble
decimal numbers. This is worthy of comment only because it differs
from version.pm which treats actual numbers used as versions as a
special case and performs various transformations on the stored
version.
* 1.2.3, 1.2.3.4
Simple versions with three or more components.
* v1.2.3
Versions with a leading 'v'.
* 5.008006
Fielded numeric versions. You'll likely have seen this in relation to
versions of Perl itself. If a version string has a single decimal
point and the part after the point is three more more digits long
components are extracted from each group of three digits in the
fractional part.
For example
my $version = Perl::Version->new( 1.002003004005006 );
print $version->normal;
prints
v1.2.3.4.5.6
* vstring
Perls later than 5.8.1 support vstring format. A vstring looks like a
number with more than one decimal point and (optionally) a leading
'v'. The 'v' is mandatory for vstrings containing fewer than two
decimal points.
Perl::Version will successfully parse vstrings
my $version = Perl::Version->new( v1.2 );
print "$version\n";
prints
v1.2
Note that stringifying a Perl::Version constructed from a vstring
will result in a regular string. Because it has no way of knowing
whether the vstring constant had a 'v' prefix it always generates one
when stringifying back to a version string.
* CVS version
A common idiom for users of CVS is to use keyword replacement to
generate a version automatically like this:
$VERSION = version->new( qw$Revision: 2.7 $ );
Perl::Version does the right thing with such versions so that
my $version = Perl::Version->new( qw$Revision: 2.7 $ );
$version->inc_revision;
print "$version\n";
prints
Revision: 3.0
Real Numbers
Real numbers are stringified before parsing. This has two
implications: trailing zeros after the decimal point will be lost
and any underscore characters in the number are discarded.
Perl allows underscores anywhere in numeric constants as an aid to
formatting. These are discarded when Perl converts the number into
its internal format. This means that
# Numeric version
print Perl::Version->new( 1.001_001 )->stringify;
prints
1.001001
but
# String version
print Perl::Version->new( '1.001_001' )->stringify;
prints
1.001_001
as expected.
In general you should probably avoid versions expressed either as
decimal numbers or vstrings. The safest option is to pass a regular
string to Perl::Version->new().
Alpha Versions
By convention if a version string has suffix that consists of an
underscore followed by one or more digits it represents an alpha or
developer release. CPAN treats modules with such version strings
specially to reflect their alpha status.
This alpha notation is one reason why using decimal numbers as
versions is a bad idea. Underscore is a valid character in numeric
constants which is discarded by Perl when a program's source is
parsed so any intended alpha suffix will become part of the version
number.
To be considered alpha a version must have a non-zero alpha
component like this
3.0.4_001
Generally the alpha component will be formatted with leading zeros
but this is not a requirement.
Component Naming
A version number consists of a series of components. By Perl convention
the first three components are named 'revision', 'version' and
'subversion':
$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
(etc)
Perl::Version follows that convention. Any component may be accessed by
passing a number from 0 to N-1 to the the component manpage or the
increment manpage but for convenience the first three components are
aliased as the revision manpage, the version manpage and the subversion
manpage.
$version->increment( 0 );
is the same as
$version->inc_revision;
and
my $subv = $version->subversion;
is the same as
my $subv = $version->component( 2 );
The alpha component is named 'alpha'.
Comparison with version.pm
If you're familiar with version.pm you'll notice that there's a certain
amount of overlap between what it does and this module. I originally
created this module as a mutable subclass of version.pm but the
requirement to be able to reformat a modified version to match the
formatting of the original didn't sit well with version.pm's internals.
As a result this module is not dependent or based on version.pm.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Build.PL installdirs=vendor
./Build build flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install destdir=%{buildroot} create_packlist=0
%perl_gen_filelist
%clean
%{__rm} -rf %{buildroot}
%files -f %{name}.files
%defattr(644,root,root,755)
%doc Changes Notes.txt README
%changelog