Projects
Mega:23.09
perl-Time-HiRes
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:perl-Time-HiRes.spec
Changed
@@ -2,14 +2,14 @@ %define mod_name Time-HiRes Name: perl-%{mod_name} Epoch: 4 -Version: 1.9767 -Release: 3 +Version: 1.9775 +Release: 1 Summary: High resolution time, sleep, and alarm for perl License: GPL+ or Artistic URL: https://metacpan.org/release/%{mod_name} Source0: https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/%{mod_name}-%{base_version}.tar.gz -Patch6000: backport-Time-HiRes-1.9764-Upgrade-to-1.9767.patch +Patch6000: backport-Time-HiRes-1.9764-Upgrade-to-1.9775.patch BuildRequires: findutils gcc make perl-devel perl-generators perl-interpreter perl(Config) BuildRequires: perl(ExtUtils::Constant) perl(ExtUtils::MakeMaker) >= 6.76 perl(File::Spec) perl(strict) @@ -54,6 +54,9 @@ %{_mandir}/man3/* %changelog +* Thu Jan 18 2024 hongjinghao <hongjinghao@huawei.com> - 4:1.9775-1 +- upgrade version to 1.9775 + * Mon Oct 24 2022 hongjinghao <hongjinghao@huawei.com> 4:1.9767-3 - add mod_name marco
View file
_service:tar_scm:backport-Time-HiRes-1.9764-Upgrade-to-1.9767.patch -> _service:tar_scm:backport-Time-HiRes-1.9764-Upgrade-to-1.9775.patch
Changed
@@ -1,31 +1,48 @@ -From b731ad9a903192762bbd6f53fb454b114c841cae Mon Sep 17 00:00:00 2001 -From: root <root@localhost.localdomain> -Date: Wed, 22 Dec 2021 11:38:30 +0800 -Subject: PATCH 1.9767 +From 06d1d3c914663189850941ed3805ce78d36fe94c Mon Sep 17 00:00:00 2001 +From: hongjinghao <hongjinghao@huawei.com> +Date: Thu, 18 Jan 2024 20:02:27 +0800 +Subject: PATCH Upgrade 1.9764 to 1.9775. Generated by the differences + between Perl 5.32.0 and 5.38.0 --- - Changes | 3 + - HiRes.pm | 2 +- - HiRes.xs | 204 +++--------------------------------------------------- - t/utime.t | 6 ++ - 4 files changed, 18 insertions(+), 197 deletions(-) + Changes | 16 +++ + HiRes.pm | 2 +- + HiRes.xs | 225 +++------------------------------- + Makefile.PL | 44 +++++-- + t/Watchdog.pm | 12 +- + t/stat.t | 66 ++++++---- + t/utime.t | 6 + + 7 files changed, 119 insertions(+), 252 deletions(-) diff --git a/Changes b/Changes -index a9b91a0..96f058a 100644 +index a9b91a0253..2b681e9225 100644 --- a/Changes +++ b/Changes -@@ -2,6 +2,9 @@ Revision history for the Perl extension Time::HiRes. +@@ -2,6 +2,22 @@ Revision history for the Perl extension Time::HiRes. {{NEXT}} + - Remove obsolete vms code + - Use core version compare ++ - Use GIMME_V instead of the deprecated GIMME ++ - t/utime.t: dragonflybsd has only microsecond precision ++ - t/utime.t: dragonflybsd is noatime by default ++ - t/stat.t: skip testing access times on HaikuOS, it doesn't support ++ atime ++ - darwin: make sure the compiler can find the system perl headers ++ https://github.com/Perl/perl5/issues/20362 ++ - darwin: make sure PERL_DARWIN is defined on darwin. ++ - don't compare stat and lstat atime if PERL_FILE_ATIME_CHANGES is set in ++ the environment. ++ https://github.com/Perl/perl5/issues/19321 ++ - don't use C++ guards around the perl header files, it caused C++ ++ build failures with MSVC. + 1.9764 2020-08-10 - Fix a bunch of repeated-word typos - Fix compilation with Visual C++ 2013 and older diff --git a/HiRes.pm b/HiRes.pm -index 433ca31..9377c34 100644 +index 433ca31a05..b8cd263c3e 100644 --- a/HiRes.pm +++ b/HiRes.pm @@ -50,7 +50,7 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval @@ -33,36 +50,52 @@ ); -our $VERSION = '1.9764'; -+our $VERSION = '1.9767'; ++our $VERSION = '1.9775'; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; diff --git a/HiRes.xs b/HiRes.xs -index 8002472..1b97962 100644 +index 8002472866..7320cb8fb5 100644 --- a/HiRes.xs +++ b/HiRes.xs -@@ -18,6 +18,7 @@ extern "C" { +@@ -11,16 +11,15 @@ + * it under the same terms as Perl itself. + */ + +-#ifdef __cplusplus +-extern "C" { +-#endif + #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" +-#ifdef USE_PPPORT_H +-# include "ppport.h" +#include "reentr.h" - #ifdef USE_PPPORT_H - # include "ppport.h" ++#if !defined(IS_SAFE_PATHNAME) && defined(TIME_HIRES_UTIME) && defined(HAS_UTIMENSAT) ++#define NEED_ck_warner #endif -@@ -42,12 +43,6 @@ extern "C" { - } ++#include "ppport.h" + #if defined(__CYGWIN__) && defined(HAS_W32API_WINDOWS_H) + # include <w32api/windows.h> + # define CYGWIN_WITH_W32API +@@ -38,15 +37,6 @@ extern "C" { + #if defined(TIME_HIRES_CLOCK_GETTIME_SYSCALL) || defined(TIME_HIRES_CLOCK_GETRES_SYSCALL) + # include <syscall.h> #endif - +-#ifdef __cplusplus +-} +-#endif +- -#define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) -#define PERL_DECIMAL_VERSION \ - PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) -#define PERL_VERSION_GE(r,v,s) \ - (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) -- + #ifndef GCC_DIAG_IGNORE # define GCC_DIAG_IGNORE(x) - # define GCC_DIAG_RESTORE -@@ -139,8 +134,12 @@ typedef struct { +@@ -139,8 +129,12 @@ typedef struct { unsigned __int64 reset_time; } my_cxt_t; @@ -77,7 +110,16 @@ struct timespec { time_t tv_sec; long tv_nsec; -@@ -323,193 +322,6 @@ _clock_getres(clockid_t clock_id, struct timespec *tp) +@@ -263,8 +257,6 @@ _gettimeofday(pTHX_ struct timeval *tp, void *not_used) + static int + _clock_gettime(pTHX_ clockid_t clock_id, struct timespec *tp) + { +- FT_t ft; +- + switch (clock_id) { + case CLOCK_REALTIME: { + FT_t ft; +@@ -323,193 +315,6 @@ _clock_getres(clockid_t clock_id, struct timespec *tp) #endif /* #if defined(WIN32) || defined(CYGWIN_WITH_W32API) */ @@ -271,7 +313,7 @@ /* Do not use H A S _ N A N O S L E E P * so that Perl Configure doesn't scan for it (and pull in -lrt and * the like which are not usually good ideas for the default Perl). -@@ -1086,7 +898,7 @@ nsec_without_unslept(struct timespec *sleepfor, +@@ -1086,7 +891,7 @@ nsec_without_unslept(struct timespec *sleepfor, /* In case Perl and/or Devel::PPPort are too old, minimally emulate * IS_SAFE_PATHNAME() (which looks for zero bytes in the pathname). */ #ifndef IS_SAFE_PATHNAME @@ -280,8 +322,308 @@ # ifdef WARN_SYSCALLS # define WARNEMUCAT WARN_SYSCALLS /* 5.22.0 -> */ # else +@@ -1380,7 +1185,7 @@ gettimeofday() + int status; + status = gettimeofday (&Tp, NULL); + if (status == 0) { +- if (GIMME == G_ARRAY) { ++ if (GIMME_V == G_LIST) { + EXTEND(sp, 2); + PUSHs(sv_2mortal(newSViv(Tp.tv_sec))); + PUSHs(sv_2mortal(newSViv(Tp.tv_usec))); +@@ -1437,7 +1242,7 @@ setitimer(which, seconds, interval = 0) + if (setitimer(which, &newit, &oldit) == 0) { + EXTEND(sp, 1); + PUSHs(sv_2mortal(newSVnv(TV2NV(oldit.it_value)))); +- if (GIMME == G_ARRAY) { ++ if (GIMME_V == G_LIST) { + EXTEND(sp, 1); + PUSHs(sv_2mortal(newSVnv(TV2NV(oldit.it_interval)))); + } +@@ -1457,7 +1262,7 @@ getitimer(which) + if (getitimer(which, &nowit) == 0) { + EXTEND(sp, 1); + PUSHs(sv_2mortal(newSVnv(TV2NV(nowit.it_value)))); +- if (GIMME == G_ARRAY) { ++ if (GIMME_V == G_LIST) { + EXTEND(sp, 1); + PUSHs(sv_2mortal(newSVnv(TV2NV(nowit.it_interval)))); + } +@@ -1710,7 +1515,7 @@ PROTOTYPE: ;$ + Zero(&fakeop, 1, OP); + fakeop.op_type = ix ? OP_LSTAT : OP_STAT; + fakeop.op_ppaddr = PL_ppaddrfakeop.op_type; +- fakeop.op_flags = GIMME_V == G_ARRAY ? OPf_WANT_LIST : ++ fakeop.op_flags = GIMME_V == G_LIST ? OPf_WANT_LIST : + GIMME_V == G_SCALAR ? OPf_WANT_SCALAR : OPf_WANT_VOID; + PL_op = &fakeop; + (void)fakeop.op_ppaddr(aTHX); +diff --git a/Makefile.PL b/Makefile.PL +index c918cd1454..ac56d8df27 100644 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -68,11 +68,20 @@ __EOD__ + } + } + +- my $ccflags = $Config{'ccflags'} . ' ' . "-I$COREincdir" +- . ' -DPERL_NO_INLINE_FUNCTIONS'; ++ my $ccflags = $Config{'ccflags'} . ' '; ++ my @osvers = split /\./, $Config{osvers}; ++ if ($^O eq "darwin" ++ && $^X eq "/usr/bin/perl" ++ && $osvers0 >= 18) { ++ $ccflags .= qq(-iwithsysroot "$COREincdir"); ++ } ++ else { ++ $ccflags .= "-I$COREincdir" ++ } ++ $ccflags .= ' -DPERL_NO_INLINE_FUNCTIONS'; + + if ($^O eq 'VMS') { +- $cccmd = "$Config{'cc'} /include=($COREincdir) $tmp.c"; ++ $cccmd = "$Config{'cc'} $Config{'ccflags'} /include=($COREincdir) $tmp.c"; + } + + if ($args{silent} || !$VERBOSE) { +@@ -562,7 +571,10 @@ EOD + my $has_clock_gettime; + my $has_clock_gettime_emulation; + if (exists $Config{d_clock_gettime}) { +- $has_clock_gettime++ if $Config{d_clock_gettime}; # Unlikely... ++ if ($Config{d_clock_gettime}) { # possibly set for cross-compilation ++ $has_clock_gettime++; ++ $DEFINE .= ' -DTIME_HIRES_CLOCK_GETTIME'; ++ } + } elsif (has_clock_xxx('gettime')) { + $has_clock_gettime++; + $DEFINE .= ' -DTIME_HIRES_CLOCK_GETTIME'; +@@ -591,7 +603,10 @@ EOD + my $has_clock_getres; + my $has_clock_getres_emulation; + if (exists $Config{d_clock_getres}) { +- $has_clock_getres++ if $Config{d_clock_getres}; # Unlikely... ++ if ($Config{d_clock_getres}) { # possibly set for cross-compilation ++ $has_clock_getres++; ++ $DEFINE .= ' -DTIME_HIRES_CLOCK_GETRES'; ++ } + } elsif (has_clock_xxx('getres')) { + $has_clock_getres++; + $DEFINE .= ' -DTIME_HIRES_CLOCK_GETRES'; +@@ -620,7 +635,10 @@ EOD + my $has_clock_nanosleep; + my $has_clock_nanosleep_emulation; + if (exists $Config{d_clock_nanosleep}) { +- $has_clock_nanosleep++ if $Config{d_clock_nanosleep}; # Unlikely... ++ if ($Config{d_clock_nanosleep}) { # possibly set for cross-compilation ++ $has_clock_nanosleep++; ++ $DEFINE .= ' -DTIME_HIRES_CLOCK_NANOSLEEP'; ++ } + } elsif (has_clock_nanosleep()) { + $has_clock_nanosleep++; + $DEFINE .= ' -DTIME_HIRES_CLOCK_NANOSLEEP'; +@@ -643,7 +661,10 @@ EOD + print "Looking for clock()... "; + my $has_clock; + if (exists $Config{d_clock}) { +- $has_clock++ if $Config{d_clock}; # Unlikely... ++ if ($Config{d_clock}) { # possibly set for cross-compilation ++ $has_clock++; ++ $DEFINE .= ' -DTIME_HIRES_CLOCK'; ++ } + } elsif (has_clock()) { + $has_clock++; + $DEFINE .= ' -DTIME_HIRES_CLOCK'; +@@ -829,6 +850,11 @@ EOM + print "NOT found.\n"; + } + } ++ if ($^O eq "darwin") { ++ # the system perl on darwin doesn't seem to include -DPERL_DARWIN ++ # which breaks setting up emulation ++ DEFINE("PERL_DARWIN"); ++ } + + if ($DEFINE) { + $DEFINE =~ s/^\s+//; +@@ -842,8 +868,6 @@ EOM + sub doMakefile { + my @makefileopts = (); + +- DEFINE('USE_PPPORT_H') unless $ENV{PERL_CORE}; +- + push (@makefileopts, + 'NAME' => 'Time::HiRes', + 'AUTHOR' => 'Jarkko Hietaniemi <jhi@iki.fi>', +@@ -861,7 +885,7 @@ sub doMakefile { + 'Config' => 0, + 'Exporter' => 0, + 'ExtUtils::MakeMaker' => 0, +- 'Test::More' => 0, ++ 'Test::More' => 0.84, + 'XSLoader' => 0, + 'strict' => 0, + 'File::Spec' => 0, +diff --git a/t/Watchdog.pm b/t/Watchdog.pm +index a93ab4f970..5f78a174f7 100644 +--- a/t/Watchdog.pm ++++ b/t/Watchdog.pm +@@ -10,30 +10,30 @@ my $watchdog_pid; + my $TheEnd; + + if ($Config{d_fork}) { +- print("# I am the main process $$, starting the watchdog process...\n"); ++ note ("I am the main process $$, starting the watchdog process..."); + $watchdog_pid = fork(); + if (defined $watchdog_pid) { + if ($watchdog_pid == 0) { # We are the kid, set up the watchdog. + my $ppid = getppid(); +- print("# I am the watchdog process $$, sleeping for $waitfor seconds...\n"); ++ note ("I am the watchdog process $$, sleeping for $waitfor seconds..."); + sleep($waitfor - 2); # Workaround for perlbug #49073 + sleep(2); # Wait for parent to exit + if (kill(0, $ppid)) { # Check if parent still exists + warn "\n$0: overall time allowed for tests (${waitfor}s) exceeded!\n"; + print("Terminating main process $ppid...\n"); + kill('KILL', $ppid); +- print("# This is the watchdog process $$, over and out.\n"); ++ note ("This is the watchdog process $$, over and out."); + } + exit(0); + } else { +- print("# The watchdog process $watchdog_pid launched, continuing testing...\n"); ++ note ("The watchdog process $watchdog_pid launched, continuing testing..."); + $TheEnd = time() + $waitfor; + } + } else { + warn "$0: fork failed: $!\n"; + } + } else { +- print("# No watchdog process (need fork)\n"); ++ note ("No watchdog process (need fork)"); + } + + END { +@@ -47,7 +47,7 @@ END { + printf("# kill KILL $watchdog_pid = %d\n", $kill); + } + unlink("ktrace.out"); # Used in BSD system call tracing. +- print("# All done.\n"); ++ note ("All done."); + } + } + +diff --git a/t/stat.t b/t/stat.t +index f2f8e87751..2f72fdc2af 100644 +--- a/t/stat.t ++++ b/t/stat.t +@@ -20,31 +20,41 @@ use t::Watchdog; + my @atime; + my @mtime; + for (1..5) { ++ note "cycle $_"; + Time::HiRes::sleep(rand(0.1) + 0.1); + open(X, '>', $$); + print X $$; + close(X); + my($a, $stat, $b) = ("a", Time::HiRes::stat($$), "b"); +- is $a, "a"; +- is $b, "b"; +- is ref($stat), "ARRAY"; ++ is $a, "a", "stat stack discipline"; ++ is $b, "b", "stat stack discipline"; ++ is ref($stat), "ARRAY", "stat returned array"; + push @mtime, $stat->9; + ($a, my $lstat, $b) = ("a", Time::HiRes::lstat($$), "b"); +- is $a, "a"; +- is $b, "b"; +- is_deeply $lstat, $stat; +- Time::HiRes::sleep(rand(0.1) + 0.1); +- open(X, '<', $$); +- <X>; +- close(X); +- $stat = Time::HiRes::stat($$); +- push @atime, $stat->8; +- $lstat = Time::HiRes::lstat($$); +- is_deeply $lstat, $stat; ++ is $a, "a", "lstat stack discipline"; ++ is $b, "b", "lstat stack discipline"; ++ SKIP: { ++ if($^O eq "haiku") { ++ skip "testing stat access time on Haiku", 2; ++ } ++ if ($ENV{PERL_FILE_ATIME_CHANGES}) { ++ # something else might access the file, changing atime ++ $lstat->8 = $stat->8; ++ } ++ is_deeply $lstat, $stat, "write: stat and lstat returned same values"; ++ Time::HiRes::sleep(rand(0.1) + 0.1); ++ open(X, '<', $$); ++ <X>; ++ close(X); ++ $stat = Time::HiRes::stat($$); ++ push @atime, $stat->8; ++ $lstat = Time::HiRes::lstat($$); ++ is_deeply $lstat, $stat, "read: stat and lstat returned same values"; ++ } + } + 1 while unlink $$; +-print("# mtime = @mtime\n"); +-print("# atime = @atime\n"); ++note ("mtime = @mtime"); ++note ("atime = @atime"); + my $ai = 0; + my $mi = 0; + my $ss = 0; +@@ -64,13 +74,15 @@ for (my $i = 1; $i < @mtime; $i++) { + $ss++; + } + } +-print("# ai = $ai, mi = $mi, ss = $ss\n"); ++note ("ai = $ai, mi = $mi, ss = $ss"); + # Need at least 75% of monotonical increase and + # 20% of subsecond results. Yes, this is guessing. + SKIP: { + skip "no subsecond timestamps detected", 1 if $ss == 0; ++ skip "testing stat access on Haiku", 1 if $^O eq "haiku"; + ok $mi/(@mtime-1) >= 0.75 && $ai/(@atime-1) >= 0.75 && +- $ss/(@mtime+@atime) >= 0.2; ++ $ss/(@mtime+@atime) >= 0.2, ++ "monotonical increase and subsecond results within expected parameters"; + } + + my $targetname = "tgt$$"; +@@ -81,17 +93,21 @@ SKIP: { + close(X); + eval { symlink $targetname, $linkname or die "can't symlink: $!"; }; + skip "can't symlink", 7 if $@ ne ""; ++ note "compare Time::HiRes::stat with ::lstat"; + my @tgt_stat = Time::HiRes::stat($targetname); + my @tgt_lstat = Time::HiRes::lstat($targetname); + my @lnk_stat = Time::HiRes::stat($linkname); + my @lnk_lstat = Time::HiRes::lstat($linkname); +- is scalar(@tgt_stat), 13; +- is scalar(@tgt_lstat), 13; +- is scalar(@lnk_stat), 13; +- is scalar(@lnk_lstat), 13; +- is_deeply \@tgt_stat, \@tgt_lstat; +- is_deeply \@tgt_stat, \@lnk_stat; +- isnt $lnk_lstat2, $tgt_stat2; ++ my $exp = 13; ++ is scalar(@tgt_stat), $exp, "stat on target"; ++ is scalar(@tgt_lstat), $exp, "lstat on target"; ++ is scalar(@lnk_stat), $exp, "stat on link"; ++ is scalar(@lnk_lstat), $exp, "lstat on link"; ++ skip "testing stat access on Haiku", 3 if $^O eq "haiku"; ++ is_deeply \@tgt_stat, \@tgt_lstat, "stat and lstat return same values on target"; ++ is_deeply \@tgt_stat, \@lnk_stat, "stat and lstat return same values on link"; ++ isnt $lnk_lstat2, $tgt_stat2, ++ "target stat mode value differs from link lstat mode value"; + } + 1 while unlink $linkname; + 1 while unlink $targetname; diff --git a/t/utime.t b/t/utime.t -index e2399b8..8a4f071 100644 +index e2399b8feb..8a4f0717a8 100644 --- a/t/utime.t +++ b/t/utime.t @@ -132,9 +132,15 @@ if ($^O eq 'cygwin') { @@ -301,5 +643,5 @@ if ($skip_atime) { printf("# Skipping atime tests because tempfiles seem to be in a filesystem mounted with 'noatime' ($^O)\n'"); -- -2.27.0 +2.33.0
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/perl-Time-HiRes.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2