This is an automated email from the git hooks/post-receive script. gregoa pushed a commit to annotated tag v0.22 in repository liblinux-distribution-perl.
commit 132571d8b025cadc2c9eb4ca68513d88e50c2236 Author: Alexandr Ciornii <alexcho...@gmail.com> Date: Sat Nov 1 15:23:44 2008 -0800 import Linux::Distribution 0.14_01 from CPAN git-cpan-module: Linux::Distribution git-cpan-version: 0.14_01 --- Changes | 13 +++++++++++-- META.yml | 30 ++++++++++++++++++++---------- Makefile.PL | 12 +++++++----- lib/Linux/Distribution.pm | 29 +++++++++++++++++++++-------- t/Linux-Distribution.t | 10 +++++++++- 5 files changed, 68 insertions(+), 26 deletions(-) diff --git a/Changes b/Changes index 4837dca..2bd4b04 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,17 @@ -* 2005-16-02 +* 2008-11-02 version 0.14_01 + +Remove bareword filehandles and 2-arg open +Will not install if not on Linux +Modernize Makefile.PL +Fix for 5.10 +Pardus support (by BURAK, RT#27357) +Fix Fedora recognition (reported by sagarshahATsofthome.net, RT#11996) + +* 2005-02-16 Added support for Redflag. -* 2006-16-01 +* 2006-01-16 Thanks to Judith Lebzelter now the module gets advantage of the LSB's /etc/lsb-release file. Added support for Ubuntu and version information retrieval for gentoo, debian, suse, fedora, redhat and slackware. diff --git a/META.yml b/META.yml index 9d99dd8..e8b3cc8 100644 --- a/META.yml +++ b/META.yml @@ -1,10 +1,20 @@ -# http://module-build.sourceforge.net/META-spec.html -#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# -name: Linux-Distribution -version: 0.14 -version_from: lib/Linux/Distribution.pm -installdirs: site -requires: - -distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 +--- #YAML:1.0 +name: Linux-Distribution +version: 0.14_01 +abstract: Perl extension to guess on which Linux distribution we are running. +author: + - Alberto Re <albe...@accidia.net> +license: perl +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +requires: + perl: 5.006 +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.48 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff --git a/Makefile.PL b/Makefile.PL index 28ef98d..4c43093 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,12 +1,14 @@ use 5.006000; use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. +unless (lc $^O eq "linux") { + die "OS unsupported\n"; +} WriteMakefile( NAME => 'Linux::Distribution', VERSION_FROM => 'lib/Linux/Distribution.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/Linux/Distribution.pm', # retrieve abstract from module - AUTHOR => 'Alberto Re <albe...@accidia.net>') : ()), + ABSTRACT_FROM => 'lib/Linux/Distribution.pm', # retrieve abstract from module + AUTHOR => 'Alberto Re <albe...@accidia.net>', + ($ExtUtils::MakeMaker::VERSION ge '6.48'? + ('LICENSE' => 'perl', 'MIN_PERL_VERSION' => 5.006,) : ()), ); diff --git a/lib/Linux/Distribution.pm b/lib/Linux/Distribution.pm index 5580447..ad08d26 100644 --- a/lib/Linux/Distribution.pm +++ b/lib/Linux/Distribution.pm @@ -10,7 +10,7 @@ our @ISA = qw(Exporter); our @EXPORT_OK = qw( distribution_name distribution_version ); -our $VERSION = '0.14'; +our $VERSION = '0.14_01'; our $standard_release_file = 'lsb-release'; @@ -38,7 +38,8 @@ our %release_files = ( 'yoper-release' => 'yoper', 'arch-release' => 'arch', 'libranet_version' => 'libranet', - 'va-release' => 'va-linux' + 'va-release' => 'va-linux', + 'pardus-release' => 'pardus', ); our %version_match = ( @@ -48,13 +49,14 @@ our %version_match = ( 'fedora' => 'Fedora Core release (\d+) \(', 'redflag' => 'Red Flag (?:Desktop|Linux) (?:release |\()(.*?)(?: \(.+)?\)', 'redhat' => 'Red Hat Linux release (.*) \(', - 'slackware' => '^Slackware (.+)$' + 'slackware' => '^Slackware (.+)$', + 'pardus' => '^Pardus (.+)$', ); if ($^O ne 'linux') { - require Carp; - Carp::croak 'you are trying to use a linux specific module on a different OS'; +# require Carp; +# Carp::croak('you are trying to use a linux specific module on a different OS'); } sub new { @@ -76,6 +78,17 @@ sub distribution_name { if ($distro = $self->_get_lsb_info()){ return $distro if ($distro); } + + foreach ('fedora-release') { + if (-f "/etc/$_" && !-l "/etc/$_"){ + if (-f "/etc/$_" && !-l "/etc/$_"){ + $self->{'DISTRIB_ID'} = $release_files{$_}; + $self->{'release_file'} = $_; + return $self->{'DISTRIB_ID'}; + } + } + } + foreach (keys %release_files) { if (-f "/etc/$_" && !-l "/etc/$_"){ if (-f "/etc/$_" && !-l "/etc/$_"){ @@ -121,9 +134,9 @@ sub _get_lsb_info { sub _get_file_info { my $self = shift; - open FH, '/etc/' . $self->{'release_file'} or die 'Cannot open file: /etc/' . $self->{'release_file'}; + open my $fh, '<', '/etc/' . $self->{'release_file'} or die 'Cannot open file: /etc/' . $self->{'release_file'}; my $info = ''; - while (<FH>){ + while (<$fh>){ chomp $_; ($info) = $_ =~ m/$self->{'pattern'}/; return "\L$info" if $info; @@ -154,7 +167,7 @@ Linux::Distribution - Perl extension to guess on which Linux distribution we are use Linux::Distribution qw(distribution_name distribution_version); - $linux = new Linux::Distribution; + $linux = Linux::Distribution->new; if(my $distro = $linux->distribution_name()) { my $version = $linux->distribution_version(); print "you are running $distro, version $version\n"; diff --git a/t/Linux-Distribution.t b/t/Linux-Distribution.t index c2d95ce..af12085 100644 --- a/t/Linux-Distribution.t +++ b/t/Linux-Distribution.t @@ -9,7 +9,15 @@ use Test::More tests => 2; BEGIN { use_ok('Linux::Distribution') }; if(isnt(Linux::Distribution::distribution_name(), undef, 'Checking your distro...')) { - diag('It seems that we are running on '.Linux::Distribution::distribution_name.' version '.(Linux::Distribution::distribution_version || 'unknown')) + diag('It seems that we are running on '.Linux::Distribution::distribution_name.' version '.(Linux::Distribution::distribution_version || 'unknown')) +} else { + diag ('Please report your Linux dist to dist maintainer'); + if (-e '/etc/lsb-release') { + diag ('lsb-release exists') ; + open my $fh,'<','/etc/lsb-release'; + my $content=join('',<$fh>); + diag($content); + } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/liblinux-distribution-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits