feat: add pkgmanifest recommendations support

Signed-off-by: sisungo <[email protected]>
This commit is contained in:
2026-07-08 01:00:53 +08:00
parent c47d1390bc
commit b0185d379b
2 changed files with 14 additions and 3 deletions
+13 -3
View File
@@ -11,6 +11,7 @@ _key_on_pack = "on_pack"
_key_arch_any = "arch_any"
_key_links = "links"
_key_dependencies = "dependencies"
_key_recommendations = "recommendations"
_key_provides = "provides"
_current_pkgname: str = _key_global
@@ -19,6 +20,7 @@ _pkginfo: dict[str, dict[str, typing.Any]] = {
_key_links: [],
_key_dependencies: [],
_key_provides: [],
_key_recommendations: [],
},
}
_supported_arch: typing.Callable[[str], bool] = lambda x: True
@@ -73,12 +75,20 @@ def provide(s: str):
]
def dep(s: str):
_pkginfo[_current_pkgname][_key_dependencies] += [
def _translate_dep_spec(s: str) -> str:
return (
s.replace("(same)", "(same-version) @same-arch")
.replace("(same-version)", f"(={_pkginfo[_current_pkgname][_key_version]})")
.replace("@same-arch", f"@{arch.get_target()}")
]
)
def dep(s: str):
_pkginfo[_current_pkgname][_key_dependencies] += [_translate_dep_spec(s)]
def recommend(s: str):
_pkginfo[_current_pkgname][_key_recommendations] += [_translate_dep_spec(s)]
def link(src: str, dst: str, default: bool = True):
+1
View File
@@ -115,6 +115,7 @@ def run_build_package(package: str):
"arch": pkgarch,
"dependencies": pkginfo[lib.make._key_dependencies],
"provides": pkginfo[lib.make._key_provides],
"recommendations": pkginfo[lib.make._key_recommendations],
}
composer.write_manifest(manifest)
composer.write_links(pkginfo[lib.make._key_links])