From 0590ab64769db0d2c534d7cdf667bf15878c6feccb05e3e1869538988cc9bd7a Mon Sep 17 00:00:00 2001 From: Peter Wullinger Date: Tue, 19 May 2020 12:03:28 +0000 Subject: [PATCH 1/3] Accepting request 807257 from home:pwcau:branches:server:mail - pre-require bash for pretrans OBS-URL: https://build.opensuse.org/request/show/807257 OBS-URL: https://build.opensuse.org/package/show/server:mail/exim?expand=0&rev=236 --- exim.changes | 3 +++ exim.spec | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/exim.changes b/exim.changes index 6cdf701..e088da0 100644 --- a/exim.changes +++ b/exim.changes @@ -1,3 +1,6 @@ +Tue May 19 13:47:05 CEST 2020 - wullinger@rz.uni-kiel.de +- pre-require bash for pretrans +------------------------------------------------------------------- Tue May 12 08:19:17 UTC 2020 - wullinger@rz.uni-kiel.de - bring changes from current in +fixes branch (patch-exim-fixes-ee83de04d3087efaf808d1f2235a988275c2ee94) diff --git a/exim.spec b/exim.spec index b225aa7..c51ee0c 100644 --- a/exim.spec +++ b/exim.spec @@ -71,9 +71,10 @@ Requires(pre): user(mail) Requires(pre): group(mail) %endif Requires(pre): fileutils textutils +Requires(pre): bash %endif Version: 4.93.0.4 -Release: 3 +Release: 4 %if %{with_mysql} BuildRequires: mysql-devel %endif From 7ea074a84c2b670b3059597a27baab86994510f5f01f3f89e692c580333f06ee Mon Sep 17 00:00:00 2001 From: Peter Wullinger Date: Tue, 19 May 2020 12:51:17 +0000 Subject: [PATCH 2/3] Accepting request 807311 from home:pwcau:branches:server:mail - switch pretrans to use lua (fixes bsc#1171877) OBS-URL: https://build.opensuse.org/request/show/807311 OBS-URL: https://build.opensuse.org/package/show/server:mail/exim?expand=0&rev=237 --- exim.changes | 4 +++- exim.spec | 34 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/exim.changes b/exim.changes index e088da0..1ccd680 100644 --- a/exim.changes +++ b/exim.changes @@ -1,5 +1,7 @@ Tue May 19 13:47:05 CEST 2020 - wullinger@rz.uni-kiel.de -- pre-require bash for pretrans +- switch pretrans to use lua + (fixes bsc#1171877) + ------------------------------------------------------------------- Tue May 12 08:19:17 UTC 2020 - wullinger@rz.uni-kiel.de - bring changes from current in +fixes branch diff --git a/exim.spec b/exim.spec index c51ee0c..4ee09d5 100644 --- a/exim.spec +++ b/exim.spec @@ -71,7 +71,6 @@ Requires(pre): user(mail) Requires(pre): group(mail) %endif Requires(pre): fileutils textutils -Requires(pre): bash %endif Version: 4.93.0.4 Release: 4 @@ -383,20 +382,25 @@ install -m 0755 $RPM_SOURCE_DIR/eximstats-html-update.py $RPM_BUILD_ROOT/%{_sbin # apparmor profile install -D -m 0644 $RPM_SOURCE_DIR/apparmor.usr.sbin.exim $RPM_BUILD_ROOT/usr/share/apparmor/extra-profiles/usr.sbin.exim -%pretrans -if [ -d "%{_docdir}/%{name}/doc/cve-2019-13917" ]; then - moved_suffix="" - moved_index="" - while [ -d "%{_docdir}/%{name}/doc/cve-2019-13917.rpmmoved${moved_suffix}${moved_index}" ]; do - if [ -z "${moved_suffix}" ]; then - moved_suffix="." - moved_index="0" - else - moved_index=$((${moved_index} + 1)) - fi - done - mv "%{_docdir}/%{name}/doc/cve-2019-13917" "%{_docdir}/%{name}/doc/cve-2019-13917.rpmmoved${moved_suffix}${moved_index}" -fi +%pretrans -p +docdir = rpm.expand('%{_docdir}') +pkgname = rpm.expand('%{name}') +path = docdir .. '/' .. pkgname .. '/doc/cve-2019-13917' +st_path = posix.stat(path) +if st_path then + moved_path = path .. '.rpmmoved' + status = os.rename(path, moved_path) + if not status then + moved_index = 0 + moved_path = path .. '.rpmmoved.' .. moved_index + status = os.rename(path, moved_path) + while not status do + moved_index = moved_index + 1 + moved_path = path .. '.rpmmoved.' .. moved_index + status = os.rename(path, moved_path) + end + end +end %pre %if 0%{?suse_version} > 1220 From 5b11e9cbf8e92c8d5f96fcc6571004ed9f4a53dde412bc2ffb6986a916ab3314 Mon Sep 17 00:00:00 2001 From: Peter Wullinger Date: Wed, 20 May 2020 11:08:36 +0000 Subject: [PATCH 3/3] Accepting request 807582 from home:pwcau:branches:server:mail cleanup pretrans lua. Instead of re-inventing the wheel, use the suggested pretrans from fedora: https://fedoraproject.org/wiki/Packaging:Directory_Replacement#Scriptlet_to_replace_a_directory OBS-URL: https://build.opensuse.org/request/show/807582 OBS-URL: https://build.opensuse.org/package/show/server:mail/exim?expand=0&rev=238 --- exim.spec | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/exim.spec b/exim.spec index 4ee09d5..42b17c7 100644 --- a/exim.spec +++ b/exim.spec @@ -386,20 +386,17 @@ install -D -m 0644 $RPM_SOURCE_DIR/apparmor.usr.sbin.exim $RPM_BUILD_ROOT/usr/sh docdir = rpm.expand('%{_docdir}') pkgname = rpm.expand('%{name}') path = docdir .. '/' .. pkgname .. '/doc/cve-2019-13917' -st_path = posix.stat(path) -if st_path then - moved_path = path .. '.rpmmoved' - status = os.rename(path, moved_path) - if not status then - moved_index = 0 - moved_path = path .. '.rpmmoved.' .. moved_index - status = os.rename(path, moved_path) - while not status do - moved_index = moved_index + 1 - moved_path = path .. '.rpmmoved.' .. moved_index - status = os.rename(path, moved_path) - end +st = posix.stat(path) +if st and st.type == "directory" then + status = os.rename(path, path .. ".rpmmoved") + if not status then + suffix = 0 + while not status do + suffix = suffix + 1 + status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix) end + os.rename(path, path .. ".rpmmoved") + end end %pre