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

egg-info syntax wrong in epel7.spec #259

Open
falon opened this issue Jan 11, 2021 · 16 comments
Open

egg-info syntax wrong in epel7.spec #259

falon opened this issue Jan 11, 2021 · 16 comments

Comments

@falon
Copy link

falon commented Jan 11, 2021

Hello,

with the default epel7.spec if I run

pyp2rpm -o epel7 -t epel7 -b 3 -s dist/<mypackagename>-0.1.post8.tar.gz

in %files -n python%{python3_pkgversion}-%{pypi_name} I read:

%{python3_sitelib}/<mypackagename>-%{version}-py%{python3_version}.egg-info

This is wrong. I should see:
%{python3_sitelib}/<mypackagename>-%{version}.post8-py%{python3_version}.egg-info

It lacks of .post8. Now I'm fixing by hands... could you help me to modify the template in order to let pyp2rpm to write the right line?
Thank you very much

Ps: the issue is the same for fedora spec too.

@gordonmessmer
Copy link
Member

Is your module available for testing?

@falon
Copy link
Author

falon commented Jan 11, 2021

Yes, for instance see at
ds-repltest

Thank you very much!

@gordonmessmer
Copy link
Member

Does PR #260 fix that problem?

@falon
Copy link
Author

falon commented Jan 12, 2021

Yes! I applied the #260 and it works because the version now includes the "post8".

I wonder if the "post" in the rpm version is a good choice. Anyway now it works.

@gordonmessmer
Copy link
Member

I wonder if the "post" in the rpm version is a good choice.

No, not as is. That would be problematic as described in Fedora's versioning guidelines (https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/#_unsortable_versions)

pyp2rpm may simply need a template filter to transform the version into something usable with '~' or '^'. (As in the "Versioning prereleases with tilde" section of the above document)

@hroncok
Copy link
Member

hroncok commented Jan 12, 2021

Note that neither works in RHEL 7.

@gordonmessmer
Copy link
Member

Thanks, @hroncok . I was going to ask you, since I'd found this pagure ticket suggesting that support had been backported to RHEL >= 6:

https://pagure.io/packaging-committee/issue/398

@hroncok
Copy link
Member

hroncok commented Jan 12, 2021

Oh, sorry. ^ is not supported, ~ might be.

@gordonmessmer
Copy link
Member

I've updated #260 . It should be closer to what's needed to support tilde / caret in versions properly. None of the tests are updated yet, so those will all fail. But this at least gets some code out for review and discussion.

(and of course, we'll need to actually test rpm with tilde versions on RHEL 6 and 7.)

@falon
Copy link
Author

falon commented Jan 13, 2021

Another trouble with EPEL7 is the requirement (Requires:) syntax.

pyp2rpm uses syntax like python3-<packagename>, which is sometimes incorrect. For instance, many packages start with capital letter and EPEL7 downcases them.

I feel fine with %{?python_enable_dependency_generator}, it works well with el8. But it doesn't work with el7 (at least some versions of el7, even with latest rpm macros installed).

%{?python_enable_dependency_generator} add requirements in the following form

python3.6dist(flask)

which is EPEL7 compatible. Instead, python3-Flask is not compatible with EPEL7.

@gordonmessmer
Copy link
Member

Please open a separate issue with that information.

If you can, please test the latest changes in #260. I still need to ensure that they're compatible with EPEL6 and 7, and get those changes reviewed. Tests are passing, at least, so that branch should be almost ready.

@falon
Copy link
Author

falon commented Jan 14, 2021

I tried the latest change in #260. They work for me.
I only replaced

{{ dependencies(data.runtime_deps, True, pv, pv, use_with=False) }

with

%{?python_enable_dependency_generator}

which is definitively better for me.
Thank you

@nkadel
Copy link

nkadel commented Sep 28, 2021

I can vouch for the case change issues in CentOS 7. Someone decided that they were smarter than the package maintainers and decided to inconsistently switch python module names to lower case, and pretty much discarded the practice for CentOS 8 and fedora.

@hroncok
Copy link
Member

hroncok commented Sep 29, 2021

Someone decided that they were smarter than the package maintainers and decided to inconsistently switch python module names to lower case...

I am afraid I have no idea what are you talking about here. Who decided to do what exactly?

@nkadel
Copy link

nkadel commented Jul 22, 2022

Checking back on this. Many RHEL python RPMs have names converted to lower case, irrelevant of the name of package at pypi.org, and irrelevant of the name of the tarball, which itself may have a different case. It's quite maddenning. The "PyYAML" package published at pypi.org, for example, has a tarball named "PyYAML-6.0.0.tar.gz. But the package in RHEL is published as python-pyyaml-3.12-1.3.3l8. It's awkward enough that it's so far out of date, but the flip-flopping cases make generating matching .spec files and Source entries extra awkward.

Fortunately, the modern syntax of "Source0: %{pypi_source} PyYAML" works very well to grab the matching tarball, and a consistent lower case for the .spec file and dependencies could help. RHEL is not completely consistent about this, so it still often needs tuning.

Unfortunately, the case change is erratic. So if you publish the same .spec file for Fedora and RHEL of various releases, it's a bit of a crap shoot. It's also a bit of a crap shoot with whether or not the package has "python%{package_version}-%{pypi_name}" as its name, or just %{pypi_name}, especially for software actually published at Red Hat like "ansible" and "ansible-core". Been there, done that with my build suite over at https://github.bom/nkadel/ansiblerepo/

@nkadel
Copy link

nkadel commented Jul 22, 2022

falon, I agree that the "python3-" dependency syntax. It should always always be "python%{python3_pkgversion}-" to support building with other python releases, such as python38 on RHEL 8.

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

No branches or pull requests

4 participants