[liblinux-distribution-perl] 07/34: import Linux::Distribution 0.14 from CPAN
gregor herrmann
gregoa at debian.org
Thu Jun 4 21:35:35 UTC 2015
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 5977c498d7a12c003e5eed46ed629d23e507c9bb
Author: Re Alberto <kerberus at accidia.net>
Date: Wed Feb 15 23:42:18 2006 -0800
import Linux::Distribution 0.14 from CPAN
git-cpan-module: Linux::Distribution
git-cpan-version: 0.14
---
Changes | 4 ++++
META.yml | 2 +-
Makefile.PL | 2 +-
README | 9 +++++----
lib/Linux/Distribution.pm | 25 +++++++++++++++----------
t/Linux-Distribution.t | 4 ++--
6 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/Changes b/Changes
index f7cc07f..4837dca 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+* 2005-16-02
+
+Added support for Redflag.
+
* 2006-16-01
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,
diff --git a/META.yml b/META.yml
index 1e65e95..9d99dd8 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
# 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.13
+version: 0.14
version_from: lib/Linux/Distribution.pm
installdirs: site
requires:
diff --git a/Makefile.PL b/Makefile.PL
index 059cbf3..28ef98d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -8,5 +8,5 @@ WriteMakefile(
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 <kerberus at accidia.net>') : ()),
+ AUTHOR => 'Alberto Re <alberto at accidia.net>') : ()),
);
diff --git a/README b/README
index 37e4100..1d0a013 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Linux-Distribution version 0.13
+Linux-Distribution version 0.14
===============================
This is a simple module that tries to guess on what linux distribution we are running by looking
@@ -7,9 +7,10 @@ rect and adds ubuntu support. Secondly, it will look for the distro specific fi
It currently recognizes slackware, debian, suse, fedora, redhat, turbolinux, yellowdog, knoppix,
mandrake, conectiva, immunix, tinysofa, va-linux, trustix, adamantix, yoper, arch-linux, libranet,
-gentoo and ubuntu.
+gentoo, ubuntu and redflag.
-It has function to get the version for debian, suse, redhat, gentoo, slackware and ubuntu(lsb).
+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 :-)
INSTALLATION
@@ -26,7 +27,7 @@ This module has no dependencies.
COPYRIGHT AND LICENCE
-Copyright (C) 2006 by Alberto Re <kerberus at accidia.net>
+Copyright (C) 2006 by Alberto Re <alberto at accidia.net>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
diff --git a/lib/Linux/Distribution.pm b/lib/Linux/Distribution.pm
index 76db669..5580447 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.13';
+our $VERSION = '0.14';
our $standard_release_file = 'lsb-release';
@@ -27,6 +27,7 @@ our %release_files = (
'yellowdog-release' => 'yellowdog',
'slackware-version' => 'slackware',
'slackware-release' => 'slackware',
+ 'redflag-release' => 'redflag',
'redhat-release' => 'redhat',
'redhat_version' => 'redhat',
'conectiva-release' => 'conectiva',
@@ -45,6 +46,7 @@ our %version_match = (
'debian' => '(.+)',
'suse' => 'VERSION = (.*)',
'fedora' => 'Fedora Core release (\d+) \(',
+ 'redflag' => 'Red Flag (?:Desktop|Linux) (?:release |\()(.*?)(?: \(.+)?\)',
'redhat' => 'Red Hat Linux release (.*) \(',
'slackware' => '^Slackware (.+)$'
);
@@ -72,8 +74,7 @@ sub distribution_name {
my $self = shift || new();
my $distro;
if ($distro = $self->_get_lsb_info()){
- $self->{'DISTRIB_ID'} = $distro;
- return $distro if ($distro = $self->_get_lsb_info());
+ return $distro if ($distro);
}
foreach (keys %release_files) {
if (-f "/etc/$_" && !-l "/etc/$_"){
@@ -95,19 +96,23 @@ sub distribution_version {
$self->distribution_name() or die 'No version because no distro.';
}
$self->{'pattern'} = $version_match{$self->{'DISTRIB_ID'}};
- return $self->_get_file_info();
- undef
+ $release = $self->_get_file_info();
+ $self->{'DISTRIB_RELEASE'} = $release;
+ return $release;
}
sub _get_lsb_info {
my $self = shift;
- my $field = shift || "DISTRIB_ID";
+ my $field = shift || 'DISTRIB_ID';
my $tmp = $self->{'release_file'};
- if ( -f '/etc/' . $standard_release_file ) {
+ if ( -r '/etc/' . $standard_release_file ) {
$self->{'release_file'} = $standard_release_file;
$self->{'pattern'} = $field . '=(.+)';
my $info = $self->_get_file_info();
- return $info if $info;
+ if ($info){
+ $self->{$field} = $info;
+ return $info
+ }
}
$self->{'release_file'} = $tmp;
$self->{'pattern'} = '';
@@ -161,9 +166,9 @@ Linux::Distribution - Perl extension to guess on which Linux distribution we are
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 and ubuntu.
+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 and ubuntu(lsb). People running unsupported distro's are greatly encouraged to submit patches :-)
+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 :-)
=head2 EXPORT
diff --git a/t/Linux-Distribution.t b/t/Linux-Distribution.t
index 0cbf4de..c2d95ce 100644
--- a/t/Linux-Distribution.t
+++ b/t/Linux-Distribution.t
@@ -8,8 +8,8 @@
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)
+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'))
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/liblinux-distribution-perl.git
More information about the Pkg-perl-cvs-commits
mailing list