summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/pdl-2.100-reproducibility.patch66
-rw-r--r--gnu/packages/perl-maths.scm56
3 files changed, 123 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index e6ece8cc48..db011f4777 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1996,6 +1996,7 @@ dist_patch_DATA = \
%D%/packages/patches/password-store-tree-compat.patch \
%D%/packages/patches/pciutils-hurd64.patch \
%D%/packages/patches/pdl-2.019-glut-bitmap-fonts.patch \
+ %D%/packages/patches/pdl-2.100-reproducibility.patch \
%D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch \
%D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
%D%/packages/patches/plasp-fix-normalization.patch \
diff --git a/gnu/packages/patches/pdl-2.100-reproducibility.patch b/gnu/packages/patches/pdl-2.100-reproducibility.patch
new file mode 100644
index 0000000000..999f372479
--- /dev/null
+++ b/gnu/packages/patches/pdl-2.100-reproducibility.patch
@@ -0,0 +1,66 @@
+From efa96da9de3a7cdc104fab92b20e3bf07a9faf98 Mon Sep 17 00:00:00 2001
+From: Danny Milosavljevic <dannym@friendly-machines.com>
+Date: Mon, 5 May 2025 21:46:16 +0200
+Subject: [PATCH] Make doc generator reproducible.
+
+Fixes <https://github.com/PDLPorters/pdl/issues/541>.
+---
+ lib/PDL/Doc.pm | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/lib/PDL/Doc.pm b/lib/PDL/Doc.pm
+index 106cd8704..50f132dad 100644
+--- a/lib/PDL/Doc.pm
++++ b/lib/PDL/Doc.pm
+@@ -495,15 +495,17 @@ sub savedb {
+ my $hash = $this->ensuredb;
+ open my $fh, '>', $this->{Outfile} or barf "can't write to symdb $this->{Outfile}: $!";
+ binmode $fh;
+- while (my ($name,$mods_hash) = each %$hash) {
++ for my $name (sort keys %$hash) {
++ my $mods_hash = $hash->{$name};
+ next if 0 == scalar(%$mods_hash);
+- while (my ($module,$val) = each %$mods_hash) {
++ for my $module (sort keys %$mods_hash) {
++ my $val = $mods_hash->{$module};
+ my $fi = $val->{File};
+ $val->{File} = abs2rel($fi, dirname($this->{Outfile}))
+ #store paths to *.pm files relative to pdldoc.db
+ if file_name_is_absolute($fi) && -f $fi;
+ delete $val->{Dbfile}; # no need to store Dbfile
+- my $txt = join(chr(0),$name,$module,%$val);
++ my $txt = join(chr(0),$name,$module,map +($_=>$val->{$_}), sort keys %$val);
+ print $fh pack("S",length($txt)).$txt;
+ }
+ }
+@@ -679,7 +681,8 @@ sub scan {
+ my $hash = $this->{SYMS} ||= {};
+ my $n = 0;
+ $_->{File} = $file2, $n++ for values %{ $parser->{SYMHASH} };
+- while (my ($key,$val) = each %{ $parser->{SYMHASH} }) {
++ for my $key (sort keys %{ $parser->{SYMHASH} }) {
++ my $val = $hash->{$key};
+ #set up the 3-layer hash/database structure: $hash->{funcname}->{PDL::SomeModule} = $val
+ if (defined($val->{Module})) {
+ $hash->{$key}{$val->{Module}} = $val;
+@@ -741,7 +744,10 @@ sub scantree {
+ $ntot += my $n = $this->scan($File::Find::name,$verbose);
+ print "\t$n functions\n";
+ };
+- File::Find::find($sub,$dir);
++ File::Find::find({
++ wanted => $sub,
++ preprocess => sub { sort @_ }
++ }, $dir);
+ print "\nfound $ntot functions\n";
+ $ntot;
+ }
+@@ -881,7 +887,7 @@ own code.
+ print $pdldoc->gethash->{zeroes}->{PDL::Core}->{Ref};
+
+ # Get info for all the functions whose examples use zeroes
+- my @entries = $pdldoc->search('zeroes','Example',1);
++ my @entries = $pdldoc->search('zeroes','Example',1,1);
+
+ # All the functions that use zeroes in their example:
+ print "Functions that use 'zeroes' in their examples include:\n";
diff --git a/gnu/packages/perl-maths.scm b/gnu/packages/perl-maths.scm
index 2ea29a13a9..5a87bc70b8 100644
--- a/gnu/packages/perl-maths.scm
+++ b/gnu/packages/perl-maths.scm
@@ -20,7 +20,9 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:use-module (guix build-system perl)
#:use-module (gnu packages)
#:use-module (gnu packages gcc)
@@ -163,3 +165,57 @@ using a list of (X, Y) pairs.")
(description "This package provides a library and simple REPL for the
Perl Data Language.")
(license license:perl-license)))
+
+;; The project has split out several packages.
+(define-public perl-pdl
+ (package
+ (inherit perl-pdl-2.019)
+ (version "2.100")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/PDLPorters/pdl.git")
+ (commit version)))
+ (sha256
+ (base32 "0nkvjb4l8r2l2piz0s9jifpm0kr6g7fy9krky130s82vq8bz19sc"))
+ (patches
+ (search-patches "pdl-2.100-reproducibility.patch"))))
+ (build-system perl-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-includes
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "lib/PDL/Core/Dev.pm"
+ ;; This would cause an underflow (1 - 120 < 0)--so prevent it.
+ (("utime [$]mtime - 120, [$]mtime - 120, [$]pmfile; # so is out of date")
+ "utime $mtime - 1, $mtime - 1, $pmfile; # so is out of date")))))))
+ (inputs (list gd gsl mesa glu))
+ (native-inputs (list perl-capture-tiny ; for a test
+ perl-devel-checklib
+ perl-extutils-depends
+ perl-extutils-f77
+ gfortran
+ perl-file-which
+ perl-pod-parser
+ perl-test-deep
+ perl-test-exception
+ perl-test-warn
+ perl-text-balanced)) ; our perl is too old, so...
+ (propagated-inputs (list perl-file-map
+ perl-file-which
+ perl-inline
+ perl-inline-c
+ perl-list-moreutils
+ perl-opengl
+ perl-pgplot
+ perl-pod-parser
+ perl-sys-sigaction
+ perl-termreadkey))
+ (home-page "https://metacpan.org/release/PDL")
+ (synopsis "Perl Data Language")
+ (description "This package provides a library and simple REPL for the
+Perl Data Language.")
+ (license license:perl-license)))