mirror of
https://github.com/BioArchLinux/Packages.git
synced 2025-03-10 12:02:42 +00:00
r-pak: fix build, get dependencies from a callback
This commit is contained in:
parent
bc1722ee8a
commit
ba5c799083
2 changed files with 16 additions and 18 deletions
|
@ -6,26 +6,22 @@ import sys
|
||||||
sys.path.append(os.path.normpath(f'{__file__}/../../../lilac-extensions'))
|
sys.path.append(os.path.normpath(f'{__file__}/../../../lilac-extensions'))
|
||||||
from lilac_r_utils import r_pre_build
|
from lilac_r_utils import r_pre_build
|
||||||
|
|
||||||
import tarfile
|
def get_depends(tar):
|
||||||
|
# Get the names of dependencies in embedded library
|
||||||
|
prefix = "pak/src/library/"
|
||||||
|
for member in tar.getmembers():
|
||||||
|
name = member.name
|
||||||
|
if not name.startswith(prefix) or not member.isdir():
|
||||||
|
continue
|
||||||
|
name = name[len(prefix):]
|
||||||
|
if "/" not in name:
|
||||||
|
yield name
|
||||||
|
|
||||||
def pre_build():
|
def pre_build():
|
||||||
# Get the names of dependencies in embedded library
|
|
||||||
deps = []
|
|
||||||
newver = _G.newver.rsplit("#", 1)[0]
|
|
||||||
with tarfile.open(f"pak_{newver}.tar.gz", "r:gz") as tar:
|
|
||||||
prefix = "pak/src/library/"
|
|
||||||
for member in tar.getmembers():
|
|
||||||
name = member.name
|
|
||||||
if not name.startswith(prefix) or not member.isdir():
|
|
||||||
continue
|
|
||||||
name = name[len(prefix):]
|
|
||||||
if "/" not in name:
|
|
||||||
deps.append(name)
|
|
||||||
|
|
||||||
r_pre_build(
|
r_pre_build(
|
||||||
_G,
|
_G,
|
||||||
expect_needscompilation = True,
|
expect_needscompilation = True,
|
||||||
extra_r_depends = deps,
|
extra_r_depends_cb = get_depends,
|
||||||
)
|
)
|
||||||
|
|
||||||
def post_build():
|
def post_build():
|
||||||
|
|
|
@ -236,14 +236,14 @@ class CheckConfig:
|
||||||
expect_needscompilation: bool = None,
|
expect_needscompilation: bool = None,
|
||||||
expect_systemrequirements: str = None,
|
expect_systemrequirements: str = None,
|
||||||
expect_title: str = None,
|
expect_title: str = None,
|
||||||
extra_r_depends: list = [],
|
extra_r_depends_cb = None,
|
||||||
ignore_fortran_files: bool = False,
|
ignore_fortran_files: bool = False,
|
||||||
):
|
):
|
||||||
self.expect_license = expect_license
|
self.expect_license = expect_license
|
||||||
self.expect_needscompilation = expect_needscompilation
|
self.expect_needscompilation = expect_needscompilation
|
||||||
self.expect_systemrequirements = expect_systemrequirements
|
self.expect_systemrequirements = expect_systemrequirements
|
||||||
self.expect_title = expect_title
|
self.expect_title = expect_title
|
||||||
self.extra_r_depends = extra_r_depends
|
self.extra_r_depends_cb = extra_r_depends_cb
|
||||||
self.ignore_fortran_files = ignore_fortran_files
|
self.ignore_fortran_files = ignore_fortran_files
|
||||||
|
|
||||||
def check_default_pkgs(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
|
def check_default_pkgs(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
|
||||||
|
@ -258,7 +258,9 @@ def check_default_pkgs(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
|
||||||
def check_depends(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
|
def check_depends(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
|
||||||
implicit_r_dep = explicit_r_dep = False
|
implicit_r_dep = explicit_r_dep = False
|
||||||
expected_depends = set(desc.depends + desc.imports)
|
expected_depends = set(desc.depends + desc.imports)
|
||||||
expected_depends.update((_r_name_to_arch(dep) for dep in cfg.extra_r_depends))
|
cb = cfg.extra_r_depends_cb
|
||||||
|
if cb is not None:
|
||||||
|
expected_depends.update((_r_name_to_arch(dep) for dep in cb(cfg.tar)))
|
||||||
errors = []
|
errors = []
|
||||||
for dep in pkg.depends:
|
for dep in pkg.depends:
|
||||||
if dep.startswith("r-"):
|
if dep.startswith("r-"):
|
||||||
|
|
Loading…
Add table
Reference in a new issue