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

make default perl install path respect CMAKE_INSTALL_PREFIX #2054

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

sarnold
Copy link
Contributor

@sarnold sarnold commented Nov 21, 2023

Rebased as requested, same name as the original PR (#1999) (sorry about any confusion).

Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
@evgenyz
Copy link
Contributor

evgenyz commented Dec 7, 2023

Hey! Sorry about it taking so long to review.

I'm a bit confused with minor versions. Here is what I have in Fedora:

[ekolesni@ekolesni perl5]$ ls /usr/lib64/perl5 -fl
total 604
drwxr-xr-x. 1 root root    436 May 26  2023 .
dr-xr-xr-x. 1 root root 121852 Dec  6 12:13 ..
drwxr-xr-x. 1 root root     70 May 26  2023 B
drwxr-xr-x. 1 root root     20 May 26  2023 CORE
drwxr-xr-x. 1 root root     14 May 26  2023 File
drwxr-xr-x. 1 root root    142 May 26  2023 IO
drwxr-xr-x. 1 root root     66 May 26  2023 PerlIO
drwxr-xr-x. 1 root root    146 May 16  2023 auto
drwxr-xr-x. 1 root root    678 Oct  2 00:13 vendor_perl
drwxr-xr-x. 1 root root     22 May 26  2023 Sys
drwxr-xr-x. 1 root root     22 May 26  2023 I18N
drwxr-xr-x. 1 root root      8 May 16  2023 Hash
-rw-r--r--. 1 root root  30093 May 16  2023 B.pm
-rw-r--r--. 1 root root   4291 May 16  2023 O.pm
-rw-r--r--. 1 root root  20383 May 16  2023 POSIX.pm
-rw-r--r--. 1 root root  82617 May 16  2023 POSIX.pod
-rw-r--r--. 1 root root   9842 May 16  2023 mro.pm
-rw-r--r--. 1 root root   3988 May 16  2023 Fcntl.pm
-rw-r--r--. 1 root root   1462 May 16  2023 IO.pm
-rw-r--r--. 1 root root   6833 May 16  2023 Errno.pm
-rw-r--r--. 1 root root   3084 May 16  2023 NDBM_File.pm
-rw-r--r--. 1 root root  26015 May 16  2023 DynaLoader.pm
-rw-r--r--. 1 root root   3154 May 16  2023 Config.pm
-rw-r--r--. 1 root root 257699 May 16  2023 Config.pod
-rw-r--r--. 1 root root    409 May 16  2023 Config_git.pl
-rw-r--r--. 1 root root  60309 May 16  2023 Config_heavy.pl
-rw-r--r--. 1 root root   3809 May 16  2023 SDBM_File.pm
-rw-r--r--. 1 root root  16353 May 16  2023 attributes.pm
-rw-r--r--. 1 root root  28710 May 16  2023 re.pm
-rw-r--r--. 1 root root   6136 May 16  2023 lib.pm
-rw-r--r--. 1 root root  16362 May 16  2023 Opcode.pm
-rw-r--r--. 1 root root    997 May 16  2023 ops.pm

Can't see any minor-version directories. I wonder, how it will actually function?

@sarnold
Copy link
Contributor Author

sarnold commented Dec 13, 2023

What's under /usr/lib64/perl5/vendor_perl ?

@evgenyz
Copy link
Contributor

evgenyz commented Dec 13, 2023

[ekolesni@ekolesni ~]$ ls -l /usr/lib64/perl5/vendor_perl/
total 472
drwxr-xr-x. 1 root root    460 Oct  2 00:13 auto
-rw-r--r--. 1 root root   7648 Nov  4  2017 autovivification.pm
drwxr-xr-x. 1 root root     46 May 26  2023 Class
-rw-r--r--. 1 root root   2354 Oct 19  2022 Clone.pm
drwxr-xr-x. 1 root root      6 Feb  9  2023 Compress
-rw-r--r--. 1 root root  21277 Jan 20  2023 Cwd.pm
drwxr-xr-x. 1 root root     18 May 26  2023 Data
drwxr-xr-x. 1 root root    160 May 26  2023 DateTime
-rw-r--r--. 1 root root 137249 Oct 24  2022 DateTime.pm
drwxr-xr-x. 1 root root     68 May 26  2023 Devel
drwxr-xr-x. 1 root root     24 May 26  2023 Digest
drwxr-xr-x. 1 root root    332 May 26  2023 Encode
-rw-r--r--. 1 root root  32201 Aug  4  2022 Encode.pm
-rw-r--r--. 1 root root  22950 Aug  4  2022 encoding.pm
drwxr-xr-x. 1 root root     22 May 26  2023 File
drwxr-xr-x. 1 root root     86 May 26  2023 Filter
drwxr-xr-x. 1 root root     92 May 26  2023 GD
-rw-r--r--. 1 root root  70936 Feb  1  2022 GD.pm
drwxr-xr-x. 1 root root     36 May 26  2023 GSSAPI
-rw-r--r--. 1 root root  11507 Apr 27  2010 GSSAPI.pm
drwxr-xr-x. 1 root root    160 May 26  2023 HTML
drwxr-xr-x. 1 root root     36 Jan 20  2023 IO
drwxr-xr-x. 1 root root     74 May 26  2023 IPC
drwxr-xr-x. 1 root root     62 May 26  2023 Lexical
drwxr-xr-x. 1 root root     40 May 26  2023 List
drwxr-xr-x. 1 root root     46 May 26  2023 MIME
drwxr-xr-x. 1 root root     66 May 26  2023 Net
drwxr-xr-x. 1 root root     18 May 26  2023 Object
drwxr-xr-x. 1 root root     10 Jan 20  2023 Package
-rw-r--r--. 1 root root   4200 Sep 27  2020 PadWalker.pm
drwxr-xr-x. 1 root root    134 May 26  2023 Params
drwxr-xr-x. 1 root root     28 May 26  2023 PerlIO
drwxr-xr-x. 1 root root      4 Jan 20  2023 POD2
drwxr-xr-x. 1 root root      8 Jan 20  2023 Ref
drwxr-xr-x. 1 root root     14 May 26  2023 Scalar
-rw-r--r--. 1 root root  37064 Aug 19  2022 Socket.pm
drwxr-xr-x. 1 root root     18 May 26  2023 Sort
-rw-r--r--. 1 root root  49923 Jan 20  2023 Storable.pm
drwxr-xr-x. 1 root root     36 May 26  2023 Sub
drwxr-xr-x. 1 root root     38 Oct  2 00:13 Sys
drwxr-xr-x. 1 root root     20 May 26  2023 Term
drwxr-xr-x. 1 root root     72 May 26  2023 Text
drwxr-xr-x. 1 root root     18 May 26  2023 threads
-rw-r--r--. 1 root root  37951 Jan 20  2023 threads.pm
drwxr-xr-x. 1 root root     16 May 26  2023 Time
drwxr-xr-x. 1 root root    202 May 26  2023 Unicode
drwxr-xr-x. 1 root root     16 May 26  2023 Variable
drwxr-xr-x. 1 root root     66 May 26  2023 version
-rw-r--r--. 1 root root   3549 Apr 16  2021 version.pm
-rw-r--r--. 1 root root   9832 Jul 31  2020 version.pod
drwxr-xr-x. 1 root root     26 Oct  2 00:13 Win
drwxr-xr-x. 1 root root    114 May 26  2023 XML
drwxr-xr-x. 1 root root     10 Jun 15 02:00 XS
-rw-r--r--. 1 root root   1801 Oct 20  2020 XString.pm

@sarnold
Copy link
Contributor Author

sarnold commented Dec 13, 2023

I was hoping this would not require distro-specific hacks... Anyway, using some perl path returned by find_perl would still leave the prefix install in a broken state.

@sarnold
Copy link
Contributor Author

sarnold commented Dec 13, 2023

Sorry, I meant using that ^^ by itself. Which means a bit more cmake foo is required, along with trusting the paths shown in the cmake docs. I should be able to push another commit shortly.

@sarnold
Copy link
Contributor Author

sarnold commented Dec 14, 2023

After checking a few installs it looks like a free-for-all under the perl install paths with multiple/nested directory trees for what are essentially the same file types so I would expect Fedora to be tolerant enough to accept the versioned subdirectories I see on pretty much any system, starting with the cmake perl paths:

-- perl vendorlib: /usr/lib64/perl5/vendor_perl/5.38
-- perl vendorarch: /usr/lib64/perl5/vendor_perl/5.38/aarch64-linux
-- perl sitelib: /usr/local/lib64/perl5/5.38
-- perl sitearch: /usr/local/lib64/perl5/5.38/aarch64-linux
-- perl privlib: /usr/lib64/perl5/5.38
-- perl archlib: /usr/lib64/perl5/5.38/aarch64-linux

The current install paths in my top commit can certainly be improved, hopefully after dinner. With the vendor paths adjusted for prefix I get this:

$ tree -L 4 -d .tox/tests/lib64/perl5/
.tox/tests/lib64/perl5/
└── vendor_perl
    └── 5.38
        ├── aarch64-linux
        │   └── openscap
        └── openscap

6 directories

* also display both vendor/non-vendor system paths in linux envs

Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
@sarnold
Copy link
Contributor Author

sarnold commented Dec 15, 2023

If not specified, cmake default install prefix on Linux/mac is /usr/local so you must provide another prefix to install to a non-system path as a "normal" user, eg, with something like -DCMAKE_INSTALL_PREFIX=my/virtualenv/root in your configure args.

Oh yeah, can you run this on fedora and post the perl paths here? Thanks!

@evgenyz
Copy link
Contributor

evgenyz commented Dec 15, 2023

Oh yeah, can you run this on fedora and post the perl paths here? Thanks!

I'm not sure what you want me to post exactly, but if you mean output of this:

message(STATUS "perl install libdir: ${PERL_VENDORARCH}")
message(STATUS "perl install archdir: ${PERL_VENDORLIB}")

then you can check it out yourself for every distro we gate against in CI logs (e.g. https://github.com/OpenSCAP/openscap/actions/runs/7216196068/job/19661940675?pr=2054#step:5:249).

@sarnold
Copy link
Contributor Author

sarnold commented Dec 15, 2023

Doh! It's so much fun when everyone gets their own PATHs.

@sarnold
Copy link
Contributor Author

sarnold commented Dec 15, 2023

Hmm, after still more thought, I added a check for default instead. I think that's about it (unless you want a custom default or other changes). Thanks!

Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
@evgenyz
Copy link
Contributor

evgenyz commented Dec 18, 2023

Great. Thank you!

@evgenyz
Copy link
Contributor

evgenyz commented Dec 18, 2023

The test failure is not relevant to the changes.

@evgenyz evgenyz merged commit ef654dd into OpenSCAP:maint-1.3 Dec 18, 2023
17 of 18 checks passed
@xambroz
Copy link
Contributor

xambroz commented Jan 10, 2024

Hello,
I believe that it might be troublesome placing *.pm file, which dynamically loads arched .so, to the /usr/share/perl5/vendor_perl/. Same package multiple arches on same disk might be problem.

For example having i686 package installed next to the x86_64 package would collide in the openscap_pm.pm
having
i686 package:
/usr/lib64/perl5/vendor_perl/openscap_pm.so
/usr/share/perl5/vendor_perl/openscap_pm.pm

x86_64:
/usr/lib/perl5/vendor_perl/openscap_pm.so
/usr/share/perl5/vendor_perl/openscap_pm.pm

Yes perl might probably live with just 3 files, but the RPM (and possibly other package managers for other distros) won't be happy. Unless we package openscap_pm.pm as noarch and openscap_pm.so as arched, but in my opinion that would be overkill.

Example reference packages using DynaLoader same as openscap:
perl-Data-UUID-1.226-13.fc39.x86_64 having:
/usr/lib64/perl5/vendor_perl/Data/UUID.pm
/usr/lib64/perl5/vendor_perl/auto/Data/UUID/UUID.so

perl-Digest-SHA-6.04-501.fc39.x86_64 having:
/usr/lib64/perl5/vendor_perl/Digest/SHA.pm
/usr/lib64/perl5/vendor_perl/auto/Digest/SHA/SHA.so

perl-GD-2.78-3.fc39.x86_64 having:
/usr/lib64/perl5/vendor_perl/GD.pm
/usr/lib64/perl5/vendor_perl/auto/GD/GD.so

perl-Glib-1.3293-13.fc39.x86_64 having:
/usr/lib64/perl5/vendor_perl/Glib.pm
/usr/lib64/perl5/vendor_perl/auto/Glib/Glib.so

Best regards
Michal Ambroz

@sarnold sarnold deleted the perl-install-fix branch February 9, 2024 21:55
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.

3 participants