public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-admin/syslog-summary/, app-admin/syslog-summary/files/
@ 2019-11-12  5:36 Joonas Niilola
  0 siblings, 0 replies; 3+ messages in thread
From: Joonas Niilola @ 2019-11-12  5:36 UTC (permalink / raw
  To: gentoo-commits

commit:     6118d6de5092f48f2cae7a2d380e1caef78ab8e0
Author:     Paul Healy <lmiphay <AT> gmail <DOT> com>
AuthorDate: Mon Oct 28 14:19:39 2019 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Tue Nov 12 05:25:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6118d6de

app-admin/syslog-summary: fix adjacent line ignore

fix for not ignoring a second line when two lines which should be
ignored come together - backport fix from:

  https://github.com/dpaleino/syslog-summary/pull/1/files

switch to EAPI 7

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

 .../syslog-summary-1.14-fix-ignore-code.patch      | 12 ++++++
 .../syslog-summary/syslog-summary-1.14-r3.ebuild   | 49 ++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/app-admin/syslog-summary/files/syslog-summary-1.14-fix-ignore-code.patch b/app-admin/syslog-summary/files/syslog-summary-1.14-fix-ignore-code.patch
new file mode 100644
index 00000000000..b66a0ad51ce
--- /dev/null
+++ b/app-admin/syslog-summary/files/syslog-summary-1.14-fix-ignore-code.patch
@@ -0,0 +1,12 @@
+diff --git a/syslog-summary b/syslog-summary
+index abf6381..65608cb 100755
+--- a/syslog-summary
++++ b/syslog-summary
+@@ -198,6 +198,7 @@ def summarize(filename, states):
+ 			if DEBUG:
+ 				print "Ignoring: %s" % line
+ 			line = file.readline()
++			continue
+ 		
+ 		date, rest = split_date(line)
+ 		if date:

diff --git a/app-admin/syslog-summary/syslog-summary-1.14-r3.ebuild b/app-admin/syslog-summary/syslog-summary-1.14-r3.ebuild
new file mode 100644
index 00000000000..75c1c04b246
--- /dev/null
+++ b/app-admin/syslog-summary/syslog-summary-1.14-r3.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2019 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" )
+
+src_prepare() {
+	python_fix_shebang -f syslog-summary
+
+	sed -i -e 's:python-magic:sys-apps/file[python]:' "syslog-summary" || die
+
+	# 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
+}
+
+pkg_postinst() {
+	elog "install sys-apps/file[python] to enable processing"
+	elog "of gzip compressed logfiles"
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-admin/syslog-summary/, app-admin/syslog-summary/files/
@ 2020-06-28 10:41 Joonas Niilola
  0 siblings, 0 replies; 3+ messages in thread
From: Joonas Niilola @ 2020-06-28 10:41 UTC (permalink / raw
  To: gentoo-commits

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
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-admin/syslog-summary/, app-admin/syslog-summary/files/
@ 2020-08-31 17:16 Aaron Bauman
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Bauman @ 2020-08-31 17:16 UTC (permalink / raw
  To: gentoo-commits

commit:     fc2ed88084be5fa1595ab7562f1eb6ef8475e5b6
Author:     Paul Healy <lmiphay <AT> gmail <DOT> com>
AuthorDate: Mon Aug 31 09:10:39 2020 +0000
Commit:     Aaron Bauman <bman <AT> gentoo <DOT> org>
CommitDate: Mon Aug 31 17:15:47 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc2ed880

app-admin/syslog-summary: port to py3

Backport upstream py3 PR https://github.com/dpaleino/syslog-summary/pull/4
Remove py2 support

Bug: https://bugs.gentoo.org/735202
Signed-off-by: Paul Healy <lmiphay <AT> gmail.com>
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>

 .../files/syslog-summary-1.14-py3.patch            | 142 +++++++++++++++++++++
 .../syslog-summary/syslog-summary-1.14-r5.ebuild   |  46 +++++++
 2 files changed, 188 insertions(+)

diff --git a/app-admin/syslog-summary/files/syslog-summary-1.14-py3.patch b/app-admin/syslog-summary/files/syslog-summary-1.14-py3.patch
new file mode 100644
index 00000000000..945c7ce290b
--- /dev/null
+++ b/app-admin/syslog-summary/files/syslog-summary-1.14-py3.patch
@@ -0,0 +1,142 @@
+diff --git a/syslog-summary b/syslog-summary
+index abf6381..a658c14 100755
+--- a/syslog-summary
++++ b/syslog-summary
+@@ -35,6 +35,8 @@ Lars Wirzenius <liw@iki.fi>
+ Tommi Virtanen <tv@debian.org>
+ David Paleino <d.paleino@gmail.com>"""
+ 
++from __future__ import print_function
++
+ version = "1.14"
+ 
+ import sys, re, getopt, string
+@@ -62,7 +64,7 @@ def io_error(err, filename, die=True):
+ 		if die:
+ 			traceback.print_exc(file=sys.stderr)
+ 		else:
+-			print "[E] %s [%s(%s) - %s]" % (os.strerror(num), errno.errorcode[num], num, filename)
++			print("[E] %s [%s(%s) - %s]" % (os.strerror(num), errno.errorcode[num], num, filename))
+ 
+ 	if die:
+ 		sys.exit(1)
+@@ -72,7 +74,7 @@ def read_patterns(filename):
+ 	pats = []
+ 	try:
+ 		f = open(filename, "r")
+-	except IOError, e:
++	except IOError as e:
+ 		io_error(e, filename, False)
+ 		return []
+ 	for line in f:
+@@ -91,7 +93,7 @@ def read_states(filename):
+ 		return states
+ 	try:
+ 		f = open(filename, "r")
+-	except IOError, e:
++	except IOError as e:
+ 		io_error(e, filename, False)
+ 		return states
+ 	for line in f:
+@@ -105,9 +107,9 @@ def save_states(filename, states):
+ 		return
+ 	try:
+ 		f = open(filename, "w")
+-	except IOError, e:
++	except IOError as e:
+ 		io_error(e, filename, True)
+-	for filename in states.keys():
++	for filename in list(states.keys()):
+ 		value = states[filename]
+ 		f.write("%s %d %s\n" % (filename, value[0], value[1]))
+ 	f.close()
+@@ -123,7 +125,7 @@ def split_date(line):
+ 		m = pat.match(line)
+ 		if m:
+ 			return line[:m.end()], line[m.end():]
+-	print "line has bad date", "<" + string.rstrip(line) + ">"
++	print("line has bad date", "<" + string.rstrip(line) + ">")
+ 	return None, line
+ 
+ def is_gzipped(filename):
+@@ -152,7 +154,7 @@ def summarize(filename, states):
+ 	order = []
+ 	ignored_count = 0
+ 	if not QUIET:
+-		print "Summarizing %s" % filename
++		print("Summarizing %s" % filename)
+ 	
+ 	# If the file is a gzipped log, open it
+ 	# using the proper function from the gzip
+@@ -162,7 +164,7 @@ def summarize(filename, states):
+ 			file = gzopen(filename, "rb")
+ 		else:
+ 			file = open(filename, "r")
+-	except IOError, e:
++	except IOError as e:
+ 		io_error(e, filename, True)
+ 		
+ 	linecount = 0
+@@ -170,7 +172,7 @@ def summarize(filename, states):
+ 	shaobj = sha1()
+ 	if filename in states:
+ 		oldlines, oldsha = states[filename]
+-		for i in xrange(oldlines):
++		for i in range(oldlines):
+ 			line = file.readline()
+ 			shaobj.update(line)
+ #		print "OLD-new: %s" % shaobj.hexdigest()
+@@ -182,7 +184,7 @@ def summarize(filename, states):
+ 		else:
+ 			linecount = oldlines
+ 	if not QUIET:
+-		print "%8d Lines skipped (already processed)" % linecount
++		print("%8d Lines skipped (already processed)" % linecount)
+ 
+ 	line = file.readline()
+ 	previous = None
+@@ -190,13 +192,13 @@ def summarize(filename, states):
+ 	foo=0
+ 	while line:
+ #		foo+=1
+-		shaobj.update(line)
++		shaobj.update(line.encode())
+ 		linecount += 1
+ 		
+ 		if should_be_ignored(line):
+ 			ignored_count += 1
+ 			if DEBUG:
+-				print "Ignoring: %s" % line
++				print("Ignoring: %s" % line)
+ 			line = file.readline()
+ 		
+ 		date, rest = split_date(line)
+@@ -213,7 +215,7 @@ def summarize(filename, states):
+ 			count = int(repeated.group(1))
+ 			rest = previous
+ 
+-		if counts.has_key(rest):
++		if rest in counts:
+ 			counts[rest] = counts[rest] + count
+ 		else:
+ 			assert count == 1
+@@ -233,14 +235,14 @@ def summarize(filename, states):
+ #	print states
+ 	
+ 	if QUIET and order:
+-		print "Summarizing %s" % filename
++		print("Summarizing %s" % filename)
+ 	if not QUIET or order:
+-		print "%8d Patterns to ignore" % len(ignore_pats)
+-		print "%8d Ignored lines" % ignored_count
++		print("%8d Patterns to ignore" % len(ignore_pats))
++		print("%8d Ignored lines" % ignored_count)
+ 	for rest in order:
+-		print "%8d %s" % (counts[rest], rest),
++		print("%8d %s" % (counts[rest], rest), end='')
+ 	if not QUIET or order:
+-		print
++		print()
+ 
+ def main():
+ 	global ignore_pats, IGNORE_FILENAME, STATE_FILENAME, REPEAT, QUIET, DEBUG

diff --git a/app-admin/syslog-summary/syslog-summary-1.14-r5.ebuild b/app-admin/syslog-summary/syslog-summary-1.14-r5.ebuild
new file mode 100644
index 00000000000..e34fa9528f0
--- /dev/null
+++ b/app-admin/syslog-summary/syslog-summary-1.14-r5.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8} )
+
+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" \
+	"${FILESDIR}/${P}-py3.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
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-31 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-31 17:16 [gentoo-commits] repo/gentoo:master commit in: app-admin/syslog-summary/, app-admin/syslog-summary/files/ Aaron Bauman
  -- strict thread matches above, loose matches on Subject: below --
2020-06-28 10:41 Joonas Niilola
2019-11-12  5:36 Joonas Niilola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox