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

Libalternatives support #115

Merged
merged 13 commits into from
Oct 1, 2021
Merged

Conversation

schubi2
Copy link
Contributor

@schubi2 schubi2 commented Sep 28, 2021

Please have a look to the README.md how the patch supports the new libalternatives too.

Copy link
Collaborator

@bnavigator bnavigator left a comment

Choose a reason for hiding this comment

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

Do you have any demo packages where this works?

README.md Outdated Show resolved Hide resolved
flavor.in Outdated
Comment on lines 51 to 52
print(rpm.expand("%ghost %{_datadir}/libalternatives/" .. name .. "/%python_version_nodots.conf\\\n")) \
print(rpm.expand("%ghost %{_datadir}/libalternatives/" .. name .. "/10%python_version_nodots.conf\\\n")) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not look right. It's either one or the other, but not both files for any flavor. Have a look at the prio variable in python_install_alternative.

Also, the Python 3.10 flavor, once it is primary (not that soon I guess), it will have a prio of 1310, not 10310.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least it is not really nice :-) I have fixed it.

Copy link
Contributor

@mcepl mcepl left a comment

Choose a reason for hiding this comment

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

Generally I don't see any serious problems, aside from what Ben noticed.

README.md Show resolved Hide resolved
flavor.in Outdated Show resolved Hide resolved
@schubi2
Copy link
Contributor Author

schubi2 commented Sep 30, 2021

Currently I am testing with following packages:
python-tempora - simple example
python-evtx - has multiple calls
python-ipython - has man pages and group settings
I will also transfer and test following packages (needed for MicoOS):
https://build.opensuse.org/package/show/openSUSE:Factory/python-chardet
https://build.opensuse.org/package/show/openSUSE:Factory/python-cheroot
https://build.opensuse.org/package/show/openSUSE:Factory/python-CherryPy
https://build.opensuse.org/package/show/openSUSE:Factory/python-numpy
https://build.opensuse.org/package/show/openSUSE:Factory/python-Flask
https://build.opensuse.org/package/show/openSUSE:Factory/python-pecan
https://build.opensuse.org/package/show/openSUSE:Factory/python-jsonpatch
https://build.opensuse.org/package/show/openSUSE:Factory/python-jsonpointer
https://build.opensuse.org/package/show/openSUSE:Factory/python-jsonschema
https://build.opensuse.org/package/show/openSUSE:Factory/python-Mako
https://build.opensuse.org/package/show/openSUSE:Factory/python-Babel
https://build.opensuse.org/package/show/openSUSE:Factory/python-pybind11
https://build.opensuse.org/package/show/openSUSE:Factory/python-rsa
https://build.opensuse.org/package/show/openSUSE:Factory/python-rtslib-fb
https://build.opensuse.org/package/show/openSUSE:Factory/python-waitress
https://build.opensuse.org/package/show/openSUSE:Factory/python-websocket-client
https://build.opensuse.org/package/show/openSUSE:Factory/python-pysmi
https://build.opensuse.org/package/show/openSUSE:Factory/python-jupyter-core
https://build.opensuse.org/package/show/openSUSE:Factory/python-notebook
https://build.opensuse.org/package/show/openSUSE:Factory/python-nbclassic
https://build.opensuse.org/package/show/openSUSE:Factory/python-jupyter-server
https://build.opensuse.org/package/show/openSUSE:Factory/python-nbformat
https://build.opensuse.org/package/show/openSUSE:Factory/python-pip
https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest
https://build.opensuse.org/package/show/openSUSE:Factory/python-Pygments
https://build.opensuse.org/package/show/openSUSE:Factory/python-json5
https://build.opensuse.org/package/show/openSUSE:Factory/python-wheel

@schubi2
Copy link
Contributor Author

schubi2 commented Sep 30, 2021

If you want I can continue with the other packages and after I have converted and tested them we are quite sure that it is working and can merge the PR after it.

@schubi2
Copy link
Contributor Author

schubi2 commented Oct 1, 2021

I have changed and tested all mentioned packages without a problem. Could we please finish this PR in order to submit all these packages ?

README.md Outdated Show resolved Hide resolved
@bnavigator
Copy link
Collaborator

Currently I am testing with following packages:
python-tempora - simple example
python-evtx - has multiple calls
python-ipython - has man pages and group settings

Where is the obs repo demonstrating it? home:schubi2 does not have your modified python-rpm-macros and none of the above packages' specfiles look like they already fully use the macros.

@bnavigator
Copy link
Collaborator

bnavigator commented Oct 1, 2021

I have pushed all my changes to home:schubi2.
https://build.opensuse.org/package/show/home:schubi2/python-rpm-macros

Okay, I see. The service file and the version 20210929.eccf3f2 are not correct, you modified the files manually. Still not in the state of the current PR. You could adjust your _service to fetch from your PR branch.

https://build.opensuse.org/package/show/home:schubi2/python-evtx

rpmlint is not happy:

[  300s] python36-evtx.noarch: E: update-alternatives-requirement-missing
[  300s] python38-evtx.noarch: E: update-alternatives-requirement-missing
[  300s] python39-evtx.noarch: E: update-alternatives-requirement-missing
[  300s] The package does not have update-alternatives in Requires(post) or
[  300s] Requires(postun). This is needed for the proper scriptlet execution.
[  300s] 
[  300s] python36-evtx.noarch: E: update-alternatives-post-call-missing
[  300s] python38-evtx.noarch: E: update-alternatives-post-call-missing
[  300s] python39-evtx.noarch: E: update-alternatives-post-call-missing
[  300s] The package does not call update-alternatives --install in post phase to
[  300s] install all the configuration.
[  300s] 

https://build.opensuse.org/package/show/home:schubi2/python-ipython

same

https://build.opensuse.org/package/show/home:schubi2/python-tempora

Why does the 15.3 build fail? It does not fail in d:l:p.
egg-info version is lost. Is it due to a libalternative related change in a package in the build dep tree?

@bnavigator
Copy link
Collaborator

rpmlint is not happy:

> rpm -q --scripts python38-evtx-0.6.1-31.1.noarch.rpm
warning: python38-evtx-0.6.1-31.1.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 3d51bceb: NOKEY
preinstall scriptlet (using /bin/sh):
# If libalternatives is used: Removing old update-alternatives entries.
for c in dump dump_chunk_slack eid_record_numbers extract_record filter_records info record_structure structure templates; do
  

if [ 1 -eq 1 ] ; then 
if [ "$1" -gt 0 ] && [ -f /usr/sbin/update-alternatives ]; then 
    update-alternatives --quiet --remove "evtx_$c.py" "/usr/bin/evtx_$c.py-3.8" 
fi 
fi 

done
postinstall scriptlet (using /bin/sh):
for c in dump dump_chunk_slack eid_record_numbers extract_record filter_records info record_structure structure templates; do
   
mkdir -p /usr/share/libalternatives/evtx_$c.py
echo binary=/usr/bin/evtx_$c.py-3.8 >/usr/share/libalternatives/evtx_$c.py/1038.conf
echo group=evtx_$c.py >>/usr/share/libalternatives/evtx_$c.py/1038.conf

done
postuninstall scriptlet (using /bin/sh):
for c in dump dump_chunk_slack eid_record_numbers extract_record filter_records info record_structure structure templates; do
  

if [ ! -e "/usr/bin/evtx_$c.py-3.8" ] && [ -f /usr/sbin/update-alternatives ]; then 
    update-alternatives --quiet --remove "evtx_$c.py" "/usr/bin/evtx_$c.py-3.8" 
fi 

done

You have to either adjust rpmlint or not install any update-alternatives call into %post and %postun at all.

https://github.com/rpm-software-management/rpmlint/blob/90c84aede91f999c4b4cbd0c3c73d5aa96f54f0f/rpmlint/checks/AlternativesCheck.py#L130

README.md Show resolved Hide resolved
@mcepl mcepl merged commit fc6c04e into openSUSE:master Oct 1, 2021
@mcepl
Copy link
Contributor

mcepl commented Oct 1, 2021

@schubi2 Thank you very much and please submit the request to Factory from the current master.

@schubi2
Copy link
Contributor Author

schubi2 commented Oct 1, 2021

Thank you ! But I will also have a look to the rpm-lint. Perhaps we can make it nicer there :-)

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.

None yet

3 participants