Skip to content

Commit

Permalink
Remove a bunch of not used legacy endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Sep 16, 2024
1 parent 5e82ef3 commit 3793f23
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 135 deletions.
4 changes: 2 additions & 2 deletions repologyapp/templates/repository.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
repometadata[repo].num_metapackages > 0 and
repometadata[repo].type == 'repository'
%}
<div class="alert alert-danger" role="alert"><p>This repository <a href="{{ url_for('repositories_fields', _anchor=repo) }}">does not provide</a> project <strong>homepage or download links</strong> in a way accessible by Repology. This is critical, because these are used to resolve project name conflicts, e.g. to distinguish similarly named packages of unrelated projects. Because of that, this repository is <strong>subject to removal</strong> in the near future.</p><p>See <a href="{{ url_for('addrepo') }}">documentation</a> for a best way to make package metadata available for Repology.</p></div>
<div class="alert alert-danger" role="alert"><p>This repository <a href="{{ url_for('repositories_fields', _anchor=repo) }}">does not provide</a> project <strong>homepage or download links</strong> in a way accessible by Repology. This is critical, because these are used to resolve project name conflicts, e.g. to distinguish similarly named packages of unrelated projects. Because of that, this repository is <strong>subject to removal</strong> in the near future.</p><p>See <a href="{{ url_for('docs_requirements') }}">documentation</a> for a best way to make package metadata available for Repology.</p></div>
{% endif %}

{% if
Expand All @@ -31,7 +31,7 @@
repometadata[repo].num_metapackages > 0 and
repometadata[repo].type == 'repository'
%}
<div class="alert alert-danger" role="alert"><p>This repository <a href="{{ url_for('repositories_fields', _anchor=repo) }}">does not provide</a> links to <strong>package recipes or sources</strong> in a way accessible by Repology. This is critical, because one of the goals of Repology is to make the details of how a project is packaged visible to anyone. It makes Repology maintenance harder as it's not possible to easily check where a specific version comes from; it does not allow upstream to check the recipe and improve their software to simplify packaging, or suggest corrections to the maintainer; it does not allow other maintainers to learn new ideas. It may be as well dangerous to users due to lack of transparency. Because of that, this repository is <strong>subject to removal</strong> in the near future.</p><p>See <a href="{{ url_for('addrepo') }}">documentation</a> for a best way to make package metadata available for Repology.</p></div>
<div class="alert alert-danger" role="alert"><p>This repository <a href="{{ url_for('repositories_fields', _anchor=repo) }}">does not provide</a> links to <strong>package recipes or sources</strong> in a way accessible by Repology. This is critical, because one of the goals of Repology is to make the details of how a project is packaged visible to anyone. It makes Repology maintenance harder as it's not possible to easily check where a specific version comes from; it does not allow upstream to check the recipe and improve their software to simplify packaging, or suggest corrections to the maintainer; it does not allow other maintainers to learn new ideas. It may be as well dangerous to users due to lack of transparency. Because of that, this repository is <strong>subject to removal</strong> in the near future.</p><p>See <a href="{{ url_for('docs_requirements') }}">documentation</a> for a best way to make package metadata available for Repology.</p></div>
{% endif %}

{% if repometadata[repo].repolinks %}
Expand Down
133 changes: 1 addition & 132 deletions repologyapp/views/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,111 +188,12 @@ def metapackage_report(name: str) -> Response:
return flask.redirect(flask.url_for('project_report', name=name), 301)


@ViewRegistrar('/api/v1/metapackages/')
@ViewRegistrar('/api/v1/metapackages/<bound>/')
def api_v1_metapackages(bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, **_get_projects_args()), 301)


@ViewRegistrar('/api/v1/metapackage/<name>')
def api_v1_metapackage(name: str) -> Response:
return flask.redirect(flask.url_for('api_v1_project', name=name), 301)


@ViewRegistrar('/api/v1/metapackages/all/')
@ViewRegistrar('/api/v1/metapackages/all/<bound>/')
def api_v1_metapackages_all(bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound), 301)


@ViewRegistrar('/api/v1/metapackages/unique/')
@ViewRegistrar('/api/v1/metapackages/unique/<bound>/')
def api_v1_metapackages_unique(bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, families=1), 301)


@ViewRegistrar('/api/v1/metapackages/in-repo/<repo>/')
@ViewRegistrar('/api/v1/metapackages/in-repo/<repo>/<bound>/')
def api_v1_metapackages_in_repo(repo: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, inrepo=repo), 301)


@ViewRegistrar('/api/v1/metapackages/outdated-in-repo/<repo>/')
@ViewRegistrar('/api/v1/metapackages/outdated-in-repo/<repo>/<bound>/')
def api_v1_metapackages_outdated_in_repo(repo: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, inrepo=repo, outdated=1), 301)


@ViewRegistrar('/api/v1/metapackages/not-in-repo/<repo>/')
@ViewRegistrar('/api/v1/metapackages/not-in-repo/<repo>/<bound>/')
def api_v1_metapackages_not_in_repo(repo: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, notinrepo=repo), 301)


@ViewRegistrar('/api/v1/metapackages/candidates-in-repo/<repo>/')
@ViewRegistrar('/api/v1/metapackages/candidates-in-repo/<repo>/<bound>/')
def api_v1_metapackages_candidates_in_repo(repo: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, inrepo=repo, families='5-'), 301)


@ViewRegistrar('/api/v1/metapackages/unique-in-repo/<repo>/')
@ViewRegistrar('/api/v1/metapackages/unique-in-repo/<repo>/<bound>/')
def api_v1_metapackages_unique_in_repo(repo: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, inrepo=repo, families=1), 301)


@ViewRegistrar('/api/v1/metapackages/by-maintainer/<maintainer>/')
@ViewRegistrar('/api/v1/metapackages/by-maintainer/<maintainer>/<bound>/')
def api_v1_metapackages_by_maintainer(maintainer: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, maintainer=maintainer), 301)


@ViewRegistrar('/api/v1/metapackages/outdated-by-maintainer/<maintainer>/')
@ViewRegistrar('/api/v1/metapackages/outdated-by-maintainer/<maintainer>/<bound>/')
def api_v1_metapackages_outdated_by_maintainer(maintainer: str, bound: str | None = None) -> Response:
return flask.redirect(flask.url_for('api_v1_projects', bound=bound, maintainer=maintainer, outdated=1), 301)


@ViewRegistrar('/graph/total/metapackages.svg')
def graph_total_metapackages() -> Response:
return flask.redirect(flask.url_for('graph_total_projects'), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_total.svg')
def graph_repo_metapackages_total(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_total', repo=repo), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_newest.svg')
def graph_repo_metapackages_newest(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_newest', repo=repo), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_newest_percent.svg')
def graph_repo_metapackages_newest_percent(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_newest_percent', repo=repo), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_outdated.svg')
def graph_repo_metapackages_outdated(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_outdated', repo=repo), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_outdated_percent.svg')
def graph_repo_metapackages_outdated_percent(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_outdated_percent', repo=repo), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_unique.svg')
def graph_repo_metapackages_unique(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_unique', repo=repo), 301)


@ViewRegistrar('/graph/repo/<repo>/metapackages_unique_percent.svg')
def graph_repo_metapackages_unique_percent(repo: str) -> Response:
return flask.redirect(flask.url_for('graph_repo_projects_unique_percent', repo=repo), 301)


# active badges on smartmontools.org, lyx.org and others
@ViewRegistrar('/badge/version-only-for-repo/<repo>/<name>.svg')
def badge_version_only_for_repo(repo: str, name: str) -> Response:
return flask.redirect(
Expand All @@ -307,38 +208,6 @@ def badge_version_only_for_repo(repo: str, name: str) -> Response:
)


@ViewRegistrar('/maintainer/<maintainer>/problems')
def maintainer_problems_legacy(maintainer: str) -> Response:
# actual problems listing is tied to repository+maintainer pair,
# so determine most active repo and redirect to it

maintainer = maintainer.lower()

maintainer_info = get_db().get_maintainer_information(maintainer)

if not maintainer_info or not maintainer_info['num_projects_newest_per_repo']:
return (flask.render_template('maintainer/404.html', maintainer=maintainer), 404)

bestrepo = max(
(
maintainer_info['num_projects_newest_per_repo'][repo],
-maintainer_info['num_projects_outdated_per_repo'][repo],
repometadata[repo]['num_metapackages_newest'],
repo
)
for repo in maintainer_info['num_projects_newest_per_repo'].keys()
)[-1]

return flask.redirect(
flask.url_for(
'maintainer_problems',
repo=bestrepo,
maintainer=maintainer
),
301
)


@ViewRegistrar('/addrepo')
@ViewRegistrar('/docs/addrepo')
def addrepo() -> Response:
Expand Down
1 change: 0 additions & 1 deletion tests/test_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def test_maintainer():

@requires_database
def test_maintainer_problems():
checkurl_301('/maintainer/[email protected]/problems') # legacy
checkurl_html('/maintainer/[email protected]/problems-for-repo/freebsd')


Expand Down

0 comments on commit 3793f23

Please sign in to comment.