summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Elliott <elliottc@objectcomputing.com>2023-01-19 12:44:46 -0600
committerChad Elliott <elliottc@objectcomputing.com>2023-01-19 12:44:46 -0600
commit1b596ecae0dae8c59f47c4f03e174487dd942f2a (patch)
tree09caf3e9bdba78ce404d5f1c3609759e218fe385
parent60b0c90efa801c758911bdc4c7949db6809eb3f4 (diff)
downloadMPC-1b596ecae0dae8c59f47c4f03e174487dd942f2a.tar.gz
Update version to contain git version info, when available.
-rw-r--r--.gitignore1
-rw-r--r--PROBLEM-REPORT-FORM12
-rw-r--r--history/ChangeLog-4_1 (renamed from ChangeLog)0
-rw-r--r--modules/Driver.pm2
-rw-r--r--modules/Version.pm67
5 files changed, 57 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..450abd35
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+modules/.version
diff --git a/PROBLEM-REPORT-FORM b/PROBLEM-REPORT-FORM
index 34d2c75a..bd68f10e 100644
--- a/PROBLEM-REPORT-FORM
+++ b/PROBLEM-REPORT-FORM
@@ -4,11 +4,6 @@ Documentation for MPC can be found at the following location.
Please consult the documentation to ensure that you are using MPC correctly.
-If you are still having a problem getting MPC to do what you want, please
-consult the FAQ before sending a support request.
-
- http://www.ociweb.com/products/mpc/mpc-faq
-
When requesting MPC support please provide the following items:
MPC version (using mwc.pl -version):
@@ -25,6 +20,7 @@ When requesting MPC support please provide the following items:
Problem description (please be as detailed as possible):
-Finally, send support requests to support@ociweb.com. You may send
-questions to the author (elliott_c@ociweb.com), but a response is not
-guaranteed.
+Please go to
+https://objectcomputing.com/products/opendds/opendds-consulting-and-support
+for commercial support. Go to https://github.com/DOCGroup/MPC/issues for
+community support.
diff --git a/ChangeLog b/history/ChangeLog-4_1
index 6d32c8df..6d32c8df 100644
--- a/ChangeLog
+++ b/history/ChangeLog-4_1
diff --git a/modules/Driver.pm b/modules/Driver.pm
index 44a0da57..97e5882e 100644
--- a/modules/Driver.pm
+++ b/modules/Driver.pm
@@ -48,6 +48,8 @@ sub new {
my @creators = @_;
my $self = $class->SUPER::new();
+ Version::cache();
+
$self->{'path'} = $path;
$self->{'basepath'} = ::getBasePath();
$self->{'name'} = $name;
diff --git a/modules/Version.pm b/modules/Version.pm
index 3c5db288..05459208 100644
--- a/modules/Version.pm
+++ b/modules/Version.pm
@@ -17,8 +17,9 @@ use strict;
# ************************************************************
## This is the starting major and minor version
-my $version = '4.1';
+my $version = '5.0';
my $once = 1;
+my $cache = 'modules/.version';
# ************************************************************
# Subroutine Section
@@ -29,30 +30,62 @@ sub get {
## We only need to do this once
$once = 0;
- ## Here we determine the beta version. The base variable
- ## is the negated number of existing ChangeLog entries at the
- ## time of the release of the major and minor version. We then
- ## add the total number of ChangeLog entries to the base to
- ## get the beta version.
- my $base = -1;
- if (open(CLH, ::getBasePath() . '/ChangeLog')) {
- while(<CLH>) {
- if (/^\w\w\w\s\w\w\w\s/) {
- ++$base;
+ ## Attempt to dynamically determine the revision part of the version
+ ## string every time the version number is requested. This only happens
+ ## if the --version option is used, an invalid option is used, and when
+ ## the process starts up and the version hasn't been cached yet.
+ my $rev = '?';
+ my $cwd = Cwd::getcwd();
+ if (chdir(::getBasePath())) {
+ ## Get the git revision for the final part of the version string.
+ my $r = _readVersion('git rev-parse --short HEAD |');
+ if (defined $r) {
+ ## Store the version for later use, in the event that the git
+ ## revision isn't available in the future.
+ if (open(CLH, ">$cache")) {
+ print CLH "$r\n";
+ close(CLH);
}
}
- close(CLH);
+ else {
+ ## See if we can load in the previously stored version string.
+ $r = _readVersion($cache);
+ }
- ## We then append the beta version number to the version string
- $version .= ".$base";
- }
- else {
- $version .= '.??';
+ ## Set the revision string if we were able to read one.
+ $rev = $r if (defined $r);
+
+ chdir($cwd);
}
+
+ ## We then append the revision to the version string.
+ $version .= ".$rev";
}
return $version;
}
+sub cache {
+ ## Attempt to cache the revision if the cache file does not exist.
+ ## This will allow the revision to be obtained in the event that git
+ ## cannot return the revision information at a later time.
+ get() if (!-e ::getBasePath() . '/' . $cache);
+}
1;
+
+sub _readVersion {
+ my $file = shift;
+ my $rev;
+ if (open(CLH, $file)) {
+ while(<CLH>) {
+ if (/^(\w+)$/) {
+ $rev = $1;
+ last;
+ }
+ }
+ close(CLH);
+ }
+ return $rev;
+}
+