[R-pkg-team] Bug#1029350: Strange error in dh_auto_install of r-cran-spatstat.core

Nilesh Patra nilesh at debian.org
Sat Jan 21 15:52:36 GMT 2023


Source: dh-r
Version: 20210816
Severity: serious
Control: retitle -1 dh-r parsing of tests depends/suggests is faulty

[ Looks like I has mistakenly submitted the report to control@ earlier, fixing that, rest of the mail is copied as is ]

Hi Andreas,

On 1/21/23 19:17, Andreas Tille wrote:
> Hi,
>
> I'm just running into
>
>     dh_auto_install: warning: can't parse dependency spatstat (>= 2.3-3).linnet (>= 2.0-0)
>     Can't call method "get_deps" on an undefined value at /usr/share/perl5/Debian/Debhelper/Buildsystem/R.pm line 51.
>
> when trying to build r-cran-spatstat.core[1]
>
> I've never seen this strange substitution of dependencies before.
> Any idea what's wrong here?

Congrats. Looks like you hit a case which catches a bug in dh-R.

The problem is in the code when you are trying to substitute test depends from the ones in suggests[2]. The substitution
that you are trying to do is also replacing prefixes with versioned dep. Since there is spatstat and spatstat.linnet both in
d/t/control test-depends, and as you could see spatstat is a common prefix, it is replacing this with the one
written in DESCRIPTION file which is wrong.

As it seems to me that you only intend to replace non-versioned stuff with the versioned stuff, maybe you don't have
to replace all strings that are prefix. So _maybe_ a patch like this would do (it works in this case at least):

diff --git a/dh/R.pm b/dh/R.pm
index 18171ae..7d052b1 100644
--- a/dh/R.pm
+++ b/dh/R.pm
@@ -210,7 +210,7 @@ sub install {
           $rsname =~ s/[\s(].*// ;
           if ( grep(/^$rsname$/i, @testdeps) ) {
             if ( $rs ne $rsname ) { # seems that is a versioned depends that needs to be propagated to Recommends
-             $testdepends =~ s/$rsname */$rs/ ;
+             $testdepends =~ s/$rsname$/$rs/ ;
             }
           } else {
             $newsuggests = $newsuggests . ', ' . $rs ;


But that said, I do not know the essence of this code, and please _triple check_ and ** do not blindly apply **

> [1] https://salsa.debian.org/r-pkg-team/r-cran-spatstat.core/-/jobs/3830571
[2]: https://salsa.debian.org/r-pkg-team/dh-r/-/blob/master/dh/R.pm#L213

Hope that helps.

Thank you
Nilesh



More information about the R-pkg-team mailing list