From d6aa896d2195da682f1d2fccfd098b1a14e6f6f1 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Sat, 30 Dec 2017 12:22:04 -0700 Subject: [PATCH] Add upstream patch to fix buildroot issue --- ...0966c503b0bc940c119d9a0adafb9ccf50d4.patch | 39 +++++++++++++++++++ fail2ban.spec | 9 ++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 eac80966c503b0bc940c119d9a0adafb9ccf50d4.patch diff --git a/eac80966c503b0bc940c119d9a0adafb9ccf50d4.patch b/eac80966c503b0bc940c119d9a0adafb9ccf50d4.patch new file mode 100644 index 0000000..269ba80 --- /dev/null +++ b/eac80966c503b0bc940c119d9a0adafb9ccf50d4.patch @@ -0,0 +1,39 @@ +From eac80966c503b0bc940c119d9a0adafb9ccf50d4 Mon Sep 17 00:00:00 2001 +From: sebres +Date: Fri, 24 Nov 2017 12:54:45 +0100 +Subject: [PATCH] Fix scripts-root within `fail2ban.service` (relative install + root-base directory). This is amend for + e3b061e94b54067525c5e7f2ac716d1c838c9f20. Closes gh-1964 + +--- + setup.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index 11748778b..5dbd5b1ae 100755 +--- a/setup.py ++++ b/setup.py +@@ -88,7 +88,13 @@ def get_outputs(self): + + def update_scripts(self, dry_run=False): + buildroot = os.path.dirname(self.build_dir) +- print('Creating %s/fail2ban.service (from fail2ban.service.in): @BINDIR@ -> %s' % (buildroot, self.install_dir)) ++ try: ++ root = self.distribution.command_options['install']['root'][1] ++ if self.install_dir.startswith(root): ++ install_dir = self.install_dir[len(root):] ++ except: # pragma: no cover ++ print('WARNING: Cannot find root-base option, check the bin-path to fail2ban-scripts in "fail2ban.service".') ++ print('Creating %s/fail2ban.service (from fail2ban.service.in): @BINDIR@ -> %s' % (buildroot, install_dir)) + with open(os.path.join(source_dir, 'files/fail2ban.service.in'), 'r') as fn: + lines = fn.readlines() + fn = None +@@ -96,7 +102,7 @@ def update_scripts(self, dry_run=False): + fn = open(os.path.join(buildroot, 'fail2ban.service'), 'w') + try: + for ln in lines: +- ln = re.sub(r'@BINDIR@', lambda v: self.install_dir, ln) ++ ln = re.sub(r'@BINDIR@', lambda v: install_dir, ln) + if dry_run: + sys.stdout.write(' | ' + ln) + continue diff --git a/fail2ban.spec b/fail2ban.spec index f13dba9..d51d2a8 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,10 +1,13 @@ Summary: Daemon to ban hosts that cause multiple authentication errors Name: fail2ban Version: 0.10.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://fail2ban.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Fix buildroot issue +# https://github.com/fail2ban/fail2ban/issues/1964 +Patch0: https://github.com/fail2ban/fail2ban/commit/eac80966c503b0bc940c119d9a0adafb9ccf50d4.patch #Source0: https://github.com/sebres/%{name}/archive/f2b-perfom-prepare-716-cs.tar.gz#/%{name}-test.tar.gz # Give up being PartOf iptables for now # https://bugzilla.redhat.com/show_bug.cgi?id=1379141 @@ -156,6 +159,7 @@ by default. %prep %setup -q +%patch0 -p1 %patch2 -p1 -b .partof %patch3 -p1 -b .sendmail # Use Fedora paths @@ -298,6 +302,9 @@ fi %changelog +* Sat Dec 30 2017 Orion Poplawski - 0.10.1-2 +- Add upstream patch to fix buildroot issue + * Tue Nov 14 2017 Orion Poplawski - 0.10.1-1 - Update to 0.10.1