r-*: use rpkgs nvchecker source in a few packages

Also add a check for upstream md5sum
This commit is contained in:
Pekka Ristola 2023-06-04 18:05:24 +03:00
parent 7bd0b2e10a
commit a8734a0c06
No known key found for this signature in database
GPG key ID: 2C20BE716E05213E
9 changed files with 40 additions and 15 deletions

View file

@ -29,6 +29,7 @@ optdepends=(
r-withr
)
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
md5sums=('3827672b1f4747ce6bd3a224a74a9f61')
sha256sums=('548b7c0ed5ab26dc4fbd88707ae12987bcaef834dbc6de4e17d453846dc436b2')
prepare() {

View file

@ -1,7 +1,10 @@
build_prefix: extra-x86_64
maintainers:
- github: pekkarr
email: pekkarr@protonmail.com
update_on:
- source: cran
cran: fs
- source: rpkgs
pkgname: fs
repo: cran
md5: true
- alias: r

View file

@ -28,6 +28,7 @@ optdepends=(
r-withr
)
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
md5sums=('bd1a39f2e4034d5f455217459fd65daa')
sha256sums=('e008472b81d4ca1a37a4ba7dd58e5e944f96ab2e44c8ccc8840d43e9fe99e93c')
build() {

View file

@ -1,12 +1,15 @@
build_prefix: extra-x86_64
maintainers:
- github: pekkarr
email: pekkarr@protonmail.com
repo_depends:
- r-ps
- r-r6
update_on:
- source: cran
cran: processx
- source: rpkgs
pkgname: processx
repo: cran
md5: true
- alias: r
- source: manual
manual: 1

View file

@ -28,6 +28,7 @@ optdepends=(
r-webfakes
)
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
md5sums=('62142c0448dd961f12955a8582e887fe')
sha256sums=('1abc3ae3c55797b994973f7e43bf5c7bbb4da649a0dcfad36675e196dba4cb4e')
build() {

View file

@ -1,9 +1,12 @@
build_prefix: extra-x86_64
maintainers:
- github: pekkarr
email: pekkarr@protonmail.com
update_on:
- source: cran
cran: ps
- source: rpkgs
pkgname: ps
repo: cran
md5: true
- alias: r
- source: manual
manual: 3

View file

@ -51,6 +51,7 @@ optdepends=(
r-withr
)
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
md5sums=('28f72cac8b8b3c646f5cbaf1c195178a')
sha256sums=('c6635519503e0fcdd518696d3ac96d8d28d9d4ecd9db0532c53426002f6387b8')
prepare() {

View file

@ -1,6 +1,7 @@
build_prefix: extra-x86_64
maintainers:
- github: pekkarr
email: pekkarr@protonmail.com
repo_depends:
- r-bslib
- r-evaluate
@ -17,8 +18,10 @@ repo_depends:
- r-shiny
- r-testthat
update_on:
- source: cran
cran: rmarkdown
- source: rpkgs
pkgname: rmarkdown
repo: cran
md5: true
- alias: r
- source: manual
manual: 1

View file

@ -4,7 +4,7 @@ import pyalpm
import tarfile
from types import SimpleNamespace
def r_update_pkgver_and_pkgrel(_G: SimpleNamespace):
def r_update_pkgver_and_pkgrel(newver: str):
"""
Update _pkgver and pkgrel used in R packages.
@ -19,14 +19,14 @@ def r_update_pkgver_and_pkgrel(_G: SimpleNamespace):
if oldver is not None:
raise Exception("_pkgver is defined twice")
oldver = line[len(ver_prefix):]
line = f"{ver_prefix}{_G.newver}"
line = f"{ver_prefix}{newver}"
elif line.startswith(rel_prefix):
if oldver is None:
raise Exception("pkgrel is defined before _pkgver")
if oldrel is not None:
raise Exception("pkgrel is defined twice")
oldrel = int(line[len(rel_prefix):])
newrel = oldrel + 1 if oldver == _G.newver else 1
newrel = oldrel + 1 if oldver == newver else 1
line = f"{rel_prefix}{newrel}"
print(line)
if oldrel is None:
@ -117,6 +117,7 @@ class Pkgbuild:
"makedepends",
"checkdepends",
"optdepends",
"md5sums",
]
def __init__(self):
@ -310,6 +311,10 @@ def check_arch(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
if pkg.arch != [expected]:
raise CheckFailed(f"Wrong arch, expected {expected}")
def check_md5sum(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
if pkg.md5sums[0] != cfg.md5sum:
raise CheckFailed(f"Wrong md5sum, expected {cfg.md5sum}")
all_checks = [
check_default_pkgs,
check_depends,
@ -320,13 +325,14 @@ all_checks = [
check_license,
check_pkgdesc,
check_arch,
check_md5sum,
]
def r_check_pkgbuild(_G: SimpleNamespace, cfg: CheckConfig):
def r_check_pkgbuild(newver: str, cfg: CheckConfig):
pkgbuild = Pkgbuild()
cfg.default_r_pkgs = get_default_r_pkgs()
errors = []
with tarfile.open(f"{pkgbuild._pkgname}_{_G.newver}.tar.gz", "r") as tar:
with tarfile.open(f"{pkgbuild._pkgname}_{newver}.tar.gz", "r") as tar:
description = Description(tar, pkgbuild._pkgname)
cfg.tar = tar
@ -341,6 +347,9 @@ def r_check_pkgbuild(_G: SimpleNamespace, cfg: CheckConfig):
def r_pre_build(_G: SimpleNamespace, **kwargs):
cfg = CheckConfig(**kwargs)
r_update_pkgver_and_pkgrel(_G)
newver, md5sum = _G.newver.rsplit("#", 1)
cfg.md5sum = md5sum
r_update_pkgver_and_pkgrel(newver)
run_protected(["updpkgsums"])
r_check_pkgbuild(_G, cfg)
r_check_pkgbuild(newver, cfg)