Parses a distro version string and returns a modified string
that matches the format needed for the gitbuilder url.
- Minor version numbers are ignored if they end in a zero. If they do
- not end in a zero the minor version number is included with a dash as
- the separator instead of a period.
- """
- version_tokens = version.split(".")
- include_minor_version = (
- len(version_tokens) > 1 and
- version_tokens[1] != "0"
- )
- if include_minor_version:
- return "_".join(version_tokens)
-
+ Minor version numbers are ignored.
+ """
# return only the major version
- return version_tokens[0]
+ return version.split(".")[0]
def _get_baseurl(ctx, remote, config):
m_get_config_value_for_remote.return_value = "tag"
result = install._get_baseurlinfo_and_dist(Mock(), remote, dict())
expected = dict(
- dist="centos6_5",
+ dist="centos6",
arch="x86_64",
flavor="basic",
uri="ref/tag",
- dist_release="el6_5",
+ dist_release="el6",
)
assert result == expected