Skip to content

Make `provides` detection more robust

Pekka Ristola requested to merge pekkarr/r:robust-provides into main

The r 4.3.3-1 package incorrectly provides do, because the DESCRIPTION file for bundled Matrix package contains lines

Version: 1.6-5
VersionNote: do also bump src/version.h, inst/include/Matrix/version.h

and the grep Version in PKGBUILD matches both of these, picking the word do from the second line.

This patch fixes the issue by adding a colon to the end of the regexp, making it similar to the Package: regexp that already had a colon.

Other minor improvements in this patch:

  • Prefix both regexps with ^ to make them match only at the start of a line, making them more robust as these strings could appear inside other fields in the file.
  • Do lowercase conversion of the package name using the ${parameter,,} bash syntax instead of using tr. This makes the code simpler and more readable.
  • When replacing dashes with dots in the versions, use two slash characters instead of one in the bash pattern substitution (${_ver//-/.}). This replaces all dashes instead of just the first one, making it more robust as technically the version could contain more dashes.

Merge request reports