app-portage/elogviewer: Revision bump 3.0, add patch
authorBrian Dolbec <dolsen@gentoo.org>
Sat, 9 May 2020 03:46:35 +0000 (20:46 -0700)
committerBrian Dolbec <dolsen@gentoo.org>
Sat, 9 May 2020 03:48:38 +0000 (20:48 -0700)
Add a patch to fix a HeaderState.parse segfault for a newer line format
Bug: https://bugs.gentoo.org/721522

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
app-portage/elogviewer/elogviewer-3.0-r2.ebuild [new file with mode: 0644]
app-portage/elogviewer/files/elogviewer-3.0-segfault.patch [new file with mode: 0644]

diff --git a/app-portage/elogviewer/elogviewer-3.0-r2.ebuild b/app-portage/elogviewer/elogviewer-3.0-r2.ebuild
new file mode 100644 (file)
index 0000000..f733ba8
--- /dev/null
@@ -0,0 +1,69 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+DISABLE_AUTOFORMATTING=true
+
+inherit desktop python-single-r1 readme.gentoo-r1
+
+DESCRIPTION="Elog viewer for Gentoo"
+HOMEPAGE="https://sourceforge.net/projects/elogviewer"
+SRC_URI="https://github.com/Synss/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+       $(python_gen_cond_dep '
+               dev-python/PyQt5[gui,widgets,${PYTHON_MULTI_USEDEP}]
+               >=sys-apps/portage-2.1[${PYTHON_MULTI_USEDEP}]
+       ')
+       $(python_gen_cond_dep 'dev-python/enum34[${PYTHON_MULTI_USEDEP}]' python2_7)
+"
+DEPEND="${RDEPEND}
+       $(python_gen_cond_dep '
+               dev-python/setuptools[${PYTHON_MULTI_USEDEP}]
+       ')
+"
+
+DOC_CONTENTS="In order to use this software, you need to activate
+Portage's elog features.  Required is
+       PORTAGE_ELOG_SYSTEM=\"save\"
+and at least one of
+       PORTAGE_ELOG_CLASSES=\"warn error info log qa\"
+More information on the elog system can be found in
+/usr/share/portage/config/make.conf.example
+
+To operate properly this software needs the directory
+${PORT_LOGDIR:-/var/log/portage}/elog created, belonging to group portage.
+To start the software as a user, add yourself to the portage group."
+
+PATCHES=( "${FILESDIR}/elogviewer-3.0-segfault.patch"
+)
+
+src_compile() {
+       rm -f Makefile
+}
+
+src_install() {
+       python_newscript elogviewer.py elogviewer
+
+       make_desktop_entry ${PN} ${PN} ${PN} System
+
+       doman elogviewer.1
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+
+       ewarn "The elogviewer's configuration file is now saved in:"
+       ewarn "~/.config/elogviewer/ (was ~/.config/Mathias\ Laurin/)."
+       ewarn "Please migrate any user specific settings to the new config file."
+}
diff --git a/app-portage/elogviewer/files/elogviewer-3.0-segfault.patch b/app-portage/elogviewer/files/elogviewer-3.0-segfault.patch
new file mode 100644 (file)
index 0000000..cc67a0d
--- /dev/null
@@ -0,0 +1,34 @@
+--- a/elogviewer.py    2020-05-08 20:23:04.419257166 -0700
++++ b/elogviewer.py    2020-05-08 20:23:30.436359552 -0700
+@@ -255,15 +255,22 @@
+         return "</h2>"
+     def parse(self, line):
+-        eclass, stage = line.split(":")
+-        self.context.eclass = {
+-            "ERROR": EClass.Error,
+-            "WARN": EClass.Warning,
+-            "LOG": EClass.Log,
+-            "INFO": EClass.Info,
+-            "QA": EClass.QA,
+-        }[eclass]
+-        return "{}: {}".format(self.context.eclass.name, stage)
++        if not line:
++            return
++        parts = line.split(":")
++        if len(parts) == 2:
++            eclass, stage = parts[0:2]
++            self.context.eclass = {
++                "ERROR": EClass.Error,
++                "WARN": EClass.Warning,
++                "LOG": EClass.Log,
++                "INFO": EClass.Info,
++                "QA": EClass.QA,
++            }[eclass]
++            return "{}: {}".format(self.context.eclass.name, stage)
++        elif len(parts) > 2:
++            # Return an empty string, eclass and stage are populated anyway
++            return "" 
+ class BodyState(AbstractState):