2009-03-19 11:39:19 +00:00
|
|
|
#
|
2013-10-04 20:00:22 +00:00
|
|
|
# spec file for package perl-Data-UUID
|
2009-03-19 11:39:19 +00:00
|
|
|
#
|
2019-03-14 10:43:42 +00:00
|
|
|
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
2009-06-21 13:58:48 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2019-03-14 10:43:42 +00:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2009-06-21 13:58:48 +00:00
|
|
|
#
|
2009-03-19 11:39:19 +00:00
|
|
|
|
2013-10-04 20:00:22 +00:00
|
|
|
|
2011-08-01 13:25:46 +00:00
|
|
|
Name: perl-Data-UUID
|
2019-03-14 10:43:42 +00:00
|
|
|
Version: 1.224
|
2013-10-04 20:00:22 +00:00
|
|
|
Release: 0
|
2011-08-01 13:25:46 +00:00
|
|
|
%define cpan_name Data-UUID
|
2015-02-08 21:51:45 +00:00
|
|
|
Summary: Globally/Universally Unique Identifiers (GUIDs/UUIDs)
|
2013-10-04 20:00:22 +00:00
|
|
|
License: BSD-3-Clause
|
2011-08-01 13:25:46 +00:00
|
|
|
Group: Development/Libraries/Perl
|
2019-03-14 10:43:42 +00:00
|
|
|
Url: https://metacpan.org/release/%{cpan_name}
|
|
|
|
Source0: https://cpan.metacpan.org/authors/id/R/RJ/RJBS/%{cpan_name}-%{version}.tar.gz
|
2015-08-23 14:19:00 +00:00
|
|
|
Source1: cpanspec.yml
|
2011-08-01 13:25:46 +00:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2009-06-21 13:58:48 +00:00
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
2011-08-01 13:25:46 +00:00
|
|
|
%{perl_requires}
|
2009-03-19 11:39:19 +00:00
|
|
|
|
|
|
|
%description
|
2011-08-01 13:25:46 +00:00
|
|
|
This module provides a framework for generating v3 UUIDs (Universally
|
|
|
|
Unique Identifiers, also known as GUIDs (Globally Unique Identifiers). A
|
|
|
|
UUID is 128 bits long, and is guaranteed to be different from all other
|
|
|
|
UUIDs/GUIDs generated until 3400 CE.
|
2009-06-21 13:58:48 +00:00
|
|
|
|
2011-08-01 13:25:46 +00:00
|
|
|
UUIDs were originally used in the Network Computing System (NCS) and later
|
|
|
|
in the Open Software Foundation's (OSF) Distributed Computing Environment.
|
|
|
|
Currently many different technologies rely on UUIDs to provide unique
|
|
|
|
identity for various software components. Microsoft COM/DCOM for instance,
|
|
|
|
uses GUIDs very extensively to uniquely identify classes, applications and
|
|
|
|
components across network-connected systems.
|
2009-06-21 13:58:48 +00:00
|
|
|
|
2011-08-01 13:25:46 +00:00
|
|
|
The algorithm for UUID generation, used by this extension, is described in
|
|
|
|
the Internet Draft "UUIDs and GUIDs" by Paul J. Leach and Rich Salz. (See
|
|
|
|
RFC 4122.) It provides reasonably efficient and reliable framework for
|
|
|
|
generating UUIDs and supports fairly high allocation rates -- 10 million
|
|
|
|
per second per machine -- and therefore is suitable for identifying both
|
|
|
|
extremely short-lived and very persistent objects on a given system as well
|
|
|
|
as across the network.
|
2009-06-21 13:58:48 +00:00
|
|
|
|
2015-02-08 21:51:45 +00:00
|
|
|
This modules provides several methods to create a UUID. In all methods,
|
|
|
|
'<namespace>' is a UUID and '<name>' is a free form string.
|
2009-06-21 13:58:48 +00:00
|
|
|
|
2011-08-01 13:25:46 +00:00
|
|
|
# creates binary (16 byte long binary value) UUID.
|
|
|
|
$ug->create();
|
|
|
|
$ug->create_bin();
|
|
|
|
|
|
|
|
# creates binary (16-byte long binary value) UUID based on particular
|
|
|
|
# namespace and name string.
|
|
|
|
$ug->create_from_name(<namespace>, <name>);
|
|
|
|
$ug->create_from_name_bin(<namespace>, <name>);
|
|
|
|
|
|
|
|
# creates UUID string, using conventional UUID string format,
|
|
|
|
# such as: 4162F712-1DD2-11B2-B17E-C09EFE1DC403
|
2015-08-23 14:19:00 +00:00
|
|
|
# Note that digits A-F are capitalized, which is contrary to rfc4122
|
2011-08-01 13:25:46 +00:00
|
|
|
$ug->create_str();
|
|
|
|
$ug->create_from_name_str(<namespace>, <name>);
|
|
|
|
|
|
|
|
# creates UUID string as a hex string,
|
|
|
|
# such as: 0x4162F7121DD211B2B17EC09EFE1DC403
|
2015-08-23 14:19:00 +00:00
|
|
|
# Note that digits A-F are capitalized, which is contrary to rfc4122
|
2011-08-01 13:25:46 +00:00
|
|
|
$ug->create_hex();
|
|
|
|
$ug->create_from_name_hex(<namespace>, <name>);
|
|
|
|
|
|
|
|
# creates UUID string as a Base64-encoded string
|
|
|
|
$ug->create_b64();
|
|
|
|
$ug->create_from_name_b64(<namespace>, <name>);
|
|
|
|
|
|
|
|
Binary UUIDs can be converted to printable strings using following methods:
|
|
|
|
|
|
|
|
# convert to conventional string representation
|
|
|
|
$ug->to_string(<uuid>);
|
|
|
|
|
2015-08-23 14:19:00 +00:00
|
|
|
# convert to hex string (using upper, rather than lower, case letters)
|
2011-08-01 13:25:46 +00:00
|
|
|
$ug->to_hexstring(<uuid>);
|
|
|
|
|
|
|
|
# convert to Base64-encoded string
|
|
|
|
$ug->to_b64string(<uuid>);
|
|
|
|
|
|
|
|
Conversly, string UUIDs can be converted back to binary form:
|
|
|
|
|
|
|
|
# recreate binary UUID from string
|
|
|
|
$ug->from_string(<uuid>);
|
|
|
|
$ug->from_hexstring(<uuid>);
|
|
|
|
|
|
|
|
# recreate binary UUID from Base64-encoded string
|
|
|
|
$ug->from_b64string(<uuid>);
|
|
|
|
|
|
|
|
Finally, two binary UUIDs can be compared using the following method:
|
|
|
|
|
|
|
|
# returns -1, 0 or 1 depending on whether uuid1 less
|
|
|
|
# than, equals to, or greater than uuid2
|
|
|
|
$ug->compare(<uuid1>, <uuid2>);
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
use Data::UUID;
|
|
|
|
|
|
|
|
# this creates a new UUID in string form, based on the standard namespace
|
|
|
|
# UUID NameSpace_URL and name "www.mycompany.com"
|
|
|
|
|
2015-02-08 21:51:45 +00:00
|
|
|
$ug = Data::UUID->new;
|
2011-08-01 13:25:46 +00:00
|
|
|
print $ug->create_from_name_str(NameSpace_URL, "www.mycompany.com");
|
|
|
|
|
2009-03-19 11:39:19 +00:00
|
|
|
%prep
|
2009-06-21 13:58:48 +00:00
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
2009-03-19 11:39:19 +00:00
|
|
|
|
|
|
|
%build
|
2019-03-14 10:43:42 +00:00
|
|
|
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
|
|
|
|
make %{?_smp_mflags}
|
2009-03-19 11:39:19 +00:00
|
|
|
|
|
|
|
%check
|
2019-03-14 10:43:42 +00:00
|
|
|
make test
|
2009-03-19 11:39:19 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
|
|
|
%perl_process_packlist
|
2009-06-21 13:58:48 +00:00
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
2015-02-08 21:51:45 +00:00
|
|
|
%defattr(-,root,root,755)
|
2019-03-14 10:43:42 +00:00
|
|
|
%doc Changes README
|
|
|
|
%license LICENSE
|
2009-06-21 13:58:48 +00:00
|
|
|
|
|
|
|
%changelog
|