[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

autodep8 for R packages?



For the set of R packages I recently uploaded, I added trivial DEP-8
tests* which did:

    R -e "if (! require('$pkg')) quit(status=1)"

Which I think is sufficient to trivially test whether a package has been
properly installed with required dependencies and hence can be loaded by R.

Would it be useful to try and get a rule to do this automatically into
autodep8 (suggested by Mattia who sponsored my original uploads), and
hence provide a minimal autopkgtest for all R packages? (Are there any
corner cases in which this wouldn't work?)


I think autodep8 `detect` and `generate` scripts something like this
would work (although I haven't tested them properly yet):

autodep8:support/r/detect
#!/bin/sh
grep-dctrl --quiet -F Source -r '^r-.*$' debian/control && \
test -f DESCRIPTION


autodep8:support/r/generate
#!/bin/sh
upstream_name=$(grep-dctrl -s Package -n . DESCRIPTION)
if [ -z "$upstream_name" ]; then
  exit 1
fi

cat <<EOF
Test-Command: R -e "if (! require('$upstream_name')) quit(status=1)"
Depends: @
Restrictions: allow-stderr
EOF



(conveniently R DESCRIPTION files use the same format as debian/control
so we can use grep-dctrl to extract the R package name)


Worth developing further?

Gordon




*Actually, these didn't work correctly because I forgot to add
`Restrictions: allow-stderr` and the tests are marked as failed since R
prints package loading messages to stderr, but this will be fixed in the
next upload.


Reply to: