From ab14c86bb4316ded6d6fc3829f57e7e2964865f4 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 26 Apr 2011 16:57:13 +0000 Subject: [PATCH] move version routine from Utils.pm to Version.pm so I will not mess up again git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9406 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 10 ++----- perl-xCAT/xCAT/Version.pm | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 perl-xCAT/xCAT/Version.pm diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 5decd08e2..2f40e1f4f 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -32,6 +32,7 @@ require xCAT::NetworkUtils; require xCAT::Schema; #require Data::Dumper; require xCAT::NodeRange; +require xCAT::Version; require DBI; our @ISA = qw(Exporter); @@ -464,14 +465,7 @@ sub Version #The following tag tells the build script where to append build info my $version = shift; - if ($version eq 'short') - { - $version = '' #XCATVERSIONSUBHERE ; - } - else - { - $version = 'Version ' #XCATVERSIONSUBHERE #XCATSVNBUILDSUBHERE ; - } + $version = xCAT::Version->Version(); return $version; } diff --git a/perl-xCAT/xCAT/Version.pm b/perl-xCAT/xCAT/Version.pm new file mode 100644 index 000000000..e492a384f --- /dev/null +++ b/perl-xCAT/xCAT/Version.pm @@ -0,0 +1,58 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +package xCAT::Version; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +# if AIX - make sure we include perl 5.8.2 in INC path. +# Needed to find perl dependencies shipped in deps tarball. +if ($^O =~ /^aix/i) { + use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi"; + use lib "/usr/opt/perl5/lib/5.8.2"; + use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi"; + use lib "/usr/opt/perl5/lib/site_perl/5.8.2"; +} + +use lib "$::XCATROOT/lib/perl"; +# do not put a use or require for xCAT::Table here. Add to each new routine +# needing it to avoid reprocessing of user tables ( ExtTab.pm) for each command call +use strict; +#------------------------------------------------------------------------------- + +=head3 Version + Arguments: + Optional 'short' string to request only the version; + Returns: + xcat Version number + Globals: + none + Error: + none + Example: + $version=xCAT::Version->Version(); + Comments: + none +=cut + +#------------------------------------------------------------------------------- +sub Version +{ + + #The following tag tells the build script where to append build info + my $version = shift; + if ($version eq 'short') + { + $version = '' #XCATVERSIONSUBHERE ; + } + else + { + $version = 'Version ' #XCATVERSIONSUBHERE #XCATSVNBUILDSUBHERE ; + } + return $version; + + } + +1;