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 2022-07-29 16:46:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rpm-macros (Old) and /work/SRC/openSUSE:Factory/.python-rpm-macros.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rpm-macros" Fri Jul 29 16:46:59 2022 rev:42 rq:991154 version:20220725.2ae32d5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-rpm-macros/python-rpm-macros.changes 2022-06-19 21:10:39.102107176 +0200 +++ /work/SRC/openSUSE:Factory/.python-rpm-macros.new.1533/python-rpm-macros.changes 2022-07-29 16:47:03.494512475 +0200 @@ -1,0 +2,15 @@ +Mon Jul 25 21:27:08 UTC 2022 - mc...@cepl.eu + +- Update to version 20220725.2ae32d5: + * restore end-of-line in alternative scriptlets + +------------------------------------------------------------------- +Thu Jul 21 10:31:50 UTC 2022 - mc...@cepl.eu + +- Update to version 20220721.0a061eb: + * make python_flavored_alternatives less verbose + * Move install of libalts from sciptlets to python_clone -a -- close gh#openSUSE/python-rpm-macros#133 + * hard-code %py_ver -- fix gh#openSUSE/python-rpm-macros#131 + * fix gh#openSUSE/python-rpm-macros#130 print proper error on missing python interpreter + +------------------------------------------------------------------- Old: ---- python-rpm-macros-20220618.1ed0055.tar.xz New: ---- python-rpm-macros-20220725.2ae32d5.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rpm-macros.spec ++++++ --- /var/tmp/diff_new_pack.pfMGBE/_old 2022-07-29 16:47:04.118514211 +0200 +++ /var/tmp/diff_new_pack.pfMGBE/_new 2022-07-29 16:47:04.118514211 +0200 @@ -17,7 +17,7 @@ Name: python-rpm-macros -Version: 20220618.1ed0055 +Version: 20220725.2ae32d5 Release: 0 Summary: RPM macros for building of Python modules License: WTFPL ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.pfMGBE/_old 2022-07-29 16:47:04.170514355 +0200 +++ /var/tmp/diff_new_pack.pfMGBE/_new 2022-07-29 16:47:04.174514366 +0200 @@ -3,6 +3,6 @@ <param name="url">git://github.com/openSUSE/python-rpm-macros.git</param> <param name="changesrevision">80d37568d9732beb7fcc2cf27c5c08f9c01fade1</param></service><service name="tar_scm"> <param name="url">https://github.com/openSUSE/python-rpm-macros.git</param> - <param name="changesrevision">8ad941748e43a59e75eec28ef976bd52a2d4f260</param></service></servicedata> + <param name="changesrevision">48d1d93930617bd353de785bde10b28c9c312993</param></service></servicedata> (No newline at EOF) ++++++ python-rpm-macros-20220618.1ed0055.tar.xz -> python-rpm-macros-20220725.2ae32d5.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220618.1ed0055/README.md new/python-rpm-macros-20220725.2ae32d5/README.md --- old/python-rpm-macros-20220618.1ed0055/README.md 2022-06-18 21:58:46.000000000 +0200 +++ new/python-rpm-macros-20220725.2ae32d5/README.md 2022-07-25 23:26:46.000000000 +0200 @@ -236,7 +236,7 @@ flavor. This is useful for packages that install unversioned executables: `/usr/bin/foo` is copied to `/usr/bin/foo-%{python_bin_suffix}` for all flavors, and the shebang is modified accordingly. __`%python_clone -a filename`__ will also invoke __`%prepare_alternative`__ with the appropriate -arguments. +arguments or create the libalternative configuration if `--with libalternatives` is specified. * __`%python_find_lang foo`__ calls `%find_lang foo` for all flavors and creates flavor specific files `%{python_prefix}-foo.lang`. Additional arguments of `%find_lang` are supported. The filelist @@ -281,14 +281,14 @@ In case the file is a manpage (`file.1.gz`), the target is called `file-%suffix.1.gz`. * __`%python_install_alternative <name> [<name> <name>...]`__: runs `update-alternatives` -for `<name>-%{python_bin_suffix}`. If more than one argument is present, the remaining ones are -converted to `--slave` arguments. +for `<name>-%{python_bin_suffix}` (unless `--with libalternatives` is enabled). +If more than one argument is present, the remaining ones are converted to `--slave` arguments. If a `name` is in the form of `something.1` or `something.4.gz` (any number applies), it is handled as a manpage and assumed to live in the appropriate `%{_mandir}` subdirectory, otherwise it is handled as a binary and assumed to live in `%{_bindir}`. You can also supply a full path to override this behavior. -* __`%python_uninstall_alternative <name>`__: reverse of the preceding. +* __`%python_uninstall_alternative <name>`__: reverse of the preceding. Note that if you created a group by specifying multiple arguments to `install_alternative`, only the first one applies for `uninstall_alternative`. @@ -303,7 +303,7 @@ 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 : +* Enable *libalternative* by making __`--with libalternatives`__ the default: ```spec %if 0%{?suse_version} > 1500 %bcond_without libalternatives @@ -313,7 +313,7 @@ ``` This example shows that *libalternatives* is available for TW only. -* Requiring needed packages: +* Require the `alts` package during build and runtime: ```spec %if %{with libalternatives} Requires: alts @@ -324,7 +324,19 @@ %endif ``` -* Cleanup old alternatives entries if libalternatives will be used after an update: +* Group entries using __`%python_group_libalternatives`__ + (similar to what would have been installed as master and slaves in %python_install_alternatives, + but without the manuals, as these do not go into group= entries) + ```spec + %install + ... + %python_clone -a %{buildroot}/%{_bindir}/cmd1 + %python_clone -a %{buildroot}/%{_binddir}/cmd2 + %python_clone -a %{buildroot}/%{_mandir}/man1/cmd1.1 + %python_group_libalternatives cmd1 cmd2 + ``` + +* Cleanup old update-alternatives entries during a transition update to libalternatives: ```spec %pre # removing old update-alternatives entries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220618.1ed0055/flavor.in new/python-rpm-macros-20220725.2ae32d5/flavor.in --- old/python-rpm-macros-20220618.1ed0055/flavor.in 2022-06-18 21:58:46.000000000 +0200 +++ new/python-rpm-macros-20220725.2ae32d5/flavor.in 2022-07-25 23:26:46.000000000 +0200 @@ -47,9 +47,8 @@ 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(rpm.expand("%dir %{_datadir}/libalternatives/" .. name .. "\\\n")) \ + print(rpm.expand("%{_datadir}/libalternatives/" .. name .. "/" .. prio .. ".conf\\\n")) \ print(link .. "\\\n") \ end \ print(path .. "\\\n") \ @@ -60,19 +59,26 @@ end \ } -%#FLAVOR#_install_alternative() \ -%{_python_macro_init} \ -%{lua:python_install_alternative("#FLAVOR#")} +# Commands for RPM scriptlets: These must not be empty even if there is no op for +# either update-alternatives or libalternatives -%#FLAVOR#_uninstall_alternative() \ +%#FLAVOR#_install_alternative() \# #FLAVOR#_install_alternative: \ +%if ! %{with libalternatives} \ +%{_python_macro_init} %{lua:python_install_ualternative("#FLAVOR#")} \\\ +%else \ +: \# no install scriptlet action for libalternatives \ +%endif \ +%{nil} + +%#FLAVOR#_uninstall_alternative() \# #FLAVOR#_uninstall_alternative: \ %if ! %{with libalternatives} \ %{uninstall_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} \ %else \ -: \# no uninstall action for libalternatives \ +: \# no uninstall scriptlet action for libalternatives \ %endif \ %{nil} -%#FLAVOR#_reset_alternative() \ +%#FLAVOR#_reset_alternative() \# #FLAVOR#_reset_alternative: \ %if %{with libalternatives} \ %{reset_alternative -n %1 -t %{_bindir}/%1-%#FLAVOR#_bin_suffix} \ %else \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220618.1ed0055/functions.lua new/python-rpm-macros-20220725.2ae32d5/functions.lua --- old/python-rpm-macros-20220618.1ed0055/functions.lua 2022-06-18 21:58:46.000000000 +0200 +++ new/python-rpm-macros-20220725.2ae32d5/functions.lua 2022-07-25 23:26:46.000000000 +0200 @@ -126,10 +126,9 @@ end return prio end -function python_install_alternative(flavor) +function python_install_ualternative(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 @@ -141,52 +140,27 @@ 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 + 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 +function python_install_libalternative(flavor, target) + local prio = alternative_prio(flavor) + local binsuffix = rpm.expand("%" .. flavor .. "_bin_suffix") + local ldir = rpm.expand("%{buildroot}%{_datadir}/libalternatives") + local link, name, path = python_alternative_names(target, binsuffix) + local man_ending = name:match(ext_man_expr) + local entry, lname + if man_ending then + lname=name:sub(1,-ext_man:len()-3) + entry="man=" .. path:basename():sub(1,-ext_man:len()-1) 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 + entry="binary=" .. path + lname=name end + print(string.format("mkdir -p %s/%s\n", ldir, lname)) + print(string.format("echo %s >> %s/%s/%s.conf\n", entry, ldir, lname, prio)) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220618.1ed0055/macros/001-alternatives new/python-rpm-macros-20220725.2ae32d5/macros/001-alternatives --- old/python-rpm-macros-20220618.1ed0055/macros/001-alternatives 2022-06-18 21:58:46.000000000 +0200 +++ new/python-rpm-macros-20220725.2ae32d5/macros/001-alternatives 2022-07-25 23:26:46.000000000 +0200 @@ -49,14 +49,17 @@ %1 \ %ghost %{_sysconfdir}/alternatives/%{basename:%1} -%python_flavored_alternatives \ +%python_flavored_alternatives(v:) \ +%{!-v:set +x} \ %{python_expand # provide libalternatives and update-alternatives in the current flavor version when shuffling the build dir \ mkdir -p build/xdgflavorconfig \ export XDG_CONFIG_HOME=$PWD/build/xdgflavorconfig \ if [ -d /usr/share/libalternatives/ ]; then \ for b in /usr/share/libalternatives/*; do \ if [ -e "${b}/%{$python_version_nodots}.conf" ]; then \ - alts -n $(basename ${b}) -p %{$python_version_nodots} \ + baseb=$(basename ${b}) \ + alts -n ${baseb} -p %{$python_version_nodots} \ + echo "Using libalternatives variant %{$python_version_nodots} for ${baseb} in XDG_CONFIG_HOME during Python %{$python_version} expansions." \ fi \ done \ fi \ @@ -68,9 +71,22 @@ basemain="$(basename ${mainbin})" \ if [ "$(readlink ${mainbin})" = "/etc/alternatives/${basemain}" ]; then \ ln -sf "${bin}" "build/flavorbin/${basemain}" \ + echo "Using alternative $(basename ${bin}) for ${basemain} in ./build/flavorbin during Python %{$python_version} expansions." \ fi \ fi \ done \ } \ +%{!-v:set -x} \ export PATH=$PWD/build/flavorbin:$PATH \ %{nil} + +%python_group_libalternatives() \ +if [ %{with libalternatives} -eq 1 ] ; then \ + group="%{**}" \ + for f in %{buildroot}%{_datadir}/libalternatives/%1/*.conf; do \ + for name in %{**}; do \ + sed -n -i -e '/^group=/!p' -e '$'"a group=${group// /, }" ${f/\\/%{1}\\//\\/$name\\/} \ + done \ + done \ +fi \ +%{nil} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220618.1ed0055/macros/010-common-defs new/python-rpm-macros-20220725.2ae32d5/macros/010-common-defs --- old/python-rpm-macros-20220618.1ed0055/macros/010-common-defs 2022-06-18 21:58:46.000000000 +0200 +++ new/python-rpm-macros-20220725.2ae32d5/macros/010-common-defs 2022-07-25 23:26:46.000000000 +0200 @@ -3,8 +3,8 @@ ##### common functionality ##### -%_python_sysconfig_path() %([ -x %1 ] && %1 -c "import sysconfig as s; print(s.get_paths().get('%2'))" || echo "!!_%1_not_installed_!!") -%_python_sysconfig_var() %([ -x %1 ] && %1 -c "import sysconfig as s; print(s.get_config_var('%2'))" || echo "!!_%1_not_installed_!!") +%_python_sysconfig_path() %([ -x %1 ] && %1 -c "import sysconfig as s; print(s.get_paths().get('%2'))" || echo "!!_{%1}_not_installed_!!") +%_python_sysconfig_var() %([ -x %1 ] && %1 -c "import sysconfig as s; print(s.get_config_var('%2'))" || echo "!!_{%1}_not_installed_!!") %_rec_macro_helper %{lua: rpm.define("_rec_macro_helper %{nil}") @@ -45,7 +45,8 @@ %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 +# this is by convention hardcoded python2 +%py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND) ##### Python dependency generator macros ##### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-rpm-macros-20220618.1ed0055/macros.lua new/python-rpm-macros-20220725.2ae32d5/macros.lua --- old/python-rpm-macros-20220618.1ed0055/macros.lua 2022-06-18 21:58:46.000000000 +0200 +++ new/python-rpm-macros-20220725.2ae32d5/macros.lua 2022-07-25 23:26:46.000000000 +0200 @@ -489,6 +489,11 @@ local buildroot = rpm.expand("%{buildroot}") if link:startswith(buildroot) then link = link:sub(buildroot:len() + 1) end print(rpm.expand(string.format("%%{prepare_alternative -t %s %s}\n", link, name))) + if rpm.expand("%{with libalternatives}") == "1" then + for _, python in ipairs(pythons) do + python_install_libalternative(python, link) + end + end end end