commit:     45a0856880a4292e8592e7dba2b3165c312e0482
Author:     Paul Healy <lmiphay <AT> gmail <DOT> com>
AuthorDate: Sun Jun 21 11:27:35 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sun Jun 28 10:40:58 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45a08568

app-admin/syslog-summary: remove file magic dep

Replace the soft dep on sys-apps/file (magic module) with the existing fallback 
file suffix check
Remove the sys-apps/file[python] suggestion in pkg_postinst

Closes: https://bugs.gentoo.org/722560
Signed-off-by: Paul Healy <lmiphay <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/16360
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../syslog-summary-1.14-remove-file-magic.patch    | 35 ++++++++++++++++++
 .../syslog-summary/syslog-summary-1.14-r4.ebuild   | 42 ++++++++++++++++++++++
 2 files changed, 77 insertions(+)

diff --git 
a/app-admin/syslog-summary/files/syslog-summary-1.14-remove-file-magic.patch 
b/app-admin/syslog-summary/files/syslog-summary-1.14-remove-file-magic.patch
new file mode 100644
index 00000000000..c7a1738b7c8
--- /dev/null
+++ b/app-admin/syslog-summary/files/syslog-summary-1.14-remove-file-magic.patch
@@ -0,0 +1,35 @@
+diff --git a/syslog-summary b/syslog-summary
+index abf6381..b3edffc 100755
+--- a/syslog-summary
++++ b/syslog-summary
+@@ -128,24 +128,12 @@ def split_date(line):
+ 
+ def is_gzipped(filename):
+       """Returns True if the filename is a gzipped compressed file""" 
+-      try:
+-              import magic
+-              ms = magic.open(magic.MAGIC_NONE)
+-              ms.load()
+-              if re.search("^gzip compressed data.*", ms.file(filename)):
+-                      return True
+-              else:
+-                      return False
+-      except:
+-              from os.path import splitext
+-              
+-              if not QUIET:
+-                      print "Using fallback detection... please install 
python-magic for better gzip detection."
+-              
+-              if splitext(filename)[1] == ".gz":
+-                      return True
+-              else:
+-                      return False
++      from os.path import splitext
++
++      if splitext(filename)[1] == ".gz":
++              return True
++      else:
++              return False
+ 
+ def summarize(filename, states):
+       counts = {}

diff --git a/app-admin/syslog-summary/syslog-summary-1.14-r4.ebuild 
b/app-admin/syslog-summary/syslog-summary-1.14-r4.ebuild
new file mode 100644
index 00000000000..1831eb914a2
--- /dev/null
+++ b/app-admin/syslog-summary/syslog-summary-1.14-r4.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-single-r1
+
+DESCRIPTION="Summarizes the contents of a syslog log file"
+HOMEPAGE="https://github.com/dpaleino/syslog-summary";
+SRC_URI="https://github.com/downloads/dpaleino/${PN}/${P}.tar.gz";
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~sparc ~x86"
+IUSE=""
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND=""
+RDEPEND="${PYTHON_DEPS}"
+
+PATCHES=( "${FILESDIR}/${P}-fix-ignore-code.patch" 
"${FILESDIR}/${P}-remove-file-magic.patch" )
+
+src_prepare() {
+       python_fix_shebang -f syslog-summary
+
+       # Sadly, the makefile is useless for us.
+       rm Makefile || die
+
+       default
+}
+
+src_install() {
+       dobin syslog-summary
+       einstalldocs
+       doman syslog-summary.1
+
+       insinto /etc/syslog-summary
+       doins ignore.rules
+}

Reply via email to