[liblinux-distribution-perl] 20/34: Added support for Scientific Linux.
gregor herrmann
gregoa at debian.org
Thu Jun 4 21:35:37 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 f1ba1eb13b7068fdbdea618a83eef7d22236644d
Author: Mike <michiel.beijen at gmail.com>
Date: Thu Jul 28 23:03:02 2011 +0200
Added support for Scientific Linux.
---
lib/Linux/Distribution.pm | 18 ++++++++++--------
t/scientific6.t | 14 ++++++++++++++
t/scientific6/files | 5 +++++
t/scientific6/redhat-release | 1 +
4 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/lib/Linux/Distribution.pm b/lib/Linux/Distribution.pm
index 0d2ca63..2bb59de 100644
--- a/lib/Linux/Distribution.pm
+++ b/lib/Linux/Distribution.pm
@@ -54,6 +54,7 @@ our %version_match = (
'slackware' => '^Slackware (.+)$',
'pardus' => '^Pardus (.+)$',
'centos' => '^CentOS(?: Linux)? release (.+)(?:\s\(Final\))',
+ 'scientific' => '^Scientific Linux release (.+) \(',
);
@@ -96,15 +97,16 @@ sub distribution_name {
if (-f "$release_files_directory/$_" && !-l "$release_files_directory/$_"){
if (-f "$release_files_directory/$_" && !-l "$release_files_directory/$_"){
if ( $release_files{$_} eq 'redhat' ) {
- $self->{'pattern'} = $version_match{'centos'};
- $self->{'release_file'}='redhat-release';
- if ( $self->_get_file_info() ) {
- $self->{'DISTRIB_ID'} = 'centos';
- $self->{'release_file'} = $_;
- return $self->{'DISTRIB_ID'};
- } else {
- $self->{'pattern'}='';
+ foreach my $rhel_deriv ('centos','scientific',) {
+ $self->{'pattern'} = $version_match{$rhel_deriv};
+ $self->{'release_file'}='redhat-release';
+ if ( $self->_get_file_info() ) {
+ $self->{'DISTRIB_ID'} = $rhel_deriv;
+ $self->{'release_file'} = $_;
+ return $self->{'DISTRIB_ID'};
+ }
}
+ $self->{'pattern'}='';
}
$self->{'release_file'} = $_;
$self->{'DISTRIB_ID'} = $release_files{$_};
diff --git a/t/scientific6.t b/t/scientific6.t
new file mode 100644
index 0000000..7f26891
--- /dev/null
+++ b/t/scientific6.t
@@ -0,0 +1,14 @@
+use 5.006000;
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+use lib '../lib/';
+use Linux::Distribution;
+
+local $Linux::Distribution::release_files_directory='scientific6/';
+my $linux = Linux::Distribution->new;
+my $distro = $linux->distribution_name();
+is($distro,'scientific');
+my $version = $linux->distribution_version();
+is ($version,'6.1');
diff --git a/t/scientific6/files b/t/scientific6/files
new file mode 100644
index 0000000..36395eb
--- /dev/null
+++ b/t/scientific6/files
@@ -0,0 +1,5 @@
+exists:
+redhat-release
+do not:
+redhat_version
+lsb-release
diff --git a/t/scientific6/redhat-release b/t/scientific6/redhat-release
new file mode 100644
index 0000000..97c0da5
--- /dev/null
+++ b/t/scientific6/redhat-release
@@ -0,0 +1 @@
+Scientific Linux release 6.1 (Carbon)
--
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