def METHOD_NAME(self, package_name, is_official_release):
    """
    There are two possible formats for our package names:
    - RC format, containing git hash and build type
      eg: <repo>[-ee]-<A.B.C.D>-<commit>[-<build_type>]-<system>-<machine>.tar.gz
    - Release format (is always release, so no need for build_type):
      eg: <repo>[-ee]-<A.B.C.D>-b<build_number>-<system>-<machine>.tar.gz
    Note that each of these types has an optional -ee for backwards compatibility to our
    previous enterprise vs community split. Also the yugabyte package has an optional build
    type, ie: -release, -debug, etc.
    """
    # Expect <repo>-<version>.
    pattern = "^(?P<repo>[^-]+)(?:-[^-]+)?-(?P<version>{})".format(RELEASE_VERSION_PATTERN)
    # If this is an official release, we expect a commit hash and maybe a build_type, else we
    # expect a "-b" and a build number.
    if is_official_release:
        # Add build number.
        pattern += "-b(?P<build_number>[0-9]+)"
    else:
        # Add commit hash and maybe build type.
        pattern += "-(?P<commit_hash>[^-]+)(-(?P<build_type>[^-]+))?"
    pattern += r"(-(?P<compiler>[^-]+))?-(?P<system>[^-]+)-(?P<machine>[^-]+)\.tar\.gz$"
    match = re.match(pattern, package_name)
    if not match:
        raise YBOpsRuntimeError("Invalid package name format: {}".format(package_name))
    self.repo = match.group("repo")
    self.version = match.group("version")
    self.build_number = match.group("build_number") if is_official_release else None
    self.commit = match.group("commit_hash") if not is_official_release else None
    self.build_type = match.group("build_type") if not is_official_release else None
    self.compiler = match.group("compiler")
    self.system = match.group("system")
    self.machine = match.group("machine")