コード例 #1
0
ファイル: missing_deps.py プロジェクト: jelmer/debian-janitor
async def schedule_new_package(conn, upstream_info, policy, requestor=None, origin=None):
    from debmutate.vcs import unsplit_vcs_url
    package = upstream_info['name'].replace('/', '-') + '-upstream'
    logging.info(
        "Creating new upstream %s => %s",
        package, upstream_info['branch_url'])
    vcs_url = unsplit_vcs_url(upstream_info['branch_url'], None, upstream_info.get('subpath'))
    await conn.execute(
        "INSERT INTO package (name, distribution, branch_url, subpath, maintainer_email, origin, vcs_url) "
        "VALUES ($1, $2, $3, $4, $5, $6, $7) ON CONFLICT DO NOTHING",
        package, 'upstream', upstream_info['branch_url'], '',
        '*****@*****.**', origin, vcs_url)
    await store_candidates(
        conn,
        [(package, 'debianize', None, DEFAULT_NEW_PACKAGE_PRIORITY,
          DEFAULT_SUCCESS_CHANCE)])
    await sync_policy(conn, policy, selected_package=package)
    policy = await conn.fetchrow(
        "SELECT update_changelog, command "
        "FROM policy WHERE package = $1 AND suite = $2",
        package, 'debianize')
    command = policy['command']
    if upstream_info['version']:
        command += ' --upstream-version=%s' % upstream_info['version']
    command = full_command(policy['update_changelog'], command)
    await do_schedule(conn, package, "debianize", requestor=requestor, bucket='missing-deps', command=command)
コード例 #2
0
ファイル: vcs.py プロジェクト: jelmer/lintian-brush
def find_secure_vcs_url(url: str, net_access: bool = True) -> Optional[str]:
    (repo_url, branch, subpath) = split_vcs_url(url)
    repo_url = find_secure_repo_url(repo_url,
                                    branch=branch,
                                    net_access=net_access)
    if repo_url is None:
        return None

    return unsplit_vcs_url(repo_url, branch, subpath)
コード例 #3
0
ファイル: vcs.py プロジェクト: jelmer/lintian-brush
def fixup_broken_git_url(url: str) -> str:
    """Attempt to fix up broken Git URLs.

    A common misspelling is to add an extra ":" after the hostname
    """
    repo_url, branch, subpath = split_vcs_url(url)
    newrepo_url, newbranch, newsubpath = fixup_broken_git_details(
        repo_url, branch, subpath)
    if newrepo_url != repo_url or newbranch != branch or newsubpath != subpath:
        return unsplit_vcs_url(newrepo_url, newbranch, newsubpath)
    return url
コード例 #4
0
ファイル: vcs.py プロジェクト: jelmer/lintian-brush
def fixup_rcp_style_git_url(url: str) -> str:
    (repo_url, branch, subpath) = split_vcs_url(url)
    repo_url = fixup_rcp_style_git_repo_url(repo_url)
    return unsplit_vcs_url(repo_url, branch, subpath)
コード例 #5
0
ファイル: vcs.py プロジェクト: jelmer/lintian-brush
def find_public_vcs_url(url: str) -> Optional[str]:
    (repo_url, branch, subpath) = split_vcs_url(url)
    revised_url = find_public_repo_url(repo_url)
    if revised_url is not None:
        return unsplit_vcs_url(revised_url, branch, subpath)
    return None
コード例 #6
0
ファイル: vcs.py プロジェクト: jelmer/lintian-brush
def canonical_vcs_git_url(url: str) -> str:
    (repo_url, branch, subpath) = split_vcs_url(url)
    repo_url = canonical_git_repo_url(repo_url)
    return unsplit_vcs_url(repo_url, branch, subpath)
コード例 #7
0
async def update_package_metadata(
    conn, distribution: str, provided_packages, package_overrides, origin
):
    logging.info("Updating package metadata.")
    packages = []
    for package in provided_packages:
        try:
            override = package_overrides[package.name]
        except KeyError:
            vcs_url = package.vcs_url
        else:
            vcs_url = override.branch_url or package.vcs_url or None

        vcs_last_revision = None

        if package.vcs_type and package.vcs_type.capitalize() == "Git":
            new_vcs_url = fixup_broken_git_url(vcs_url)
            if new_vcs_url != vcs_url:
                logging.info("Fixing up VCS URL: %s -> %s", vcs_url, new_vcs_url)
                vcs_url = new_vcs_url
            if package.commit_id:
                vcs_last_revision = default_mapping.revision_id_foreign_to_bzr(
                    package.commit_id.encode("ascii")
                )

        if package.vcs_type:
            # Drop the subpath, we're storing it separately.
            (url, branch, subpath) = split_vcs_url(vcs_url)
            url = unsplit_vcs_url(url, branch)
            url = canonicalize_vcs_url(package.vcs_type, url)
            try:
                branch_url = convert_debian_vcs_url(package.vcs_type.capitalize(), url)
            except ValueError as e:
                logging.info("%s: %s", package.name, e)
                branch_url = None
        else:
            subpath = None
            branch_url = None

        if vcs_url:
            vcs_browser = determine_browser_url(package.vcs_type, vcs_url)
        else:
            vcs_browser = None

        if vcs_browser is None and package.vcs_browser:
            vcs_browser = package.vcs_browser

        packages.append(
            (
                package.name,
                distribution,
                branch_url if branch_url else None,
                subpath if subpath else None,
                package.maintainer_email if package.maintainer_email else None,
                package.uploader_email if package.uploader_email else [],
                package.archive_version if package.archive_version else None,
                package.vcs_type.lower() if package.vcs_type else None,
                vcs_url,
                vcs_browser,
                vcs_last_revision.decode("utf-8") if vcs_last_revision else None,
                package.vcswatch_status.lower() if package.vcswatch_status else None,
                package.vcswatch_version if package.vcswatch_version else None,
                package.insts,
                package.removed,
                package.in_base,
                origin
            )
        )
    await conn.executemany(
        "INSERT INTO package "
        "(name, distribution, branch_url, subpath, maintainer_email, "
        "uploader_emails, archive_version, vcs_type, vcs_url, vcs_browse, "
        "vcs_last_revision, vcswatch_status, vcswatch_version, popcon_inst, "
        "removed, in_base, origin) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, "
        "$13, $14, $15, $16, $17) ON CONFLICT (name, distribution) DO UPDATE SET "
        "branch_url = EXCLUDED.branch_url, "
        "subpath = EXCLUDED.subpath, "
        "maintainer_email = EXCLUDED.maintainer_email, "
        "uploader_emails = EXCLUDED.uploader_emails, "
        "archive_version = EXCLUDED.archive_version, "
        "vcs_type = EXCLUDED.vcs_type, "
        "vcs_url = EXCLUDED.vcs_url, "
        "vcs_last_revision = EXCLUDED.vcs_last_revision, "
        "vcs_browse = EXCLUDED.vcs_browse, "
        "vcswatch_status = EXCLUDED.vcswatch_status, "
        "vcswatch_version = EXCLUDED.vcswatch_version, "
        "popcon_inst = EXCLUDED.popcon_inst, "
        "removed = EXCLUDED.removed, "
        "in_base = EXCLUDED.in_base",
        packages,
    )