Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move package NEVR parsing to builder #2800

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

FrostyX
Copy link
Member

@FrostyX FrostyX commented Jul 1, 2023

Fix #2790
Fix #2777

@FrostyX
Copy link
Member Author

FrostyX commented Jul 1, 2023

Some of the backend tests are failing. That's because we need to add results.json file here
https://github.com/fedora-copr/test-data-copr-backend/tree/main/build_results/00848963-example

{
    "name": "example",
    "epoch": null,
    "version": "1.0.14",
    "release": "1",
    "exclusivearch": [],
    "excludearch": []
}

The problem is, this test directory is for RPM build, not SRPM. We are only abusing it for testing SRPM builds as well. So this will require a bit more changes. But the code itself works fine.

Copy link
Member

@nikromen nikromen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR!
I just have one question below but apart from that +1

"""
Queries a package for its name and evr (epoch:version-release)
"""
cmd = ['rpm', '-qp', '--nosignature', '--qf',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if specfile parsing fails for some reason (other than no spec file found), would this backup approach fail too? Are we giving up the backup approach and we trust specfile library in every case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know :-).
But we should cover it in tests for sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praiskup, as @nikromen pointed out, I completely removed the pkg_name_evr_from_srpm function and rely solely on parsing version and name from the spec file. Do want to go with this? Or should I move the pkg_name_evr_from_srpm function to builder as well and use it if something goes wrong when parsing the spec file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was kind of a safety belt (I still don't trust python-specfile that much, also - newly it will be run on multiple architectures). But I won't argue too much on this :-)

FrostyX added a commit to FrostyX/test-data-copr-backend that referenced this pull request Jul 23, 2023
It contains `results.json` generated by code from
fedora-copr/copr#2800
@praiskup
Copy link
Member

+1, but these two are worth fixing

Error: PYLINT_WARNING:
copr_backend/background_worker_build.py:634:13: W1514[unspecified-encoding]: BuildBackgroundWorker._get_srpm_build_details: Using open without explicitly specifying an encoding

Error: PYLINT_WARNING:
copr_backend/helpers.py:35: W0611[unused-import]: Unused CoprBackendSrpmError imported from copr_backend.exceptions

@FrostyX FrostyX force-pushed the version-parsing-on-builder branch 3 times, most recently from 64acf99 to e5d33ab Compare July 24, 2023 19:55
@FrostyX
Copy link
Member Author

FrostyX commented Jul 24, 2023

Fixed linter errors and tests, PTAL

BuildRequires: python3-backoff >= 1.9.0

%if 0%{?rhel} == 8
BuildRequires: %{python_pfx}-specfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submited the issue packit/specfile#255 for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested a bit specfile v0.20 on epel8 and wasn't able to make it work. So I don't think there's an easy way to update specfile into EPEL8 (missing setup.py, incompatible (too new) typing, I stopped there...).

The question is - is the python-specfile in epel 8 "new enough" for us (100% working, but slow), or does this actually mean we have to drop the support for EPEL8?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting to EPEL8 https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-8a36e6e848 so we can probably drop the %if/%else

@praiskup
Copy link
Member

praiskup commented Aug 3, 2023

@FrostyX
Copy link
Member Author

FrostyX commented Aug 6, 2023

I added a simple beaker test and the rpm -qip fallback.
Also, CI fails for rawhide but it is not related to this PR. Even main branch fails.

@praiskup praiskup merged commit 030dd32 into fedora-copr:main Aug 7, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move python-specfile dep from backend to builder Benchmark python specfile a bit
3 participants