Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-ogr for openSUSE:Factory checked in at 2023-06-28 21:33:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ogr (Old) and /work/SRC/openSUSE:Factory/.python-ogr.new.13546 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ogr" Wed Jun 28 21:33:33 2023 rev:5 rq:1095771 version:0.45.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ogr/python-ogr.changes 2022-12-03 10:03:57.703348719 +0100 +++ /work/SRC/openSUSE:Factory/.python-ogr.new.13546/python-ogr.changes 2023-06-28 21:33:44.889997651 +0200 @@ -1,0 +2,14 @@ +Tue Jun 27 11:25:57 UTC 2023 - Markéta Machová <mmach...@suse.com> + +- Update to 0.45.0 + * OGR now supports PyGithub >= 1.58. + * OGR now understands a few community-hosted GitLab instances + that could not be determined automatically from the hostname. + * Fixes an issue with project->service mapping where the service + with an url not containing the service type wasn't matched. + * A bug in ogr resulting in returning only first page of pull + requests for Pagure has been fixed. + * ogr now raises GitForgeInternalError rather than PagureAPIException + when getting 50x response from the Pagure API. + +------------------------------------------------------------------- Old: ---- ogr-0.41.0.tar.gz New: ---- ogr-0.45.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ogr.spec ++++++ --- /var/tmp/diff_new_pack.xHh4r5/_old 2023-06-28 21:33:45.622001973 +0200 +++ /var/tmp/diff_new_pack.xHh4r5/_new 2023-06-28 21:33:45.630002021 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-ogr # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-ogr -Version: 0.41.0 +Version: 0.45.0 Release: 0 Summary: One API for multiple git forges License: MIT ++++++ ogr-0.41.0.tar.gz -> ogr-0.45.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/.github/workflows/do-release.yml new/ogr-0.45.0/.github/workflows/do-release.yml --- old/ogr-0.41.0/.github/workflows/do-release.yml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/.github/workflows/do-release.yml 2023-06-05 19:00:23.000000000 +0200 @@ -11,8 +11,9 @@ if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') && github.repository_owner == 'packit' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - run: | + - uses: actions/checkout@v3 + - name: Create GitHub release + run: | VERSION=$(grep -oP '^# \K[0-9.]*' CHANGELOG.md | head -n 1) # Take the lines between the first two headers from CHANGELOG.md, # and use it as a description for the new release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/.github/workflows/docs.yml new/ogr-0.45.0/.github/workflows/docs.yml --- old/ogr-0.41.0/.github/workflows/docs.yml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/.github/workflows/docs.yml 2023-06-05 19:00:23.000000000 +0200 @@ -11,7 +11,7 @@ steps: - name: Checkout branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build and push docs run: | git config user.name Packit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/.github/workflows/prepare-release.yml new/ogr-0.45.0/.github/workflows/prepare-release.yml --- old/ogr-0.41.0/.github/workflows/prepare-release.yml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/.github/workflows/prepare-release.yml 2023-06-05 19:00:23.000000000 +0200 @@ -17,17 +17,14 @@ with: fetch-depth: 0 - name: Prepare release content - uses: packit/prepare-release@v0 + uses: packit/prepare-release@v1 with: version: ${{ inputs.version }} specfiles: fedora/python-ogr.spec - env: - GITHUB_TOKEN: ${{ secrets.RELEASEBOT_GITHUB_TOKEN }} - name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: labels: release - token: ${{ secrets.RELEASEBOT_GITHUB_TOKEN }} commit-message: Release ${{ inputs.version }} title: Release ${{ inputs.version }} body: Update the changelog and the specfile for release ${{ inputs.version }}. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/.github/workflows/pypi-publish.yml new/ogr-0.45.0/.github/workflows/pypi-publish.yml --- old/ogr-0.41.0/.github/workflows/pypi-publish.yml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/.github/workflows/pypi-publish.yml 2023-06-05 19:00:23.000000000 +0200 @@ -10,21 +10,21 @@ jobs: build-n-publish: runs-on: ubuntu-latest + permissions: + id-token: write # for trusted publishing steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 - name: Build a source tarball and a binary wheel # https://pypa-build.readthedocs.io run: | python -m pip install build - python -m build --sdist --wheel + python -m build - name: Publish ð¦ to PyPI # https://github.com/pypa/gh-action-pypi-publish uses: pypa/gh-action-pypi-publish@release/v1 with: - # secrets.PYPI_API_TOKEN is set to usercont-release-bot user token - password: ${{ secrets.PYPI_API_TOKEN }} verbose: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/.packit.yaml new/ogr-0.45.0/.packit.yaml --- old/ogr-0.41.0/.packit.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/.packit.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -20,7 +20,7 @@ create-archive: - python3 setup.py sdist --dist-dir ./fedora/ - bash -c "ls -1t ./fedora/*.tar.gz | head -n 1" - get-current-version: python3 setup.py --version + get-current-version: python3 -W ignore setup.py --version # TODO: remove -W ignore when setup process is updated srpm_build_deps: - python3-pip # "python3 setup.py --version" needs it @@ -47,7 +47,7 @@ - fedora-all - epel-9 - - job: production_build + - job: upstream_koji_build trigger: pull_request scratch: True targets: @@ -82,6 +82,12 @@ list_on_homepage: True preserve_project: True + - job: pull_from_upstream + trigger: release + dist_git_branches: + - fedora-all + - epel-9 + # downstream automation: - job: koji_build trigger: commit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/.pre-commit-config.yaml new/ogr-0.45.0/.pre-commit-config.yaml --- old/ogr-0.41.0/.pre-commit-config.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/.pre-commit-config.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -4,19 +4,19 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.38.2 + rev: v3.4.0 hooks: - id: pyupgrade - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.0 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-ast @@ -30,19 +30,19 @@ - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 args: [--max-line-length=100] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.971 + rev: v1.3.0 hooks: - id: mypy args: [--no-strict-optional, --ignore-missing-imports] additional_dependencies: [types-pkg_resources, types-requests, types-Deprecated] - repo: https://github.com/packit/pre-commit-hooks - rev: 8db5a24e01b9f54aaa7a800f33c4b9aa619af1b9 + rev: v1.2.0 hooks: - id: check-rebase args: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/CHANGELOG.md new/ogr-0.45.0/CHANGELOG.md --- old/ogr-0.41.0/CHANGELOG.md 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/CHANGELOG.md 2023-06-05 19:00:23.000000000 +0200 @@ -1,3 +1,20 @@ +# 0.45.0 + +- OGR now supports PyGithub >= 1.58. + +# 0.44.0 + +- OGR now understands a few community-hosted GitLab instances that could not be determined automatically from the hostname. Thanks to that, you don't need to hardcode these instances to be mapped correctly. (#775) + +# 0.43.0 + +- Fixes an issue with project->service mapping where the service with an url not containing the service type wasn't matched. (#771) + +# 0.42.0 + +- A bug in ogr resulting in returning only first page of pull requests for Pagure has been fixed. (#761) +- ogr now raises `GitForgeInternalError` rather than `PagureAPIException` when getting 50x response from the Pagure API. (#762) + # 0.41.0 - `CommitComment.comment` has been deprecated in favour of `CommitComment.body` to make the naming consistent across objects. (#748) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/Makefile new/ogr-0.45.0/Makefile --- old/ogr-0.41.0/Makefile 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/Makefile 2023-06-05 19:00:23.000000000 +0200 @@ -2,6 +2,8 @@ TEST_TARGET ?= ./tests/ PY_PACKAGE := ogr OGR_IMAGE := ogr +COLOR ?= yes +COV_REPORT ?= --cov=ogr --cov-report=term-missing build-test-image: recipe.yaml ansible-bender build --build-volumes $(CURDIR):/src:Z -- ./recipe.yaml $(BASE_IMAGE) $(OGR_IMAGE) @@ -9,10 +11,16 @@ check: @#`python3 -m pytest` doesn't work here b/c the way requre overrides import system: @#`AttributeError: module 'importlib_metadata' has no attribute 'distributions' - PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 /usr/bin/pytest --verbose --showlocals $(TEST_TARGET) + PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 /usr/bin/pytest --color=$(COLOR) --verbose --showlocals $(COV_REPORT) $(TEST_TARGET) check-in-container: - podman run --rm -it -v $(CURDIR):/src:Z -w /src --env TEST_TARGET $(OGR_IMAGE) make -e GITHUB_TOKEN=$(GITHUB_TOKEN) GITLAB_TOKEN=$(GITLAB_TOKEN) check + podman run --rm -it \ + -v $(CURDIR):/src:Z -w /src \ + --env TEST_TARGET \ + --env COLOR \ + --env COV_REPORT \ + $(OGR_IMAGE) \ + make -e GITHUB_TOKEN=$(GITHUB_TOKEN) GITLAB_TOKEN=$(GITLAB_TOKEN) check shell: podman run --rm -ti -v $(CURDIR):/src:Z -w /src $(OGR_IMAGE) bash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/PKG-INFO new/ogr-0.45.0/PKG-INFO --- old/ogr-0.41.0/PKG-INFO 2022-10-27 12:53:59.205885400 +0200 +++ new/ogr-0.45.0/PKG-INFO 2023-06-05 19:00:33.002232300 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: ogr -Version: 0.41.0 +Version: 0.45.0 Summary: One API for multiple git forges. Home-page: https://github.com/packit/ogr Author: Red Hat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/fedora/python-ogr.spec new/ogr-0.45.0/fedora/python-ogr.spec --- old/ogr-0.41.0/fedora/python-ogr.spec 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/fedora/python-ogr.spec 2023-06-05 19:00:23.000000000 +0200 @@ -1,7 +1,7 @@ %global srcname ogr Name: python-%{srcname} -Version: 0.41.0 +Version: 0.45.0 Release: 1%{?dist} Summary: One API for multiple git forges @@ -52,6 +52,18 @@ %changelog +* Mon Jun 05 2023 Packit Team <he...@packit.dev> - 0.45.0-1 +- New upstream release 0.45.0 + +* Sun Mar 05 2023 Packit Team <he...@packit.dev> - 0.44.0-1 +- New upstream release 0.44.0 + +* Thu Feb 23 2023 Packit Team <he...@packit.dev> - 0.43.0-1 +- New upstream release 0.43.0 + +* Mon Jan 16 2023 Packit Team <he...@packit.dev> - 0.42.0-1 +- New upstream release 0.42.0 + * Thu Oct 27 2022 Packit Team <he...@packit.dev> - 0.41.0-1 - New upstream release 0.41.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/files/tasks/generic-dnf-requirements.yaml new/ogr-0.45.0/files/tasks/generic-dnf-requirements.yaml --- old/ogr-0.41.0/files/tasks/generic-dnf-requirements.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/files/tasks/generic-dnf-requirements.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -8,6 +8,7 @@ - python3-pip - python3-pygithub - python3-gitlab + - python3-pytest-cov become: true - name: Install rpmautospec-rpm-macros dnf: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/files/tasks/project-dir.yaml new/ogr-0.45.0/files/tasks/project-dir.yaml --- old/ogr-0.41.0/files/tasks/project-dir.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/files/tasks/project-dir.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -1,17 +1,17 @@ --- -- set_fact: +- ansible.builtin.set_fact: project_dir: "{{ playbook_dir }}/.." when: zuul is not defined -- set_fact: +- ansible.builtin.set_fact: project_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" when: zuul is defined - name: stat {{ project_dir }} - stat: + ansible.builtin.stat: path: "{{ project_dir }}" tags: - no-cache register: src_path -- name: Make sure {{ project_dir }} is present - assert: +- name: Assert project_dir is present + ansible.builtin.assert: that: - src_path.stat.isdir diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/files/zuul-install-requirements-pip.yaml new/ogr-0.45.0/files/zuul-install-requirements-pip.yaml --- old/ogr-0.41.0/files/zuul-install-requirements-pip.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/files/zuul-install-requirements-pip.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -2,10 +2,10 @@ - name: Install dependencies for PIP ogr hosts: all tasks: - - include_tasks: tasks/generic-dnf-requirements.yaml - - include_tasks: tasks/python-compile-deps.yaml + - ansible.builtin.include_tasks: tasks/generic-dnf-requirements.yaml + - ansible.builtin.include_tasks: tasks/python-compile-deps.yaml - name: Install deps from PyPI - pip: + ansible.builtin.pip: name: "{{ item }}" with_items: - PyGithub diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/files/zuul-install-requirements-rpms.yaml new/ogr-0.45.0/files/zuul-install-requirements-rpms.yaml --- old/ogr-0.41.0/files/zuul-install-requirements-rpms.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/files/zuul-install-requirements-rpms.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -2,11 +2,11 @@ - name: Install RPM dependencies for ogr hosts: all tasks: - - include_tasks: tasks/project-dir.yaml - - include_tasks: tasks/generic-dnf-requirements.yaml - - include_tasks: tasks/build-rpm-deps.yaml + - ansible.builtin.include_tasks: tasks/project-dir.yaml + - ansible.builtin.include_tasks: tasks/generic-dnf-requirements.yaml + - ansible.builtin.include_tasks: tasks/build-rpm-deps.yaml - name: Install deps as RPMs - dnf: + ansible.builtin.dnf: name: - python3-pygithub - python3-gitlab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/files/zuul-reverse-dep-packit.yaml new/ogr-0.45.0/files/zuul-reverse-dep-packit.yaml --- old/ogr-0.41.0/files/zuul-reverse-dep-packit.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/files/zuul-reverse-dep-packit.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -2,11 +2,11 @@ - name: Check if we are not breaking packit hosts: all tasks: - - set_fact: + - ansible.builtin.set_fact: reverse_dir: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/packit/packit'].src_dir }}" - - include_tasks: tasks/project-dir.yaml - - include_tasks: tasks/generic-dnf-requirements.yaml - - include_tasks: tasks/rpm-test-deps.yaml - - include_tasks: tasks/packit-requirements.yaml - - include_tasks: tasks/install-ogr.yaml - - include_tasks: tasks/packit-tests.yaml + - ansible.builtin.include_tasks: tasks/project-dir.yaml + - ansible.builtin.include_tasks: tasks/generic-dnf-requirements.yaml + - ansible.builtin.include_tasks: tasks/rpm-test-deps.yaml + - ansible.builtin.include_tasks: tasks/packit-requirements.yaml + - ansible.builtin.include_tasks: tasks/install-ogr.yaml + - ansible.builtin.include_tasks: tasks/packit-tests.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/files/zuul-tests.yaml new/ogr-0.45.0/files/zuul-tests.yaml --- old/ogr-0.41.0/files/zuul-tests.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/files/zuul-tests.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -2,11 +2,11 @@ - name: This is a recipe for how to run ogr tests hosts: all tasks: - - include_tasks: tasks/project-dir.yaml - - include_tasks: tasks/rpm-test-deps.yaml - - include_tasks: tasks/install-ogr.yaml - - include_tasks: tasks/configure-git.yaml + - ansible.builtin.include_tasks: tasks/project-dir.yaml + - ansible.builtin.include_tasks: tasks/rpm-test-deps.yaml + - ansible.builtin.include_tasks: tasks/install-ogr.yaml + - ansible.builtin.include_tasks: tasks/configure-git.yaml - name: Run tests - command: make check + ansible.builtin.command: make check args: chdir: "{{ project_dir }}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/__init__.py new/ogr-0.45.0/ogr/__init__.py --- old/ogr-0.41.0/ogr/__init__.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/__init__.py 2023-06-05 19:00:23.000000000 +0200 @@ -16,6 +16,7 @@ from ogr.services.github import GithubService from ogr.services.gitlab import GitlabService from ogr.services.pagure import PagureService +from ogr.abstract import AuthMethod try: __version__ = distribution(__name__).version @@ -27,6 +28,7 @@ GithubService.__name__, PagureService.__name__, GitlabService.__name__, + AuthMethod.__name__, get_project.__name__, get_service_class.__name__, get_service_class_or_none.__name__, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/abstract.py new/ogr-0.45.0/ogr/abstract.py --- old/ogr-0.41.0/ogr/abstract.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/abstract.py 2023-06-05 19:00:23.000000000 +0200 @@ -1241,6 +1241,12 @@ raise NotImplementedError() +class AuthMethod(str, Enum): + tokman = "tokman" + github_app = "github_app" + token = "token" + + class GitService(OgrAbstractClass): """ Attributes: @@ -1301,6 +1307,22 @@ """ raise NotImplementedError + def set_auth_method(self, method: AuthMethod) -> None: + """ + Override the default auth method. + Can be used when the service has more auth methods available. + + Args: + method: the method identifier (a str name) + """ + raise NotImplementedError() + + def reset_auth_method(self) -> None: + """ + Set the auth method to the default one. + """ + raise NotImplementedError() + def project_create( self, repo: str, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/factory.py new/ogr-0.45.0/ogr/factory.py --- old/ogr-0.41.0/ogr/factory.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/factory.py 2023-06-05 19:00:23.000000000 +0200 @@ -64,7 +64,7 @@ Args: url: URL of the project, e.g. `"https://github.com/packit/ogr"`. service_mapping_update: Custom mapping from - service url (`str`) to service class. + service url/hostname (`str`) to service class. Defaults to no mapping. custom_instances: List of instances that will be @@ -84,7 +84,7 @@ mapping = service_mapping_update.copy() if service_mapping_update else {} custom_instances = custom_instances or [] for instance in custom_instances: - mapping[instance.instance_url] = instance.__class__ + mapping[instance.hostname] = instance.__class__ kls = get_service_class(url=url, service_mapping_update=mapping) parsed_repo_url = parse_git_repo(url) @@ -117,7 +117,7 @@ Args: url: URL of the project, e.g. `"https://github.com/packit/ogr"`. - service_mapping_update: Custom mapping from service url (`str`) to service + service_mapping_update: Custom mapping from service url/hostname (`str`) to service class. Defaults to `None`. @@ -132,7 +132,7 @@ parsed_url = parse_git_repo(url) for service, service_kls in mapping.items(): - if service in parsed_url.hostname: + if parse_git_repo(service).hostname in parsed_url.hostname: return service_kls return None @@ -146,7 +146,7 @@ Args: url: URL of the project, e.g. `"https://github.com/packit/ogr"`. - service_mapping_update: Custom mapping from service url (str) to service + service_mapping_update: Custom mapping from service url/hostname (str) to service class. Defaults to `None`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/services/github/auth_providers/github_app.py new/ogr-0.45.0/ogr/services/github/auth_providers/github_app.py --- old/ogr-0.41.0/ogr/services/github/auth_providers/github_app.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/services/github/auth_providers/github_app.py 2023-06-05 19:00:23.000000000 +0200 @@ -75,7 +75,15 @@ if not self.private_key: return None - inst_id = self.integration.get_installation(namespace, repo).id + # PyGithub 1.58 deprecated get_installation() in favor of get_repo_installation() + # that raises an exception on error rather than returning None + if hasattr(self.integration, "get_repo_installation"): + try: + inst_id = self.integration.get_repo_installation(namespace, repo).id + except github.GithubException: + inst_id = None + else: + inst_id = self.integration.get_installation(namespace, repo).id # PyGithub<1.52 returned an object for id, with a value attribute, # which was None or an ID. # This was changed in: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/services/github/service.py new/ogr-0.45.0/ogr/services/github/service.py --- old/ogr-0.41.0/ogr/services/github/service.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/services/github/service.py 2023-06-05 19:00:23.000000000 +0200 @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT import logging -from typing import Optional, Type, Union, List +from typing import Optional, Type, Union, List, Dict import re from urllib3.util import Retry @@ -14,7 +14,7 @@ Repository as PyGithubRepository, ) -from ogr.abstract import GitUser +from ogr.abstract import GitUser, AuthMethod from ogr.exceptions import GithubAPIException from ogr.factory import use_for_service from ogr.services.base import BaseGitService, GitProject @@ -56,7 +56,9 @@ """ super().__init__() self.read_only = read_only - self.authentication = github_authentication + self._default_auth_method = github_authentication + self._other_auth_method: GithubAuthentication = None + self._auth_methods: Dict[AuthMethod, GithubAuthentication] = {} if isinstance(max_retries, Retry): self._max_retries = max_retries @@ -65,13 +67,13 @@ total=int(max_retries), read=0, # Retry mechanism active for these HTTP methods: - method_whitelist=["DELETE", "GET", "PATCH", "POST", "PUT"], + allowed_methods=["DELETE", "GET", "PATCH", "POST", "PUT"], # Only retry on following HTTP status codes status_forcelist=[500, 503, 403, 401], raise_on_status=False, ) - if not self.authentication: + if not self._default_auth_method: self.__set_authentication( token=token, github_app_id=github_app_id, @@ -86,16 +88,34 @@ def __set_authentication(self, **kwargs): auth_methods = [ - Tokman, - GithubApp, - TokenAuthentication, + (Tokman, AuthMethod.tokman), + (GithubApp, AuthMethod.github_app), + (TokenAuthentication, AuthMethod.token), ] - for auth_class in auth_methods: - self.authentication = auth_class.try_create(**kwargs) - if self.authentication: - return + for auth_class, auth_name in auth_methods: + auth_inst = auth_class.try_create(**kwargs) + self._auth_methods[auth_name] = auth_inst + if not self._default_auth_method: + self._default_auth_method = auth_inst + + return None if self._default_auth_method else TokenAuthentication(None) + + def set_auth_method(self, method: AuthMethod): + if self._auth_methods[method]: + logger.info("Forced Github auth method to %s", method) + self._other_auth_method = self._auth_methods[method] + else: + raise GithubAPIException( + f"Choosen authentication method ({method}) is not available" + ) - return TokenAuthentication(None) + def reset_auth_method(self): + logger.info("Reset Github auth method to the default") + self._other_auth_method = None + + @property + def authentication(self): + return self._other_auth_method or self._default_auth_method @property def github(self): @@ -152,7 +172,7 @@ return GithubUser(service=self) def change_token(self, new_token: str) -> None: - self.authentication = TokenAuthentication(new_token) + self._default_auth_method = TokenAuthentication(new_token) def project_create( self, @@ -193,7 +213,6 @@ search_pattern: str = None, language: str = None, ) -> List[GitProject]: - search_query = "" if user: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/services/gitlab/service.py new/ogr-0.45.0/ogr/services/gitlab/service.py --- old/ogr-0.41.0/ogr/services/gitlab/service.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/services/gitlab/service.py 2023-06-05 19:00:23.000000000 +0200 @@ -16,7 +16,20 @@ logger = logging.getLogger(__name__) -@use_for_service("gitlab") +@use_for_service("gitlab") # anything containing a gitlab word in hostname +# + list of community-hosted instances based on the following list +# https://wiki.p2pfoundation.net/List_of_Community-Hosted_GitLab_Instances +@use_for_service("salsa.debian.org") +@use_for_service("git.fosscommunity.in") +@use_for_service("framagit.org") +@use_for_service("dev.gajim.org") +@use_for_service("git.coop") +@use_for_service("lab.libreho.st") +@use_for_service("git.linux-kernel.at") +@use_for_service("git.pleroma.social") +@use_for_service("git.silence.dev") +@use_for_service("code.videolan.org") +@use_for_service("source.puri.sm") class GitlabService(BaseGitService): name = "gitlab" @@ -122,7 +135,6 @@ search_pattern: str = None, language: str = None, ) -> List[GitProject]: - if namespace: group = self.gitlab_instance.groups.get(namespace) projects = group.projects.list(all=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/services/pagure/pull_request.py new/ogr-0.45.0/ogr/services/pagure/pull_request.py --- old/ogr-0.41.0/ogr/services/pagure/pull_request.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/services/pagure/pull_request.py 2023-06-05 19:00:23.000000000 +0200 @@ -190,13 +190,22 @@ assignee=None, author=None, ) -> List["PullRequest"]: - payload = {"status": status.name.capitalize()} + payload = {"page": 1, "status": status.name.capitalize()} if assignee is not None: payload["assignee"] = assignee if author is not None: payload["author"] = author - raw_prs = project._call_project_api("pull-requests", params=payload)["requests"] + raw_prs = [] + while True: + page_result = project._call_project_api("pull-requests", params=payload) + raw_prs += page_result["requests"] + if not page_result["pagination"]["next"]: + break + + # mypy don't know that key "page" really contains int... + payload["page"] += 1 # type: ignore + return [PagurePullRequest(pr_dict, project) for pr_dict in raw_prs] def update_info( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr/services/pagure/service.py new/ogr-0.45.0/ogr/services/pagure/service.py --- old/ogr-0.41.0/ogr/services/pagure/service.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/ogr/services/pagure/service.py 2023-06-05 19:00:23.000000000 +0200 @@ -12,6 +12,7 @@ OgrException, OperationNotSupported, OgrNetworkError, + GitForgeInternalError, ) from ogr.factory import use_for_service from ogr.parsing import parse_git_repo @@ -203,6 +204,13 @@ except requests.exceptions.ConnectionError as er: logger.error(er) raise OgrNetworkError(f"Cannot connect to url: '{url}'.") from er + + if response.status_code >= 500: + raise GitForgeInternalError( + f"Pagure API returned {response.status_code} status for `{url}`" + f" with reason: `{response.reason}`" + ) + return response def get_raw_request( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/ogr.egg-info/PKG-INFO new/ogr-0.45.0/ogr.egg-info/PKG-INFO --- old/ogr-0.41.0/ogr.egg-info/PKG-INFO 2022-10-27 12:53:58.000000000 +0200 +++ new/ogr-0.45.0/ogr.egg-info/PKG-INFO 2023-06-05 19:00:32.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: ogr -Version: 0.41.0 +Version: 0.45.0 Summary: One API for multiple git forges. Home-page: https://github.com/packit/ogr Author: Red Hat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/recipe.yaml new/ogr-0.45.0/recipe.yaml --- old/ogr-0.41.0/recipe.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/recipe.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -6,11 +6,11 @@ with_testing: false tasks: - - set_fact: + - ansible.builtin.set_fact: project_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" when: zuul is defined - name: Install all packages needed to hack on ogr. - dnf: + ansible.builtin.dnf: name: - make - python3-flexmock @@ -24,20 +24,20 @@ - python3-tox become: true - name: Install latest twine for sake of check command - pip: + ansible.builtin.pip: name: - twine # we need newest twine, b/c of the check command - readme_renderer[md] state: latest become: true - name: Install requre - pip: + ansible.builtin.pip: name: - git+https://github.com/packit/requre state: latest become: true - name: Install dependencies for git APIs - dnf: + ansible.builtin.dnf: name: - python3-requests - python3-pygithub @@ -45,22 +45,22 @@ state: present become: true - name: stat {{ project_dir }} - stat: + ansible.builtin.stat: path: "{{ project_dir }}" tags: - no-cache register: src_path - - name: Make sure {{ project_dir }} is present - assert: + - name: Assert project_dir is present + ansible.builtin.assert: that: - src_path.stat.isdir # this requires to have sources mounted inside at /src - name: Install ogr from {{ project_dir }} - pip: + ansible.builtin.pip: name: "{{ project_dir }}" become: true - name: Run tests - command: tox + ansible.builtin.command: tox args: chdir: "{{ project_dir }}" when: with_testing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/setup.cfg new/ogr-0.45.0/setup.cfg --- old/ogr-0.41.0/setup.cfg 2022-10-27 12:53:59.205885400 +0200 +++ new/ogr-0.45.0/setup.cfg 2023-06-05 19:00:33.002232300 +0200 @@ -10,7 +10,7 @@ author = Red Hat author_email = user-cont-t...@redhat.com license = MIT -license_file = LICENSE +license_files = LICENSE classifiers = Development Status :: 4 - Beta Intended Audience :: Developers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/factory/test_factory.py new/ogr-0.45.0/tests/integration/factory/test_factory.py --- old/ogr-0.41.0/tests/integration/factory/test_factory.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/factory/test_factory.py 2023-06-05 19:00:23.000000000 +0200 @@ -27,7 +27,7 @@ or not self.pagure_token or not os.environ.get("GITLAB_TOKEN") ): - raise EnvironmentError( + raise OSError( "You are in requre write mode, please set GITHUB_TOKEN PAGURE_TOKEN" " GITLAB_TOKEN env variables" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/base.py new/ogr-0.45.0/tests/integration/github/base.py --- old/ogr-0.41.0/tests/integration/github/base.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/base.py 2023-06-05 19:00:23.000000000 +0200 @@ -15,7 +15,7 @@ super().setUp() self.token = os.environ.get("GITHUB_TOKEN") if not Path(get_datafile_filename(obj=self)).exists() and not self.token: - raise EnvironmentError( + raise OSError( "You are in Requre write mode, please set proper GITHUB_TOKEN env variables" ) self._service = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/base_app.py new/ogr-0.45.0/tests/integration/github/base_app.py --- old/ogr-0.41.0/tests/integration/github/base_app.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/base_app.py 2023-06-05 19:00:23.000000000 +0200 @@ -38,7 +38,7 @@ if not get_datafile_filename(obj=self) and ( not self._github_app_id or not self._github_app_private_key_path ): - raise EnvironmentError( + raise OSError( "You are in Requre write mode, please set " "GITHUB_APP_ID GITHUB_APP_PRIVATE_KEY_PATH env variables" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_app/App.test_get_project.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_app/App.test_get_project.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_app/App.test_get_project.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_app/App.test_get_project.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/ogr/installation: + https://api.github.com/repos/packit/ogr/installation: &get_installation - metadata: latency: 0.4268009662628174 module_call_list: @@ -98,6 +98,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/ogr/installation: *get_installation https://api.github.com:443/repos/packit/ogr: - metadata: latency: 0.4936249256134033 @@ -275,7 +276,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1210186/access_tokens: + https://api.github.com/app/installations/1210186/access_tokens: &post_access_tokens - metadata: latency: 0.42986464500427246 module_call_list: @@ -332,3 +333,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1210186/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_app/App.test_get_project_having_key_as_path.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_app/App.test_get_project_having_key_as_path.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_app/App.test_get_project_having_key_as_path.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_app/App.test_get_project_having_key_as_path.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/ogr/installation: + https://api.github.com/repos/packit/ogr/installation: &get_installation - metadata: latency: 0.3324146270751953 module_call_list: @@ -99,6 +99,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/ogr/installation: *get_installation https://api.github.com:443/repos/packit/ogr: - metadata: latency: 0.34122323989868164 @@ -275,7 +276,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.25110363960266113 module_call_list: @@ -331,3 +332,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_app/App.test_github_proj_no_app_creds.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_app/App.test_github_proj_no_app_creds.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_app/App.test_github_proj_no_app_creds.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_app/App.test_github_proj_no_app_creds.yaml 2023-06-05 19:00:23.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/packit/installation: + https://api.github.com/repos/packit/packit/installation: &get_installation - metadata: latency: 0.4730544090270996 module_call_list: @@ -55,3 +55,4 @@ raw: !!binary "" reason: Unauthorized status_code: 401 + https://api.github.com:443/repos/packit/packit/installation: *get_installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_name.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_name.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_name.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_name.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.29810547828674316 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.2955963611602783 @@ -1058,7 +1059,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.24229907989501953 module_call_list: @@ -1117,3 +1118,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_url.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_url.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_url.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_change_url.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.25656819343566895 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.3188660144805908 @@ -1109,7 +1110,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.2624211311340332 module_call_list: @@ -1168,3 +1169,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_neutral_completed.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_neutral_completed.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_neutral_completed.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_neutral_completed.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.26059412956237793 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.2895488739013672 @@ -280,7 +281,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.25103282928466797 module_call_list: @@ -488,3 +489,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_timed_out.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_timed_out.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_timed_out.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_timed_out.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.25350522994995117 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.3098289966583252 @@ -280,7 +281,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.24237823486328125 module_call_list: @@ -473,3 +474,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_to_queue_and_succeed.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_to_queue_and_succeed.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_to_queue_and_succeed.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_create_to_queue_and_succeed.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.33959269523620605 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.313035249710083 @@ -414,7 +415,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.261521577835083 module_call_list: @@ -607,3 +608,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_latest_check_run.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_latest_check_run.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_latest_check_run.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_latest_check_run.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.25191450119018555 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.31367015838623047 @@ -843,7 +844,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.26648426055908203 module_call_list: @@ -902,3 +903,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.34171438217163086 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.4061391353607178 @@ -785,7 +786,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.2929067611694336 module_call_list: @@ -844,3 +845,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list_no_runs.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list_no_runs.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list_no_runs.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_get_list_no_runs.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.30007433891296387 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.3033430576324463 @@ -564,7 +565,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.29575181007385254 module_call_list: @@ -623,3 +624,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_non_existing_check_runs_returns_none.yaml new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_non_existing_check_runs_returns_none.yaml --- old/ogr-0.41.0/tests/integration/github/test_data/test_check_run/CheckRun.test_non_existing_check_runs_returns_none.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_data/test_check_run/CheckRun.test_non_existing_check_runs_returns_none.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://api.github.com/repos/packit/hello-world/installation: + https://api.github.com/repos/packit/hello-world/installation: &get_installation - metadata: latency: 0.27318501472473145 module_call_list: @@ -102,6 +102,7 @@ raw: !!binary "" reason: OK status_code: 200 + https://api.github.com:443/repos/packit/hello-world/installation: *get_installation https://api.github.com:443/repos/packit/hello-world: - metadata: latency: 0.34101152420043945 @@ -564,7 +565,7 @@ reason: OK status_code: 200 POST: - https://api.github.com/app/installations/1924121/access_tokens: + https://api.github.com/app/installations/1924121/access_tokens: &post_access_tokens - metadata: latency: 0.24870777130126953 module_call_list: @@ -623,3 +624,4 @@ raw: !!binary "" reason: Created status_code: 201 + https://api.github.com:443/app/installations/1924121/access_tokens: *post_access_tokens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_readonly.py new/ogr-0.45.0/tests/integration/github/test_readonly.py --- old/ogr-0.41.0/tests/integration/github/test_readonly.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_readonly.py 2023-06-05 19:00:24.000000000 +0200 @@ -15,7 +15,7 @@ super().setUp() self.token = os.environ.get("GITHUB_TOKEN") if not Path(get_datafile_filename(obj=self)).exists() and not self.token: - raise EnvironmentError( + raise OSError( "You are in Requre write mode, please set proper GITHUB_TOKEN env variables" ) self._service = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/github/test_retries.py new/ogr-0.45.0/tests/integration/github/test_retries.py --- old/ogr-0.41.0/tests/integration/github/test_retries.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/github/test_retries.py 2023-06-05 19:00:24.000000000 +0200 @@ -13,7 +13,6 @@ @pytest.mark.skip(reason="Will fail until flexmock is fixed") @pytest.mark.parametrize("max_retries", [0, 2]) def test_bad_credentials(max_retries): - flexmock(HTTPSConnectionPool).should_call("urlopen").times(max_retries + 1) flexmock(Github).should_call("get_repo").and_raise( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/gitlab/base.py new/ogr-0.45.0/tests/integration/gitlab/base.py --- old/ogr-0.41.0/tests/integration/gitlab/base.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/gitlab/base.py 2023-06-05 19:00:24.000000000 +0200 @@ -16,7 +16,7 @@ self.token = os.environ.get("GITLAB_TOKEN") if not Path(get_datafile_filename(obj=self)).exists() and not self.token: - raise EnvironmentError( + raise OSError( "You are in Requre write mode, please set GITLAB_TOKEN env variables" ) elif not self.token: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/pagure/base.py new/ogr-0.45.0/tests/integration/pagure/base.py --- old/ogr-0.41.0/tests/integration/pagure/base.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/pagure/base.py 2023-06-05 19:00:24.000000000 +0200 @@ -15,7 +15,7 @@ self.token = os.environ.get("PAGURE_TOKEN") if not get_datafile_filename(obj=self) and (not self.token): - raise EnvironmentError( + raise OSError( "You are in Requre write mode, please set PAGURE_TOKEN env variables" ) self._service = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/pagure/test_data/test_pull_requests/PullRequests.test_pr_list.yaml new/ogr-0.45.0/tests/integration/pagure/test_data/test_pull_requests/PullRequests.test_pr_list.yaml --- old/ogr-0.41.0/tests/integration/pagure/test_data/test_pull_requests/PullRequests.test_pr_list.yaml 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/pagure/test_data/test_pull_requests/PullRequests.test_pr_list.yaml 2023-06-05 19:00:24.000000000 +0200 @@ -5,7 +5,7 @@ requests.sessions: send: GET: - https://pagure.io/api/0/ogr-tests/pull-requests?status=All: + https://pagure.io/api/0/ogr-tests/pull-requests?page=1&status=All: - metadata: latency: 0.6439666748046875 module_call_list: @@ -745,7 +745,7 @@ raw: !!binary "" reason: OK status_code: 200 - https://pagure.io/api/0/ogr-tests/pull-requests?status=Open: + https://pagure.io/api/0/ogr-tests/pull-requests?page=1&status=Open: - metadata: latency: 0.737177848815918 module_call_list: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/pagure/test_generic_commands.py new/ogr-0.45.0/tests/integration/pagure/test_generic_commands.py --- old/ogr-0.41.0/tests/integration/pagure/test_generic_commands.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/pagure/test_generic_commands.py 2023-06-05 19:00:24.000000000 +0200 @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT import pytest -from ogr.exceptions import PagureAPIException +from ogr.exceptions import GitForgeInternalError from requre.online_replacing import record_requests_for_all_methods @@ -92,7 +92,7 @@ self.ogr_project.get_file_content(".blablabla_nonexisting_file") def test_no_file_server_error(self): - with pytest.raises(PagureAPIException) as ex: + with pytest.raises(GitForgeInternalError) as ex: self.ogr_project.get_file_content(".blablabla_no_file") assert "INTERNAL SERVER ERROR" in str(ex) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/integration/pagure/test_project_token.py new/ogr-0.45.0/tests/integration/pagure/test_project_token.py --- old/ogr-0.41.0/tests/integration/pagure/test_project_token.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/integration/pagure/test_project_token.py 2023-06-05 19:00:24.000000000 +0200 @@ -21,7 +21,7 @@ self.token = os.environ.get("PAGURE_OGR_TEST_TOKEN", "") if not get_datafile_filename(obj=self) and (not self.token): - raise EnvironmentError("please set PAGURE_OGR_TEST_TOKEN env variables") + raise OSError("please set PAGURE_OGR_TEST_TOKEN env variables") self._service = None self._user = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/unit/test_factory.py new/ogr-0.45.0/tests/unit/test_factory.py --- old/ogr-0.41.0/tests/unit/test_factory.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/unit/test_factory.py 2023-06-05 19:00:24.000000000 +0200 @@ -29,6 +29,11 @@ GithubService, ), ( + "https://some-url/packit-service/ogr", + {"https://some-url": GithubService}, + GithubService, + ), + ( "https://github.com/packit-service/ogr", {"github.com": PagureService}, PagureService, @@ -38,6 +43,18 @@ ("https://pagure.something.com/ogr", None, PagureService), ("https://gitlab.com/someone/project", None, GitlabService), ("https://gitlab.abcd.def/someone/project", None, GitlabService), + # Known GitLab instances without gitlab word in a hostname: + ("https://salsa.debian.org/someone/project", None, GitlabService), + ("https://git.fosscommunity.in/someone/project", None, GitlabService), + ("https://framagit.org/someone/project", None, GitlabService), + ("https://dev.gajim.org/someone/project", None, GitlabService), + ("https://git.coop/someone/project", None, GitlabService), + ("https://lab.libreho.st/someone/project", None, GitlabService), + ("https://git.linux-kernel.at/someone/project", None, GitlabService), + ("https://git.pleroma.social/someone/project", None, GitlabService), + ("https://git.silence.dev/someone/project", None, GitlabService), + ("https://code.videolan.org/someone/project", None, GitlabService), + ("https://source.puri.sm/someone/project", None, GitlabService), ( "https://src.fedoraproject.org/rpms/golang-gitlab-flimzy-testy", None, @@ -117,6 +134,15 @@ ), ), ( + "https://some-url/packit-service/ogr", + {"https://some-url": GithubService}, + None, + True, + GithubProject( + namespace="packit-service", repo="ogr", service=GithubService() + ), + ), + ( "https://github.com/packit-service/ogr", {"github.com": PagureService}, None, @@ -229,6 +255,19 @@ service=GithubService(instance_url="https://github.com/packit/ogr"), ), ), + ( + "https://my.gtlb/packit/ogr", + None, + [ + GitlabService(instance_url="https://my.gtlb"), + ], + False, + GitlabProject( + repo="ogr", + namespace="packit", + service=GitlabService(instance_url="https://my.gtlb"), + ), + ), ], ) def test_get_project(url, mapping, instances, force_custom_instance, result): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ogr-0.41.0/tests/unit/test_github.py new/ogr-0.45.0/tests/unit/test_github.py --- old/ogr-0.41.0/tests/unit/test_github.py 2022-10-27 12:53:49.000000000 +0200 +++ new/ogr-0.45.0/tests/unit/test_github.py 2023-06-05 19:00:24.000000000 +0200 @@ -14,6 +14,10 @@ create_github_check_run_output, GithubCheckRunOutput, ) +from ogr.services.github.auth_providers.tokman import Tokman +from ogr.services.github.auth_providers.token import TokenAuthentication +from ogr.abstract import AuthMethod +from ogr.exceptions import GithubAPIException @pytest.fixture @@ -142,3 +146,57 @@ title: str, summary: str, text: Optional[str], expected: GithubCheckRunOutput ) -> None: assert create_github_check_run_output(title, summary, text) == expected + + +@pytest.fixture +def github_service_with_multiple_auth_methods(): + service = GithubService( + token="abcdef", + github_app_id="123", + github_app_private_key="id_rsa", + github_app_private_key_path="/path", + tokman_instance_url="http://tokman:8080", + github_authentication=None, + ) + + return service + + +def test_multiple_auth_methods_default_is_tokman( + github_service_with_multiple_auth_methods, +): + service = github_service_with_multiple_auth_methods + assert isinstance(service.authentication, Tokman) + + +def test_set_reset_customized_auth_method(github_service_with_multiple_auth_methods): + service = github_service_with_multiple_auth_methods + assert isinstance(service.authentication, Tokman) + service.set_auth_method(AuthMethod.token) + assert isinstance(service.authentication, TokenAuthentication) + service.reset_auth_method() + assert isinstance(service.authentication, Tokman) + + +@pytest.fixture +def github_service_with_one_auth_method(): + service = GithubService( + tokman_instance_url="http://tokman:8080", github_authentication=None + ) + + return service + + +def test_no_multiple_auth_methods_default_is_tokman( + github_service_with_one_auth_method, +): + service = github_service_with_one_auth_method + assert isinstance(service.authentication, Tokman) + + +def test_no_set_reset_customized_auth_method(github_service_with_one_auth_method): + service = github_service_with_one_auth_method + assert isinstance(service.authentication, Tokman) + with pytest.raises(GithubAPIException): + service.set_auth_method(AuthMethod.github_app) + assert isinstance(service.authentication, Tokman)