From 38414e65b6601ac6c49c1df0cea47c697856b315 Mon Sep 17 00:00:00 2001 From: madomado Date: Wed, 1 Jan 2025 03:37:34 +0800 Subject: [PATCH] feat(ffmpeg): track tesseract and x265 version per branch (#2721) fixes #2611 --- anda/fusion/ffmpeg/VERSION_tesseract.txt | 1 + anda/fusion/ffmpeg/VERSION_x265.txt | 1 + anda/fusion/ffmpeg/anda.hcl | 3 +++ anda/fusion/ffmpeg/update.rhai | 10 +++++++++- anda/system/mesa-freeworld/update.rhai | 10 +++------- andax/bump_extras.rhai | 22 ++++++++++++++++++++++ 6 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 anda/fusion/ffmpeg/VERSION_tesseract.txt create mode 100644 anda/fusion/ffmpeg/VERSION_x265.txt create mode 100644 andax/bump_extras.rhai diff --git a/anda/fusion/ffmpeg/VERSION_tesseract.txt b/anda/fusion/ffmpeg/VERSION_tesseract.txt new file mode 100644 index 0000000000..c7ba1e87f7 --- /dev/null +++ b/anda/fusion/ffmpeg/VERSION_tesseract.txt @@ -0,0 +1 @@ +5.5.0 \ No newline at end of file diff --git a/anda/fusion/ffmpeg/VERSION_x265.txt b/anda/fusion/ffmpeg/VERSION_x265.txt new file mode 100644 index 0000000000..8a36cd142b --- /dev/null +++ b/anda/fusion/ffmpeg/VERSION_x265.txt @@ -0,0 +1 @@ +4.1 \ No newline at end of file diff --git a/anda/fusion/ffmpeg/anda.hcl b/anda/fusion/ffmpeg/anda.hcl index dee5f8a1f8..7d1f17de36 100644 --- a/anda/fusion/ffmpeg/anda.hcl +++ b/anda/fusion/ffmpeg/anda.hcl @@ -2,4 +2,7 @@ project pkg { rpm { spec = "ffmpeg.spec" } + labels { + updbranch = 1 + } } diff --git a/anda/fusion/ffmpeg/update.rhai b/anda/fusion/ffmpeg/update.rhai index 1376b8d647..415b1d4994 100644 --- a/anda/fusion/ffmpeg/update.rhai +++ b/anda/fusion/ffmpeg/update.rhai @@ -1 +1,9 @@ -rpm.version(find(`ffmpeg-([\d.]+?)\.tar\.xz`, get("https://ffmpeg.org/download.html"), 1)); +import "andax/bump_extras.rhai" as bump; + +//rpm.version(find(`ffmpeg-([\d.]+?)\.tar\.xz`, get("https://ffmpeg.org/download.html"), 1)); + +let ffmpeg_ver = get(`https://madoguchi.fyralabs.com/v4/terra${labels.branch}/packages/x265`).json().ver; +open_file("anda/fusion/ffmpeg/VERSION_x265.txt", "w").write(ffmpeg_ver); + +let tesseract_ver = bump::bodhi("tesseract", labels.branch.as_bodhi_ver()); +open_file("anda/fusion/ffmpeg/VERSION_tesseract.txt", "w").write(tesseract_ver); diff --git a/anda/system/mesa-freeworld/update.rhai b/anda/system/mesa-freeworld/update.rhai index 8d6c3e10f3..55ef4263cb 100644 --- a/anda/system/mesa-freeworld/update.rhai +++ b/anda/system/mesa-freeworld/update.rhai @@ -1,7 +1,3 @@ -if !labels.branch.starts_with("f") { - print(`mesa-freeworld: unsupported branch: ${labels.branch}`); - terminate(); -} -let release = labels.branch.to_upper(); -let ver = get(`https://bodhi.fedoraproject.org/updates/?search=mesa&status=stable&releases=${release}&rows_per_page=1&page=1`).json().updates[0].title; -rpm.global("ver", find(`^mesa-([\d.]+)`, ver, 1)); +import "andax/bump_extras.rhai" as bump; + +rpm.global("ver", bump::bodhi("mesa", labels.branch.as_bodhi_ver())); diff --git a/andax/bump_extras.rhai b/andax/bump_extras.rhai new file mode 100644 index 0000000000..c7c21db7b4 --- /dev/null +++ b/andax/bump_extras.rhai @@ -0,0 +1,22 @@ +fn as_bodhi_ver(branch) { + if branch.starts_with("el") { + branch.crop(2); + if branch == "10" { + return "EPEL-10.0"; + } + return `EPEL-${release}`; + } else if branch == "frawhide" { + return "42"; + } else if branch.starts_with("f") { + branch.crop(1); + return branch; + } else { + print(`E: unsupported branch: ${labels.branch}`); + terminate(); + } +} + +fn bodhi(pkg, branch) { + let url = `https://bodhi.fedoraproject.org/updates/?search=${pkg}&status=stable&releases=${branch}&rows_per_page=1&page=1`; + return find(`^${pkg}-([\d.]+)-\d+\.[\w\d]+$`, get(url).json().updates[0].title, 1); +}