Sys-Info-Driver-Linux-0.7908/ 000755 000765 000024 00000000000 15047747607 016106 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/LICENSE 000644 000765 000024 00000046301 15047747607 017117 0 ustar 00burak staff 000000 000000 This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2006 by Burak Gursoy.
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see .
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Moe Ghoul, President of Vice
That's all there is to it!
--- The Perl Artistic License 1.0 ---
This software is Copyright (c) 2006 by Burak Gursoy.
This is free software, licensed under:
The Perl Artistic License 1.0
The "Artistic License"
Preamble
The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.
Definitions:
"Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
"Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder as specified below.
"Copyright Holder" is whoever is named in the copyright or
copyrights for the package.
"You" is you, if you're thinking about copying or distributing
this Package.
"Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
"Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as uunet.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided, and provide
a separate manual page for each non-standard executable that clearly
documents how it differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where
to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) give non-standard executables non-standard names, and clearly
document the differences in manual pages (or equivalent), together
with instructions on where to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this
Package. You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own. You may embed this Package's interpreter within
an executable of yours (by linking); this shall be construed as a mere
form of aggregation, provided that the complete Standard Version of the
interpreter is so embedded.
6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whoever generated
them, and may be sold commercially, and may be aggregated with this
Package. If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.
7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.
8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution. Such use shall not be
construed as a distribution of this Package.
9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
Sys-Info-Driver-Linux-0.7908/Changes 000644 000765 000024 00000005346 15047747607 017411 0 ustar 00burak staff 000000 000000 Revision history for Perl extension Sys::Info::Driver::Linux.
0.7908 2025-08-16 BURAK
- Fix for timezone / !6
0.7907 2025-08-16 BURAK
- Fix for CentOS / !5
0.7906 2025-08-16 BURAK
- Fix for "Can't open /etc/ARRAY(0xdeadbeef): No such file or directory at ..."
- Update Debian release names.
- Fallback to picking the edition from the integer versions list.
0.7905 2018-12-31 BURAK
0.7904 2018-12-27 BURAK
- Migrate to dzil.
0.7903 Wed May 8 04:47:19 2013
- Fix for Debian.
0.7902 Mon Nov 26 04:08:14 2012
- Use full path to ifconfig.
- Fixes for ::Distribution
0.7901 Sun Jul 15 23:45:45 2012
- Workaround for the missing /etc/lsb-release and existing /etc/lsb-release.d/ (CentOS)
- Attach " Linux" to the name only if it doesn't have that already (RHEL).
- Fix for RT#72673 and RT#77563 (RHEL&CentOS)
0.7900 Thu Jan 5 00:21:39 2012
- Fix RT#72586 (mcholste)
- Fix RT#70510 (jquelin, pjedwards)
- Updated edition lists.
0.7801 Sun Jul 31 00:10:35 2011
- Added a diag section to unit test and some code to SPEC to disable
nonsense smoker setups.
- Move constants from base module into the driver specific one.
It's nonsense to have driver specific stuff in the base classes
anyway.
0.78 Sat Apr 16 15:39:39 2011
- Just increased the version number.
0.77 Thu Aug 5 01:34:42 2010
- Fix Fedora version handling. Reported by Mark T. Kennedy.
0.76 Sat Jul 17 01:44:28 2010
- Internal cleanup.
0.75_01 Fri Apr 2 03:31:54 2010
- Split data parts from ::Distribution into ::Distribution::Conf
- Several complex data structures are now converted to a simple
configuration file (a string in the ::Conf module currently)
- Config::General is now a dependency.
- CentOS patch by Tom Skrainar.
0.74 Fri Jan 15 01:48:58 2010
- Fix for "The stat preceding -l _ wasn't an lstat" failures.
0.73 Sun Jan 10 08:18:25 2010
- Add Ubuntu 9.04 to editions list.
- Support new uname().
- Perl::Critic refactoring.
- Merge Linux::Distribution as Sys::Info::Driver::Linux::OS::Distribution
since the original is not maintained and was a fragile dependency.
- Fix RT#42437.
0.72 Thu Apr 23 17:32:32 2009
- Update builder.
0.70 Mon Apr 6 03:54:23 2009
- Bump version for new stable release.
0.69_11 Sat Apr 4 07:15:36 2009
- Implement bitness.
0.69_10 Fri Apr 3 22:45:27 2009
- Update test suite.
0.69_06 Sat Mar 14 06:20:17 2009
- Update test suite.
0.69_05 Sat Mar 14 01:52:57 2009
- Fix build tools.
0.69_02 Fri Mar 6 04:14:39 2009
- Add support for more distro code names.
- Fix domain name.
0.69_01 Thu Mar 5 04:01:14 2009
- Separation from Sys::Info.
Sys-Info-Driver-Linux-0.7908/MANIFEST 000644 000765 000024 00000001100 15047747607 017227 0 ustar 00burak staff 000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.033.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
dist.ini
lib/Sys/Info/Driver/Linux.pm
lib/Sys/Info/Driver/Linux/Constants.pm
lib/Sys/Info/Driver/Linux/Device.pm
lib/Sys/Info/Driver/Linux/Device/CPU.pm
lib/Sys/Info/Driver/Linux/OS.pm
lib/Sys/Info/Driver/Linux/OS/Distribution.pm
lib/Sys/Info/Driver/Linux/OS/Distribution/Conf.pm
t/00-compile.t
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/03-basic.t
t/04-distribution.t
t/author-distmeta.t
t/author-pod-coverage.t
t/author-pod-syntax.t
Sys-Info-Driver-Linux-0.7908/t/ 000755 000765 000024 00000000000 15047747607 016351 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/META.yml 000644 000765 000024 00000001703 15047747607 017360 0 ustar 00burak staff 000000 000000 ---
abstract: 'Linux driver for Sys::Info'
author:
- 'Burak Gursoy'
build_requires:
ExtUtils::MakeMaker: '0'
File::Spec: '0'
IO::Handle: '0'
IPC::Open3: '0'
Test::More: '0'
Test::Sys::Info: '0.20'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'Dist::Zilla version 6.033, CPAN::Meta::Converter version 2.150010'
keywords:
- sys
- system
- info
- linux
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Sys-Info-Driver-Linux
requires:
Config::General: '0'
Sys::Info::Base: '0.7801'
Unix::Processors: '0'
parent: '0'
perl: '5.010'
resources:
bugtracker: https://github.com/burak/CPAN-Sys-Info-Driver-Linux/issues
repository: git://github.com/burak/CPAN-Sys-Info-Driver-Linux.git
version: '0.7908'
x_generated_by_perl: v5.40.1
x_serialization_backend: 'YAML::Tiny version 1.76'
x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
Sys-Info-Driver-Linux-0.7908/lib/ 000755 000765 000024 00000000000 15047747607 016654 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/Makefile.PL 000644 000765 000024 00000003573 15047747607 020070 0 ustar 00burak staff 000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.033.
use strict;
use warnings;
use 5.010;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Linux driver for Sys::Info",
"AUTHOR" => "Burak Gursoy",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "Sys-Info-Driver-Linux",
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.010",
"NAME" => "Sys::Info::Driver::Linux",
"PREREQ_PM" => {
"Config::General" => 0,
"Sys::Info::Base" => "0.7801",
"Unix::Processors" => 0,
"parent" => 0
},
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Test::More" => 0,
"Test::Sys::Info" => "0.20"
},
"VERSION" => "0.7908",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Config::General" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Sys::Info::Base" => "0.7801",
"Test::More" => 0,
"Test::Sys::Info" => "0.20",
"Unix::Processors" => 0,
"parent" => 0
);
# inserted by Dist::Zilla::Plugin::DynamicPrereqs 0.040
# BEGIN dynamic
# This section is used/injected by dzil and not to be executed as a
# standalone program
# copy-paste from Sys::Info::Constants
die "OS unsupported\n" if $^O !~ m{linux}xmsi;
my @crucial = qw(
/proc/cpuinfo
);
foreach my $file ( @crucial ) {
next if -e $file;
warn "You have a bogus Linux system which is missing $file\n";
die "OS unsupported\n";
}
# END dynamic
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
Sys-Info-Driver-Linux-0.7908/META.json 000644 000765 000024 00000003661 15047747607 017535 0 ustar 00burak staff 000000 000000 {
"abstract" : "Linux driver for Sys::Info",
"author" : [
"Burak Gursoy"
],
"dynamic_config" : 1,
"generated_by" : "Dist::Zilla version 6.033, CPAN::Meta::Converter version 2.150010",
"keywords" : [
"sys",
"system",
"info",
"linux"
],
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "Sys-Info-Driver-Linux",
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
"Pod::Coverage::TrustPod" : "0",
"Test::CPAN::Meta" : "0",
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08"
}
},
"runtime" : {
"requires" : {
"Config::General" : "0",
"Sys::Info::Base" : "0.7801",
"Unix::Processors" : "0",
"parent" : "0",
"perl" : "5.010"
}
},
"test" : {
"recommends" : {
"CPAN::Meta" : "2.120900"
},
"requires" : {
"ExtUtils::MakeMaker" : "0",
"File::Spec" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0",
"Test::Sys::Info" : "0.20"
}
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/burak/CPAN-Sys-Info-Driver-Linux/issues"
},
"repository" : {
"type" : "git",
"url" : "git://github.com/burak/CPAN-Sys-Info-Driver-Linux.git",
"web" : "https://github.com/burak/CPAN-Sys-Info-Driver-Linux"
}
},
"version" : "0.7908",
"x_generated_by_perl" : "v5.40.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.39",
"x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
}
Sys-Info-Driver-Linux-0.7908/dist.ini 000644 000765 000024 00000002161 15047747607 017552 0 ustar 00burak staff 000000 000000 ; basic stuff
name = Sys-Info-Driver-Linux
author = Burak Gursoy
license = Perl_5
copyright_holder = Burak Gursoy
copyright_year = 2006
; file modifiers
[PkgVersion]
[PodWeaver]
; file generators
[ManifestSkip]
[Manifest]
[License]
[MakeMaker]
[PruneCruft]
[GatherDir]
exclude_filename = weaver.ini
exclude_match = Sys-Info-Driver-Linux-[0-9]+
; metadata
[MetaYAML]
[MetaJSON]
[Keywords]
keywords = sys system info linux
[Prereqs / Build]
-phase = test
Test::Sys::Info = 0.20
[Prereqs]
perl = 5.010
parent = 0
Sys::Info::Base = 0.7801
Unix::Processors = 0
Config::General = 0
[ExecDir]
[ShareDir]
[GitHub::Meta]
[Meta::Contributors]
[DynamicPrereqs]
-body_from_file=check_os.pl
; tests
[MetaTests]
[ExtraTests]
[PodSyntaxTests]
[PodCoverageTests]
[Test::ReportPrereqs]
[Test::Compile]
; release
[NextRelease]
format = %v %{yyyy-MM-dd}d %P
[TestRelease]
[ConfirmRelease]
[UploadToCPAN]
; git
[Git::Check]
[Git::Commit]
commit_msg = Changes for version %v
[Git::Tag]
tag_format = v%v
tag_message = %N v%v
[Git::Push]
push_to = origin
[Git::NextVersion]
Sys-Info-Driver-Linux-0.7908/lib/Sys/ 000755 000765 000024 00000000000 15047747607 017432 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/ 000755 000765 000024 00000000000 15047747607 020325 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/ 000755 000765 000024 00000000000 15047747607 021560 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/ 000755 000765 000024 00000000000 15047747607 022657 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux.pm 000644 000765 000024 00000002617 15047747607 023223 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux;
$Sys::Info::Driver::Linux::VERSION = '0.7908';
use strict;
use warnings;
use parent qw( Exporter );
our @EXPORT = qw( proc );
use constant proc => { ## no critic (NamingConventions::Capitalization)
loadavg => '/proc/loadavg', # average cpu load
cpuinfo => '/proc/cpuinfo', # cpu information
uptime => '/proc/uptime', # uptime file
version => '/proc/version', # os version
meminfo => '/proc/meminfo',
swaps => '/proc/swaps',
fstab => '/etc/fstab', # for filesystem type of the current disk
resolv => '/etc/resolv.conf',
timezone_old => '/etc/timezone',
timezone => '/etc/localtime',
issue => '/etc/issue',
};
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
use Sys::Info::Driver::Linux;
=head1 DESCRIPTION
This is the main module in the C driver collection.
=head1 NAME
Sys::Info::Driver::Linux - Linux driver for Sys::Info
=head1 METHODS
None.
=head1 CONSTANTS
=head2 proc
Automatically exported. Includes paths to several files.
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/Constants.pm 000644 000765 000024 00000004162 15047747607 025174 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux::Constants;
$Sys::Info::Driver::Linux::Constants::VERSION = '0.7908';
use strict;
use warnings;
use parent qw( Exporter );
# uptime
use constant UP_TIME => 0;
use constant IDLE_TIME => 1;
# fstab entries
use constant FS_SPECIFIER => 0;
use constant MOUNT_POINT => 1;
use constant FS_TYPE => 2;
use constant MOUNT_OPTS => 3;
use constant DUMP_FREQ => 4;
use constant FS_CHECK_ORDER => 5;
# getpwnam()
use constant REAL_NAME_FIELD => 6;
# format: 'Linux version 1.2.3 (foo@bar.com)'
# format: 'Linux version 1.2.3 (foo@bar.com) (gcc 1.2.3)'
# format: 'Linux version 1.2.3 (foo@bar.com) (gcc 1.2.3 (Redhat blah blah))'
use constant RE_LINUX_VERSION => qr{
\A
Linux \s+ version \s
(.+?)
\s
[(] .+? \@ .+? [)]
(.*?)
\z
}xmsi;
# format: 'linux foo.domain.bar 1.2.3-foo'
use constant RE_LINUX_VERSION2 => qr{
\A
linux \s+ [a-zA-Z0-9.]+ \s+
([a-zA-Z0-9.]+)?
}xmsi;
our %EXPORT_TAGS = (
uptime => [qw/
UP_TIME
IDLE_TIME
/],
fstab => [qw/
FS_SPECIFIER
MOUNT_POINT
FS_TYPE
MOUNT_OPTS
DUMP_FREQ
FS_CHECK_ORDER
/],
user => [qw/
REAL_NAME_FIELD
/],
general => [qw/
RE_LINUX_VERSION
RE_LINUX_VERSION2
/],
);
our @EXPORT_OK = map { @{ $_ } } values %EXPORT_TAGS;
$EXPORT_TAGS{all} = \@EXPORT_OK;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux::Constants
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
=head1 DESCRIPTION
Constants for Linux driver.
=head1 NAME
Sys::Info::Driver::Linux::Constants - Constants for Linux driver
=head1 METHODS
None.
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/Device.pm 000644 000765 000024 00000001334 15047747607 024415 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux::Device;
$Sys::Info::Driver::Linux::Device::VERSION = '0.7908';
use strict;
use warnings;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux::Device
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
use parent qw( Sys::Info::Driver::Linux::Device );
=head1 DESCRIPTION
Base class for Linux device drivers.
=head1 NAME
Sys::Info::Driver::Linux::Device - Base class for Linux device drivers
=head1 METHODS
None.
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/OS.pm 000644 000765 000024 00000023772 15047747607 023551 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux::OS;
$Sys::Info::Driver::Linux::OS::VERSION = '0.7908';
use strict;
use warnings;
use parent qw( Sys::Info::Base );
use POSIX ();
use Cwd;
use Carp qw( croak );
use Sys::Info::Driver::Linux;
use Sys::Info::Driver::Linux::Constants qw( :all );
use constant FSTAB_LENGTH => 6;
##no critic (InputOutput::ProhibitBacktickOperators)
sub init {
my $self = shift;
$self->{OSVERSION} = undef; # see _populate_osversion
$self->{FILESYSTEM} = undef; # see _populate_fs
return;
}
# unimplemented
sub logon_server {}
sub edition {
return shift->_populate_osversion->{OSVERSION}{RAW}{EDITION};
}
sub tz {
my $self = shift;
my $old_tz_file = proc->{timezone_old};
my $tz_file = proc->{timezone};
my $rv;
if ( -e $tz_file ) {
if ( ! -l $tz_file ) {
die "The timezone file $tz_file is not a symbolic link!";
}
else {
my $name = readlink $tz_file;
my $junk = quotemeta '/usr/share/zoneinfo/';
$name =~ s{ \A $junk }{}xmsg;
$rv = $name;
}
}
elsif ( -e $old_tz_file ) {
$rv = chomp( my $rv = $self->slurp( $old_tz_file ) );
}
else {
# warn?
}
return $rv;
}
sub meta {
my $self = shift->_populate_osversion;
require POSIX;
require Sys::Info::Device;
my $cpu = Sys::Info::Device->new('CPU');
my $arch = ($cpu->identify)[0]->{architecture};
my %mem = $self->_parse_meminfo;
my @swaps = $self->_parse_swap;
my %info;
$info{manufacturer} = $self->{OSVERSION}{MANUFACTURER};
$info{build_type} = undef;
$info{owner} = undef;
$info{organization} = undef;
$info{product_id} = undef;
$info{install_date} = $self->{OSVERSION}{RAW}{BUILD_DATE};
$info{boot_device} = undef;
$info{physical_memory_total} = $mem{MemTotal};
$info{physical_memory_available} = $mem{MemFree};
$info{page_file_total} = $mem{SwapTotal};
$info{page_file_available} = $mem{SwapFree};
# windows specific
$info{windows_dir} = undef;
$info{system_dir} = undef;
$info{system_manufacturer} = undef;
$info{system_model} = undef;
$info{system_type} = sprintf '%s based Computer', $arch;
$info{page_file_path} = join ', ', map { $_->{Filename} } @swaps;
return %info;
}
sub tick_count {
my $self = shift;
my $uptime = $self->slurp( proc->{uptime} ) || return 0;
my @uptime = split /\s+/xms, $uptime;
# this file has two entries. uptime is the first one. second: idle time
return $uptime[UP_TIME];
}
sub name {
my($self, @args) = @_;
$self->_populate_osversion;
my %opt = @args % 2 ? () : @args;
my $id = $opt{long} ? 'LONGNAME' : 'NAME';
return $self->{OSVERSION}{ $opt{edition} ? $id . '_EDITION' : $id };
}
sub version { return shift->_populate_osversion->{OSVERSION}{VERSION} }
sub build { return shift->_populate_osversion->{OSVERSION}{RAW}{BUILD_DATE} }
sub uptime { return time - shift->tick_count }
# user methods
sub is_root {
return 0 if defined &Sys::Info::EMULATE;
my $name = login_name();
my $id = POSIX::geteuid();
my $gid = POSIX::getegid();
return 0 if $@;
return 0 if ! defined $id || ! defined $gid;
return $id == 0 && $gid == 0 && $name eq 'root';
}
sub login_name {
my($self, @args) = @_;
my %opt = @args % 2 ? () : @args;
my $login = POSIX::getlogin() || return;
my $rv = eval { $opt{real} ? (getpwnam $login)[REAL_NAME_FIELD] : $login };
$rv =~ s{ [,]{3,} \z }{}xms if $opt{real};
return $rv;
}
sub node_name { return shift->uname->{nodename} }
sub domain_name {
my $self = shift;
# hmmmm...
foreach my $line ( $self->read_file( proc->{resolv} ) ) {
chomp $line;
if ( $line =~ m{\A domain \s+ (.*) \z}xmso ) {
return $1;
}
}
my $sys = qx{dnsdomainname 2> /dev/null};
return $sys;
}
sub fs {
my $self = shift;
$self->{current_dir} = Cwd::getcwd();
my(@fstab, @junk, $re);
foreach my $line( $self->read_file( proc->{fstab} ) ) {
chomp $line;
next if $line =~ m{ \A \# }xms;
@junk = split /\s+/xms, $line;
next if ! @junk || @junk != FSTAB_LENGTH;
next if lc($junk[FS_TYPE]) eq 'swap'; # ignore swaps
$re = $junk[MOUNT_POINT];
next if $self->{current_dir} !~ m{\Q$re\E}xmsi;
push @fstab, [ $re, $junk[FS_TYPE] ];
}
@fstab = reverse sort { $a->[0] cmp $b->[0] } @fstab if @fstab > 1;
my $fstype = $fstab[0]->[1];
my $attr = $self->_fs_attributes( $fstype );
return
filesystem => $fstype,
($attr ? %{$attr} : ())
;
}
sub bitness { return shift->uname->{machine} =~ m{64}xms ? '64' : '32' }
# ------------------------[ P R I V A T E ]------------------------ #
sub _parse_meminfo {
my $self = shift;
my %mem;
foreach my $line ( split /\n/xms, $self->slurp( proc->{meminfo} ) ) {
chomp $line;
my($k, $v) = split /:/xms, $line;
# units in KB
$mem{ $k } = (split /\s+/xms, $self->trim( $v ) )[0];
}
return %mem;
}
sub _parse_swap {
my $self = shift;
my @swaps = split /\n/xms, $self->slurp( proc->{swaps} );
my @swap_title = split /\s+/xms, shift @swaps;
my @swap_list;
foreach my $line ( @swaps ) {
chomp $line;
my @data = split /\s+/xms, $line;
push @swap_list,
{
map { $swap_title[$_] => $data[$_] } 0..$#swap_title
};
}
return @swap_list;
}
sub _ip {
my $self = shift;
my $cmd = q{/sbin/ifconfig};
return if ! -e $cmd || ! -x _;
my $raw = qx($cmd);
return if not $raw;
my @raw = split /inet addr/xms, $raw;
return if ! @raw || @raw < 2 || ! $raw[1];
if ( $raw[1] =~ m{(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})}xms ) {
return $1;
}
return;
}
sub _populate_osversion {
my $self = shift;
return $self if $self->{OSVERSION};
require Sys::Info::Driver::Linux::OS::Distribution;
my $distro = Sys::Info::Driver::Linux::OS::Distribution->new;
my $osname = $distro->name;
my $V = $distro->version;
my $edition = $distro->edition;
my $kernel = $distro->kernel;
my $build = $distro->build;
my $build_date = $distro->build_date;
my $manufacturer = $distro->manufacturer || q{};
$self->{OSVERSION} = {
NAME => $osname,
NAME_EDITION => $edition ? "$osname ($edition)" : $osname,
LONGNAME => q{}, # will be set below
LONGNAME_EDITION => q{}, # will be set below
VERSION => $V,
KERNEL => $kernel,
MANUFACTURER => $manufacturer,
RAW => {
BUILD => defined $build ? $build : 0,
BUILD_DATE => defined $build_date ? $build_date : 0,
EDITION => $edition,
},
};
my $o = $self->{OSVERSION};
my $t = '%s %s (kernel: %s)';
$o->{LONGNAME} = sprintf $t, $o->{NAME}, $o->{VERSION}, $kernel;
$o->{LONGNAME_EDITION} = sprintf $t, $o->{NAME_EDITION}, $o->{VERSION}, $kernel;
return $self;
}
sub _fs_attributes {
my $self = shift;
my $fs = shift;
return {
ext3 => {
case_sensitive => 1, #'supports case-sensitive filenames',
preserve_case => 1, #'preserves the case of filenames',
unicode => 1, #'supports Unicode in filenames',
#acl => '', #'preserves and enforces ACLs',
#file_compression => '', #'supports file-based compression',
#disk_quotas => '', #'supports disk quotas',
#sparse => '', #'supports sparse files',
#reparse => '', #'supports reparse points',
#remote_storage => '', #'supports remote storage',
#compressed_volume => '', #'is a compressed volume (e.g. DoubleSpace)',
#object_identifiers => '', #'supports object identifiers',
efs => '1', #'supports the Encrypted File System (EFS)',
#max_file_length => '';
},
}->{$fs};
}
1;
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux::OS
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
-
=head1 DESCRIPTION
-
=head1 NAME
Sys::Info::Driver::Linux::OS - Linux backend
=head1 METHODS
Please see L for definitions of these methods and more.
=head2 build
=head2 domain_name
=head2 edition
=head2 fs
=head2 init
=head2 is_root
=head2 login_name
=head2 logon_server
=head2 meta
=head2 name
=head2 node_name
=head2 tick_count
=head2 tz
=head2 uptime
=head2 version
=head2 bitness
=head1 SEE ALSO
L, L,
The C virtual filesystem:
L.
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
__END__
sub _fetch_user_info {
my %user;
$user{NAME} = POSIX::getlogin();
$user{REAL_USER_ID} = POSIX::getuid(); # $< uid
$user{EFFECTIVE_USER_ID} = POSIX::geteuid(); # $> effective uid
$user{REAL_GROUP_ID} = POSIX::getgid(); # $( guid
$user{EFFECTIVE_GROUP_ID} = POSIX::getegid(); # $) effective guid
my %junk;
# quota, comment & expire are unreliable
@junk{qw(name passwd uid gid
quota comment gcos dir shell expire)} = getpwnam($user{NAME});
$user{REAL_NAME} = defined $junk{gcos} ? $junk{gcos} : '';
$user{COMMENT} = defined $junk{comment} ? $junk{comment} : '';
return %user;
}
Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/Device/ 000755 000765 000024 00000000000 15047747607 024056 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/OS/ 000755 000765 000024 00000000000 15047747607 023200 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/OS/Distribution/ 000755 000765 000024 00000000000 15047747607 025657 5 ustar 00burak staff 000000 000000 Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/OS/Distribution.pm 000755 000765 000024 00000031531 15047747607 026223 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux::OS::Distribution;
$Sys::Info::Driver::Linux::OS::Distribution::VERSION = '0.7908';
use strict;
use warnings;
use constant STD_RELEASE => 'lsb-release';
use constant STD_RELEASE_DIR => 'lsb-release.d';
use constant DEBIAN_RELEASE => 'os-release';
use constant STD_ETC_DIR => '/etc';
use parent qw( Sys::Info::Base );
use Carp qw( croak );
use Sys::Info::Driver::Linux;
use Sys::Info::Driver::Linux::Constants qw( :all );
use Sys::Info::Driver::Linux::OS::Distribution::Conf;
use File::Spec;
# XXX:
my $RELX = sub {
my $master = shift;
my $t = sub {
my($k, $v) = @_;
return map { $_ => $v} ref $k ? @{$k} : ($k);
};
map { $t->($CONF{$_}->{$master}, $_ ) }
grep { $CONF{$_}->{$master} }
keys %CONF
};
my %ORIGINAL_RELEASE = $RELX->('release');
my %DERIVED_RELEASE = $RELX->('release_derived');
#
sub new {
my $class = shift;
my %option;
if ( @_ ) {
die "Parameters must be in name => value format" if @_ % 2;
%option = @_;
}
my $self = {
DISTRIB_ID => q{},
DISTRIB_NAME => q{}, # workround field for new distros
DISTRIB_RELEASE => q{},
DISTRIB_CODENAME => q{},
DISTRIB_DESCRIPTION => q{},
release_file => q{},
pattern => q{},
PROBE => undef,
RESULTS => undef,
etc_dir => STD_ETC_DIR,
%option,
};
$self->{etc_dir} =~ s{[/]+$}{}xms;
bless $self, $class;
$self->_initial_probe;
return $self;
}
sub raw_name { return shift->{RESULTS}{raw_name} }
sub name { return shift->{RESULTS}{name} }
sub version { return shift->{RESULTS}{version} }
sub edition { return shift->{RESULTS}{edition} }
sub kernel { return shift->{PROBE}{kernel} }
sub build { return shift->{PROBE}{build} }
sub build_date { return shift->{PROBE}{build_date} }
sub manufacturer {
my $self = shift;
my $slot = $CONF{ lc $self->raw_name } || return;
return if ! exists $slot->{manufacturer};
return $slot->{manufacturer};
}
sub _probe {
my $self = shift;
return $self->{RESULTS} if $self->{RESULTS};
$self->{RESULTS} = {};
$self->{RESULTS}{name} = $self->_probe_name;
$self->{RESULTS}{raw_name} = $self->{RESULTS}{name};
$self->{RESULTS}{version} = $self->_probe_version;
# this has to be last, since this also modifies the two above
$self->{RESULTS}{edition} = $self->_probe_edition;
return $self->{RESULTS};
}
sub _probe_name {
my $self = shift;
my $distro = $self->_get_lsb_info;
return $distro if $distro;
return $self->_probe_release( \%DERIVED_RELEASE )
|| $self->_probe_release( \%ORIGINAL_RELEASE );
}
sub _probe_release {
my($self, $r) = @_;
foreach my $id ( keys %{ $r } ) {
my $file = File::Spec->catfile( $self->{etc_dir}, $id );
if ( -f $file && ! -l $file ) {
$self->{DISTRIB_ID} = $r->{ $id };
$self->{release_file} = $id;
return $self->{DISTRIB_ID};
}
}
return;
}
sub _probe_version {
my $self = shift;
my $release = $self->_get_lsb_info('DISTRIB_RELEASE');
my $dist_id = $self->{DISTRIB_ID};
if ( ! $dist_id && ! $self->name ) {
# centos will return a string, but if couldn't detect the thing, it is
# better to return that instead.
return $release if $release;
croak 'No version because no distribution';
}
my $slot = $CONF{ lc $dist_id };
$self->{pattern} = exists $slot->{version_match}
? $slot->{version_match}
: q{};
my $slot_release = $slot->{release}
? ref $slot->{release} eq 'ARRAY' ? $slot->{release}[0] : $slot->{release}
: undef
;
local $self->{release_file} = $slot_release if $slot_release;
my $vrelease = $self->_get_file_info;
# Set to the original if we got any, othwerwise try the version
$self->{DISTRIB_RELEASE} = $release || $vrelease;
# Opposite of above as we want a version number
# if we were able locate one
return $vrelease || $release;
}
sub _probe_edition {
my $self = shift;
my $p = $self->{PROBE};
if ( my $dn = $self->name ) {
my $n = $self->{DISTRIB_NAME} || do {
my $slot = $CONF{ $dn };
exists $slot->{name} ? $slot->{name} : ucfirst $dn;
};
$dn = $self->trim( $n );
$dn .= ' Linux' if $dn !~ m{Linux}xmsi;
$self->{RESULTS}{name} = $dn;
}
else {
$self->{RESULTS}{name} = $p->{distro};
$self->{RESULTS}{version} = $p->{kernel};
}
my $name = $self->name;
my $raw_name = $self->raw_name;
my $version = $self->version;
my $slot = $CONF{$raw_name} || return;
my $int_version = int($version) . '.0';
my $edition;
if ( exists $slot->{edition} ) {
my $this_ve = $slot->{edition}{ $version };
if ( $this_ve ) {
$edition = $this_ve;
}
elsif ( my $this_ie = $slot->{edition}{$int_version} ) {
$edition = $this_ie;
}
else {
# warn?
}
}
if ( ! $edition ) {
if ( $version && $version !~ m{[0-9]}xms ) {
if ( $name =~ m{debian}xmsi ) {
my @buf = split m{/}xms, $version;
if ( my $test = $CONF{debian}->{vfix}{ lc $buf[0] } ) {
# Debian version comes as the edition name
$edition = $version;
$self->{RESULTS}{version} = $test;
}
}
}
else {
if ( $slot->{use_codename_for_edition}
&& $self->{DISTRIB_CODENAME}
) {
my $cn = $self->{DISTRIB_CODENAME};
$edition = $cn if $cn !~ m{[0-9]}xms;
}
}
}
return $edition;
}
sub _initial_probe {
my $self = shift;
my $version = q{};
if ( -e proc->{version} && -f _) {
$version = $self->trim(
$self->slurp(
proc->{version},
'I can not open linux version file %s for reading: '
)
);
}
my($str, $build_date) = split /\#/xms, $version;
my($kernel, $distro) = (q{},q{});
#$build_date = "1 Fri Jul 23 20:48:29 CDT 2004';";
#$build_date = "1 SMP Mon Aug 16 09:25:06 EDT 2004";
$build_date = q{} if not $build_date; # running since blah thingie
if ( $str =~ RE_LINUX_VERSION || $str =~ RE_LINUX_VERSION2 ) {
$kernel = $1;
if ( $distro = $self->trim( $2 ) ) {
if ( $distro =~ m{ \s\((.+?)\)\) \z }xms ) {
$distro = $1;
}
}
}
$distro = 'Linux' if ! $distro || $distro =~ m{\(gcc}xms;
# kernel build date
$build_date = $self->date2time($build_date) if $build_date;
my $build = $build_date ? localtime $build_date : q{};
$self->{PROBE} = {
version => $version,
kernel => $kernel,
build => $build,
build_date => $build_date,
distro => $distro,
};
$self->_probe;
return;
}
sub _get_lsb_info {
my $self = shift;
my $field = shift || 'DISTRIB_ID';
my $tmp = $self->{release_file};
my($rfile) = grep { -r $_->[1] }
map {
[ $_ => File::Spec->catfile( $self->{etc_dir}, $_ ) ]
}
STD_RELEASE,
DEBIAN_RELEASE
;
if ( $rfile ) {
$self->{release_file} = $rfile->[0];
$self->{pattern} = $field . '=(.+)';
my $info = $self->_get_file_info;
return $self->{$field} = $info if $info;
}
else {
# CentOS6+? RHEL? Any new distro?
my $dir = File::Spec->catdir( $self->{etc_dir}, STD_RELEASE_DIR );
if ( -d $dir ) {
my $rv = join q{: },
map { m{$dir/(.*)}xms ? $1 : () }
grep { $_ !~ m{ \A [.] }xms }
glob "$dir/*";
$self->{LSB_VERSION} = $rv if $rv;
}
my($release) = do {
if ( my @files = glob $self->{etc_dir} . "/*release" ) {
my($real) = sort grep { ! -l } @files;
my %uniq = map { $self->trim( $self->slurp( $_ ) ) => 1 }
@files;
if ( $real ) {
my $etc = $self->{etc_dir};
($self->{release_file} = $real) =~ s{$etc/}{}xms;
$self->{pattern} = '(.+)';
}
keys %uniq;
}
};
return if ! $release; # huh?
my($rname) = split m{\-}xms, $self->{release_file};
my($distrib_id, @rest) = split m{release}xms, $release, 2;
my($version, $codename) = split m{ \s+ }xms, $self->trim( join ' ', @rest ), 2;
$codename =~ s{[()]}{}xmsg if $codename;
$distrib_id = $self->trim( $distrib_id );
$self->{DISTRIB_DESCRIPTION} = $release;
$self->{DISTRIB_ID} = $rname || $distrib_id;
$self->{DISTRIB_NAME} = $distrib_id;
$self->{DISTRIB_RELEASE} = $version;
$self->{DISTRIB_CODENAME} = $codename || q{};
# fix stupidity
if ( $self->{DISTRIB_ID}
&& $self->{DISTRIB_ID} eq 'redhat'
&& $self->{DISTRIB_NAME}
&& index($self->{DISTRIB_NAME}, 'CentOS') != -1
) {
$self->{DISTRIB_ID} = 'centos';
}
return $self->{ $field } if $self->{ $field };
}
$self->{release_file} = $tmp;
$self->{pattern} = q{};
return;
}
sub _get_file_info {
my $self = shift;
my $file = File::Spec->catfile( $self->{etc_dir}, $self->{release_file} );
require IO::File;
my $FH = IO::File->new;
$FH->open( $file, '<' ) || croak "Can't open $file: $!";
my @raw = <$FH>;
$FH->close || croak "Can't close FH($file): $!";
my $new_pattern =
$self->{pattern} =~ m{ \A DISTRIB_ID \b }xms ? '^ID=(.+)'
: $self->{pattern} =~ m{ \A DISTRIB_RELEASE \b }xms ? '^PRETTY_NAME=(.+)'
: undef;
my $rv;
foreach my $line ( @raw ){
chomp $line;
next if ! $line;
## no critic (RequireExtendedFormatting)
my($info) = $line =~ m/$self->{pattern}/ms;
if ( $info ) {
$rv = "\L$info";
last;
}
elsif ( $new_pattern ) {
## no critic (RequireExtendedFormatting)
my($info2) = $line =~ m/$new_pattern/ms;
if ( $info2 ) {
$rv = "\L$info2";
last;
}
}
}
if ( $rv ) {
$rv =~ s{ \A ["] }{}xms;
$rv =~ s{ ["] \z }{}xms;
}
return $rv;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux::OS::Distribution
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
use Sys::Info::Driver::Linux::OS::Distribution;
my $distro = Sys::Info::Driver::Linux::OS::Distribution->new;
my $name = $distro->name;
if( $name ) {
my $version = $distro->version;
print "you are running $distro, version $version\n";
}
else {
print "distribution unknown\n";
}
=head1 DESCRIPTION
This is a simple module that tries to guess on what linux distribution
we are running by looking for release's files in /etc. It now looks for
'lsb-release' first as that should be the most correct and adds ubuntu support.
Secondly, it will look for the distro specific files.
It currently recognizes slackware, debian, suse, fedora, redhat, turbolinux,
yellowdog, knoppix, mandrake, conectiva, immunix, tinysofa, va-linux, trustix,
adamantix, yoper, arch-linux, libranet, gentoo, ubuntu and redflag.
It has function to get the version for debian, suse, redhat, gentoo, slackware,
redflag and ubuntu(lsb). People running unsupported distro's are greatly
encouraged to submit patches.
=head1 NAME
Sys::Info::Driver::Linux::OS::Distribution - Linux distribution probe
=head1 METHODS
=head2 build
=head2 build_date
=head2 edition
=head2 kernel
=head2 manufacturer
=head2 name
=head2 new
=head2 raw_name
=head2 version
=head1 TODO
Add the capability of recognize the version of the distribution for all
recognized distributions.
=head1 Linux::Distribution AUTHORS
Some parts of this module were originally taken from C
and it's authors are:
Alberto Re Ealberto@accidia.netE
Judith Lebzelter Ejudith@osdl.orgE
Alexandr Ciornii Ealexchorny@gmail.com
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/OS/Distribution/Conf.pm 000644 000765 000024 00000014570 15047747607 027111 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux::OS::Distribution::Conf;
$Sys::Info::Driver::Linux::OS::Distribution::Conf::VERSION = '0.7908';
use strict;
use warnings;
use parent qw( Exporter );
use Config::General ();
our @EXPORT = qw( %CONF );
our %CONF = Config::General::ParseConfig( -String => <<'RAW' );
# Some parts of this data set was initially taken from Wikipedia
release_derived = adamantix_version
release = arch-release
manufacturer = Lance Davis
release = redhat-release
version_match = CentOS(?: Linux)? release (.*) \(
release_derived = conectiva-release
manufacturer = Debian Project
version_match = (.+)
release = debian_version
release = debian_release
1.1 = buzz
1.2 = rex
1.3 = bo
2.0 = hamm
2.1 = slink
2.2 = potato
3.0 = woody
3.1 = sarge
4.0 = etch
5.0 = lenny
6.0 = squeeze
7.0 = wheezy
8.0 = jessie
9.0 = stretch
10.0 = buster
11.0 = bullseye
12.0 = bookworm
13.0 = trixie
14.0 = forky
15.0 = duke
# we get the version as "lenny/sid" for example
buzz = 1.1
rex = 1.2
bo = 1.3
hamm = 2.0
slink = 2.1
potato = 2.2
woody = 3.0
sarge = 3.1
etch = 4.0
lenny = 5.0
squeeze = 6.0
wheezy = 7.0
jessie = 8.0
stretch = 9.0
buster = 10.0
bullseye = 11.0
bookworm = 12.0
trixie = 13.0
forky = 14.0
duke = 15.0
manufacturer = Fedora Project
version_match = Fedora (?:Core )?release (\d+) \(
release_derived = fedora-release
1 = Yarrow
2 = Tettnang
3 = Heidelberg
4 = Stentz
5 = Bordeaux
6 = Zod
7 = Moonshine
8 = Werewolf
9 = Sulphur
10 = Cambridge
11 = Leonidas
12 = Constantine
13 = Goddard
14 = Laughlin
15 = Lovelock
16 = Verne
17 = Beefy Miracle
manufacturer = Gentoo Foundation
version_match = Gentoo Base System version (.*)
release = gentoo-release
release_derived = immunix-release
manufacturer = Klaus Knopper
release_derived = knoppix-version
release_derived = libranet_version
release = mandrake-release
release = mandrakelinux-release
manufacturer = Mandriva
5.1 = Venice
5.2 = Leeloo
5.3 = Festen
6.0 = Venus
6.1 = Helios
7.0 = Air
7.1 = Helium
7.2 = Odyssey
8.0 = Traktopel
8.1 = Vitamin
8.2 = Bluebird
9.0 = Dolphin
9.1 = Bamboo
9.2 = FiveStar
10.0 = Community
10.1 = Community
10.2 = Limited Edition 2005
2006.0 = 2006
2007 = 2007
2007.1 = 2007 Spring
2008.0 = 2008
2008.1 = 2008 Spring
2009.0 = 2009
2009.1 = 2009 Spring
2010.0 = 2010
2010.1 = 2010 Spring
2010.2 = 2010.2
2011.0 = Hydrogen
version_match = Red Flag (?:Desktop|Linux) (?:release |\()(.*?)(?: \(.+)?\)
release_derived = redflag-release
manufacturer = Red Hat, Inc.
version_match = Red Hat (?:Enterprise )?Linux (?:Server )release (.*) \(
release = redhat-release
release = redhat_version
release = centos-release
use_codename_for_edition = 1
version_match = \APardus (.+)\z
release_derived = pardus-release
manufacturer = Patrick Volkerding
version_match = \ASlackware (.+)\z
release = slackware-version
release = slackware-release
name = SUSE
manufacturer = Novell
version_match = VERSION = (.*)
release = SuSE-release
release_derived = tinysofa-release
release_derived = trustix-release
release_derived = turbolinux-release
manufacturer = Canonical Ltd. / Ubuntu Foundation
4.10 = Warty Warthog
5.04 = Hoary Hedgehog
5.10 = Breezy Badger
6.06 = Dapper Drake
6.10 = Edgy Eft
7.04 = Feisty Fawn
7.10 = Gutsy Gibbon
8.04 = Hardy Heron
8.10 = Intrepid Ibex
9.04 = Jaunty Jackalope
9.10 = Karmic Koala
10.04 = Lucid Lynx
10.10 = Maverick Meerkat
11.04 = Natty Narwhal
11.10 = Oneiric Ocelot
12.04 = Precise Pangolin
12.10 = Quantal Quetzal
13.04 = Raring Ringtail
13.10 = Saucy Salamander
14.04 = Trusty Tahr
14.10 = Utopic Unicorn
15.04 = Vivid Vervet
15.10 = Wily Werewolf
16.04 = Xenial Xerus
16.10 = Yakkety Yak
17.04 = Zesty Zapus
17.10 = Artful Aardvark
18.04 = Bionic Beaver
18.10 = Cosmic Cuttlefish
19.04 = Disco Dingo
release_derived = va-release
release_derived = yellowdog-release
release_derived = yoper-release
RAW
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux::OS::Distribution::Conf
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 NAME
Sys::Info::Driver::Linux::OS::Distribution::Conf - Distro configuration
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Sys-Info-Driver-Linux-0.7908/lib/Sys/Info/Driver/Linux/Device/CPU.pm 000644 000765 000024 00000007063 15047747607 025051 0 ustar 00burak staff 000000 000000 package Sys::Info::Driver::Linux::Device::CPU;
$Sys::Info::Driver::Linux::Device::CPU::VERSION = '0.7908';
use strict;
use warnings;
use parent qw(Sys::Info::Base);
use Sys::Info::Driver::Linux;
use Unix::Processors;
use POSIX ();
use Carp qw( croak );
sub identify {
my $self = shift;
if ( ! $self->{META_DATA} ) {
my $mach = $self->uname->{machine};
my $arch = $mach =~ m{ i [0-9] 86 }xmsi ? 'x86'
: $mach =~ m{ ia64 }xmsi ? 'IA64'
: $mach =~ m{ x86_64 }xmsi ? 'AMD-64'
: $mach
;
my @raw = split m{\n\n}xms,
$self->trim( $self->slurp( proc->{cpuinfo} ) );
$self->{META_DATA} = [];
foreach my $e ( @raw ) {
push @{ $self->{META_DATA} },
{ $self->_parse_cpuinfo($e), architecture => $arch };
}
}
return $self->_serve_from_cache(wantarray);
}
sub bitness {
my $self = shift;
my @cpu = $self->identify;
my $flags = $cpu[0]->{flags};
if ( $flags ) {
my $lm = grep { $_ eq 'lm' } @{$flags};
return '64' if $lm;
}
return $cpu[0]->{architecture} =~ m{64}xms ? '64' : '32';
}
sub load {
my $self = shift;
my $level = shift;
my @loads = split /\s+/xms, $self->slurp( proc->{loadavg} );
return $loads[$level];
}
sub _parse_cpuinfo {
my $self = shift;
my $raw = shift || croak 'Parser called without data';
my($k, $v);
my %cpu;
foreach my $line (split /\n/xms, $raw) {
($k, $v) = split /\s+:\s+/xms, $line;
$cpu{$k} = $v;
}
my @flags = $cpu{flags} ? (split /\s+/xms, $cpu{flags}) : ();
my %flags = map { $_ => 1 } @flags;
my $up = Unix::Processors->new;
my $name = $cpu{'model name'};
$name =~ s[ \s{2,} ][ ]xms if $name;
return(
processor_id => $cpu{processor},
data_width => $flags{lm} ? '64' : '32', # guess
address_width => $flags{lm} ? '64' : '32', # guess
bus_speed => undef,
speed => $cpu{'cpu MHz'},
name => $name || q{},
family => $cpu{'cpu family'},
manufacturer => $cpu{vendor_id},
model => $cpu{model},
stepping => $cpu{stepping},
number_of_cores => $cpu{'cpu cores'} || $up->max_physical,
number_of_logical_processors => $up->max_online,
L2_cache => {max_cache_size => $cpu{'cache size'}},
flags => @flags ? [ @flags ] : undef,
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Sys::Info::Driver::Linux::Device::CPU
=head1 VERSION
version 0.7908
=head1 SYNOPSIS
-
=head1 DESCRIPTION
Identifies the CPU with L, L and C<< /proc >>.
=head1 NAME
Sys::Info::Driver::Linux::Device::CPU - Linux CPU Device Driver
=head1 METHODS
=head2 identify
See identify in L.
=head2 load
See load in L.
=head2 bitness
See bitness in L.
=head1 SEE ALSO
L,
L,
L, L,
proc filesystem.
=head1 AUTHOR
Burak Gursoy
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Burak Gursoy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
Sys-Info-Driver-Linux-0.7908/t/04-distribution.t 000644 000765 000024 00000001651 15047747607 021501 0 ustar 00burak staff 000000 000000 #!/usr/bin/env perl -w
use strict;
use warnings;
use Carp qw( croak );
use Test::More qw( no_plan );
use Data::Dumper;
use Sys::Info::Driver::Linux::OS::Distribution;
ok( my $distro = Sys::Info::Driver::Linux::OS::Distribution->new, 'Got the object' );
ok( my $name = $distro->name, 'Got a name' );
ok( my $version = $distro->version, 'Got a version' );
diag Dumper {
distro => $distro,
name => $name,
version => $version,
};
dump_if_exists( '/etc/lsb-release' );
sub dump_if_exists {
my $file = shift;
return if ! -e $file;
diag('DEBUG');
diag("[DUMPING] $file");
diag( slurp( $file ) );
return;
}
sub slurp {
my $file = shift || croak 'File parameter is missing';
require IO::File;
my $FH = IO::File->new;
$FH->open( $file, '<' ) or croak "Can't open FH ($file) for reading: $!";
my $rv = do { local $/; <$FH> };
$FH->close;
return $rv;
}
1;
Sys-Info-Driver-Linux-0.7908/t/author-pod-coverage.t 000644 000765 000024 00000000567 15047747607 022421 0 ustar 00burak staff 000000 000000 #!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
use strict;
use warnings;
use Test::Pod::Coverage 1.08;
use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
Sys-Info-Driver-Linux-0.7908/t/00-compile.t 000644 000765 000024 00000003252 15047747607 020405 0 ustar 00burak staff 000000 000000 use 5.006;
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058
use Test::More;
plan tests => 7 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'Sys/Info/Driver/Linux.pm',
'Sys/Info/Driver/Linux/Constants.pm',
'Sys/Info/Driver/Linux/Device.pm',
'Sys/Info/Driver/Linux/Device/CPU.pm',
'Sys/Info/Driver/Linux/OS.pm',
'Sys/Info/Driver/Linux/OS/Distribution.pm',
'Sys/Info/Driver/Linux/OS/Distribution/Conf.pm'
);
# no fake home requested
my @switches = (
-d 'blib' ? '-Mblib' : '-Ilib',
);
use File::Spec;
use IPC::Open3;
use IO::Handle;
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}
is(scalar(@warnings), 0, 'no warnings found')
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
Sys-Info-Driver-Linux-0.7908/t/00-report-prereqs.t 000644 000765 000024 00000013601 15047747607 021746 0 ustar 00burak staff 000000 000000 #!perl
use strict;
use warnings;
# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.029
use Test::More tests => 1;
use ExtUtils::MakeMaker;
use File::Spec;
# from $version::LAX
my $lax_version_re =
qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
|
(?:\.[0-9]+) (?:_[0-9]+)?
) | (?:
v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
|
(?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
)
)/x;
# hide optional CPAN::Meta modules from prereq scanner
# and check if they are available
my $cpan_meta = "CPAN::Meta";
my $cpan_meta_pre = "CPAN::Meta::Prereqs";
my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic
# Verify requirements?
my $DO_VERIFY_PREREQS = 1;
sub _max {
my $max = shift;
$max = ( $_ > $max ) ? $_ : $max for @_;
return $max;
}
sub _merge_prereqs {
my ($collector, $prereqs) = @_;
# CPAN::Meta::Prereqs object
if (ref $collector eq $cpan_meta_pre) {
return $collector->with_merged_prereqs(
CPAN::Meta::Prereqs->new( $prereqs )
);
}
# Raw hashrefs
for my $phase ( keys %$prereqs ) {
for my $type ( keys %{ $prereqs->{$phase} } ) {
for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
$collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module};
}
}
}
return $collector;
}
my @include = qw(
);
my @exclude = qw(
);
# Add static prereqs to the included modules list
my $static_prereqs = do './t/00-report-prereqs.dd';
# Merge all prereqs (either with ::Prereqs or a hashref)
my $full_prereqs = _merge_prereqs(
( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
$static_prereqs
);
# Add dynamic prereqs to the included modules list (if we can)
my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
my $cpan_meta_error;
if ( $source && $HAS_CPAN_META
&& (my $meta = eval { CPAN::Meta->load_file($source) } )
) {
$full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
}
else {
$cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source)
$source = 'static metadata';
}
my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
# Add static includes into a fake section
for my $mod (@include) {
$req_hash->{other}{modules}{$mod} = 0;
}
for my $phase ( qw(configure build test runtime develop other) ) {
next unless $req_hash->{$phase};
next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
for my $type ( qw(requires recommends suggests conflicts modules) ) {
next unless $req_hash->{$phase}{$type};
my $title = ucfirst($phase).' '.ucfirst($type);
my @reports = [qw/Module Want Have/];
for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
next if grep { $_ eq $mod } @exclude;
my $want = $req_hash->{$phase}{$type}{$mod};
$want = "undef" unless defined $want;
$want = "any" if !$want && $want == 0;
if ($mod eq 'perl') {
push @reports, ['perl', $want, $]];
next;
}
my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
my $file = $mod;
$file =~ s{::}{/}g;
$file .= ".pm";
my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
if ($prefix) {
my $have = MM->parse_version( File::Spec->catfile($prefix, $file) );
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
if ( $have !~ /\A$lax_version_re\z/ ) {
push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
}
elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
push @dep_errors, "$mod version '$have' is not in required range '$want'";
}
}
}
else {
push @reports, [$mod, $want, "missing"];
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
else {
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
}
push @full_reports, "\n";
}
}
}
if ( @full_reports ) {
diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
}
if ( $cpan_meta_error || @dep_errors ) {
diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n";
}
if ( $cpan_meta_error ) {
my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n";
}
if ( @dep_errors ) {
diag join("\n",
"\nThe following REQUIRED prerequisites were not satisfied:\n",
@dep_errors,
"\n"
);
}
pass('Reported prereqs');
# vim: ts=4 sts=4 sw=4 et:
Sys-Info-Driver-Linux-0.7908/t/author-pod-syntax.t 000644 000765 000024 00000000454 15047747607 022147 0 ustar 00burak staff 000000 000000 #!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;
all_pod_files_ok();
Sys-Info-Driver-Linux-0.7908/t/03-basic.t 000644 000765 000024 00000000224 15047747607 020035 0 ustar 00burak staff 000000 000000 #!/usr/bin/env perl -w
use strict;
use warnings;
use Test::Sys::Info;
printf STDERR "UNAME: %s\n", qx(uname -a) || 'unknown';
driver_ok('Linux');
Sys-Info-Driver-Linux-0.7908/t/00-report-prereqs.dd 000644 000765 000024 00000003157 15047747607 022077 0 ustar 00burak staff 000000 000000 do { my $x = {
'configure' => {
'requires' => {
'ExtUtils::MakeMaker' => '0'
}
},
'develop' => {
'requires' => {
'Pod::Coverage::TrustPod' => '0',
'Test::CPAN::Meta' => '0',
'Test::Pod' => '1.41',
'Test::Pod::Coverage' => '1.08'
}
},
'runtime' => {
'requires' => {
'Config::General' => '0',
'Sys::Info::Base' => '0.7801',
'Unix::Processors' => '0',
'parent' => '0',
'perl' => '5.010'
}
},
'test' => {
'recommends' => {
'CPAN::Meta' => '2.120900'
},
'requires' => {
'ExtUtils::MakeMaker' => '0',
'File::Spec' => '0',
'IO::Handle' => '0',
'IPC::Open3' => '0',
'Test::More' => '0',
'Test::Sys::Info' => '0.20'
}
}
};
$x;
} Sys-Info-Driver-Linux-0.7908/t/author-distmeta.t 000644 000765 000024 00000000425 15047747607 021651 0 ustar 00burak staff 000000 000000 #!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
# This file was automatically generated by Dist::Zilla::Plugin::MetaTests.
use strict;
use warnings;
use Test::CPAN::Meta;
meta_yaml_ok();