def get_version(url):
        data = '\n'.join(get_url_content(url=url))
        primary_path = PRIMARY_XML_GZ_REGEX.search(data).groups()[0]
        xml_url = url.replace(REPOMD_XML_PATH, primary_path)

        parser = Parser(url=xml_url)
        major_versions = [package['version'][1]['ver'] for package in parser.getList()]
        return max(set(major_versions), key=major_versions.count)
Ejemplo n.º 2
0
def get_branch_version_from_repo(url):
    page = requests.get(url).text
    repo_regex = re.compile(r'baseurl=(http.*?)\$basearch')

    match = repo_regex.search(page)
    if not match:
        raise ValueError("url isn't a correct yum repo\n\turl:[{}] ".format(url))

    repo_base_url = match.groups()[0]
    url = "{}x86_64/repodata/repomd.xml".format(repo_base_url)
    page = requests.get(url).text

    primary_regex = re.compile(r'="(.*?primary.xml.gz)"')
    primary_path = primary_regex.search(page).groups()[0]

    url = "{}x86_64/{}".format(repo_base_url, primary_path)

    parser = Parser(url=url)
    major_versions = [package['version'][1]['ver'] for package in parser.getList()]

    return max(set(major_versions), key=major_versions.count)
Ejemplo n.º 3
0
 def __init__(self, session, url):
     self.session = session
     self.url = url
     Parser.__init__(self, url=url)
Ejemplo n.º 4
0
 def __init__(self, session, url):
     self.session = session
     self.url = url
     Parser.__init__(self, url=url)