code: public static AppVersion parseName(String amiName) {
          if (amiName == null) {
              return null;
          }
          Matcher matcher = APP_VERSION_PATTERN.matcher(amiName);
          if (!matcher.matches()) {
              return null;
          }
          AppVersion parsedName = new AppVersion();
          parsedName.packageName = matcher.group(1);
          parsedName.version = matcher.group(2);
          // Historically we put the change number first because with Perforce it was a number we could use to sort.
          // This broke when we started using git, since hashes have no order. For a while the stash builds ommited the
          // commit id, but eventually we began appending it after the build number.
          boolean buildFirst = matcher.group(3) != null && matcher.group(3).startsWith("h"); // 'h' is for Hudson
          String buildString = matcher.group(buildFirst ? 3 : 4);
          parsedName.buildNumber = buildString != null ? buildString.substring(1) : null;
          parsedName.commit = matcher.group(buildFirst ? 4 : 3);
          parsedName.buildJobName = matcher.group(5);
          return parsedName;
      }
docs: Parses the appversion tag into its component parts.
  
  @param amiName the text of the AMI's appversion tag
  @return bean representing the component parts of the appversion tag