Get Device ID: support new version format

We plan to change our version string to the format
"<platform>-YEAR.WEEK.BUILD-g<hash>-<hash>".

This supports the new format by allowing for a dot instead of a dash
before the BUILD number and by using only the last two characters of the
major version string.

Tested:
Confirmed that "ipmitool mc info" and "ipmitool raw 6 1" both return the
correct version information from the old and new version strings.

Change-Id: I7e9cdffd37c0033062377a0b575d8d4635fb5625
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index 315b581..8f00e54 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -198,7 +198,7 @@
 //   openbmcHash 14dc00e79
 //   MetaHasg    5e7d997
 //
-// 2.New solution  wht-0.2-3-gab3500-38384ac
+// 2.New solution  wht-0.2-3-gab3500-38384ac or wht-2000.2.3-gab3500-38384ac
 //   IdStr        wht
 //   Major        0
 //   Minor        2
@@ -232,13 +232,16 @@
         }
     }
     constexpr size_t matchedIntel = 7;
-    std::regex pattern2("(\\w+?)-(\\d+?).(\\d+?)-(\\d+?)-g(\\w+?)-(\\w+?)");
+    std::regex pattern2("(\\w+?)-(\\d+?).(\\d+?)[-.](\\d+?)-g(\\w+?)-(\\w+?)");
     if (std::regex_match(s, results, pattern2))
     {
         if (results.size() == matchedIntel)
         {
             rev.platform = results[1];
-            rev.major = static_cast<uint8_t>(std::stoi(results[2]));
+            std::string majorVer = results[2].str();
+            // Take only the last two digits of the major version
+            rev.major = static_cast<uint8_t>(
+                std::stoi(majorVer.substr(majorVer.size() - 2)));
             rev.minor = static_cast<uint8_t>(std::stoi(results[3]));
             rev.buildNo = static_cast<uint32_t>(std::stoi(results[4]));
             rev.openbmcHash = results[6];