oetiker / znapzend

zfs backup with remote capabilities and mbuffer integration.
www.znapzend.org
GNU General Public License v3.0
604 stars 136 forks source link

make install does not respect LIBDIR, always installs to LIBDIR/../lib/ #646

Closed spike77453 closed 1 month ago

spike77453 commented 2 months ago

Since znapzend 0.22.0 make install does not respect LIBDIR any more and tries to install the *.pm files to LIBDIR/.../lib/:

$ ./configure --libdir=/usr/share/perl5/vendor_perl/
```console checking in to see how you are doing... keep fighting man! checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a race-free mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether UID '0' is supported by ustar format... yes checking whether GID '0' is supported by ustar format... yes checking how to create a ustar tar archive... gnutar checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... (cached) yes checking for perl... /usr/bin/perl checking for curl... /usr/bin/curl checking for wget... /usr/bin/wget checking for pod2man... /usr/bin/pod2man checking for rm... /usr/bin/rm checking for CONFIG_YEAR and CONFIG_DATE... got 2024 and 2024-05-03 respectively checking default SMF service name... oep/znapzend checking for way to cat URLs... /usr/bin/wget -O - checking for perl version greater than or equal to 5.16.0... checking is perl reasonably complete... yes. ExtUtils::MakeMaker is available checking if require a c compiler to get perl modules compiled... no checking for grep that handles long lines and -e... /usr/bin/grep checking for gnumake... no checking for gmake... /usr/bin/gmake checking for gnu make availability... /usr/bin/gmake is GNU make checking the price for bergulian eckels... way to expensive! checking for PERL_MODULES... $(top_srcdir)/lib/ZnapZend.pm $(top_srcdir)/lib/ZnapZend/Config.pm $(top_srcdir)/lib/ZnapZend/Time.pm $(top_srcdir)/lib/ZnapZend/ZFS.pm $(top_srcdir)/lib/inheritLevels.pm checking for PERL_CONFIG_VERSION... 5.38 checking for PERL_THIRDPARTY_DIST cache... empty configure: Generating "data" files from templates, see below for executable scripts configure: Generating templated script files that should be marked executable checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating thirdparty/Makefile config.status: creating lib/Makefile config.status: creating debian/Makefile config.status: creating debian/znapzend.links config.status: creating init/znapzend.service config.status: creating init/znapzend.xml config.status: WARNING: 'init/znapzend.xml.in' seems to ignore the --datarootdir setting config.status: creating init/org.znapzend.plist config.status: creating init/znapzend.freebsd config.status: creating init/znapzend.sysv config.status: creating init/znapzend.upstart ** CONFIGURE DONE ********************************************** Settings: PERL5LIB = not set PERL = /usr/bin/perl SVCINSTALLDIR = no URL_CAT = /usr/bin/wget -O - DEB_BUILD = false The Makefiles should be portable to the best extent of our testing, but their recipes should most certainly succeed with GNU make. It is recommended that now you continue installation with /usr/bin/gmake install ```
$ make
...
$ make install
Making install in lib
make[1]: Entering directory '/tmp/znapzend/znapzend-0.22.0/lib'
make[2]: Entering directory '/tmp/znapzend/znapzend-0.22.0/lib'
make[2]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/share/perl5/vendor_perl'
 /usr/bin/mkdir -p '/usr/share/perl5/vendor_perl/../lib/ZnapZend'
 /usr/bin/install -c -m 644  ../lib/ZnapZend/Config.pm ../lib/ZnapZend/Time.pm ../lib/ZnapZend/ZFS.pm '/usr/share/perl5/vendor_perl/../lib/ZnapZend'
 /usr/bin/mkdir -p '/usr/share/perl5/vendor_perl/../lib'
 /usr/bin/install -c -m 644  ../lib/ZnapZend.pm ../lib/inheritLevels.pm '/usr/share/perl5/vendor_perl/../lib'
...

git bisect says it was introduced in this commit: https://github.com/oetiker/znapzend/commit/e690f415b68230724bcef4a4d67037df0b42c2a3

oetiker commented 2 months ago

@jimklimov I guess the Makefile.am in lib needs a tweak too

jimklimov commented 1 month ago

Sorry, missed the notification. I'll take a look soon.

@github: I miss a "facepalm" emoticon in the list.

jimklimov commented 1 month ago

Confirming the issue. Oddly enough, things installed by bin/cpanm tool do follow the specified LIBDIR:

### OK:
     6856     32 -rwxr-xr-x   1 jim      jim         28772 May 27 20:34 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/bin/znapzend
...
     6820      0 drwxr-xr-x   2 jim      jim            80 May 27 20:34 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/x86_64-linux-gnu-thread-multi/.meta/Mojolicious-9.36
     6822      4 -r--r--r--   1 jim      jim          1716 May 27 20:34 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/x86_64-linux-gnu-thread-multi/.meta/Mojolicious-9.36/MYMETA.json
     6821      8 -r--r--r--   1 jim      jim          7066 May 27 20:34 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/x86_64-linux-gnu-thread-multi/.meta/Mojolicious-9.36/install.json
     6818      4 -rw-r--r--   1 jim      jim          1309 May 27 20:34 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/x86_64-linux-gnu-thread-multi/perllocal.pod
...
     6787      4 -r--r--r--   1 jim      jim           741 May 27 20:34 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/Role/Tiny/With.pm
     6784     32 -r--r--r--   1 jim      jim         29618 May 27 20:34 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/Mojolicious.pm
...

### WRONG:
     6586      0 drwxr-xr-x   3 jim      jim           100 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib
     6592     92 -rw-r--r--   1 jim      jim         90429 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib/ZnapZend.pm
     6591      8 -rw-r--r--   1 jim      jim          6044 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib/inheritLevels.pm
     6587      0 drwxr-xr-x   2 jim      jim           100 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib/ZnapZend
     6590     76 -rw-r--r--   1 jim      jim         77492 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib/ZnapZend/ZFS.pm
     6589     28 -rw-r--r--   1 jim      jim         28411 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib/ZnapZend/Config.pm
     6588     12 -rw-r--r--   1 jim      jim         10333 May 27 20:33 /dev/shm/zzz-0.22.0/usr/share/perl5/lib/ZnapZend/Time.pm

This may be thanks to our znapzend/thirdparty/Makefile.am being explicit about this though:

install-exec-hook:
        cp -fr lib/perl5/* $(DESTDIR)$(libdir)    
jimklimov commented 1 month ago

Thinking of the latter, I wonder if installing znapzend dependencies from third party modules into system perl location is correct or a problem as well? Maybe needs a configure toggle too?..

jimklimov commented 1 month ago

As for this issue, the problem seems to be with detection of PERL_MODULES including the srcdir (or rather top_srcdir) and then automake picking up the directory component as imperative for installation.

In the lib/Makefile(.am) the PM = @PERL_MODULES@ becomes eventually nobase_data_DATA which goes "under" datadir=libdir (for that lib makefile). The definition of "under" with relative paths involving ../lib is the issue.

jimklimov commented 1 month ago

With the fix: default configuration (private libdir):

:; make distclean ; rm -rf /dev/shm/zzz-0.22.0 ; ./bootstrap.sh ; ./configure ; make DESTDIR=/dev/shm/zzz-0.22.0 install &&  find /dev/shm/zzz-0.22.0 -ls
...
     6913      8 -r--r--r--   1 jim      jim          6118 May 27 21:27 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/Mojo/Asset/File.pm
     6891      0 drwxr-xr-x   2 jim      jim           100 May 27 21:26 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/ZnapZend
     6894     76 -rw-r--r--   1 jim      jim         77492 May 27 21:26 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/ZnapZend/ZFS.pm
     6893     28 -rw-r--r--   1 jim      jim         28411 May 27 21:26 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/ZnapZend/Config.pm
     6892     12 -rw-r--r--   1 jim      jim         10333 May 27 21:26 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/ZnapZend/Time.pm
     6890     92 -rw-r--r--   1 jim      jim         90429 May 27 21:26 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/ZnapZend.pm
     6889      8 -rw-r--r--   1 jim      jim          6044 May 27 21:26 /dev/shm/zzz-0.22.0/opt/znapzend-0.22.0/lib/inheritLevels.pm

With a customized libdir:

:; make distclean ; rm -rf /dev/shm/zzz-0.22.0 ; ./bootstrap.sh ; ./configure  --libdir=/usr/share/perl5/vendor_perl/ ; make DESTDIR=/dev/shm/zzz-0.22.0 install &&  find /dev/shm/zzz-0.22.0 -ls
...
     7194      8 -r--r--r--   1 jim      jim          6118 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/Mojo/Asset/File.pm
     7172      0 drwxr-xr-x   2 jim      jim           100 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/ZnapZend
     7175     76 -rw-r--r--   1 jim      jim         77492 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/ZnapZend/ZFS.pm
     7174     28 -rw-r--r--   1 jim      jim         28411 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/ZnapZend/Config.pm
     7173     12 -rw-r--r--   1 jim      jim         10333 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/ZnapZend/Time.pm
     7171     92 -rw-r--r--   1 jim      jim         90429 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/ZnapZend.pm
     7170      8 -rw-r--r--   1 jim      jim          6044 May 27 21:28 /dev/shm/zzz-0.22.0/usr/share/perl5/vendor_perl/inheritLevels.pm

QUESTION: @spike77453 @oetiker : is presence of inheritLevels.pm and/or ZnapZend.pm right in the libdir a problem, especially the former? I see most other modules fit in their dedicated directories (not all).

spike77453 commented 1 month ago

QUESTION: @spike77453 @oetiker : is presence of inheritLevels.pm and/or ZnapZend.pm right in the libdir a problem, especially the former? I see most other modules fit in their dedicated directories (not all).

That's how it's been until https://github.com/oetiker/znapzend/commit/e690f415b68230724bcef4a4d67037df0b42c2a3 so it's not a huge issue. However, I've never submitted a package review to Fedora/EPEL (mainly due to time concerns, I'd need to maintain/package the missing perl libraries as well) and only maintained a copr repository with much looser restrictions.
I think that libdir/ZnapZend/inheritLevels.pm is probably the correct place though to avoid file name conflicts with other packages.

Please keep in mind that my use case is rather narrow and I'm only concerned about Fedora/EPEL (and not particular familiar with the perl ecosystem on top of that) so please take what I say with a grain of salt. I can ask the folks of the Fedora Perl SIG though if you need a more informed answer.