From 386d93d06d1789d1bdfbd944afbe285213cb4ce8 Mon Sep 17 00:00:00 2001 From: Alexis Praga Date: Sat, 8 Feb 2025 11:35:15 +0100 Subject: [PATCH 1/2] perlPackages.BioExtAlign: bug fix and add test Bug: with perl > 5.36, the compiler is more restrictive with errors. This package has implicit function definitions. The fix is to ignore the errors as vep, the main package for that, runs without issue. Also this package is no longer maintained We also add test that were missing from the package. Not all test can be run as they depends on other Perl modules in Bioper. --- .../perl-modules/Bio-Ext-Align/default.nix | 25 ++++-- .../Bio-Ext-Align/disable-other-tests.patch | 84 +++++++++++++++++++ .../perl-modules/Bio-Ext-Align/fprintf.patch | 2 +- .../Bio-Ext-Align/no-implicit-function.patch | 13 +++ 4 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/perl-modules/Bio-Ext-Align/disable-other-tests.patch create mode 100644 pkgs/development/perl-modules/Bio-Ext-Align/no-implicit-function.patch diff --git a/pkgs/development/perl-modules/Bio-Ext-Align/default.nix b/pkgs/development/perl-modules/Bio-Ext-Align/default.nix index dde83f2b0f23..2bbb36e2ad25 100644 --- a/pkgs/development/perl-modules/Bio-Ext-Align/default.nix +++ b/pkgs/development/perl-modules/Bio-Ext-Align/default.nix @@ -8,10 +8,7 @@ buildPerlPackage rec { pname = "BioExtAlign"; version = "1.5.1"; - outputs = [ - "out" - "dev" - ]; + outputs = [ "out" ]; src = fetchFromGitHub { owner = "bioperl"; @@ -20,7 +17,15 @@ buildPerlPackage rec { sha256 = "sha256-+0tZ6q3PFem8DWa2vq+njOLmjDvMB0JhD0FGk00lVMA="; }; - patches = [ ./fprintf.patch ]; + patches = [ + # Starting for Perl 5.6, implicit function declaration are treated as errors + # There may be an error but ensembl-vep (the main package for this dependency) + # runs + ./no-implicit-function.patch + # Tests need other parts of BioExt, disabling them + ./disable-other-tests.patch + ./fprintf.patch + ]; # Do not install other Bio-ext packages preConfigure = '' @@ -30,6 +35,15 @@ buildPerlPackage rec { # Disable tests as it requires Bio::Tools::Align which is in a different directory buildPhase = '' make + + ''; + + checkPhase = '' + runHook preCheck + + make test + + runHook postCheck ''; meta = { @@ -39,5 +53,6 @@ buildPerlPackage rec { Part of BioPerl Extensions (BioPerl-Ext) distribution, a collection of Bioperl C-compiled extensions. ''; license = with lib.licenses; [ artistic1 ]; + maintainers = with lib.maintainers; [ apraga ]; }; } diff --git a/pkgs/development/perl-modules/Bio-Ext-Align/disable-other-tests.patch b/pkgs/development/perl-modules/Bio-Ext-Align/disable-other-tests.patch new file mode 100644 index 000000000000..37a7d99ba45c --- /dev/null +++ b/pkgs/development/perl-modules/Bio-Ext-Align/disable-other-tests.patch @@ -0,0 +1,84 @@ +diff --git a/Bio/Ext/Align/test.pl b/Bio/Ext/Align/test.pl +index 72411f3..1deb77b 100755 +--- a/Bio/Ext/Align/test.pl ++++ b/Bio/Ext/Align/test.pl +@@ -8,13 +8,10 @@ my $DEBUG = $ENV{'BIOPERLDEBUG'} || 0; + BEGIN { + eval { require Test; }; + use Test; +- plan tests => 9; ++ plan tests => 4; + } + + use Bio::Ext::Align; +-use Bio::Tools::dpAlign; +-use Bio::Seq; +-use Bio::AlignIO; + + $loaded = 1; + ok(1); # modules loaded +@@ -34,64 +31,3 @@ $alb = &Bio::Ext::Align::Align_Sequences_ProteinSmithWaterman($seq1,$seq2, + $seq2->seq,15,50,STDERR) if $DEBUG; + + +-warn( "Testing Local Alignment case...\n") if $DEBUg; +- +-$alnout = new Bio::AlignIO(-format => 'pfam', -fh => \*STDERR); +-$aln = &Bio::Ext::Align::Align_DNA_Sequences("AATGCCATTGACGG", +- "CAGCCTCGCTTAG",3,-1,3,1, +- Bio::Tools::dpAlign::DPALIGN_LOCAL_MILLER_MYERS); +- +-$out = Bio::SimpleAlign->new(); +- +-$out->add_seq(Bio::LocatableSeq->new(-seq => $aln->aln1, +- -start => $aln->start1, +- -end => $aln->end1, +- -id => "one")); +- +-$out->add_seq(Bio::LocatableSeq->new(-seq => $aln->aln2, +- -start => $aln->start2, +- -end => $aln->end2, +- -id => "two")); +-$alnout->write_aln($out) if $DEBUG; +- +-$aln = &Bio::Ext::Align::Align_Protein_Sequences("WLGQRNLVSSTGGNLLNVWLKDW","WMGNRNVVNLLNVWFRDW",0, +- Bio::Tools::dpAlign::DPALIGN_LOCAL_MILLER_MYERS); +-$out = Bio::SimpleAlign->new(); +-ok($aln); +- +-$out->add_seq(Bio::LocatableSeq->new(-seq => $aln->aln1, +- -start => $aln->start1, +- -end => $aln->end1, +- -id => "one")); +- +-$out->add_seq(Bio::LocatableSeq->new(-seq => $aln->aln2, +- -start => $aln->start2, +- -end => $aln->end2, +- -id => "two")); +-$alnout->write_aln($out) if $DEBUG; +-ok(1); +- +-warn( "Testing Global Alignment case...\n") if $DEBUG; +- +-$factory = new Bio::Tools::dpAlign('-alg' => Bio::Tools::dpAlign::DPALIGN_GLOBAL_MILLER_MYERS); +-$s1 = new Bio::Seq(-id => "one", -seq => "AATGCCATTGACGG", -alphabet => 'dna'); +-$s2 = new Bio::Seq(-id => "two", -seq => "CAGCCTCGCTTAG", -alphabet => 'dna'); +-$aln = $factory->pairwise_alignment($s1, $s2); +-$alnout->write_aln($aln) if $DEBUG; +-$factory->align_and_show($s1, $s2) if $DEBUG; +- +-ok(1); +- +-$s1 = new Bio::Seq(-id => "one", -seq => "WLGQRNLVSSTGGNLLNVWLKDW", +- -alphabet => 'protein'); +-$s2 = new Bio::Seq(-id => "two", -seq => "WMGNRNVVNLLNVWFRDW", +- -alphabet => 'protein'); +-$aln = $factory->pairwise_alignment($s1, $s2); +-$alnout->write_aln($aln) if $DEBUG; +-$factory->align_and_show($s1, $s2) if $DEBUG; +-ok(1); +- +-$prof = $factory->sequence_profile($s1); +-warn( "Optimal Alignment Score = %d\n", $factory->pairwise_alignment_score($prof, $s2)) if $DEBUG; +- +-ok($factory->pairwise_alignment_score($prof,$s2),77); diff --git a/pkgs/development/perl-modules/Bio-Ext-Align/fprintf.patch b/pkgs/development/perl-modules/Bio-Ext-Align/fprintf.patch index f62004a9a338..fd4d01df6df6 100644 --- a/pkgs/development/perl-modules/Bio-Ext-Align/fprintf.patch +++ b/pkgs/development/perl-modules/Bio-Ext-Align/fprintf.patch @@ -7,7 +7,7 @@ index 0e07b67..0eab932 100644 dpAlign_fatal(char * s) { - fprintf(stderr, s); -+ fputs(stderr, s); ++ fputs(s, stderr); exit(-1); } diff --git a/pkgs/development/perl-modules/Bio-Ext-Align/no-implicit-function.patch b/pkgs/development/perl-modules/Bio-Ext-Align/no-implicit-function.patch new file mode 100644 index 000000000000..02a6baeb1316 --- /dev/null +++ b/pkgs/development/perl-modules/Bio-Ext-Align/no-implicit-function.patch @@ -0,0 +1,13 @@ +diff --git a/Bio/Ext/Align/Makefile.PL b/Bio/Ext/Align/Makefile.PL +index cc6c343..ea5cffa 100755 +--- a/Bio/Ext/Align/Makefile.PL ++++ b/Bio/Ext/Align/Makefile.PL +@@ -5,7 +5,7 @@ WriteMakefile( + 'NAME' => 'Bio::Ext::Align', + 'VERSION' => '1.5.1', + 'LIBS' => ['-lm'], # e.g., '-lm' +- 'DEFINE' => '-DPOSIX -DNOERROR', # e.g., '-DHAVE_SOMETHING' ++ 'DEFINE' => '-DPOSIX -DNOERROR -Wno-implicit-function-declaration', # e.g., '-DHAVE_SOMETHING' + 'INC' => '-I./libs', # e.g., '-I/usr/include/other' + 'MYEXTLIB' => 'libs/libsw$(LIB_EXT)', + 'clean' => { 'FILES' => 'libs/*.o libs/*.a' } From ebe61cdf1f3be12630b2b6af4c84bc1943fcb7ec Mon Sep 17 00:00:00 2001 From: Alexis Praga Date: Mon, 10 Feb 2025 23:56:52 +0100 Subject: [PATCH 2/2] kent: fix for non-x86_64 cpus. --- pkgs/by-name/ke/kent/package.nix | 8 ++++---- pkgs/development/perl-modules/Bio-Ext-Align/default.nix | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/ke/kent/package.nix b/pkgs/by-name/ke/kent/package.nix index d7e8abd22b84..2c9d41ff6d27 100644 --- a/pkgs/by-name/ke/kent/package.nix +++ b/pkgs/by-name/ke/kent/package.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { export HOME=$TMPDIR export DESTBINDIR=$HOME/bin - mkdir -p $HOME/lib $HOME/bin/x86_64 + mkdir -p $HOME/lib $HOME/bin/${stdenv.hostPlatform.parsed.cpu.name} cd ./src chmod +x ./checkUmask.sh @@ -63,8 +63,8 @@ stdenv.mkDerivation rec { cd jkOwnLib make - cp ../lib/x86_64/jkOwnLib.a $HOME/lib - cp ../lib/x86_64/jkweb.a $HOME/lib + cp ../lib/${stdenv.hostPlatform.parsed.cpu.name}/jkOwnLib.a $HOME/lib + cp ../lib/${stdenv.hostPlatform.parsed.cpu.name}/jkweb.a $HOME/lib cp -r ../inc $HOME/ cd ../utils @@ -79,7 +79,7 @@ stdenv.mkDerivation rec { mkdir -p $out/bin $out/lib $out/inc cp $HOME/lib/jkOwnLib.a $out/lib cp $HOME/lib/jkweb.a $out/lib - cp $HOME/bin/x86_64/* $out/bin + cp $HOME/bin/${stdenv.hostPlatform.parsed.cpu.name}/* $out/bin cp -r $HOME/inc/* $out/inc/ runHook postInstall diff --git a/pkgs/development/perl-modules/Bio-Ext-Align/default.nix b/pkgs/development/perl-modules/Bio-Ext-Align/default.nix index 2bbb36e2ad25..936148bc1ce8 100644 --- a/pkgs/development/perl-modules/Bio-Ext-Align/default.nix +++ b/pkgs/development/perl-modules/Bio-Ext-Align/default.nix @@ -35,7 +35,6 @@ buildPerlPackage rec { # Disable tests as it requires Bio::Tools::Align which is in a different directory buildPhase = '' make - ''; checkPhase = ''