106 lines
4.1 KiB
RPMSpec
106 lines
4.1 KiB
RPMSpec
#
|
|
# spec file for package perl-Time-Format
|
|
#
|
|
# Copyright (c) 2024 SUSE LLC
|
|
#
|
|
# 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 https://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%define cpan_name Time-Format
|
|
Name: perl-Time-Format
|
|
Version: 1.160.0
|
|
Release: 0
|
|
# 1.16 -> normalize -> 1.160.0
|
|
%define cpan_version 1.16
|
|
License: SUSE-Public-Domain
|
|
Summary: Easy-to-use date/time formatting
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
Source0: https://cpan.metacpan.org/authors/id/R/RO/ROODE/%{cpan_name}-%{cpan_version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(Module::Build) >= 0.4
|
|
Provides: perl(Time::Format) = %{version}
|
|
%undefine __perllib_provides
|
|
Recommends: perl(Date::Manip)
|
|
Recommends: perl(DateTime)
|
|
Recommends: perl(Module::Signature)
|
|
%{perl_requires}
|
|
|
|
%description
|
|
This module creates global pseudovariables which format dates and times,
|
|
according to formatting codes you pass to them in strings.
|
|
|
|
The '%time' formatting codes are designed to be easy to remember and use,
|
|
and to take up just as many characters as the output time value whenever
|
|
possible. For example, the four-digit year code is "'yyyy'", the
|
|
three-letter month abbreviation is "'Mon'".
|
|
|
|
The nice thing about having a variable-like interface instead of function
|
|
calls is that the values can be used inside of strings (as well as outside
|
|
of strings in ordinary expressions). Dates are frequently used within
|
|
strings (log messages, output, data records, etc.), so having the ability
|
|
to interpolate them directly is handy.
|
|
|
|
Perl allows arbitrary expressions within curly braces of a hash, even when
|
|
that hash is being interpolated into a string. This allows you to do
|
|
computations on the fly while formatting times and inserting them into
|
|
strings. See the "yesterday" example above.
|
|
|
|
The format strings are designed with programmers in mind. What do you need
|
|
most frequently? 4-digit year, month, day, 24-based hour, minute, second --
|
|
usually with leading zeroes. These six are the easiest formats to use and
|
|
remember in Time::Format: 'yyyy', 'mm', 'dd', 'hh', 'mm', 'ss'. Variants on
|
|
these formats follow a simple and consistent formula. This module is for
|
|
everyone who is weary of trying to remember _strftime(3)_'s arcane codes,
|
|
or of endlessly writing '$t[4]++; $t[5]+=1900' as you manually format times
|
|
or dates.
|
|
|
|
Note that 'mm' (and related codes) are used both for months and minutes.
|
|
This is a feature. '%time' resolves the ambiguity by examining other nearby
|
|
formatting codes. If it's in the context of a year or a day, "month" is
|
|
assumed. If in the context of an hour or a second, "minute" is assumed.
|
|
|
|
The format strings are not meant to encompass every date/time need ever
|
|
conceived. But how often do you need the day of the year (strftime's '%j')
|
|
or the week number (strftime's '%W')?
|
|
|
|
For capabilities that '%time' does not provide, '%strftime' provides an
|
|
interface to POSIX's 'strftime', and '%manip' provides an interface to the
|
|
Date::Manip module's 'UnixDate' function.
|
|
|
|
If the companion module Time::Format_XS is also installed, Time::Format
|
|
will detect and use it. This will result in a significant speed increase
|
|
for '%time' and 'time_format'.
|
|
|
|
%prep
|
|
%autosetup -n %{cpan_name}-%{cpan_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
|
|
|
|
%files -f %{name}.files
|
|
%doc Changes quickref.ps quickref.txt README
|
|
|
|
%changelog
|