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 r-withr
) )
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz") source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
md5sums=('3827672b1f4747ce6bd3a224a74a9f61')
sha256sums=('548b7c0ed5ab26dc4fbd88707ae12987bcaef834dbc6de4e17d453846dc436b2') sha256sums=('548b7c0ed5ab26dc4fbd88707ae12987bcaef834dbc6de4e17d453846dc436b2')
prepare() { prepare() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ import pyalpm
import tarfile import tarfile
from types import SimpleNamespace 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. 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: if oldver is not None:
raise Exception("_pkgver is defined twice") raise Exception("_pkgver is defined twice")
oldver = line[len(ver_prefix):] oldver = line[len(ver_prefix):]
line = f"{ver_prefix}{_G.newver}" line = f"{ver_prefix}{newver}"
elif line.startswith(rel_prefix): elif line.startswith(rel_prefix):
if oldver is None: if oldver is None:
raise Exception("pkgrel is defined before _pkgver") raise Exception("pkgrel is defined before _pkgver")
if oldrel is not None: if oldrel is not None:
raise Exception("pkgrel is defined twice") raise Exception("pkgrel is defined twice")
oldrel = int(line[len(rel_prefix):]) 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}" line = f"{rel_prefix}{newrel}"
print(line) print(line)
if oldrel is None: if oldrel is None:
@ -117,6 +117,7 @@ class Pkgbuild:
"makedepends", "makedepends",
"checkdepends", "checkdepends",
"optdepends", "optdepends",
"md5sums",
] ]
def __init__(self): def __init__(self):
@ -310,6 +311,10 @@ def check_arch(pkg: Pkgbuild, desc: Description, cfg: CheckConfig):
if pkg.arch != [expected]: if pkg.arch != [expected]:
raise CheckFailed(f"Wrong arch, expected {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 = [ all_checks = [
check_default_pkgs, check_default_pkgs,
check_depends, check_depends,
@ -320,13 +325,14 @@ all_checks = [
check_license, check_license,
check_pkgdesc, check_pkgdesc,
check_arch, check_arch,
check_md5sum,
] ]
def r_check_pkgbuild(_G: SimpleNamespace, cfg: CheckConfig): def r_check_pkgbuild(newver: str, cfg: CheckConfig):
pkgbuild = Pkgbuild() pkgbuild = Pkgbuild()
cfg.default_r_pkgs = get_default_r_pkgs() cfg.default_r_pkgs = get_default_r_pkgs()
errors = [] 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) description = Description(tar, pkgbuild._pkgname)
cfg.tar = tar cfg.tar = tar
@ -341,6 +347,9 @@ def r_check_pkgbuild(_G: SimpleNamespace, cfg: CheckConfig):
def r_pre_build(_G: SimpleNamespace, **kwargs): def r_pre_build(_G: SimpleNamespace, **kwargs):
cfg = CheckConfig(**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"]) run_protected(["updpkgsums"])
r_check_pkgbuild(_G, cfg) r_check_pkgbuild(newver, cfg)