Merge pull request 'feat: add pkgmanifest recommendations support' (#111) from sisungo/semios-packages:recommends into master
Reviewed-on: #111
This commit was merged in pull request #111.
This commit is contained in:
+13
-3
@@ -11,6 +11,7 @@ _key_on_pack = "on_pack"
|
|||||||
_key_arch_any = "arch_any"
|
_key_arch_any = "arch_any"
|
||||||
_key_links = "links"
|
_key_links = "links"
|
||||||
_key_dependencies = "dependencies"
|
_key_dependencies = "dependencies"
|
||||||
|
_key_recommendations = "recommendations"
|
||||||
_key_provides = "provides"
|
_key_provides = "provides"
|
||||||
|
|
||||||
_current_pkgname: str = _key_global
|
_current_pkgname: str = _key_global
|
||||||
@@ -19,6 +20,7 @@ _pkginfo: dict[str, dict[str, typing.Any]] = {
|
|||||||
_key_links: [],
|
_key_links: [],
|
||||||
_key_dependencies: [],
|
_key_dependencies: [],
|
||||||
_key_provides: [],
|
_key_provides: [],
|
||||||
|
_key_recommendations: [],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_supported_arch: typing.Callable[[str], bool] = lambda x: True
|
_supported_arch: typing.Callable[[str], bool] = lambda x: True
|
||||||
@@ -73,12 +75,20 @@ def provide(s: str):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def dep(s: str):
|
def _translate_dep_spec(s: str) -> str:
|
||||||
_pkginfo[_current_pkgname][_key_dependencies] += [
|
return (
|
||||||
s.replace("(same)", "(same-version) @same-arch")
|
s.replace("(same)", "(same-version) @same-arch")
|
||||||
.replace("(same-version)", f"(={_pkginfo[_current_pkgname][_key_version]})")
|
.replace("(same-version)", f"(={_pkginfo[_current_pkgname][_key_version]})")
|
||||||
.replace("@same-arch", f"@{arch.get_target()}")
|
.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):
|
def link(src: str, dst: str, default: bool = True):
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ def cmd_build_package(package: str):
|
|||||||
"arch": pkgarch,
|
"arch": pkgarch,
|
||||||
"dependencies": pkginfo[lib.make._key_dependencies],
|
"dependencies": pkginfo[lib.make._key_dependencies],
|
||||||
"provides": pkginfo[lib.make._key_provides],
|
"provides": pkginfo[lib.make._key_provides],
|
||||||
|
"recommendations": pkginfo[lib.make._key_recommendations],
|
||||||
}
|
}
|
||||||
composer.write_manifest(manifest)
|
composer.write_manifest(manifest)
|
||||||
composer.write_links(pkginfo[lib.make._key_links])
|
composer.write_links(pkginfo[lib.make._key_links])
|
||||||
|
|||||||
Reference in New Issue
Block a user