From e36bdffafffa816250391cbd9f055edc080adbd2 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 10 Aug 2025 12:54:07 +0800 Subject: [PATCH] Update os recipes using chef DSL --- src/recipe/os/APT/Debian.c | 8 +++++++- src/recipe/os/Alpine-Linux.c | 21 +++++++++------------ src/recipe/os/Gentoo-Linux.c | 11 ++++++----- src/recipe/os/OpenWrt.c | 21 +++++++++------------ src/recipe/os/Solus.c | 11 ++++++----- src/recipe/os/Void-Linux.c | 21 +++++++++------------ src/recipe/os/openSUSE.c | 11 ++++++----- 7 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/recipe/os/APT/Debian.c b/src/recipe/os/APT/Debian.c index ce25c90..715fd5d 100644 --- a/src/recipe/os/APT/Debian.c +++ b/src/recipe/os/APT/Debian.c @@ -28,8 +28,14 @@ os_debian_prelude () chef_allow_set(); chef_allow_reset(); + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note(this, NULL, NULL); + def_upstream("http://deb.debian.org/debian"); - def_sources_begin(os_debian) + def_sources_begin() {&upstream, "http://deb.debian.org/debian", DelegateToUpstream}, /* MirrorZ 的速度这么测也是可以的 */ diff --git a/src/recipe/os/Alpine-Linux.c b/src/recipe/os/Alpine-Linux.c index 5c8df05..9f1eb72 100644 --- a/src/recipe/os/Alpine-Linux.c +++ b/src/recipe/os/Alpine-Linux.c @@ -2,12 +2,6 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------*/ -static SourceProvider_t os_alpine_upstream = -{ - def_upstream, "http://dl-cdn.alpinelinux.org/alpine", - {NotSkip, NA, NA, "https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/alpine-standard-3.21.0-x86_64.iso", ACCURATE} -}; - def_target(os_alpine); void @@ -28,13 +22,14 @@ os_alpine_prelude () chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = true; - this.can_user_define = false; - this.note = NULL; - def_upstream_provider(os_alpine_upstream); + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_allow_english(this); + chef_forbid_user_define(this); + + chef_set_note(this, NULL, NULL); + + def_upstream("http://dl-cdn.alpinelinux.org/alpine"); def_sources_begin() {&upstream, "http://dl-cdn.alpinelinux.org/alpine", DelegateToUpstream}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/alpine", DelegateToMirror}, @@ -46,6 +41,8 @@ os_alpine_prelude () {&Tencent, "https://mirrors.cloud.tencent.com/alpine", DelegateToMirror}, {&Huawei, "https://mirrors.huaweicloud.com/alpine", DelegateToMirror} def_sources_end() + + chsrc_set_provider_speed_measure_url (&upstream, "https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/alpine-standard-3.21.0-x86_64.iso"); } diff --git a/src/recipe/os/Gentoo-Linux.c b/src/recipe/os/Gentoo-Linux.c index 97523c7..a8fc64f 100644 --- a/src/recipe/os/Gentoo-Linux.c +++ b/src/recipe/os/Gentoo-Linux.c @@ -22,11 +22,12 @@ os_gentoo_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = true; - this.can_user_define = false; - this.note = NULL; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_allow_english(this); + chef_forbid_user_define(this); + + chef_set_note(this, NULL, NULL); def_upstream("https://www.gentoo.org/downloads/mirrors/"); def_sources_begin() diff --git a/src/recipe/os/OpenWrt.c b/src/recipe/os/OpenWrt.c index 65ca078..9d90c23 100644 --- a/src/recipe/os/OpenWrt.c +++ b/src/recipe/os/OpenWrt.c @@ -2,12 +2,6 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------*/ -static SourceProvider_t os_openwrt_upstream = -{ - def_upstream, "https://downloads.openwrt.org", - {NotSkip, NA, NA, "https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz", ACCURATE} -}; - def_target(os_openwrt); void @@ -29,13 +23,14 @@ os_openwrt_prelude () chef_allow_get(); chef_allow_set(); chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = true; - this.can_user_define = true; - this.note = NULL; - def_upstream_provider(os_openwrt_upstream); + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_allow_english(this); + chef_allow_user_define(this); + + chef_set_note(this, NULL, NULL); + + def_upstream("https://downloads.openwrt.org"); def_sources_begin() {&upstream, "https://downloads.openwrt.org", DelegateToUpstream}, {&MirrorZ, "https://mirrors.cernet.edu.cn/openwrt", DelegateToMirror}, @@ -47,6 +42,8 @@ os_openwrt_prelude () {&Pku, "https://mirrors.pku.edu.cn/openwrt", DelegateToMirror}, {&Sustech, "https://mirrors.sustech.edu.cn/openwrt", DelegateToMirror} def_sources_end() + + chsrc_set_provider_speed_measure_url (&upstream, "https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz"); } diff --git a/src/recipe/os/Solus.c b/src/recipe/os/Solus.c index 45dcf65..5207ab8 100644 --- a/src/recipe/os/Solus.c +++ b/src/recipe/os/Solus.c @@ -22,11 +22,12 @@ os_solus_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = true; - this.note = NULL; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_allow_user_define(this); + + chef_set_note(this, NULL, NULL); def_upstream("https://packages.getsol.us/"); def_sources_begin() diff --git a/src/recipe/os/Void-Linux.c b/src/recipe/os/Void-Linux.c index ef262a1..6bad74a 100644 --- a/src/recipe/os/Void-Linux.c +++ b/src/recipe/os/Void-Linux.c @@ -2,12 +2,6 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------*/ -static SourceProvider_t os_voidlinux_upstream = -{ - def_upstream, "https://repo-default.voidlinux.org", - {NotSkip, NA, NA, "https://repo-default.voidlinux.org/live/20240314/void-live-x86_64-musl-20240314-xfce.iso", ACCURATE} -}; - def_target(os_voidlinux); void @@ -28,19 +22,22 @@ os_voidlinux_prelude () chef_allow_get(); chef_allow_set(); chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = true; - this.note = NULL; - def_upstream_provider(os_voidlinux_upstream); + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + + + chef_set_note(this, NULL, NULL); + + def_upstream("https://repo-default.voidlinux.org"); def_sources_begin() {&upstream, "https://repo-default.voidlinux.org", DelegateToUpstream}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/voidlinux", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/voidlinux", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/voidlinux", DelegateToMirror} def_sources_end() + + chsrc_set_provider_speed_measure_url (&upstream, "https://repo-default.voidlinux.org/live/20240314/void-live-x86_64-musl-20240314-xfce.iso"); } diff --git a/src/recipe/os/openSUSE.c b/src/recipe/os/openSUSE.c index 7e1a816..256aada 100644 --- a/src/recipe/os/openSUSE.c +++ b/src/recipe/os/openSUSE.c @@ -22,11 +22,12 @@ os_opensuse_prelude () // chef_allow_get(); chef_allow_set(); // chef_allow_reset(); - this.cap_locally = CanNot; - this.cap_locally_explain = NULL; - this.can_english = false; - this.can_user_define = false; - this.note = NULL; + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note(this, NULL, NULL); def_upstream("https://download.opensuse.org/"); def_sources_begin()