mirror of
https://github.com/BioArchLinux/pkgbuild-generator-for-r.git
synced 2025-03-10 06:14:02 +00:00
add gcc-fortran to makedepends if Fortran source is found in source tarball
This commit is contained in:
parent
097266c1be
commit
9bd4a3f3f7
2 changed files with 23 additions and 0 deletions
|
@ -124,6 +124,15 @@ class PKGBUILDGenerator(object):
|
||||||
"ZPL"
|
"ZPL"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def has_fortran_src(self, tarfile_object):
|
||||||
|
"""
|
||||||
|
return True if Fortran src file is found in the source tarball
|
||||||
|
"""
|
||||||
|
for name in tarfile_object.getnames():
|
||||||
|
if name.endswith(".f") or name.endswith(".f90") or name.endswith(".for"):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def get_bioconductor_ver(self, bio_name, return_idx=False):
|
def get_bioconductor_ver(self, bio_name, return_idx=False):
|
||||||
""" get pkg version from Bioconductor
|
""" get pkg version from Bioconductor
|
||||||
args:
|
args:
|
||||||
|
@ -210,6 +219,7 @@ class PKGBUILDGenerator(object):
|
||||||
"depends": ["r"],
|
"depends": ["r"],
|
||||||
"r_optdepends": [],
|
"r_optdepends": [],
|
||||||
"optdepends": [],
|
"optdepends": [],
|
||||||
|
"makedepends": [],
|
||||||
"systemrequirements": None,
|
"systemrequirements": None,
|
||||||
"license": None,
|
"license": None,
|
||||||
"license_filename": None,
|
"license_filename": None,
|
||||||
|
@ -262,6 +272,8 @@ class PKGBUILDGenerator(object):
|
||||||
f"Failed to get source tarball {rpkgname}-{rpkgver}.tar.gz due to: {r.reason}")
|
f"Failed to get source tarball {rpkgname}-{rpkgver}.tar.gz due to: {r.reason}")
|
||||||
with tarfile.open(tarfilename) as f:
|
with tarfile.open(tarfilename) as f:
|
||||||
f.extract(desc_filename)
|
f.extract(desc_filename)
|
||||||
|
if self.has_fortran_src(f):
|
||||||
|
result["makedepends"] = ["gcc-fortran"]
|
||||||
with open(desc_filename, "r") as f:
|
with open(desc_filename, "r") as f:
|
||||||
config.read_string(f"[{rpkgname}]\n" + f.read())
|
config.read_string(f"[{rpkgname}]\n" + f.read())
|
||||||
if clean:
|
if clean:
|
||||||
|
@ -480,6 +492,13 @@ class PKGBUILDGenerator(object):
|
||||||
'\n'.join([' ' + _ for _ in desc_dict["optdepends"]]),
|
'\n'.join([' ' + _ for _ in desc_dict["optdepends"]]),
|
||||||
')'
|
')'
|
||||||
])
|
])
|
||||||
|
makedepends = None
|
||||||
|
if desc_dict["makedepends"]:
|
||||||
|
makedepends = '\n'.join([
|
||||||
|
'makedepends=(',
|
||||||
|
'\n'.join([' ' + _ for _ in desc_dict["makedepends"]]),
|
||||||
|
')'
|
||||||
|
])
|
||||||
build_func = '\n'.join([
|
build_func = '\n'.join([
|
||||||
'build() {',
|
'build() {',
|
||||||
' R CMD INSTALL ${_pkgname}_${_pkgver}.tar.gz -l "${srcdir}"',
|
' R CMD INSTALL ${_pkgname}_${_pkgver}.tar.gz -l "${srcdir}"',
|
||||||
|
@ -525,6 +544,7 @@ class PKGBUILDGenerator(object):
|
||||||
license_line = f"license=('{desc_dict['license']}')"
|
license_line = f"license=('{desc_dict['license']}')"
|
||||||
depends_line = depends
|
depends_line = depends
|
||||||
optdepends_line = optdepends
|
optdepends_line = optdepends
|
||||||
|
makedepends_line = makedepends
|
||||||
source_line = f'source=("{desc_dict["source"]}")'
|
source_line = f'source=("{desc_dict["source"]}")'
|
||||||
checksums_line = "sha256sums=('a')\n"
|
checksums_line = "sha256sums=('a')\n"
|
||||||
build_line = build_func + '\n'
|
build_line = build_func + '\n'
|
||||||
|
@ -556,6 +576,8 @@ class PKGBUILDGenerator(object):
|
||||||
]
|
]
|
||||||
if optdepends_line:
|
if optdepends_line:
|
||||||
pkgbuild_lines.append(optdepends_line)
|
pkgbuild_lines.append(optdepends_line)
|
||||||
|
if makedepends:
|
||||||
|
pkgbuild_lines.append(makedepends_line)
|
||||||
pkgbuild_lines += [
|
pkgbuild_lines += [
|
||||||
source_line,
|
source_line,
|
||||||
checksums_line,
|
checksums_line,
|
||||||
|
|
|
@ -9,6 +9,7 @@ Run `python generate_pkgbuild_for_r.py --help` for detail.
|
||||||
* support for R packages from [CRAN](https://cran.r-project.org)
|
* support for R packages from [CRAN](https://cran.r-project.org)
|
||||||
* support for R packages from [Bioconductor](https://bioconductor.org)
|
* support for R packages from [Bioconductor](https://bioconductor.org)
|
||||||
* recursively generate `PKGBUILD` for R packages and its depends
|
* recursively generate `PKGBUILD` for R packages and its depends
|
||||||
|
* add `gcc-fortran` to `makedepends` if any Fortran source file is found in source tarball
|
||||||
* generate `lilac.yaml` and `lilac.py` for building in [ArchLinux CN repo](https://github.com/archlinuxcn/repo)
|
* generate `lilac.yaml` and `lilac.py` for building in [ArchLinux CN repo](https://github.com/archlinuxcn/repo)
|
||||||
* and more...
|
* and more...
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue