[liblinux-distribution-perl] 29/34: Added OS and version detection for Amazon Linux. (RT#88412)

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 923467c5b5b7180470f75fd6090ca133e7b335f6
Author: Michiel Beijen <michiel.beijen at otrs.com>
Date:   Sat Oct 5 20:31:12 2013 +0200

    Added OS and version detection for Amazon Linux. (RT#88412)
---
 Changes                   |  4 ++++
 lib/Linux/Distribution.pm |  6 ++++--
 t/amazon.t                | 14 ++++++++++++++
 t/amazon/files            |  4 ++++
 t/amazon/system-release   |  1 +
 5 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Changes b/Changes
index c1a61f0..aac7824 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+* 2013-??-?? version 0.22
+
+Added OS and version detection for Amazon Linux. (RT#88412)
+
 * 2011-02-23 version 0.21
 
 Added OS and version detection for Oracle Enterprise Linux
diff --git a/lib/Linux/Distribution.pm b/lib/Linux/Distribution.pm
index fc55397..5444ca5 100644
--- a/lib/Linux/Distribution.pm
+++ b/lib/Linux/Distribution.pm
@@ -43,6 +43,7 @@ our %release_files = (
     'libranet_version'      => 'libranet',
     'va-release'            => 'va-linux',
     'pardus-release'        => 'pardus',
+    'system-release'        => 'amazon',
 );
 
 our %version_match = (
@@ -57,6 +58,7 @@ our %version_match = (
     'pardus'                => '^Pardus (.+)$',
     'centos'                => '^CentOS(?: Linux)? release (.+)(?:\s\(Final\))',
     'scientific'            => '^Scientific Linux release (.+) \(',
+    'amazon'                => 'Amazon Linux AMI release (.+)$',
 );
 
 
@@ -198,9 +200,9 @@ Linux::Distribution - Perl extension to detect on which Linux distribution we ar
 
 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, scientific, oracle enterprise linux and redflag.
+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, scientific, oracle enterprise linux, amazon linux and redflag.
 
-It has function to get the version for debian, suse, fedora, redhat, gentoo, slackware, scientific, oracle enterprise linux, redflag and ubuntu(lsb). People running unsupported distro's are greatly encouraged to submit patches :-)
+It has function to get the version for debian, suse, fedora, redhat, gentoo, slackware, scientific, oracle enterprise linux, amazon linux, redflag and ubuntu(lsb). People running unsupported distro's are greatly encouraged to submit patches :-)
 
 =head2 EXPORT
 
diff --git a/t/amazon.t b/t/amazon.t
new file mode 100644
index 0000000..88c95fe
--- /dev/null
+++ b/t/amazon.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='t/amazon/';
+my $linux = Linux::Distribution->new;
+my $distro = $linux->distribution_name();
+is($distro,'amazon');
+my $version = $linux->distribution_version();
+is ($version,'2013.09');
diff --git a/t/amazon/files b/t/amazon/files
new file mode 100644
index 0000000..a5566d3
--- /dev/null
+++ b/t/amazon/files
@@ -0,0 +1,4 @@
+exists:
+system-release
+do not:
+lsb-release
diff --git a/t/amazon/system-release b/t/amazon/system-release
new file mode 100644
index 0000000..8cb7f66
--- /dev/null
+++ b/t/amazon/system-release
@@ -0,0 +1 @@
+Amazon Linux AMI release 2013.09

-- 
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