r-igraph: fix depends, use metadata checks

This commit is contained in:
Pekka Ristola 2023-06-17 14:56:11 +03:00
parent ef9619ac99
commit 8295536dbb
No known key found for this signature in database
GPG key ID: 2C20BE716E05213E
5 changed files with 148 additions and 37 deletions

View file

@ -1,27 +1,42 @@
# system requirements: gmp (>= 4.38, optional), libxml2 (optional), glpk(optional)
# Maintainer: Guoyi Zhang <guoyizhang at malacology dot net>
# Maintainer: Pekka Ristola <pekkarr [at] protonmail [dot] com>
# Contributor: Guoyi Zhang <guoyizhang at malacology dot net>
# Contributor: Alex Branham <branham@utexas.edu>
_pkgname=igraph
_pkgver=1.4.3
_pkgver=1.5.0
pkgname=r-${_pkgname,,}
pkgver=1.4.3
pkgrel=1
pkgdesc='Network Analysis and Visualization'
arch=('x86_64')
pkgver=${_pkgver//[:-]/.}
pkgrel=0
pkgdesc="Network Analysis and Visualization"
arch=(x86_64)
url="https://cran.r-project.org/package=${_pkgname}"
license=('GPL')
license=(GPL)
depends=(
r
r-cpp11
arpack
blas
glpk
gmp
lapack
libxml2
plfit
r-cli
r-magrittr
r-pkgconfig
r-rlang
suitesparse
util-linux-libs
)
makedepends=(
r-cpp11
)
checkdepends=(
r-graph
r-testthat
r-vdiffr
)
optdepends=(
glpk
gmp
libxml2
r-ape
r-callr
r-decor
r-digest
r-graph
@ -30,24 +45,35 @@ optdepends=(
r-rgl
r-rmarkdown
r-scales
r-stats4
r-tcltk
r-testthat
r-vdiffr
r-withr
)
makedepends=(
gcc-fortran
)
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
sha256sums=('06bdb3fa6cced6a5990268f9f26c5ef129df1dc2d4ff2806fe36f3b45cc16021')
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz"
"igraph-system-libs.patch")
md5sums=('5e77d6cd9b04e72ceb0d51d2e5a232c8'
'34283a0a206240ab1f33f83d2526ffca')
sha256sums=('d80778ff0fd0ee00a348c5d63b3b398b7467a1af49d85dc57fbee0a900fd7306'
'38731c656da7f1fe34a4d21c3e3dcae65592898ba81620b96cd27c7894539530')
prepare() {
cd "$_pkgname"
# Build using system libraries
patch -Np1 -i ../igraph-system-libs.patch
autoconf
}
build() {
R CMD INSTALL ${_pkgname}_${_pkgver}.tar.gz -l "${srcdir}"
mkdir -p build
R CMD INSTALL "$_pkgname" -l build
}
check() {
cd "$_pkgname/tests"
R_LIBS="$srcdir/build" NOT_CRAN=true Rscript --vanilla testthat.R
}
package() {
install -dm0755 "${pkgdir}/usr/lib/R/library"
cp -a --no-preserve=ownership "${_pkgname}" "${pkgdir}/usr/lib/R/library"
install -d "$pkgdir/usr/lib/R/library"
cp -a --no-preserve=ownership "build/$_pkgname" "$pkgdir/usr/lib/R/library"
}
# vim:set ts=2 sw=2 et:

File diff suppressed because one or more lines are too long

View file

@ -1,12 +1,17 @@
#!/usr/bin/env python3
from lilaclib import *
import os
import sys
sys.path.append(os.path.normpath(f'{__file__}/../../../lilac-extensions'))
from lilac_r_utils import r_pre_build
def pre_build():
for line in edit_file('PKGBUILD'):
if line.startswith('_pkgver='):
line = f'_pkgver={_G.newver}'
print(line)
update_pkgver_and_pkgrel(_G.newver.replace(':', '.').replace('-', '.'))
r_pre_build(
_G,
expect_systemrequirements = "gmp (optional), libxml2 (optional), glpk (>= 4.57, optional)",
ignore_fortran_files = True,
)
def post_build():
git_pkgbuild_commit()

View file

@ -1,14 +1,30 @@
build_prefix: extra-x86_64
maintainers:
- github: starsareintherose
email: kuoi@bioarchlinux.org
- github: pekkarr
email: pekkarr@protonmail.com
repo_depends:
- r-cpp11
- r-cli
- r-magrittr
- r-pkgconfig
- r-rlang
repo_makedepends:
- r-cpp11
- r-graph
- r-testthat
- r-vdiffr
update_on:
- regex: igraph_([\d._-]+).tar.gz
source: regex
url: https://cran.r-project.org/package=igraph
- source: rpkgs
pkgname: igraph
repo: cran
md5: true
- alias: r
- source: alpm
alpm: libxml2
repo: core
provided: libxml2.so
strip_release: true
- source: alpm
alpm: util-linux-libs
repo: core
provided: libuuid.so
strip_release: true

View file

@ -211,9 +211,14 @@ class CheckFailed(Exception):
self.msg = msg
class CheckConfig:
def __init__(self, expect_license: str = None, expect_systemrequirements: str = None):
def __init__(self,
expect_license: str = None,
expect_systemrequirements: str = None,
ignore_fortran_files: bool = False,
):
self.expect_license = expect_license
self.expect_systemrequirements = expect_systemrequirements
self.ignore_fortran_files = ignore_fortran_files
def check_default_pkgs(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
errors = set()
@ -285,9 +290,12 @@ def check_fortran(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
fortran_dep = "gcc-fortran" in pkg.makedepends
if fortran_files and not fortran_dep:
raise CheckFailed("Missing make dependency: gcc-fortran")
if not cfg.ignore_fortran_files:
raise CheckFailed("Missing make dependency: gcc-fortran")
elif not fortran_files and fortran_dep:
raise CheckFailed("Unnecessary make dependency: gcc-fortran")
elif cfg.ignore_fortran_files and not fortran_files:
raise CheckFailed("Unnecessary config 'ignore_fortran_files'");
def check_systemrequirements(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
if cfg.expect_systemrequirements != desc.systemrequirements: