aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--MANIFEST.in6
-rw-r--r--Makefile7
-rw-r--r--README6
-rwxr-xr-xelogv31
-rw-r--r--man/elogv.14
-rw-r--r--man/elogv.1.de4
-rw-r--r--man/elogv.1.es4
-rw-r--r--man/elogv.1.it4
-rw-r--r--man/elogv.1.pl4
-rw-r--r--setup.py2
11 files changed, 61 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 921225c..d8645e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
# ChangeLog for elogv
+0.7.6.4
+ * Fix crash when log files with bad names are found, only
+ * Fix crash for PORT_LOGDIR containing ".log" (issue #4)
+
+0.7.6.3
+ * Prevent crash with LC_TIME=ja_JP.UTF-8 (Gentoo bug #464962)
+
+0.7.6.2
+ * Make log filename parsing more robust (Gentoo bug #503904)
+ * Fix locations of make.conf(.example)
+ * Add "make dist" support
+
0.7.6.1
* Fix crash for "TERM=vt100 elogv" invokation (Sebastian Pipping <sebastian@pipping.org>
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..2af5ebb
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,6 @@
+recursive-include man *.1*
+recursive-include po *.po *.pot
+include ChangeLog
+include ChangeLog.old
+include INSTALL
+include Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f340d3c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,7 @@
+PYTHON = python
+
+dist:
+ $(RM) MANIFEST
+ $(PYTHON) setup.py sdist
+
+.PHONY: dist
diff --git a/README b/README
index 79943b8..cd06733 100644
--- a/README
+++ b/README
@@ -30,12 +30,12 @@ Inside the program, you can use these keys:
Note:
To use this software you need the portage elog system configured on your
-/etc/make.conf, this is a simply configuration:
+/etc/portage/make.conf, this is a simply configuration:
----- /etc/make.conf
+---- /etc/portage/make.conf
# Logging
PORTAGE_ELOG_CLASSES="warn error log"
PORTAGE_ELOG_SYSTEM="save"
----
-For other details see /etc/make.conf.example
+For other details see /usr/share/portage/config/make.conf.example
diff --git a/elogv b/elogv
index 7fd3451..8f5ba7c 100755
--- a/elogv
+++ b/elogv
@@ -1,4 +1,5 @@
#!/usr/bin/python
+# -*- coding: UTF-8 -*-
# Author: Luca Marturana (luca89) <lucamarturana@gmail.com>
# This program is free software; you can redistribute it and/or modify
@@ -149,6 +150,16 @@ class CannotOpenElogdir(Exception):
def __init__(self):
pass
+def date2str(d):
+ u = d.strftime(date_format).decode(locale.getlocale()[1])
+ try:
+ u.encode('ascii')
+ except UnicodeEncodeError:
+ # Prevent crash locales like ja_JP.UTF-8, e.g. "2014年10月24日"
+ # https://bugs.gentoo.org/show_bug.cgi?id=464962
+ u = u.encode('ascii', errors='replace').decode('ascii')
+ return u
+
# Main class (called with curses.wrapper later)
class ElogViewer:
def __init__(self, screen):
@@ -337,13 +348,13 @@ class ElogViewer:
class_char,
curses.A_BOLD + curses.color_pair(prev_pkg[CLASS]))
self.file_pad.addstr(prev_usel,3,
- list_format % (prev_pkg[CAT], prev_pkg[PN], prev_pkg[DATE].strftime(date_format) ),
+ list_format % (prev_pkg[CAT], prev_pkg[PN], date2str(prev_pkg[DATE]) ),
curses.color_pair(normal))
self.file_pad.addstr(self.usel,1,
class_char,
curses.A_BOLD + curses.color_pair(pkg[CLASS]))
self.file_pad.addstr(self.usel,3,
- list_format % (pkg[CAT], pkg[PN], pkg[DATE].strftime(date_format) ),
+ list_format % (pkg[CAT], pkg[PN], date2str(pkg[DATE]) ),
curses.color_pair(selected))
first = self.pposy
@@ -400,9 +411,6 @@ class ElogViewer:
except OSError:
raise CannotOpenElogdir()
- if not file_list:
- raise NoLogFiles()
-
# self.packages contains all info extracted from each file, this is the
# structure:
# [ ("filename", "category", "package name", date:datetime_obj, class:int), ... ]
@@ -420,9 +428,11 @@ class ElogViewer:
# then we split the string using as pattern / or : to obtain in any
# case
# ( "x11-themes", "haematite-xcursors", "1.0:20091018-195827.log")
- if not filepath.endswith == ".log":
- tmpfilepath = re.sub('\.log.*$', '.log', filepath)
- (cat,pn,other) = re.split(":|" + os.path.sep, tmpfilepath.replace(elogdir + os.path.sep, "") )
+ tmpfilepath = re.sub('\\.log[^/]*$', '.log', filepath)
+ split_up = re.split(":|" + os.path.sep, tmpfilepath.replace(elogdir + os.path.sep, ""))
+ if len(split_up) < 3:
+ continue
+ (cat, pn, other) = split_up[-3:]
if sys.version_info[:2] >= (2, 5):
date = datetime.strptime(other, "%Y%m%d-%H%M%S.log")
else:
@@ -432,6 +442,9 @@ class ElogViewer:
date = datetime(int(date_str[:4]),int(date_str[4:6]),int(date_str[6:]))
self.packages.append( (filepath, cat, pn, date, self.get_class(filepath)) )
+ if not self.packages:
+ raise NoLogFiles()
+
# Maybe that after removing files self.usel points to a wrong index,
# so this will prevent a crash
if self.usel >= len(self.packages):
@@ -468,7 +481,7 @@ class ElogViewer:
class_char,
curses.A_BOLD + curses.color_pair(pkg[CLASS]))
self.file_pad.addstr(i,3,
- list_format % (pkg[CAT], pkg[PN], pkg[DATE].strftime(date_format) ),
+ list_format % (pkg[CAT], pkg[PN], date2str(pkg[DATE]) ),
curses.color_pair(cp))
def get_class(self,filepath):
diff --git a/man/elogv.1 b/man/elogv.1
index 8e6bbdf..7e5e63d 100644
--- a/man/elogv.1
+++ b/man/elogv.1
@@ -70,14 +70,14 @@ starts a search prompt, write a string and will be showed the next package that
quit
.SH NOTES
To use this software you need the portage elog system configured on your
-/etc/make.conf, this is a simply configuration:
+/etc/portage/make.conf, this is a simply configuration:
.nf
# Logging
PORTAGE_ELOG_CLASSES="warn error log"
PORTAGE_ELOG_SYSTEM="save"
.TP
-For other details see /etc/make.conf.example
+For other details see /usr/share/portage/config/make.conf.example
.SH "REPORTING BUGS"
Report your bugs to our GitHub tracker:
.P
diff --git a/man/elogv.1.de b/man/elogv.1.de
index 8b5b389..e17b00e 100644
--- a/man/elogv.1.de
+++ b/man/elogv.1.de
@@ -69,14 +69,14 @@ Schlieen
.SH Hinweise
Um diese Software nutzen zu knnen, mssen Sie das elog-System von
Portage eingerichtet haben. Die Minimalkonfiguration in
-/etc/make.conf ist:
+/etc/portage/make.conf ist:
.nf
# Logging
PORTAGE_ELOG_CLASSES="warn error log"
PORTAGE_ELOG_SYSTEM="save"
.TP
-Details finden sich in /etc/make.conf.example
+Details finden sich in /usr/share/portage/config/make.conf.example
.SH "REPORTING BUGS"
Fehlerberichte (auf Englisch) bitte unter folgender URL melden:
.P
diff --git a/man/elogv.1.es b/man/elogv.1.es
index b739b62..7aa3e06 100644
--- a/man/elogv.1.es
+++ b/man/elogv.1.es
@@ -68,14 +68,14 @@ Iniciar una operacin de bsqueda. Escriba una cadena de texto y se mostrar el
.B q
Salir
.SH NOTAS
-Para utilizar este software, usted necesita tener configurado el sistema de elog de Portage en su fichero /etc/make.conf. Esta es una configuracin sencilla:
+Para utilizar este software, usted necesita tener configurado el sistema de elog de Portage en su fichero /etc/portage/make.conf. Esta es una configuracin sencilla:
.nf
# Logging
PORTAGE_ELOG_CLASSES="warn error log"
PORTAGE_ELOG_SYSTEM="save"
.TP
-Para otros detalles, vea el fichero /etc/make.conf.example
+Para otros detalles, vea el fichero /usr/share/portage/config/make.conf.example
.SH "INFORMANDO DE ERRORES"
Informe de los errores en GitHub:
.P
diff --git a/man/elogv.1.it b/man/elogv.1.it
index e69aee8..bec5c18 100644
--- a/man/elogv.1.it
+++ b/man/elogv.1.it
@@ -73,14 +73,14 @@ verso il file successivo che contiene la stringa, per uscire premere ESC
Esce da elogv
.SH NOTES
Per usare questo software è necessario avere il sistema elog di portage
-configurato nel proprio /etc/make.conf, ecco un esempio:
+configurato nel proprio /etc/portage/make.conf, ecco un esempio:
.nf
# Logging
PORTAGE_ELOG_CLASSES="warn error log"
PORTAGE_ELOG_SYSTEM="save"
.TP
-Per altre informazioni dare un'occhiata a /etc/make.conf.example
+Per altre informazioni dare un'occhiata a /usr/share/portage/config/make.conf.example
.SH "REPORTING BUGS"
Segnalare eventuali malfunzionamenti sul tracker di GitHub:
.P
diff --git a/man/elogv.1.pl b/man/elogv.1.pl
index 5dc5276..fee8f4e 100644
--- a/man/elogv.1.pl
+++ b/man/elogv.1.pl
@@ -68,14 +68,14 @@ włącza tryb wyszukiwania, wpisz ciąg znaków, a zostanie wybrany następny pa
.B q
wyjście
.SH UWAGI
-Aby używać tego programu, musisz skonfigurować system elog w /etc/make.conf, oto przykładowa konfiguracja:
+Aby używać tego programu, musisz skonfigurować system elog w /etc/portage/make.conf, oto przykładowa konfiguracja:
.nf
# Logowanie
PORTAGE_ELOG_CLASSES="warn error log"
PORTAGE_ELOG_SYSTEM="save"
.TP
-Więcej informacji znajduje się w /etc/make.conf.example
+Więcej informacji znajduje się w /usr/share/portage/config/make.conf.example
.SH "ZGŁASZANIE BŁĘDÓW"
Błędy proszę zgłaszać w języku angielskim do naszego serwisu raportowania błędów:
diff --git a/setup.py b/setup.py
index d384a70..5f83514 100644
--- a/setup.py
+++ b/setup.py
@@ -244,7 +244,7 @@ class install_manpages(Command):
man_pages=glob("man/*")
setup(name="elogv",
- version="0.7.6.1",
+ version="0.7.6.4",
author="Luca Marturana",
author_email="lucamarturana@gmail.com",
license="GPL-2",