3 # ************************************************************
4 # Description : Central location for the MPC version.
5 # Author : Chad Elliott
6 # Create Date : 1/5/2003
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
16 # ************************************************************
18 # ************************************************************
20 ## This is the starting major and minor version
23 my $cache = 'modules/.version';
25 # ************************************************************
27 # ************************************************************
31 ## We only need to do this once
34 ## Attempt to dynamically determine the revision part of the version
35 ## string every time the version number is requested. This only happens
36 ## if the --version option is used, an invalid option is used, and when
37 ## the process starts up and the version hasn't been cached yet.
39 my $cwd = Cwd
::getcwd
();
40 if (chdir(::getBasePath
())) {
41 ## Get the git revision for the final part of the version string.
42 my $nul = File
::Spec
->devnull();
43 my $r = _readVersion
("git rev-parse --short HEAD 2> $nul |");
45 ## Store the version for later use, in the event that the git
46 ## revision isn't available in the future.
47 if (open(CLH
, ">$cache")) {
53 ## See if we can load in the previously stored version string.
54 $r = _readVersion
($cache);
57 ## Set the revision string if we were able to read one.
58 $rev = $r if (defined $r);
63 ## We then append the revision to the version string.
71 ## Attempt to cache the revision if the cache file does not exist.
72 ## This will allow the revision to be obtained in the event that git
73 ## cannot return the revision information at a later time.
74 get
() if (!-e
::getBasePath
() . '/' . $cache);
82 if (open(CLH
, $file)) {