Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cobbler for openSUSE:Factory checked in at 2021-02-02 14:24:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cobbler (Old) and /work/SRC/openSUSE:Factory/.cobbler.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cobbler" Tue Feb 2 14:24:57 2021 rev:61 rq:868358 version:3.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/cobbler/cobbler.changes 2020-11-13 19:00:52.206236522 +0100 +++ /work/SRC/openSUSE:Factory/.cobbler.new.28504/cobbler.changes 2021-02-02 14:25:04.275335786 +0100 @@ -1,0 +2,20 @@ +Tue Jan 19 14:08:27 UTC 2021 - Dominik Gedon <dominik.ge...@suse.com> + +- Update spec file to satisfy current rpmbuild (>=4.16) and make + the build on Tumbleweed work again. + +------------------------------------------------------------------- +Tue Jan 19 09:02:43 UTC 2021 - Dominik Gedon <dominik.ge...@suse.com> + +- Update tarball from upstream to remove the .pc quilt folder. + +------------------------------------------------------------------- +Mon Jan 18 13:07:58 UTC 2021 - Dominik Gedon <dominik.ge...@suse.com> + +- Fix string replacement for @@xyz@@ +- Better performing string replacements +- Added: + * better-string-replacement-performance.diff + * fix-string-replacement.diff + +------------------------------------------------------------------- New: ---- better-string-replacement-performance.diff fix-string-replacement.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cobbler.spec ++++++ --- /var/tmp/diff_new_pack.PYEY9p/_old 2021-02-02 14:25:05.299337378 +0100 +++ /var/tmp/diff_new_pack.PYEY9p/_new 2021-02-02 14:25:05.303337384 +0100 @@ -1,4 +1,4 @@ -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -103,7 +103,7 @@ # To ensure correct byte compilation %global __python %{__python3} -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" %global devsuffix dev %else %global devsuffix devel @@ -117,7 +117,7 @@ Summary: Boot server configurator URL: https://cobbler.github.io/ -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" Packager: Cobbler Developers <cobb...@lists.fedorahosted.org> Group: admin %endif @@ -136,6 +136,8 @@ Patch2: load_module_apache_suse_fix.diff Patch3: fix-for-old-str.join-usage.diff Patch4: remove-redundant-json-suffix.diff +Patch5: better-string-replacement-performance.diff +Patch6: fix-string-replacement.diff BuildRequires: git-core BuildRequires: %{system_release_pkg} @@ -143,7 +145,7 @@ %if 0%{?suse_version} BuildRequires: python-rpm-macros %endif -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" BuildRequires: python3-deb-macros BuildRequires: apache2-deb-macros @@ -172,7 +174,7 @@ %if 0%{?fedora} >= 30 || 0%{?rhel} >= 9 || 0%{?suse_version} BuildRequires: systemd-rpm-macros %endif -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" BuildRequires: systemd-deb-macros Requires: systemd-sysv Requires(post): python3-minimal @@ -219,7 +221,7 @@ Recommends: logrotate %endif # https://github.com/cobbler/cobbler/issues/1685 -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" Requires: init-system-helpers %else Requires: /sbin/service @@ -273,6 +275,8 @@ %endif %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 %if 0%{?suse_version} # Set tftpboot location correctly for SUSE distributions @@ -317,13 +321,13 @@ %pre -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" if [ "$1" = "upgrade" ]; then %else if [ $1 -ge 2 ]; then %endif # package upgrade: backup configuration - DATE=$(date "+%Y%m%d-%H%M%S") + DATE=$(date "+%%Y%%m%%d-%%H%%M%%S") if [ ! -d "%{_sharedstatedir}/cobbler/backup/upgrade-${DATE}" ]; then mkdir -p "%{_sharedstatedir}/cobbler/backup/upgrade-${DATE}" fi @@ -337,7 +341,7 @@ fi fi -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" %post %{py3_bytecompile_post %{name}} %{systemd_post cobblerd.service} @@ -377,7 +381,7 @@ %endif %post web -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" # Work around broken attr support # Cf. https://github.com/debbuild/debbuild/issues/160 chown %{apache_user}:%{apache_group} %{_datadir}/cobbler/web @@ -484,7 +488,7 @@ %license COPYING %doc AUTHORS.in README.md %config(noreplace) %{apache_etc}/vhosts.d/cobbler_web.conf -%if %{_vendor} == "debbuild" +%if "%{_vendor}" == "debbuild" # Work around broken attr support # Cf. https://github.com/debbuild/debbuild/issues/160 %{_datadir}/cobbler/web ++++++ better-string-replacement-performance.diff ++++++ diff --git a/cobbler/templar.py b/cobbler/templar.py index aeb161214..ab2beb46f 100644 --- a/cobbler/templar.py +++ b/cobbler/templar.py @@ -24,6 +24,7 @@ from builtins import str from builtins import object +import re import Cheetah import functools import os @@ -139,9 +140,11 @@ def render(self, data_input, search_table, out_path, subject=None, template_type repstr = server search_table["http_server"] = repstr - for x in list(search_table.keys()): - if type(x) == str: - data_out = data_out.replace("@@%s@@" % str(x), str(search_table[str(x)])) + # string replacements for @@xyz@@ in data_out with prior regex lookups of keys + regex = r"@@[a-zA-Z]*@@" + matches = re.finditer(regex, data_out, re.MULTILINE) + for matchNum, match in enumerate(matches, start=1): + data_out = data_out.replace(match.group(), search_table[str(match.group()).strip("@@")]) # remove leading newlines which apparently breaks AutoYAST ? if data_out.startswith("\n"): ++++++ cobbler-3.1.2.obscpio ++++++ /work/SRC/openSUSE:Factory/cobbler/cobbler-3.1.2.obscpio /work/SRC/openSUSE:Factory/.cobbler.new.28504/cobbler-3.1.2.obscpio differ: char 27, line 1 ++++++ cobbler-3.1.2.tar.gz ++++++ /work/SRC/openSUSE:Factory/cobbler/cobbler-3.1.2.tar.gz /work/SRC/openSUSE:Factory/.cobbler.new.28504/cobbler-3.1.2.tar.gz differ: char 12, line 1 ++++++ fix-string-replacement.diff ++++++ Index: cobbler-3.1.2/cobbler/templar.py =================================================================== --- cobbler-3.1.2.orig/cobbler/templar.py +++ cobbler-3.1.2/cobbler/templar.py @@ -141,7 +141,7 @@ class Templar(object): search_table["http_server"] = repstr # string replacements for @@xyz@@ in data_out with prior regex lookups of keys - regex = r"@@[a-zA-Z]*@@" + regex = r"@@[\S]*?@@" matches = re.finditer(regex, data_out, re.MULTILINE) for matchNum, match in enumerate(matches, start=1): data_out = data_out.replace(match.group(), search_table[str(match.group()).strip("@@")]) Index: cobbler-3.1.2/tests/xmlrpcapi/distro_profile_system_test.py =================================================================== --- cobbler-3.1.2.orig/tests/xmlrpcapi/distro_profile_system_test.py +++ cobbler-3.1.2/tests/xmlrpcapi/distro_profile_system_test.py @@ -1157,3 +1157,20 @@ class TestDistroProfileSystem: # Assert --> Let the test pass if the call is okay. assert True + + @pytest.mark.usefixtures("create_testdistro", "create_profile", "remove_testdistro", "remove_testprofile") + def test_render_vars(self, remote, token): + """ + Test: string replacements for @@xyz@@ + """ + + # Arrange --> There is nothing to be arranged + kernel_options = "tree=http://@@http_server@@/cblr/links/@@distro_name@@" + + # Act + distro = remote.get_item_handle("distro", "testdistro0", token) + remote.modify_distro(distro, "kernel_options", kernel_options, token) + remote.save_distro(distro, token) + + # Assert --> Let the test pass if the call is okay. + assert True