Skip to content

Commit

Permalink
Pin Alien::Sodium to an old version, to fix install errors (#949)
Browse files Browse the repository at this point in the history
Workaround for genio/alien-sodium#2. Fixes
#942.
  • Loading branch information
richvdh authored Sep 7, 2020
1 parent 55346d2 commit c1f4d83
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
4 changes: 4 additions & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 19 additions & 11 deletions install-deps.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,50 @@ 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 ) } ) {
print STDERR "Failed to import $mod even after installing: $@\n";
exit 1;
}
} else {
print qq($^X -MCPAN -e 'install "$mod"'\n);
print qq($^X -MCPAN -e 'install "$dist_path"'\n);
}
}

Expand Down

0 comments on commit c1f4d83

Please sign in to comment.