From 38f0acca3835d0c4bdf042edbf92579e73447852 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 4 Sep 2020 14:26:28 +0100 Subject: [PATCH] Pin Alien::Sodium to an old version, to fix install errors Workaround for https://github.com/genio/alien-sodium/issues/2. Fixes https://github.com/matrix-org/sytest/issues/942. --- cpanfile | 4 ++++ install-deps.pl | 30 +++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/cpanfile b/cpanfile index 06bd4615b..1334af131 100644 --- a/cpanfile +++ b/cpanfile @@ -5,6 +5,10 @@ requires 'Alien::Base::ModuleBuild'; requires 'Class::Method::Modifiers'; +# workaround for https://github.com/matrix-org/sytest/issues/942: +# Crypt::NaCl::Sodium won't install with Alien::Sodium 2.0. +requires 'Alien::Sodium', '<2.0', 'AJGB/Alien-Sodium-1.0.8.0.tar.gz'; + # this can be a pain to install. # # We used to have a libcrypt-nacl-sodium-perl deb, but it was only built for diff --git a/install-deps.pl b/install-deps.pl index 59d47c096..691131f26 100755 --- a/install-deps.pl +++ b/install-deps.pl @@ -31,34 +31,42 @@ sub check_installed } defined $want_ver or return 1; - unless( $want_ver =~ s/^>=\s+// ) { - print STDERR "TODO: can only perform '>=' version checks\n"; + my $inst_ver = `$^X -M$mod -e 'print \$${mod}::VERSION'`; + + if( $want_ver =~ s/^>=\s*// ) { + if( $inst_ver lt $want_ver ) { + die "$mod: got $inst_ver, want >=$want_ver\n"; + } + } elsif( $want_ver =~ s/^<\s*// ) { + if( $inst_ver ge $want_ver ) { + die "$mod: got $inst_ver, want <$want_ver\n"; + } + } else { + print STDERR "TODO: can only perform '<' and '>=' version checks: cannot support $want_ver\n"; return 1; } - my $inst_ver = `$^X -M$mod -e 'print \$${mod}::VERSION'`; - if( $inst_ver lt $want_ver ) { - die "$mod: got $inst_ver, want $want_ver\n"; - } return 1; } sub requires { - my ( $mod, $ver ) = @_; + my ( $mod, $ver, $dist_path ) = @_; eval { check_installed( $mod, $ver ) } and return; + $dist_path //= $mod; + # TODO: check that some location is user-writable in @INC, and that it appears # somehow in PERL_{MB,MM}_OPT if( !$DRYRUN ) { - print STDERR "**** Installing $mod ****\n"; + print STDERR "\n\n**** install-deps.pl: Installing $mod ****\n"; if( $NOTEST ) { - CPAN::Shell->notest('install', $mod); + CPAN::Shell->notest('install', $dist_path); } else { - CPAN::Shell->install($mod); + CPAN::Shell->install($dist_path); } if( not eval { check_installed( $mod, $ver ) } ) { @@ -66,7 +74,7 @@ sub requires exit 1; } } else { - print qq($^X -MCPAN -e 'install "$mod"'\n); + print qq($^X -MCPAN -e 'install "$dist_path"'\n); } }