Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:ygutierrez:branches:systemsmanagement:saltstack:bundle:next:Debian12
saltbundlepy-rpm-macros
revert-alternatives-macro.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File revert-alternatives-macro.patch of Package saltbundlepy-rpm-macros
--- a/flavor.in +++ b/flavor.in @@ -127,14 +127,11 @@ # Commands for RPM scriptlets: These must not be empty even if there is no operation for # either update-alternatives or libalternatives. -%#FLAVOR#_install_alternative() \# #FLAVOR#_install_alternative: \ -%{?!with_libalternatives:%{_python_macro_init}%{lua:python_install_ualternative("#FLAVOR#") \ -}}%{?with_libalternatives:\: \# no install scriptlet action for libalternatives} +%#FLAVOR#_install_alternative() %{_python_macro_init} \ +%{lua:python_install_alternative("#FLAVOR#")} -%#FLAVOR#_uninstall_alternative() \# #FLAVOR#_uninstall_alternative: \ -%{?!with_libalternatives:%{uninstall_alternative -n %1 -t %{_bindir}/%1-%{#FLAVOR#_bin_suffix} \ -}}%{?with_libalternatives:\: \# no uninstall scriptlet action for libalternatives} +%#FLAVOR#_uninstall_alternative() \ +%{uninstall_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} -%#FLAVOR#_reset_alternative() \# #FLAVOR#_reset_alternative: \ -%{?!with_libalternatives:\: \# reset action only for libalternatives \ -}%{?with_libalternatives:%{reset_alternative -n %1 -t %{_bindir}/%1-%{#FLAVOR#_bin_suffix}}} +%#FLAVOR#_reset_alternative() \ +%{reset_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} --- a/functions.lua +++ b/functions.lua @@ -116,6 +116,70 @@ end return prio end +function python_install_alternative(flavor) + local prio = alternative_prio(flavor) + local binsuffix = rpm.expand("%" .. flavor .. "_bin_suffix") + local libalternatives = rpm.expand("%{with libalternatives}") + + local params = {} + for p in string.gmatch(rpm.expand("%*"), "%S+") do + table.insert(params, p) + end + + if #params == 0 then + print("error") + return + end + + if libalternatives == "1" then + for _, v in ipairs(params) do + local link, name, path = python_alternative_names(v, binsuffix) + if not v:match(".+%.%d") then + local group = "" + local man = "" + for _, v2 in ipairs(params) do + local man_match = v2:match(".+%.%d") + if man_match then + if string.sub(man_match,1,-3) == v then + local man_entry = v .. "-" .. binsuffix .. "." .. string.sub(man_match,man_match:len()) + if man:len() > 0 then + man = man .. ", " .. man_entry + else + man = man_entry + end + end + else + if group:len() > 0 then + group = group .. ", " .. v2 + else + group = v2 + end + end + end + local bindir = rpm.expand("%_bindir") + local datadir = rpm.expand("%_datadir") + print(string.format("mkdir -p %s/libalternatives/%s\n", datadir, v)) + print(string.format("echo binary=%s/%s-%s >%s/libalternatives/%s/%s.conf\n", + bindir, v, binsuffix, datadir, v, prio)) + if man:len() > 0 then + print(string.format("echo man=%s >>%s/libalternatives/%s/%s.conf\n", + man, datadir, v, prio)) + end + if group:len() > 0 then + print(string.format("echo group=%s >>%s/libalternatives/%s/%s.conf\n", + group, datadir, v, prio)) + end + end + end + else + local link, name, path = python_alternative_names(params[1], binsuffix) + print(string.format("update-alternatives --quiet --install %s %s %s %s", link, name, path, prio)) + table.remove(params, 1) + for _, v in ipairs(params) do + print(string.format(" \\\n --slave %s %s %s", python_alternative_names(v, binsuffix))) + end + end +end function python_install_ualternative(flavor) local prio = alternative_prio(flavor) local binsuffix = rpm.expand("%" .. flavor .. "_bin_suffix") --- a/macros/001-alternatives +++ b/macros/001-alternatives @@ -41,7 +41,7 @@ %define alternative_name %{-n:%{-n*}}%{!-n:%1} \ %define alternative_target %{-t:%{-t*}}%{!-t:%2} \ if [ "$1" -gt 0 ] && [ -f %{_sbindir}/update-alternatives ]; then \ - update-alternatives --quiet --remove "%{alternative_name}" "%{alternative_target}" \ + update-alternatives --quiet --remove "%{alternative_name}" "%{alternative_target}" || true \ fi \ %{nil}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor