[perl-Sys-Detect-Virtualization] Initial import (#1095662).

David Dick ddick at fedoraproject.org
Wed May 14 11:42:55 UTC 2014


commit 441b6227a9cdbd85f192507624e6ca7d27a8ffbd
Author: David Dick <ddick at cpan.org>
Date:   Wed May 14 21:42:41 2014 +1000

    Initial import (#1095662).

 .gitignore                          |    1 +
 perl-Sys-Detect-Virtualization.spec |   94 +++++++++++++++++++++++++++++++++++
 sources                             |    1 +
 sys_detect_virt_dmidecode.patch     |   26 ++++++++++
 sys_detect_virt_perldoc.patch       |   35 +++++++++++++
 5 files changed, 157 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..464d642 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/Sys-Detect-Virtualization-0.106.tar.gz
diff --git a/perl-Sys-Detect-Virtualization.spec b/perl-Sys-Detect-Virtualization.spec
new file mode 100644
index 0000000..43862b3
--- /dev/null
+++ b/perl-Sys-Detect-Virtualization.spec
@@ -0,0 +1,94 @@
+Name:           perl-Sys-Detect-Virtualization
+Version:        0.106
+Release:        1%{?dist}
+Summary:        Library to detect if a UNIX system is running as a virtual machine
+License:        GPL+ or Artistic
+Group:          Development/Libraries
+URL:            http://search.cpan.org/dist/Sys-Detect-Virtualization/
+Source0:        http://www.cpan.org/modules/by-module/Sys/Sys-Detect-Virtualization-%{version}.tar.gz
+# Included from https://rt.cpan.org/Public/Bug/Display.html?id=86673 to allow building on archs that do not have Parse::DMIDecode
+Patch1:         sys_detect_virt_dmidecode.patch
+# Included from https://rt.cpan.org/Public/Bug/Display.html?id=95536 to pass POD tests
+Patch2:         sys_detect_virt_perldoc.patch
+BuildRequires:  perl
+BuildRequires:  perl(base)
+BuildRequires:  perl(constant)
+BuildRequires:  perl(Cwd)
+BuildRequires:  perl(Config)
+BuildRequires:  perl(ExtUtils::MakeMaker)
+BuildRequires:  perl(ExtUtils::MM_Unix)
+BuildRequires:  perl(Fcntl)
+BuildRequires:  perl(File::Find)
+BuildRequires:  perl(File::Spec)
+BuildRequires:  perl(File::Path)
+BuildRequires:  perl(Getopt::Long)
+BuildRequires:  perl(IO::File)
+BuildRequires:  perl(lib)
+# The dmidecode package (and perl-Parse-DMIDecode) are only available on the following archs
+%ifarch %{ix86} x86_64 ia64
+BuildRequires:  perl(Parse::DMIDecode) >= 0.03
+%endif
+BuildRequires:  perl(Pod::Coverage)
+BuildRequires:  perl(Pod::Usage)
+BuildRequires:  perl(POSIX)
+BuildRequires:  perl(strict)
+BuildRequires:  perl(Test::Deep)
+BuildRequires:  perl(Test::Exception)
+BuildRequires:  perl(Test::Pod)
+BuildRequires:  perl(Test::Pod::Coverage)
+# BuildRequires:  perl(Test::CheckManifest) not required except for author tests
+BuildRequires:  perl(Test::More) >= 0.82
+BuildRequires:  perl(vars)
+BuildRequires:  perl(warnings)
+%ifarch %{ix86} x86_64 ia64
+Requires:       perl(Parse::DMIDecode) >= 0.03
+%endif
+Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+
+%description
+This module attempts to detect whether or not a system is running as a
+guest under virtualization, using various heuristics.
+
+%prep
+%setup -q -n Sys-Detect-Virtualization-%{version}
+%patch1 -p1
+%patch2 -p1
+
+%build
+# There is no need for a debug package, the only reason an arch is important is because of the BuildRequires
+%define debug_package %{nil}
+%{__perl} Makefile.PL INSTALLDIRS=vendor
+make %{?_smp_mflags}
+
+%install
+make pure_install DESTDIR=$RPM_BUILD_ROOT
+
+find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
+
+%{_fixperms} $RPM_BUILD_ROOT/*
+
+%check
+make test
+
+%files
+%doc Changes README
+%{perl_vendorlib}/*
+%{_mandir}/man3/*
+
+%package -n virtdetect
+Summary:        Detect if a UNIX system is running as a virtual machine
+# The BuildArch is now irrelevant, Sys::Detect::Virtualization hides the dependency on dmidecode
+BuildArch:      noarch
+
+%description -n virtdetect
+This script attempts to detect whether or not a system is running as a
+guest under virtualization, using various heuristics.
+
+%files -n virtdetect
+%doc README
+%{_mandir}/man1/*
+%{_bindir}/*
+
+%changelog
+* Sun May 11 2014 David Dick <ddick at cpan.org> - 0.106-1
+- Initial release
diff --git a/sources b/sources
index e69de29..e23c0d3 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+b99ab9687c21be533270d065e68860fa  Sys-Detect-Virtualization-0.106.tar.gz
diff --git a/sys_detect_virt_dmidecode.patch b/sys_detect_virt_dmidecode.patch
new file mode 100644
index 0000000..d8d2cd2
--- /dev/null
+++ b/sys_detect_virt_dmidecode.patch
@@ -0,0 +1,26 @@
+diff -Naur old/t/linux_helpers.t new/t/linux_helpers.t
+--- old/t/linux_helpers.t	2012-12-19 04:04:14.000000000 +1100
++++ new/t/linux_helpers.t	2013-07-03 22:13:29.638284551 +1000
+@@ -80,11 +80,17 @@
+ 			"detect_dmesg() against $virt test data") or diag explain $got;
+ 
+ 		$got = eval { $d->detect_dmidecode() } || [];
+-		cmp_deeply(
+-			$got,
+-			$expected_dmidecode{$virt},
+-			"detect_dmidecode() against $virt test data") or diag explain $got;
+-
++		SKIP: {
++			if (($@) && ($@ =~ /^Cannot run dmidecode detection without Parse::DMIDecode/)) {
++				my $exception = $@;
++				eval { require Parse::DMIDecode; };
++				skip("Parse::DMIDecode has not been installed:$exception", 1);
++			}
++			cmp_deeply(
++				$got,
++				$expected_dmidecode{$virt},
++				"detect_dmidecode() against $virt test data") or diag explain $got;
++		}
+ 		$got = eval { $d->detect_modules() } || [];
+ 		cmp_deeply(
+ 			$got,
diff --git a/sys_detect_virt_perldoc.patch b/sys_detect_virt_perldoc.patch
new file mode 100644
index 0000000..30fe371
--- /dev/null
+++ b/sys_detect_virt_perldoc.patch
@@ -0,0 +1,35 @@
+diff -Naur old/script/virtdetect new/script/virtdetect
+--- old/script/virtdetect	2010-02-25 08:43:50.000000000 +1100
++++ new/script/virtdetect	2014-05-11 18:54:01.916440022 +1000
+@@ -1,4 +1,7 @@
+ #!/usr/bin/perl -w
++
++eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
++    if 0; # not running under some shell
+ use strict;
+ use warnings;
+ use Getopt::Long;
+@@ -51,17 +54,17 @@
+ 
+ =over 4
+ 
+-=item 0
++=item *
+ 
+-No virtualization detected
++0 - No virtualization detected
+ 
+-=item 1
++=item *
+ 
+-Virtualization detected
++1 - Virtualization detected
+ 
+-=item 2
++=item *
+ 
+-More than one kind of virtualization detected
++2 - More than one kind of virtualization detected
+ 
+ =back
+ 


More information about the scm-commits mailing list