def get_qa_build_urls():
    print('Looking up all patcher builds needing analysis')

    base_url = 'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/builds'

    parameters = {'tabs1': 'accounts'}

    links = []

    def append_build_link(columns):
        if columns['build id'].text.strip().lower() != 'qa analysis needed':
            return

        for link_tag in columns['qa status'].find_all('a'):
            if link_tag['href'].find(
                    'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/builds/'
            ) == 0:
                window_state_href = link_tag['href']
                query_index = window_state_href.find('?')
                links.append(window_state_href if query_index ==
                             -1 else window_state_href[0:query_index])

    process_patcher_search_container(
        base_url, parameters, 'patcherBuildsSearchContainerSearchContainer',
        ['build id', 'qa status'], append_build_link)

    return links
def get_62_fix_pack_tag(fix_pack_name):
    base_url = 'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/fix_packs'

    parameters = {'delta': '200'}

    tag_names = []

    def get_fix_pack(columns):
        for link_tag in columns['name'].find_all('a'):
            if link_tag.text != fix_pack_name:
                continue

            html = get_liferay_content(link_tag['href'])
            soup = BeautifulSoup(html, 'html.parser')

            for fp_label in soup.find_all('label'):
                if fp_label['for'] is not None and fp_label['for'].find(
                        'git-hash') > 0:
                    fp_url = fp_label.find_parent('div').find('a')['href']
                    tag_names.append(fp_url[fp_url.find('...') + 3:])

    process_patcher_search_container(
        base_url, parameters, 'patcherFixPacksSearchContainerSearchContainer',
        ['name'], get_fix_pack)

    if len(tag_names) == 0:
        return None

    return tag_names[0]
def get_new_fixes(build_id, new_fix_names):
    print('Looking up fixes for patcher build %s' % build_id)

    base_url = 'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/builds/%s/fixes' % build_id
    parameters = {}

    links = []

    def process_fixes(columns):
        has_fix = False

        for fix_name in columns['name'].text.strip().split(','):
            if fix_name in new_fix_names:
                has_fix = True

        if not has_fix:
            return

        fix_id = columns['fix id'].text.strip()

        links.append(
            'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/fixes/%s'
            % fix_id)

    process_patcher_search_container(
        base_url, parameters, 'patcherFixsSearchContainerSearchContainer',
        ['fix id', 'name'], process_fixes)

    base_url = 'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/builds/%s/childBuilds' % build_id
    parameters = {}

    def process_child_builds(columns):
        child_build_id = columns['build id'].text.strip()
        links.extend(get_new_fixes(child_build_id, new_fix_names))

    process_patcher_search_container(
        base_url, parameters, 'patcherBuildsSearchContainerSearchContainer',
        ['build id'], process_child_builds)

    return links