Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int:

# Warning: This will not work if branch names contain "/" but we don't really care here.
heads = [h.split("/")[-1] for h in repo.git.branch("--remote").split("\n")]
available_branches = [h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)]
available_branches.sort(key=lambda ver: Version(ver))
available_branches.append(DEFAULT_BRANCH)
available_branches = sorted(
{h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)}, key=lambda ver: Version(ver)
) + [DEFAULT_BRANCH]

branches = options.branches
if branches == "supported":
Expand Down
1 change: 0 additions & 1 deletion .ci/scripts/check_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import warnings
from packaging.requirements import Requirement


CHECK_MATRIX = [
("pyproject.toml", True, True, True),
("requirements.txt", True, True, True),
Expand Down
1 change: 0 additions & 1 deletion .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from git import GitCommandError, Repo
from packaging.version import parse as parse_version


PYPI_PROJECT = "pulp_rpm"

# Read Towncrier settings
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ jobs:
pulpcore-manager openapi --file "api.json"
pulpcore-manager openapi --bindings --component "rpm" --file "rpm-api.json"
- name: "Upload Package whl"
uses: "actions/upload-artifact@v5"
uses: "actions/upload-artifact@v7"
with:
name: "plugin_package"
path: "pulp_rpm/dist/"
if-no-files-found: "error"
retention-days: 5
overwrite: true
- name: "Upload API specs"
uses: "actions/upload-artifact@v5"
uses: "actions/upload-artifact@v7"
with:
name: "api_spec"
path: |
Expand All @@ -73,7 +73,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
- name: "Upload python client packages"
uses: "actions/upload-artifact@v5"
uses: "actions/upload-artifact@v7"
with:
name: "python-client.tar"
path: |
Expand All @@ -82,7 +82,7 @@ jobs:
retention-days: 5
overwrite: true
- name: "Upload python client docs"
uses: "actions/upload-artifact@v5"
uses: "actions/upload-artifact@v7"
with:
name: "python-client-docs.tar"
path: |
Expand All @@ -100,7 +100,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}"
- name: "Upload Ruby client"
uses: "actions/upload-artifact@v5"
uses: "actions/upload-artifact@v7"
with:
name: "ruby-client.tar"
path: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
id-token: "write"

steps:
- uses: "actions/download-artifact@v4"
- uses: "actions/download-artifact@v8"
with:
name: "plugin_package"
path: "dist/"
Expand All @@ -53,7 +53,7 @@ jobs:
path: "pulp_rpm"

- name: "Download Python client"
uses: "actions/download-artifact@v4"
uses: "actions/download-artifact@v8"
with:
name: "python-client.tar"
path: "pulp_rpm/"
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
path: "pulp_rpm"

- name: "Download Ruby client"
uses: "actions/download-artifact@v4"
uses: "actions/download-artifact@v8"
with:
name: "ruby-client.tar"
path: "pulp_rpm/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
from git import Repo
from git.exc import GitCommandError


helper = textwrap.dedent(
"""\
helper = textwrap.dedent("""\
Stage the changelog for a release on main branch.

Example:
$ python .github/workflows/scripts/stage-changelog-for-default-branch.py 3.4.0

"""
)
""")

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper)

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
docker logs pulp 2>&1 | grep -i pulpcore.deprecation | tee deprecations-${{ matrix.env.TEST }}.txt

- name: "Upload Deprecations"
uses: "actions/upload-artifact@v5"
uses: "actions/upload-artifact@v7"
with:
name: "deprecations-${{ matrix.env.TEST }}"
path: "pulp_rpm/deprecations-${{ matrix.env.TEST }}.txt"
Expand Down
2 changes: 1 addition & 1 deletion lint_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# For more info visit https://github.com/pulp/plugin_template

black==24.3.0
black~=26.3 # Pin style to the year. https://black.readthedocs.io/en/stable/faq.html#how-stable-is-black-s-style
bump-my-version
check-manifest
flake8
Expand Down
11 changes: 5 additions & 6 deletions pulp_rpm/app/depsolving.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from django.conf import settings


logger = logging.getLogger(__name__)

# The name for the repo inside libsolv which represents the combined set of target/destination
Expand Down Expand Up @@ -577,7 +576,7 @@ def get_units_from_solvables(self, solvables):
"""Map a list of solvables into their Pulp units, keyed by the repo they came from."""
repo_unit_map = collections.defaultdict(set)
for solvable in solvables:
(unit_id, repo_id) = self.get_unit_id(solvable)
unit_id, repo_id = self.get_unit_id(solvable)
repo_unit_map[repo_id].add(unit_id)

return repo_unit_map
Expand Down Expand Up @@ -1026,7 +1025,7 @@ def write_solver_debug_data(solver, problems, mapping, full=False):
print(file=summary)

for solvable in transaction.newsolvables():
(reason, rule) = solver.describe_decision(solvable)
reason, rule = solver.describe_decision(solvable)

print(
"{name}-{evr}.{arch}".format(
Expand All @@ -1035,15 +1034,15 @@ def write_solver_debug_data(solver, problems, mapping, full=False):
file=summary,
)

(reason_name, reason_description) = reason_desc_map[reason]
(unit_id, from_repo) = mapping.get_unit_id(solvable)
reason_name, reason_description = reason_desc_map[reason]
unit_id, from_repo = mapping.get_unit_id(solvable)
print(
" Pulp Content unit '{}' from repo '{}'".format(unit_id, from_repo), file=summary
)
print(" Reason: {} - {}".format(reason_name, reason_description), file=summary)
print(" Rules:", file=summary)
for info in rule.allinfos():
(rule_name, rule_description) = rule_desc_map[info.type]
rule_name, rule_description = rule_desc_map[info.type]
print(" {} - {}".format(rule_name, rule_description), file=summary)
if info.solvable:
pkg = str(info.solvable)
Expand Down
3 changes: 1 addition & 2 deletions pulp_rpm/app/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pulp_rpm.app.exceptions import UlnCredentialsError
from pulp_rpm.app.shared_utils import urlpath_sanitize


log = getLogger(__name__)


Expand Down Expand Up @@ -80,7 +79,7 @@ def __init__(
# So, we have a pretty ugly workaround.
parsed = urlparse(self.url)
# two pieces of the URL: pre- and post-path
(before_path, after_path) = self.url.split(parsed.path)
before_path, after_path = self.url.split(parsed.path)
new_path = quote(unquote(parsed.path), safe=":/") # fix the path
new_url = "{}{}{}".format(before_path, new_path, after_path) # rebuild
if self.sles_auth_token:
Expand Down
2 changes: 1 addition & 1 deletion pulp_rpm/app/management/commands/rpm-datarepair.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def repair_2460(self, dry_run):

def fix_package(package):
def fix_requirement(require):
(name, flags, epoch, version, release, pre) = require
name, flags, epoch, version, release, pre = require
if "&" in name:
fixed_name = name.replace("&", "&")
return (fixed_name, flags, epoch, version, release)
Expand Down
2 changes: 1 addition & 1 deletion pulp_rpm/app/modelresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def before_import_row(self, row, **kwargs):
"""
super().before_import_row(row, **kwargs)

(uc_name, uc_updrec_digest) = row["update_collection"].split("|")
uc_name, uc_updrec_digest = row["update_collection"].split("|")
uc_updrecord = UpdateRecord.objects.filter(
digest=uc_updrec_digest, pulp_domain=get_domain()
).first()
Expand Down
1 change: 0 additions & 1 deletion pulp_rpm/app/models/acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pulpcore.plugin.models import AlternateContentSource, AutoAddObjPermsMixin
from pulp_rpm.app.models import RpmRemote


log = getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion pulp_rpm/app/models/modulemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from pulp_rpm.app.models.package import Package


log = getLogger(__name__)


Expand Down
4 changes: 2 additions & 2 deletions pulp_rpm/app/models/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ def createrepo_to_dict(cls, package, tuple_cache=None, string_cache=None):
# see https://github.com/pulp/pulp_rpm/issues/4328
no_file_digest = len(file_entry) == 3
if no_file_digest:
(typ, parent_dir, name) = file_entry
typ, parent_dir, name = file_entry
else:
# currently this should ONLY happen during upload
(typ, parent_dir, name, digest) = file_entry
typ, parent_dir, name, digest = file_entry
# check if the "parent_dir" string exists in our cache. If it does, we replace it
# with the cached copy, to take advantage of Python's refcounting behavior. We do
# this separately from the tuple itself, because the parent_dir path is frequently
Expand Down
6 changes: 2 additions & 4 deletions pulp_rpm/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,11 @@ def content_handler(self, path):
repo_config = publication.repo_config
repo_config.pop("name", None)
repo_config.pop("baseurl", None)
val = textwrap.dedent(
f"""\
val = textwrap.dedent(f"""\
[{re.sub(self.INVALID_REPO_ID_CHARS, "", self.name)}]
name={self.name}
baseurl={base_url}
"""
)
""")
for k, v in repo_config.items():
val += f"{k}={v}\n"

Expand Down
8 changes: 2 additions & 6 deletions pulp_rpm/app/serializers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,7 @@ class CopySerializer(ValidateFieldsMixin, serializers.Serializer):
"""

config = serializers.JSONField(
help_text=_(
dedent(
"""\
help_text=_(dedent("""\
Content to be copied into the given destinations from the given sources.

Its a list of dictionaries with the following available fields:
Expand All @@ -538,9 +536,7 @@ class CopySerializer(ValidateFieldsMixin, serializers.Serializer):

For usage examples, refer to the advanced copy guide:
<https://pulpproject.org/pulp_rpm/docs/user/guides/modify/#advanced-copy-workflow>
"""
)
),
""")),
)

dependency_solving = serializers.BooleanField(
Expand Down
4 changes: 2 additions & 2 deletions pulp_rpm/app/tasks/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def find_children_of_content(content, src_repo_version):
package_nevras = advisory.get_pkglist()
advisory_package_q = Q(pk__in=[])
for nevra in package_nevras:
(name, epoch, version, release, arch) = nevra
name, epoch, version, release, arch = nevra
advisory_package_q |= Q(
name=name,
epoch=epoch,
Expand All @@ -66,7 +66,7 @@ def find_children_of_content(content, src_repo_version):
module_nsvcas = advisory.get_module_list()
advisory_module_q = Q(pk__in=[])
for nsvca in module_nsvcas:
(name, stream, version, context, arch) = nsvca
name, stream, version, context, arch = nsvca
advisory_module_q |= Q(
name=name,
stream=stream,
Expand Down
1 change: 0 additions & 1 deletion pulp_rpm/app/tasks/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pulp_rpm.app.models.package import Package
from pulp_rpm.app.models.repository import RpmRepository


log = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions pulp_rpm/tests/functional/api/test_auto_publish.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
"""Tests that sync rpm plugin repositories."""

import pytest


Expand Down
1 change: 0 additions & 1 deletion pulp_rpm/tests/functional/api/test_character_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
RPM_WITH_NON_UTF_8_URL,
)


"""Test upload of RPMs with different character encoding.

This test targets the following issues:
Expand Down
6 changes: 2 additions & 4 deletions pulp_rpm/tests/functional/api/test_crud_content_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ def test_create_modulemd_defaults(monitor_task, gen_object_with_cleanup, rpm_mod
"module": "squid",
"stream": "4",
"profiles": {"4": ["common"]},
"snippet": dedent(
"""\
"snippet": dedent("""\
---
document: modulemd-defaults
version: 1
Expand All @@ -238,8 +237,7 @@ def test_create_modulemd_defaults(monitor_task, gen_object_with_cleanup, rpm_mod
stream: "4"
profiles:
4: [common]
..."""
),
..."""),
}

# Can create
Expand Down
2 changes: 1 addition & 1 deletion pulp_rpm/tests/functional/api/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def test_distribution_tree_metadata_publish(

# skip any differences that are "correct" i.e. rewritten "repository" and "packages" paths
for d in diff:
(diff_type, diff_name, _, new_value) = (d[0], d[1], d[2][0], d[2][1])
diff_type, diff_name, _, new_value = (d[0], d[1], d[2][0], d[2][1])
# ('change', 'variant-Land.packages', ('Packages', 'Land/Packages'))
if diff_type == "change":
if diff_name.endswith(".packages") or diff_name.endswith(".repository"):
Expand Down