Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Can I get cpanm to skip re-installation of a module when pointing directly to a remote .tgz file?

by boleary (Scribe)
on Oct 01, 2021 at 13:29 UTC ( [id://11137163]=perlquestion: print w/replies, xml ) Need Help??

boleary has asked for the wisdom of the Perl Monks concerning the following question:

I built a patched version of TK to work around a bad pointer issue in the latest CPAN released module.
(I got the fix from one of the pull requests on gitHub)
I store that .tgz file out on my website at https://securedata.cadEnhance.com/build_assets/Tk-Module-fixed/Tk-804.035_999-cboleary.tar.gz
When I am setting up perl on a vm, I run a script to install all the modules I need
the script issues this command:
cpanm https://securedata.cadEnhance.com/build_assets/Tk-Module-fixed/Tk-804.035_999-cboleary.tar.gz

The problem I have is that the script always re-installs this module (and the Tk module takes a good 15-20 minutes to install)
while it skips all the other modules since it knows they are up-to-date
Is there a way to debug why cpanm thinks it needs to re-install the up-to-date module ? hopefully without it going through the whole install process?
Or is there some option I'm missing to to tell it not to re-install?
I can't figure it out from the command line options I think the default option is not to re-install
or will cpanm always re-install if I am pointing to a remote tgz file like this?

  • Comment on Can I get cpanm to skip re-installation of a module when pointing directly to a remote .tgz file?
  • Download Code

Replies are listed 'Best First'.
Re: Can I get cpanm to skip re-installation of a module when pointing directly to a remote .tgz file?
by choroba (Cardinal) on Oct 01, 2021 at 15:04 UTC
    You can also use distroprefs. You can specify patches to apply upon installation and CPAN clients will happily apply them.

    Just specify

    $CPAN::Config->{prefs_dir} = ...; $CPAN::Config->{patches_dir} = ...;

    See rurban's distroprefs for inspiration.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      I think this sounds like a good idea, but the inspiration I got from the link and the documents on cpan were not enough for me to figure out how to use it

      It sounds like I can download the latest distro, make the changes I want and create a patch file and then have distoprefs apply them?

      can it also patch the c code and .xs files if needed?

Re: Can I get cpanm to skip re-installation of a module when pointing directly to a remote .tgz file?
by hippo (Bishop) on Oct 01, 2021 at 13:51 UTC
Re: Can I get cpanm to skip re-installation of a module when pointing directly to a remote .tgz file?
by Fletch (Bishop) on Oct 01, 2021 at 20:16 UTC

    Kludgy (marginally), but maybe further patch your Tk.pm and define something like $Tk::IS_FIXED_BOLEARY = 1 in it. Then you could prefix your call to cpanm with something like (adjusting for shell and how snippets need to be called in whatever you're doing):

    perl -MTk -E 'exit( $Tk::IS_FIXED_BOLEARY == 1 ? 0 : 99 )' 2>&1 > /dev +/null if [[ $? -eq 0 ]] ; then echo "Locally patched Tk already present, skipping" else echo "Locally patched Tk NOT present, installing with cpanm" cpanm https://BLAHBLAHBLAH/YACKETYSMACKETY fi

    Edit: Tweaked exit value check and tossed output. Derp.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      I hadn't checked back on the history of this post in quite some time..

      I like this workaround, and I was actually doing something similar with my installation script.

      Not a bad idea...

Re: Can I get cpanm to skip re-installation of a module when pointing directly to a remote .tgz file?
by Anonymous Monk on Oct 01, 2021 at 20:05 UTC

      I will take a look at this.. skip-satisfied sounds like its worth a shot

      the skip-satisfied option looks hopeful ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11137163]
Approved by marto
Front-paged by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-18 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found