App-perlbrew icon indicating copy to clipboard operation
App-perlbrew copied to clipboard

perlbrew install issue -- Can't call method "basename"

Open varneraa opened this issue 5 years ago • 1 comments

I'm using perlbrew to build standalone tool repositories that contain their own perl version and libraries due to a strict compute environment. (I am unable to install perlbrew in my home directory, due to size quotas)

Sometime in the last few months I've been unable to have perlbrew install hitting the 'Can't call method "basename"' I'll show in a log below.

Here is the bash script I have that installs perl for me. I've used this for a few years now and it worked up until early last year, but over the last couple of months it has failed with this issue.

Here is first half of the shell script I use for bulding my initial repo. It sets up proxies, downloads perlbrew and a perl version, then installs the perl version using perlbrew to the path. I maintain I template of the repo that I copy and rename to start a new project.

#################################
#Build File For New Perl Project#
#################################

#1 Install PerlBrew
echo "#1) Install PerlBrew"
#  a Setup
echo "#  a) Setup"
#     i Env Variables
echo "#     i) Env Variables"
#        A Proxies
echo "#        A) Proxies"
#Removing proxy info

#        B PERLBREW/CPANM
echo "#        B) PERLBREW/CPANM"
setenv TOOL_BASE `realpath $0` #TOOL_BASE/doc/build.tcsh
setenv TOOL_BASE `/usr/bin/dirname $TOOL_BASE` #TOOL_BASE/doc
setenv TOOL_BASE `/usr/bin/dirname $TOOL_BASE` #TOOL_BASE
setenv PERLBREW_ROOT $TOOL_BASE/perl5
setenv PERLBREW_HOME $TOOL_BASE/perl5
setenv PERL_VER 5.24.0

#     ii Create PERLBREW_ROOT dir
echo "#     ii) Create PERLBREW_ROOT dir"
mkdir $PERLBREW_ROOT
mkdir $TOOL_BASE/download

#  b Download PerlBrew
echo "#  b) Download PerlBrew"
/usr/bin/wget --no-check-certificate -O $TOOL_BASE/download/perlbrew-install http://install.perlbrew.pl

#  c Install PerlBrew
echo "#  c) Install PerlBrew"
/bin/bash $TOOL_BASE/download/perlbrew-install

#  d Enable PerlBrew #TODO: This needs to be done by any script trying to update PerlBrew
echo "#  d) Enable PerlBrew #TODO: This needs to be done by any script trying to update PerlBrew"
source $PERLBREW_ROOT/etc/cshrc

#  e Download Perl Version(This avoids proxy failures later on)
echo "#  e) Download Perl Version(This avoids proxy failures later on)"
/usr/bin/wget -O $TOOL_BASE/download/perl-${PERL_VER}.tar.gz http://www.cpan.org/src/5.0/perl-${PERL_VER}.tar.gz

#  f Dump proxies to avoid HTTP-Tiny related build failures
echo "#  f) Dump proxies to avoid HTTP-Tiny related build failures"

#Commenting since proxies are removed
#unsetenv http_proxy
#unsetenv https_proxy

#  g Install Perl
echo "#  g) Install Perl"
perlbrew install $TOOL_BASE/download/perl-${PERL_VER}.tar.gz

Here is the output:

#1) Install PerlBrew
#  a) Setup
#     i) Env Variables
#        A) Proxies
#        B) PERLBREW/CPANM
#     ii) Create PERLBREW_ROOT dir
#  b) Download PerlBrew
--2019-01-04 08:17:15--  http://install.perlbrew.pl/
<REMOVED PROXY DETAILS>
Proxy request sent, awaiting response... 302 Moved Temporarily
Location: https://raw.githubusercontent.com/gugod/App-perlbrew/master/perlbrew-install [following]
--2019-01-04 08:17:16--  https://raw.githubusercontent.com/gugod/App-perlbrew/master/perlbrew-install
<REMOVING PROXY INFO>
WARNING: cannot verify raw.githubusercontent.com's certificate, issued by ‘CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US’:
  Unable to locally verify the issuer's authority.
Proxy request sent, awaiting response... 200 OK
Length: 1548 (1.5K) [text/plain]
Saving to: ‘<HIDING BASE PATH>/download/perlbrew-install’

     0K .                                                     100%  381M=0s

2019-01-04 08:17:16 (381 MB/s) - ‘<HIDING BASE PATH>/download/perlbrew-install’ saved [1548/1548]

#  c) Install PerlBrew

## Download the latest perlbrew

## Installing perlbrew
Using Perl </usr/bin/perl>
perlbrew is installed: <HIDING BASE PATH>/perl5/bin/perlbrew

perlbrew root (<HIDING BASE PATH>/perl5) is initialized.
## Installing patchperl

## Done.
#  d) Enable PerlBrew #TODO: This needs to be done by any script trying to update PerlBrew
#  e) Download Perl Version(This avoids proxy failures later on)
--2019-01-04 08:17:17--  http://www.cpan.org/src/5.0/perl-5.24.0.tar.gz
<REMOVING PROXY INFO>
Proxy request sent, awaiting response... 200 OK
Length: 17576316 (17M) [application/x-gzip]
Saving to: ‘<HIDING BASE PATH>/download/perl-5.24.0.tar.gz’

     0K .......... .......... .......... .......... ..........  0% 2.98M 6s
     <REMOVING EXTRA LINES>
 17150K .......... ....                                       100% 4.48M=1.4s

2019-01-04 08:17:18 (12.3 MB/s) - ‘<HIDING BASE PATH>/download/perl-5.24.0.tar.gz’ saved [17576316/17576316]

#  f) Dump proxies to avoid HTTP-Tiny related build failures
#  g) Install Perl
Can't call method "basename" without a package or object reference at <HIDING BASE PATH>/perl5/bin/perlbrew line 1977.

That refers to this subroutine:

  sub do_install_archive {
      require File::Basename;
  
      my $self = shift;
      my $dist_tarball_path = shift;
      my $dist_version;
      my $installation_name;
  
      if ($dist_tarball_path->basename =~ m{(c?perl)-?(5.+)\.tar\.(gz|bz2|xz)\Z}) {
          my $perl_variant = $1;
          $dist_version = $2;
          $installation_name = "${perl_variant}-${dist_version}";
      }
  
      unless ($dist_version && $installation_name) {
          die "Unable to determine perl version from archive filename.\n\nThe archive name should look like perl-5.x.y.tar.gz or perl-5.x.y.tar.bz2 or perl-5.x.y.tar.xz\n";
      }
  
      my $dist_extracted_path = $self->do_extract_tarball($dist_tarball_path);
      $self->do_install_this($dist_extracted_path, $dist_version, $installation_name);
      return;
  }

Specifically the if ( $dist_tarball_path->basename =~ ... ) line:

 if ($dist_tarball_path->basename =~ m{(c?perl)-?(5.+)\.tar\.(gz|bz2|xz)\Z}) {

I'll dig around to see if I can find an older copy of the perlbrew and run with it.

varneraa avatar Jan 04 '19 16:01 varneraa