From 9876475a33ba656d772ad4c2a49793f146fc6e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 17 Jul 2014 12:46:29 +0200 Subject: [PATCH] Resolves: #1093266 - Fixes for ARM and AArch64 --- Sys-CPU-0.54-disable-cpu-type.patch | 35 ------------- ...cpu_type-on-ARM-and-AArch64-Linux-pl.patch | 36 +++++++++++++ ...cpu_clock-can-be-undefined-on-an-ARM.patch | 50 +++++++++++++++++++ perl-Sys-CPU.spec | 13 ++++- 4 files changed, 97 insertions(+), 37 deletions(-) delete mode 100644 Sys-CPU-0.54-disable-cpu-type.patch create mode 100644 Sys-CPU-0.61-Add-support-for-cpu_type-on-ARM-and-AArch64-Linux-pl.patch create mode 100644 Sys-CPU-0.61-cpu_clock-can-be-undefined-on-an-ARM.patch diff --git a/Sys-CPU-0.54-disable-cpu-type.patch b/Sys-CPU-0.54-disable-cpu-type.patch deleted file mode 100644 index eed155d..0000000 --- a/Sys-CPU-0.54-disable-cpu-type.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -up Sys-CPU-0.54/t/Sys-CPU.t.disable Sys-CPU-0.54/t/Sys-CPU.t ---- Sys-CPU-0.54/t/Sys-CPU.t.disable 2013-04-14 09:43:26.547961803 +0530 -+++ Sys-CPU-0.54/t/Sys-CPU.t 2013-04-14 09:51:02.107120338 +0530 -@@ -6,7 +6,7 @@ - # Change 1..1 below to 1..last_test_to_print . - # (It may become useful if the test is moved to ./t subdirectory.) - --BEGIN { $| = 1; print "1..4\n"; } -+BEGIN { $| = 1; print "1..2\n"; } - END {print "not ok 1\n" unless $loaded;} - use Sys::CPU; - $loaded = 1; -@@ -19,22 +19,6 @@ if (defined($number)) { - print "not ok 2 (cpu_count failed)\n"; - } - --$speed = &Sys::CPU::cpu_clock(); --if (defined($speed)) { -- print "ok 3 (CPU Speed : $speed)\n"; --} elsif ( $^O eq 'MSWin32'){ -- print "ok 3 (CPU Speed: test skipped on MSWin32)\n"; --} else { -- print "not ok 3 (cpu_clock undefined (ok if Win9x))\n"; --} -- --$type = &Sys::CPU::cpu_type(); --if (defined($type)) { -- print "ok 4 (CPU Type : $type)\n"; --} else { -- print "not ok 4 (cpu_type unavailable)\n"; --} -- - ######################### End of black magic. - - # Insert your test code below (better if it prints "ok 13" diff --git a/Sys-CPU-0.61-Add-support-for-cpu_type-on-ARM-and-AArch64-Linux-pl.patch b/Sys-CPU-0.61-Add-support-for-cpu_type-on-ARM-and-AArch64-Linux-pl.patch new file mode 100644 index 0000000..7f724ee --- /dev/null +++ b/Sys-CPU-0.61-Add-support-for-cpu_type-on-ARM-and-AArch64-Linux-pl.patch @@ -0,0 +1,36 @@ +From f77b2b0c795f5d2ad7a85ae3bfffcf74232836ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 6 May 2014 08:47:16 +0200 +Subject: [PATCH 1/2] Add support for cpu_type on ARM and AArch64 Linux + platforms +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The CPU type is listed as Processor (upper-cased P) entry. SMP systems +enumerate cores by processor (lower-cased P) entries in addition. +The Processor is always first, so case-insesitive look-up is not +a problem. + +Signed-off-by: Petr Písař +--- + CPU.xs | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/CPU.xs b/CPU.xs +index 236b14d..067c9cb 100644 +--- a/CPU.xs ++++ b/CPU.xs +@@ -395,6 +395,9 @@ CODE: + sysctlbyname("hw.model", value, &len, NULL, 0); + #endif + #ifdef __linux__ ++#if defined __arm__ || defined __aarch64__ ++ value = proc_cpuinfo_field ("Processor"); ++#endif + #if defined __s390__ || defined __s390x__ + value = processor_machine_field (proc_cpuinfo_field ("processor") ); + #endif +-- +1.9.0 + diff --git a/Sys-CPU-0.61-cpu_clock-can-be-undefined-on-an-ARM.patch b/Sys-CPU-0.61-cpu_clock-can-be-undefined-on-an-ARM.patch new file mode 100644 index 0000000..6d2b390 --- /dev/null +++ b/Sys-CPU-0.61-cpu_clock-can-be-undefined-on-an-ARM.patch @@ -0,0 +1,50 @@ +From ceaef15d1391e37623aaf18d6614a4bbf35a3607 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 6 May 2014 09:12:16 +0200 +Subject: [PATCH 2/2] cpu_clock can be undefined on an ARM +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some ARM boards do not publish CPU clock. + +Signed-off-by: Petr Písař +--- + Makefile.PL | 1 + + t/Sys-CPU.t | 3 +++ + 2 files changed, 4 insertions(+) + +diff --git a/Makefile.PL b/Makefile.PL +index 910c77a..4e72025 100644 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -13,4 +13,5 @@ WriteMakefile( + 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' + 'INC' => '', # e.g., '-I/usr/include/other' + 'dynamic_lib' => {OTHERLDFLAGS => $extra_arg}, ++ 'BUILD_REQUIRES' => {'Config' => 0 }, + ); +diff --git a/t/Sys-CPU.t b/t/Sys-CPU.t +index 9edaaa3..4246b22 100755 +--- a/t/Sys-CPU.t ++++ b/t/Sys-CPU.t +@@ -8,6 +8,7 @@ + + BEGIN { $| = 1; print "1..4\n"; } + END {print "not ok 1\n" unless $loaded;} ++use Config; + use Sys::CPU; + $loaded = 1; + print "ok 1\n"; +@@ -24,6 +25,8 @@ if (defined($speed)) { + print "ok 3 (CPU Speed : $speed)\n"; + } elsif ( $^O eq 'MSWin32'){ + print "ok 3 (CPU Speed: test skipped on MSWin32)\n"; ++} elsif ($Config{archname} =~ /^(arm|aarch64)/ ) { ++ print "ok 3 (CPU Speed: test skipped on ARM and AArch64)\n"; + } else { + print "not ok 3 (cpu_clock undefined (ok if Win9x))\n"; + } +-- +1.9.3 + diff --git a/perl-Sys-CPU.spec b/perl-Sys-CPU.spec index 3ad0a78..f8e0609 100644 --- a/perl-Sys-CPU.spec +++ b/perl-Sys-CPU.spec @@ -1,6 +1,6 @@ Name: perl-Sys-CPU Version: 0.61 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Getting CPU information # Some code was copied from Unix::Processors, which is LGPLv3 or Artistic 2.0 @@ -9,7 +9,11 @@ Summary: Getting CPU information License: (GPL+ or Artistic) and (LGPLv3 or Artistic 2.0) URL: http://search.cpan.org/~mzsanford/Sys-CPU/ Source0: http://search.cpan.org/CPAN/authors/id/M/MZ/MZSANFORD/Sys-CPU-%{version}.tar.gz -Patch0: Sys-CPU-0.54-disable-cpu-type.patch +# Support cpu_type on ARM and AArch64, bug #1093266, CPAN RT#95400 +Patch0: Sys-CPU-0.61-Add-support-for-cpu_type-on-ARM-and-AArch64-Linux-pl.patch +# Accept undefined cpu_clock on ARM and AArch64, bug #1093266, CPAN RT#95400 +Patch1: Sys-CPU-0.61-cpu_clock-can-be-undefined-on-an-ARM.patch +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) # Run-time: BuildRequires: perl(DynaLoader) @@ -25,6 +29,7 @@ Currently only number of CPU's supported. %prep %setup -q -n Sys-CPU-%{version} %patch0 -p1 +%patch1 -p1 sed -i 's/\r//' Changes README %build @@ -48,6 +53,10 @@ find %{buildroot} -type f -name CPU.bs -exec rm -f {} ';' %changelog +* Thu Jul 17 2014 Petr Pisar - 0.61-3 +- Support cpu_type on ARM and AArch64 (bug #1093266) +- Accept undefined cpu_clock on ARM and AArch64 (bug #1093266) + * Sat Jun 07 2014 Fedora Release Engineering - 0.61-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild