• [gentoo-user] Advice appreciated regarding how to handle Perl modules c

    From =?UTF-8?Q?Morgan_Wesstr=c3=b6m?=@21:1/5 to All on Tue Mar 21 20:30:02 2023
    Dear list,

    I'm trying to create an ebuild for a ZFS snapshot/replication automation tool called Znapzend that I've been using on FreeBSD for some time and also would like to use in Gentoo. https://github.com/oetiker/znapzend

    The project homepage has a link to a 3 year old abandoned ebuild that no longer works. The program exists as a package in FreeBSD and also in Arch Linux and I've used all these sources to try to understand the best approach how to handle it in Gentoo.

    I've managed to create a working ebuild but I need some input for the final install phase. The program is written in Perl and creates a few modules. The above mentioned sources do not agree on the location of these files and gives no hints to why the maintainers chose the solution they did.

    The FreeBSD approach seems straight forward and places the files accordingly: /usr/local/lib/perl5/site_perl/ZnapZend.pm /usr/local/lib/perl5/site_perl/ZnapZend/Config.pm /usr/local/lib/perl5/site_perl/ZnapZend/Time.pm /usr/local/lib/perl5/site_perl/ZnapZend/ZFS.pm /usr/local/lib/perl5/site_perl/inheritLevels.pm

    In Gentoo I find .pm files in a multitude of places e.g.
    /usr/lib64/perl5/5.36
    /usr/lib64/perl5/vendor_perl/5.36

    This is where I lack the necessary knowledge to proceed.

    1) Where's the appropriate place for these files in Gentoo and why?

    2) If the appropriate place is either of those folders with a version number, how do I install the files there without hard coding the version number in the ebuild (which would naturally break the next time Perl gets updated)?

    Regards
    Morgan Wesström

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jack@21:1/5 to All on Tue Mar 21 21:10:01 2023
    On 2023.03.21 15:19, Morgan Wesström wrote:
    Dear list,

    I'm trying to create an ebuild for a ZFS snapshot/replication
    automation tool called Znapzend that I've been using on FreeBSD for
    some time and also would like to use in Gentoo. https://github.com/oetiker/znapzend

    The project homepage has a link to a 3 year old abandoned ebuild that
    no longer works. The program exists as a package in FreeBSD and also
    in Arch Linux and I've used all these sources to try to understand
    the best approach how to handle it in Gentoo.

    I've managed to create a working ebuild but I need some input for the
    final install phase. The program is written in Perl and creates a few modules. The above mentioned sources do not agree on the location of
    these files and gives no hints to why the maintainers chose the
    solution they did.

    The FreeBSD approach seems straight forward and places the files accordingly:
    /usr/local/lib/perl5/site_perl/ZnapZend.pm /usr/local/lib/perl5/site_perl/ZnapZend/Config.pm /usr/local/lib/perl5/site_perl/ZnapZend/Time.pm /usr/local/lib/perl5/site_perl/ZnapZend/ZFS.pm /usr/local/lib/perl5/site_perl/inheritLevels.pm

    In Gentoo I find .pm files in a multitude of places e.g. /usr/lib64/perl5/5.36
    /usr/lib64/perl5/vendor_perl/5.36

    This is where I lack the necessary knowledge to proceed.

    1) Where's the appropriate place for these files in Gentoo and why?

    2) If the appropriate place is either of those folders with a version number, how do I install the files there without hard coding the
    version number in the ebuild (which would naturally break the next
    time Perl gets updated)?

    Regards
    Morgan Wesström
    I'd suggest looking at ebuilds created by g-cpan, which produces
    ebuilds for any module in CPAN. I suspect the eclass(es) involved deal
    with the perl version issue. I don't think you can savely ignore that,
    since there are likely to be things in the module which do depend on
    the version of perl used to create that module.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jack@21:1/5 to All on Tue Mar 21 22:00:01 2023
    On 2023.03.21 16:27, Morgan Wesström wrote:
    On 2023-03-21 21:04, Jack wrote:
    1) Where's the appropriate place for these files in Gentoo and why?

    2) If the appropriate place is either of those folders with a
    version number, how do I install the files there without hard
    coding the version number in the ebuild (which would naturally
    break the next time Perl gets updated)?

    Regards
    Morgan Wesström
    I'd suggest looking at ebuilds created by g-cpan, which produces
    ebuilds for any module in CPAN.  I suspect the eclass(es) involved
    deal with the perl version issue.  I don't think you can savely
    ignore that, since there are likely to be things in the module which
    do depend on the version of perl used to create that module.


    Thank you, Jack. Digging through some ebuilds in the dev-perl
    category was the first thing I did. It led me to the perl-module
    eclass but I can only find reference documentation which doesn't tell
    me how to use it or how its functions hook into the build system.
    I don't know if it's actually useful, but note I suggested perl-gcpan
    not dev-perl. I don't know how different those generated ebuilds are
    from ones in dev-perl, but they are created "on the fly" from the CPAN
    entry for the module. You could try it on some CPAN module you think
    has some similarities to one of the znapzend perl modules. I don't
    know how to know if a perl module truly depends on the perl version,
    but I don't think it hurts to make that assumption. The only cost I
    see is a possibly unnecessary rebuild on a perl upgrade.

    I lack fundamental knowledge of how Perl is organized and I'm an old
    guy which mean I have to be selective with new knowledge not t be overwhelmed. ;) How DO I know if either module is dependent on a
    specific Perl version for example?
    I might challenge you on age, and the mere fact that you are using
    Gentoo, and messing with ebuilds puts you far ahead of the general
    crowd. I'm currently trying to make an application work with Qt6, so
    don't underestimate what you can figure out how to do.

    In the old ebuild I found online, the developer just creates a /usr/share/znapzend/perl5 folder and puts all those files there.

    https://git.gerczei.eu/tgerczei/gentoo-overlay/src/branch/master/app-backup/znapzend/znapzend-0.20.0.ebuild

    I could easily do that and be done with it but this is also an
    opportunity to absorb some new knowledge and to know that I made the correct choice and why this choice is the correct one in this
    situation.
    The znapaend readme says something about any necessary perl modules
    being installed within the znapzend area and not within the system
    perl, so that might actually be a reasonable place to also put their
    own perl modules. You could also dig into the package for one of the
    other distributions and see where they put the various pieces.

    Regards
    Morgan
    Jack

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Morgan_Wesstr=c3=b6m?=@21:1/5 to Jack on Tue Mar 21 21:30:02 2023
    On 2023-03-21 21:04, Jack wrote:
    1) Where's the appropriate place for these files in Gentoo and why?

    2) If the appropriate place is either of those folders with a version number,
    how do I install the files there without hard coding the version number in >> the ebuild (which would naturally break the next time Perl gets updated)?

    Regards
    Morgan Wesström
    I'd suggest looking at ebuilds created by g-cpan, which produces ebuilds for any module in CPAN.  I suspect the eclass(es) involved deal with the perl version issue.  I don't think you can savely ignore that, since there are likely to be things in the module which do depend on the version of perl used to create that module.


    Thank you, Jack. Digging through some ebuilds in the dev-perl category was the first thing I did. It led me to the perl-module eclass but I can only find reference documentation which doesn't tell me how to use it or how its functions hook into the build system. I lack fundamental knowledge of how Perl is organized and I'm an old guy which mean I have to be selective with new knowledge not t be overwhelmed. ;) How DO I know if either module is dependent on a specific Perl version for example?

    In the old ebuild I found online, the developer just creates a /usr/share/znapzend/perl5 folder and puts all those files there.

    https://git.gerczei.eu/tgerczei/gentoo-overlay/src/branch/master/app-backup/znapzend/znapzend-0.20.0.ebuild

    I could easily do that and be done with it but this is also an opportunity to absorb some new knowledge and to know that I made the correct choice and why this choice is the correct one in this situation.

    Regards
    Morgan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Morgan_Wesstr=c3=b6m?=@21:1/5 to Jack on Wed Mar 22 02:50:02 2023
    On 2023-03-21 21:04, Jack wrote:
    I'd suggest looking at ebuilds created by g-cpan, which produces ebuilds for any module in CPAN.

    I was looking at this early on but didn't think I would need it but it turned out that there was one more dependency I had missed. g-cpan worked very well, integrated itself automatically with Portage and put the generated ebuild in my localrepo. For now I just add g-cpan as a dependency to my ebuild with an elog message at the end with instructions how to install the missing module. I'll be looking for a way to trigger that automatically after the main program is emerged.

    Regarding the location for the Perl modules created by znapzend, I ended up putting them in a separate folder for now until I can find some best practices on how to handle them. The ebuild works and I'm running tests on znapzend at the moment to see that I didn't miss more dependencies.

    Thank you for your input and if anyone has info on best practices regarding Perl modules location and how to make your ebuild automatically put them in the current versioned vendor_perl folder, I'm all ears.

    Morgan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Kenworthy@21:1/5 to All on Wed Mar 22 02:20:01 2023
    On 22/3/23 04:27, Morgan Wesström wrote:


    On 2023-03-21 21:04, Jack wrote:
    1) Where's the appropriate place for these files in Gentoo and why?

    2) If the appropriate place is either of those folders with a
    version number, how do I install the files there without hard coding
    the version number in the ebuild (which would naturally break the
    next time Perl gets updated)?

    Regards
    Morgan Wesström
    I'd suggest looking at ebuilds created by g-cpan, which produces
    ebuilds for any module in CPAN.  I suspect the eclass(es) involved
    deal with the perl version issue.  I don't think you can savely
    ignore that, since there are likely to be things in the module which
    do depend on the version of perl used to create that module.


    Thank you, Jack. Digging through some ebuilds in the dev-perl category
    was the first thing I did. It led me to the perl-module eclass but I
    can only find reference documentation which doesn't tell me how to use
    it or how its functions hook into the build system. I lack fundamental knowledge of how Perl is organized and I'm an old guy which mean I
    have to be selective with new knowledge not t be overwhelmed. ;) How
    DO I know if either module is dependent on a specific Perl version for example?

    In the old ebuild I found online, the developer just creates a /usr/share/znapzend/perl5 folder and puts all those files there.

    https://git.gerczei.eu/tgerczei/gentoo-overlay/src/branch/master/app-backup/znapzend/znapzend-0.20.0.ebuild


    I could easily do that and be done with it but this is also an
    opportunity to absorb some new knowledge and to know that I made the
    correct choice and why this choice is the correct one in this situation.

    Regards
    Morgan

    Also, are you aware of perl-cleaner? - it takes care of perl packages
    after an upgrade.

    This is a good read: https://wiki.gentoo.org/wiki/Perl

    BillK

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)