-
Notifications
You must be signed in to change notification settings - Fork 80
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
Adding chapter Packaging of Python RPMs #51
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a benefit of this guide. It has Fedora specific links, a RHEL 6/7 specfile example without explanation and that's it.
source/advanced-topics.adoc
Outdated
[id="Converting-PyPI-package-to-an-RPM"] | ||
==== Converting PyPI package to an RPM | ||
|
||
Pyp2rpm is a tool which automatically converts PyPI packages to an RPM spec file. Simple tutorial can be found on this page link:https://github.com/fedora-python/pyp2rpm[pyp2rpm]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the tool doesn't support RHEL 7 specfiles. Only Fedora or EPEL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hroncok what is the difference between epel and rhel then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backported Fedora macros. Python 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does support epel. pyp2rpm -o epel6
and similary for epel7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But not plain RHEL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can write this in conditionals to make it visible only in community version of the guide, not in the RHEL one.
source/advanced-topics.adoc
Outdated
[id="Common-macros-for-Python-RPM-packages"] | ||
==== Common macros for Python RPM packages | ||
|
||
All Python specific RPM macros can be found on this page link:https://fedoraproject.org/wiki/Packaging:Python#Macros[Python packaging macros]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the spec file above is RHEL 6/7, but the link is for Fedora. That is very different currently and rather confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there at least some macros the same?
Anyway, we might pick at least the macros from the example, and either use the description from Fedora, or write a new one. I don't think we need as comprehensive guide for RHEL, as we have for Fedora, a simple variant should work.
Another thought regarding this is that Fedora macros will be relevant for the next major version of RHEL, so it's also question what RHEL version this guide is focused on..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. They all got python version number in Fedora.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What RHEL version we target has never been answered to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is written for RHEL7 (RHEL version) and for Fedora (community version) under conditionals. Other versions of RHEL might be written in different paragraphs stating for which version they are written in their headings. The above link to macros was only WIP. I would like to see several most used and useful macros for RHEL7 and for Fedora. We do not need to document them all. Can you please suggest the most used macros for RHEL7 and for Fedora (separately)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I like it is short, and using links to other sources looks like a good way to me. I just added small comments, but generally I think this could be good enough.
source/advanced-topics.adoc
Outdated
[id="Benefits-of-packaging-Python-packages-as-RPMs"] | ||
==== Benefits of packaging Python packages as RPMs | ||
|
||
Benefits of packaging Python packages as RPMs are the same as for any other RPM package. More can be found in the chapter xref:Why-Package-Software-with-RPM[]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd maybe add some thinking about comparison with working with native python packages, like:
In comparison to native python packages from Python Package Index, RPM allows to specify dependencies on other RPMs, that are not necessary Python packages, RPM also allows to use cryptographic signing to verify content, and deliver packages that are integrated and tested ahead with the rest of the system. On the other hand RPM does not allow users to install Python software as a non-root user or to an arbitrary location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, good idea.
source/advanced-topics.adoc
Outdated
[id="Converting-PyPI-package-to-an-RPM"] | ||
==== Converting PyPI package to an RPM | ||
|
||
Pyp2rpm is a tool which automatically converts PyPI packages to an RPM spec file. Simple tutorial can be found on this page link:https://github.com/fedora-python/pyp2rpm[pyp2rpm]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just add a note that some manual corrections may be necessary, to not set too high expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Pyp2rpm is still in development. Some manual corrections might be necessary."
source/advanced-topics.adoc
Outdated
[id="Differences-in-RPM-packages-for-Python-as-a-Software-Collection"] | ||
==== Differences in RPM packages for Python as a Software Collection | ||
|
||
Those differences are documented in link:https://www.softwarecollections.org/en/docs/guide/#sect-Enabling_the_Software_Collection[Software Collections]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally, we also have this Packaging guide available as part of the RHSCL documentation, so internally we should like there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be done.
Link to Python packaging macros added in community ifdef. Python packaging macros for ifdef rhel needs to be added.
Callouts added to "Typical Python RPM package spec file description". Adding table to Common macros for Python RPM packages.
source/advanced-topics.adoc
Outdated
|
||
|python_sitelib | ||
|/usr/lib/python.X.Y/site-packages | ||
|Where pure python modules are installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please make a suggestion what are those modules and what does "pure" means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python modules https://docs.python.org/2/tutorial/modules.html
pure python - written only in Python (as opposed to extension modules compiled from languages like C, C++ or Fortran)
This seems to be stuck. Can you please rebase it? And make it up to date (python3)? |
@Daskyleia ping |
@xsuchy I think that @Daskyleia has left Red Hat years ago and never used GitHub since, the profile page shows no activity after this PR. |
@hroncok thank you. Is someone from the python team willing to finish it, or is it doomed to be closed? |
I am afraid I still don't understand the purpose of this guide. Do we still need a guide for packaging for RHEL 7? Or is it RHEL 8 now? Or even RHEL 9? Those guides would be different. Essentially this repo says in the README:
Yet the pello.spec example would not even build on anything newer than RHEL 7. What is the purpose of this guide? Who is the target audience and what type of Python software do they package for what distributions? |
My ultimate goal was to hopefully get rid of RPM Max one day. Which we still have to reference because it is only source for some parts. The guide can generate artifacts for upstream and for RHEL. E.g., see https://github.com/redhat-developer/rpm-packaging-guide/blame/master/source/advanced-topics.adoc#L611 The guide should be introductory and is meant for beginners. Speaking of python I would keep it as minimal as possible and reference the Python section from Fedora Packaging Guidelines. |
I have no idea what RPM Max is and I was unable to Google it, as it seems to be the name of some kind of a dagger 🗡️ The Python section from Fedora Packaging Guidelines is not present-RHEL compatible. If you target RHEL 9+ only, feel free to do so, but in the next years, it might not be RHEL9 compatible either. There is also https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_201x/ which is more or less compatible with EPEL 8, but not entirely and not with pure RHEL 8. It is extremely incompatible with RHEL 7.
Something like this? https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/
An
I'd like to help here, but I still don't understand what kind of a guide you are looking for (and I didn't understand that 3 years ago either). Back to my question:
You said they are beginners. But what are they trying to accomplish? I cannot imagine a simple "beginners' guide to packaging Python RPM packages" because the topic is too wide. There might be "simple" guides for straightforward tasks, e.g.:
|
|
I should add here that this guide hasn't received many updates since the
RHEL7 times. Downstream writers also decided on not syncing this with the
RHEL8 documentation anymore, so since the RHEL8 release it's been
essentially out of sync.
At this point it might be wise to scrap the RHEL7 parts and focus on the
latest RHEL and Fedora, if there's interest to continue updating it.
Starting updating it against the current RHEL8 doc might also be an option.
For Python, I see there's e.g.:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/packaging_and_distributing_software/advanced-topics#assembly_packaging-python-3-rpms_advanced-topics
|
Yes. But more verbose :) |
Resolving BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1429422
This chapter is WIP. Please add any comments to help me make this chapter more informative.