Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-rpm-macros for openSUSE:Factory checked in at 2021-10-25 15:17:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rpm-macros (Old) and /work/SRC/openSUSE:Factory/.python-rpm-macros.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rpm-macros" Mon Oct 25 15:17:06 2021 rev:37 rq:926976 version:20211022.38e7c70 Changes: -------- --- /work/SRC/openSUSE:Factory/python-rpm-macros/python-rpm-macros.changes 2021-07-09 23:56:36.745796834 +0200 +++ /work/SRC/openSUSE:Factory/.python-rpm-macros.new.1890/python-rpm-macros.changes 2021-10-25 15:17:41.653685417 +0200 @@ -1,0 +2,21 @@ +Fri Oct 22 12:47:07 UTC 2021 - mc...@cepl.eu + +- Update to version 20211022.38e7c70: + * no newline after python_install_alternative + +------------------------------------------------------------------- +Mon Oct 18 14:21:08 UTC 2021 - Ben Greiner <c...@bnavigator.de> + +- Update to version 20211018.c7614ad: + * remove ghost gh#openSUSE/python-rpm-macros#118 + * revert reset name change + * fix README + * move u-a/la switch for scriptlets to build phase + +------------------------------------------------------------------- +Fri Oct 01 15:47:31 UTC 2021 - mc...@cepl.eu + +- Update to version 20211001.fc6c04e: + * Supporting libalternatives. + +------------------------------------------------------------------- Old: ---- python-rpm-macros-20210628.eccf3f2.tar.xz New: ---- python-rpm-macros-20211022.38e7c70.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rpm-macros.spec ++++++ --- /var/tmp/diff_new_pack.vD6XSE/_old 2021-10-25 15:17:42.217685769 +0200 +++ /var/tmp/diff_new_pack.vD6XSE/_new 2021-10-25 15:17:42.217685769 +0200 @@ -17,7 +17,7 @@ Name: python-rpm-macros -Version: 20210628.eccf3f2 +Version: 20211022.38e7c70 Release: 0 Summary: RPM macros for building of Python modules License: WTFPL ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.vD6XSE/_old 2021-10-25 15:17:42.253685792 +0200 +++ /var/tmp/diff_new_pack.vD6XSE/_new 2021-10-25 15:17:42.253685792 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/openSUSE/python-rpm-macros.git</param> - <param name="changesrevision">045846b919fb55800c8e3a47681cefd006e0a83f</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">c3e755dfcfa8e34821a2a305ff076246d8b37aa0</param></service></servicedata> \ No newline at end of file ++++++ python-rpm-macros-20210628.eccf3f2.tar.xz -> python-rpm-macros-20211022.38e7c70.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210628.eccf3f2/.gitignore new/python-rpm-macros-20211022.38e7c70/.gitignore --- old/python-rpm-macros-20210628.eccf3f2/.gitignore 2021-06-28 11:59:37.000000000 +0200 +++ new/python-rpm-macros-20211022.38e7c70/.gitignore 2021-10-22 14:46:35.000000000 +0200 @@ -2,5 +2,8 @@ /macros/020-flavor-* /macros/035-default-pythons /macros/040-buildset +/macros/041-buildset +/macros/040-builset-start +/macros/042-builset-end /macros/050-automagic *.swp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210628.eccf3f2/README.md new/python-rpm-macros-20211022.38e7c70/README.md --- old/python-rpm-macros-20210628.eccf3f2/README.md 2021-06-28 11:59:37.000000000 +0200 +++ new/python-rpm-macros-20211022.38e7c70/README.md 2021-10-22 14:46:35.000000000 +0200 @@ -295,6 +295,43 @@ Each of these has a flavor-specific spelling: `%python2_alternative` etc. +#### Libalternatives-related: + +[Libalternatives](https://github.com/openSUSE/libalternatives) provides another way for settings alternative. +Instead of symlinks, the preferred executable is executed directly. Which executable is executed +depends on the available alternatives installed on the system and the system and/or user configuration files. +These configuration files will also be generated by the macros described above **AND** following settings in the +spec file: + +* Enabling *libalternative* by the definition __`libalternatives`__ in the spec file : + ```spec + %if 0%{?suse_version} > 1500 + %bcond_without libalternatives + %else + %bcond_with libalternatives + %endif + ``` + This example shows that *libalternatives* is available for TW only. + +* Requiring needed packages: + ```spec + %if %{with libalternatives} + Requires: alts + BuildRequires: alts + %else + Requires(post): update-alternatives + Requires(postun):update-alternatives + %endif + ``` + +* Cleanup old alternatives entries if libalternatives will be used after an update: + ```spec + %pre + # removing old update-alternatives entries + %python_libalternatives_reset_alternative <name> + ``` + The argument *\<name\>* is the same used for calling *%python_uninstall_alternative*. + #### Flavor-specific macros In addition, the following flavor-specific macros are known and supported by the configuration: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210628.eccf3f2/flavor.in new/python-rpm-macros-20211022.38e7c70/flavor.in --- old/python-rpm-macros-20210628.eccf3f2/flavor.in 2021-06-28 11:59:37.000000000 +0200 +++ new/python-rpm-macros-20211022.38e7c70/flavor.in 2021-10-22 14:46:35.000000000 +0200 @@ -43,12 +43,39 @@ %#FLAVOR#_alternative() %{_python_macro_init} \ %{lua:local link, name, path = python_alternative_names(rpm.expand("%1"), rpm.expand("%#FLAVOR#_bin_suffix")) \ -print(rpm.expand("%ghost %{_sysconfdir}/alternatives/" .. name .. "\\\n")) \ -print(link .. "\\\n") \ -print(path .. "\\\n") } +local libalternatives = rpm.expand("%{with libalternatives}") \ +if libalternatives == "1" then \ + if not link:startswith(rpm.expand("%{_mandir}")) then \ + local prio = alternative_prio("#FLAVOR#") \ + print(rpm.expand("%dir %{_datadir}/libalternatives\\\n")) \ + print(rpm.expand("%ghost %dir %{_datadir}/libalternatives/" .. name .. "\\\n")) \ + print(rpm.expand("%ghost %{_datadir}/libalternatives/" .. name .. "/" .. prio .. ".conf\\\n")) \ + print(link .. "\\\n") \ + end \ + print(path .. "\\\n") \ +else \ + print(rpm.expand("%ghost %{_sysconfdir}/alternatives/" .. name .. "\\\n")) \ + print(link .. "\\\n") \ + print(path .. "\\\n") \ +end \ +} -%#FLAVOR#_install_alternative() %{_python_macro_init} \ +%#FLAVOR#_install_alternative() \ +%{_python_macro_init} \ %{lua:python_install_alternative("#FLAVOR#")} %#FLAVOR#_uninstall_alternative() \ -%{uninstall_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} +%if ! %{with libalternatives} \ +%{uninstall_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} \ +%else \ +: \# no uninstall action for libalternatives \ +%endif \ +%{nil} + +%#FLAVOR#_reset_alternative() \ +%if %{with libalternatives} \ +%{reset_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} \ +%else \ +: \# reset action only for libalternatives \ +%endif \ +%{nil} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210628.eccf3f2/functions.lua new/python-rpm-macros-20211022.38e7c70/functions.lua --- old/python-rpm-macros-20210628.eccf3f2/functions.lua 2021-06-28 11:59:37.000000000 +0200 +++ new/python-rpm-macros-20211022.38e7c70/functions.lua 2021-10-22 14:46:35.000000000 +0200 @@ -33,7 +33,7 @@ function replace_macros(str, targetflavor) local LONG_MACROS = { "sitelib", "sitearch", - "alternative", "install_alternative", "uninstall_alternative", + "alternative", "install_alternative", "uninstall_alternative", "reset_alternative", "version", "version_nodots", "bin_suffix", "prefix", "provides"} local SHORT_MACROS = { "ver" } for _, srcflavor in ipairs({flavor, "python"}) do @@ -117,16 +117,19 @@ end return link, name, path end - -function python_install_alternative(flavor) +function alternative_prio(flavor) local prio = rpm.expand("%" .. flavor .. "_version_nodots") - local binsuffix = rpm.expand("%" .. flavor .. "_bin_suffix") - -- increase priority for primary python3 flavor local provides = rpm.expand("%" .. flavor .. "_provides") .. " " if provides:match("python3%s") then prio = prio + 1000 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 @@ -138,10 +141,52 @@ return end - 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))) + 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210628.eccf3f2/macros/001-alternatives new/python-rpm-macros-20211022.38e7c70/macros/001-alternatives --- old/python-rpm-macros-20210628.eccf3f2/macros/001-alternatives 2021-06-28 11:59:37.000000000 +0200 +++ new/python-rpm-macros-20211022.38e7c70/macros/001-alternatives 2021-10-22 14:46:35.000000000 +0200 @@ -6,9 +6,16 @@ rm -f %{buildroot}${alternative_target%%%%%{ext_man}} \ rm -f %{buildroot}%{alternative_target}%{ext_man} \ fi \ +if [ %{with libalternatives} -eq 1 ] ; then \ +mkdir -p %{buildroot}%{_datadir}/libalternatives \ +if [[ "$alternative_target" != %{_mandir}* ]]; then \ +ln -sf %{_bindir}/alts %{buildroot}%{alternative_target} \ +fi \ +else \ mkdir -p %{buildroot}%{_sysconfdir}/alternatives \ touch %{buildroot}%{_sysconfdir}/alternatives/%1 \ ln -sf %{_sysconfdir}/alternatives/%1 %{buildroot}%{alternative_target} \ +fi \ %{nil} %install_alternative(s:t:p:n:) \ @@ -29,6 +36,14 @@ update-alternatives --quiet --remove "%{alternative_name}" "%{alternative_target}" \ fi \ %{nil} + +%reset_alternative(n:t:) \ +%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}" \ +fi \ +%{nil} %alternative_for() \ %1 \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20210628.eccf3f2/macros/010-common-defs new/python-rpm-macros-20211022.38e7c70/macros/010-common-defs --- old/python-rpm-macros-20210628.eccf3f2/macros/010-common-defs 2021-06-28 11:59:37.000000000 +0200 +++ new/python-rpm-macros-20211022.38e7c70/macros/010-common-defs 2021-10-22 14:46:35.000000000 +0200 @@ -43,6 +43,7 @@ %python_alternative() %{_rec_macro_helper}%{lua:expand_macro("alternative", "%**")} %python_install_alternative() %{_rec_macro_helper}%{lua:expand_macro("install_alternative", "%**")} %python_uninstall_alternative() %{_rec_macro_helper}%{lua:expand_macro("uninstall_alternative", "%**")} +%python_libalternatives_reset_alternative() %{_rec_macro_helper}%{lua:expand_macro("reset_alternative", "%**")} %py_ver %python_version