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

Hard-coded libexec in setup.py #3597

Closed
sbradnick opened this issue Jul 25, 2022 · 5 comments
Closed

Hard-coded libexec in setup.py #3597

sbradnick opened this issue Jul 25, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@sbradnick
Copy link

sbradnick commented Jul 25, 2022

For openSUSE Leap 15.4 (latest Leap), %{_libexecdir} resolves to /usr/lib (vs. /usr/libexec for TW):

Leap> rpm -E '%{_libexecdir}'
/usr/lib

TW> rpm -E '%{_libexecdir}'
/usr/libexec

Would it be possible to have something that ties into is_openSUSE() so the distro-specific value can be swapped in? a la __FILLUPDIR__ & __UNITDIR__

The issue presents itself in https://github.com/Xpra-org/xpra/blob/master/setup.py#L1592

# This works for TW:
add_data_files("libexec/xpra/", ["fs/libexec/xpra/%s" % x for x in libexec_scripts])
# This works for Leap:
add_data_files("lib/xpra/", ["fs/libexec/xpra/%s" % x for x in libexec_scripts])
@sbradnick sbradnick added the bug Something isn't working label Jul 25, 2022
@totaam
Copy link
Collaborator

totaam commented Jul 26, 2022

This used to be per-distro but now that Debian has finally caught up with the filesystem spec, this is no longer the case: f9108f5
I am extremely reluctant to revert this change just for one unsupported distro, sorry.
The most intrusive I would accept at this point would be an environment variable lookup, something like: libexec_dir=os.environ.get("LIBEXEC_DIR", "/usr/libexec")

@sbradnick
Copy link
Author

Understood, I recall notifications from gh about libexec around that time frame. I certainly wouldn't advocate for changing the default, just having a way to tie-in to the macro which TW defines as /usr/libexec and Leap defines as /usr/lib ; no extraneous code on your part where YOU need to be aware of those differences, but something akin to ( not saying this code is actually valid ;) ):

if is_openSUSE():
  # basically need $(basename $(rpm -E '%{_libexecdir}'))
  libexec_dir = "__LIBEXECDIR__"
else
  libexec_dir = "libexec"
...
add_data_files(libexec_dir + "/xpra/", ["fs/libexec/xpra/%s" % x for x in libexec_scripts])

So the same sed that fixes up __FILLUPDIR__ & __UNITDIR__ can be used here.

Currently, the .spec file is copying these files out of an unusable %{buildroot}%{_prefix}/libexec/%{name}/* and moving them to %{buildroot}%{_libexecdir}/%{name} for Leap. It works, but it's one of those things that would fail a few times until someone realizes the difference between _libexecdir for TW vs. Leap and this special mv provision for it.

@totaam
Copy link
Collaborator

totaam commented Jul 26, 2022

Applied this ugly fix in the commit above.

Do you happen to know when opensuse is going to catch up with libexec?

@totaam totaam closed this as completed Jul 26, 2022
@sbradnick
Copy link
Author

Thanks :) I'll keep an eye on it ~ not sure what Leap's future holds (since it's tied to SLE, and may even pivot in a different direction in a release or two).

Seems /usr/lib and /usr/libexec are provided by the filesystem pkg and the %{_libexecdir} macro comes from the rpm package ~ I'll keep an eye on them to see if anything changes for Leap.

$ sudo chroot /var/tmp/build-root/openSUSE_Tumbleweed-x86_64
:/ #  cd /usr/lib/rpm
:/usr/lib/rpm #  grep _libexecdir ./platform/x86_64-linux/macros
%_libexecdir		%{_exec_prefix}/libexec

$ sudo chroot /var/tmp/build-root/15.4-x86_64/
:/ #  cd /usr/lib/rpm/
:/usr/lib/rpm #  grep _libexecdir ./platform/x86_64-linux/macros
%_libexecdir		%{_exec_prefix}/lib

@sbradnick
Copy link
Author

I really appreciate you making this change ; I was able to use a03b3f6 and make .spec file adjustments as well as remove the extraneous 'if this version of openSUSE or this version of openSUSE or this version ...' code to manually move things out of libexec when %{_libexecdir} doesn't resolve to /usr/libexec (Tumbleweed uses it, but SLE/Leap do not).

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants