LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 10-09-2020, 03:31 PM   #1
unassailable
Member
 
Registered: May 2012
Distribution: gentoo, debian, qubes, openELEC
Posts: 42

Rep: Reputation: 2
Portage Logging System Inconsistencies


As far as I know, portage logging has never worked correctly on any of my systems (and I'm not alone). While trying to diagnose the issue, I noticed that there is conflicting information on various Gentoo wikis regarding the proper setup and execution of elog. Further examining the scripts show inconsistencies as well. I hope to get some input from the community, and devs, to help clear everything up on the wikis and get some patches pushed through.

For example, I have make.conf configured
Code:
FEATURES=""

PORTAGE_TMPDIR="/var/tmp"
DISTDIR="/var/gentoo/distfiles"
PORTDIR=/usr/portage # depreciated?
#PORTDIR_OVERLAY=/usr/local/portage # depreciated?
#PKGDIR=${PORTDIR}/packages # depreciated?
PORTAGE_LOGDIR="/var/log/portage" 
PORT_LOGDIR="/var/log/portage" # depreciated?
PORTAGE_NICENESS=19
AUTOCLEAN="yes"

PORTAGE_ELOG_CLASSES="*"
PORTAGE_ELOG_SYSTEM="save"
#PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '\${PACKAGE}' -f '\${LOGFILE}'"
#PORTAGE_ELOG_MAILFROM="portage@some.domain"
#PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}"
and portage has the following features
Code:
# emerge --info|grep ^FEATURES=
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified
distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news
parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms
split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox
usersync xattr"
Emerging a package
Code:
# emerge -av www-client/firefox-bin
results in three log files
Code:
# ls /var/log/portage/
www-client:firefox-bin-81.0.1-r1:20201009-170046.log
www-client:firefox-bin-81.0.1-r1:20201009-170058.log

# ls /var/log/portage/elog/www-client/
firefox-bin-81.0.1-r1:20201009-170100.log
and eread sees nothing
Code:
# eread
No log items to read
Because I have FEATURES="split-elog" set, I expect the three logs to be placed in /var/log/portage/www-client and eread to detect and display those logs.


PORT_LOGDIR or PORTAGE_LOGDIR
The x86 Handbook suggests that PORT_LOGDIR is the correct variable to set in make.conf.
Quote:
Portage can create per-ebuild log files, but only when the PORT_LOGDIR variable is set to a location that is writable by Portage (through the Portage user). By default this variable is unset. If PORT_LOGDIR is not set, then there will not be any build logs with the current logging system, though users may receive some logs from the new elog support.
The Portage log wiki says
Quote:
Until Portage version 2.3.53, PORTAGE_LOGDIR variable used to be named PORT_LOGDIR. This old name is now deprecated.
The python module responsible for saving logs uses PORTAGE_LOGDIR
Code:
# cat /usr/lib/python3.7/site-packages/portage/elog/mod_save.py
import errno
import io
import time
import portage
from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
from portage.data import portage_gid, portage_uid
from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
from portage.util import apply_permissions, ensure_dirs, normalize_path

def process(mysettings, key, logentries, fulltext):

	if mysettings.get("PORTAGE_LOGDIR"):I hope to get some input from the community, and devs, to help clear everything up on the wikis
		logdir = normalize_path(mysettings["PORTAGE_LOGDIR"])
	else:
		logdir = os.path.join(os.sep, mysettings["EPREFIX"].lstrip(os.sep),
			"var", "log", "portage")
And the eread script, part of app-portage/gentoolkit, uses PORT_LOGDIR
Code:
# cat /usr/bin/eread
#!/bin/bash

# This is a script to read portage log items from einfo, ewarn etc, new in the
# portage-2.1 series.
#
# Author: Donnie Berkholz <spyderous@gentoo.org>
# Updated by: Uwe Klosa <uwe.klosa@gmail.com>
# Updated by: Slawomir Nizio <slawomir.nizio@sabayon.org>

# Get prefix
EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}

# set decent PATH for bug 172969

PATH=${EPREFIX}/usr/bin:${EPREFIX}/bin:${PATH}

# Set ELOGDIR
PORT_LOGDIR="$(portageq envvar PORT_LOGDIR)"
[ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="${EPREFIX}/var/log/portage"
ELOGDIR="$PORT_LOGDIR/elog"
It is clear to me that after portage-2.3.53 PORTAGE_LOGDIR should be used, so the x86 Handbook and gentoolkit should be updated?

Why three logs?
The first log appears to be a merge (?) log
Code:
cat /var/log/portage/www-client\:firefox-bin-81.0.1-r1\:20201009-170046.log 
 * Package:    www-client/firefox-bin-81.0.1-r1
 * Repository: gentoo
 * Maintainer: tripolar@gmx.at mozilla@gentoo.org,proxy-maint@gentoo.org
 * USE:        abi_x86_64 alsa amd64 elibc_glibc ffmpeg gmp-autoupdate kernel_linux pulseaudio userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
>>> Source unpacked in /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/work
>>> Preparing source in /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/work/firefox-bin-81.0.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/work/firefox-bin-81.0.1 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/work/firefox-bin-81.0.1 ...
>>> Source compiled.
>>> Test phase [not enabled]: www-client/firefox-bin-81.0.1-r1

>>> Install www-client/firefox-bin-81.0.1-r1 into /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/image
>>> Unpacking firefox-bin_x86_64-81.0.1.tar.bz2 to /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/image/opt
>>> Completed installing www-client/firefox-bin-81.0.1-r1 into /var/tmp/portage/www-client/firefox-bin-81.0.1-r1/image

 * Final size of build directory:     12 KiB
 * Final size of installed tree:  212864 KiB (207.8 MiB)

 * checking 71 files for package collisions
>>> Merging www-client/firefox-bin-81.0.1-r1 to /
--- /opt/
--- /opt/firefox/
>>> /opt/firefox/update-settings.ini
>>> /opt/firefox/libnssckbi.so
>>> /opt/firefox/libnss3.so
>>> /opt/firefox/libmozavutil.so
>>> /opt/firefox/libmozwayland.so
--- /opt/firefox/icons/
>>> /opt/firefox/icons/updater.png
>>> /opt/firefox/libnssutil3.so
>>> /opt/firefox/crashreporter
>>> /opt/firefox/libxul.so.sig
>>> /opt/firefox/firefox
>>> /opt/firefox/libplc4.so
>>> /opt/firefox/precomplete
--- /opt/firefox/browser/
--- /opt/firefox/browser/features/
>>> /opt/firefox/browser/features/doh-rollout@mozilla.org.xpi
>>> /opt/firefox/browser/features/screenshots@mozilla.org.xpi
>>> /opt/firefox/browser/features/formautofill@mozilla.org.xpi
>>> /opt/firefox/browser/features/webcompat-reporter@mozilla.org.xpi
>>> /opt/firefox/browser/features/webcompat@mozilla.org.xpi
>>> /opt/firefox/browser/crashreporter-override.ini
--- /opt/firefox/browser/defaults/
--- /opt/firefox/browser/defaults/preferences/
>>> /opt/firefox/browser/defaults/preferences/all-gentoo.js
>>> /opt/firefox/browser/omni.ja
--- /opt/firefox/browser/chrome/
--- /opt/firefox/browser/chrome/icons/
--- /opt/firefox/browser/chrome/icons/default/
>>> /opt/firefox/browser/chrome/icons/default/default64.png
>>> /opt/firefox/browser/chrome/icons/default/default48.png
>>> /opt/firefox/browser/chrome/icons/default/default16.png
>>> /opt/firefox/browser/chrome/icons/default/default128.png
>>> /opt/firefox/browser/chrome/icons/default/default32.png
>>> /opt/firefox/libmozsandbox.so
>>> /opt/firefox/platform.ini
--- /opt/firefox/gtk2/
>>> /opt/firefox/gtk2/libmozgtk.so
--- /opt/firefox/gmp-clearkey/
--- /opt/firefox/gmp-clearkey/0.1/
>>> /opt/firefox/gmp-clearkey/0.1/libclearkey.so.sig
>>> /opt/firefox/gmp-clearkey/0.1/manifest.json
>>> /opt/firefox/gmp-clearkey/0.1/libclearkey.so
>>> /opt/firefox/updater
>>> /opt/firefox/plugin-container.sig
>>> /opt/firefox/libnspr4.so
>>> /opt/firefox/libxul.so
>>> /opt/firefox/libssl3.so
>>> /opt/firefox/libgraphitewasm.so
--- /opt/firefox/fonts/
>>> /opt/firefox/fonts/TwemojiMozilla.ttf
>>> /opt/firefox/libmozavcodec.so
>>> /opt/firefox/libplds4.so
>>> /opt/firefox/updater.ini
--- /opt/firefox/defaults/
--- /opt/firefox/defaults/pref/
>>> /opt/firefox/defaults/pref/channel-prefs.js
>>> /opt/firefox/firefox.sig
>>> /opt/firefox/liboggwasm.so
>>> /opt/firefox/omni.ja
>>> /opt/firefox/liblgpllibs.so
>>> /opt/firefox/removed-files
>>> /opt/firefox/plugin-container
>>> /opt/firefox/application.ini
>>> /opt/firefox/firefox-bin
>>> /opt/firefox/pingsender
>>> /opt/firefox/libsoftokn3.so
>>> /opt/firefox/libmozsqlite3.so
>>> /opt/firefox/libsmime3.so
>>> /opt/firefox/Throbber-small.gif
>>> /opt/firefox/libfreeblpriv3.so
>>> /opt/firefox/crashreporter.ini
>>> /opt/firefox/libmozgtk.so
>>> /opt/firefox/dependentlibs.list
--- /opt/firefox/distribution/
>>> /opt/firefox/distribution/policies.json
>>> /opt/firefox/minidump-analyzer
>>> /opt/firefox/firefox-bin.sig
--- /usr/
--- /usr/bin/
>>> /usr/bin/firefox-bin
--- /usr/share/
--- /usr/share/icons/
--- /usr/share/icons/hicolor/
--- /usr/share/icons/hicolor/128x128/
--- /usr/share/icons/hicolor/128x128/apps/
>>> /usr/share/icons/hicolor/128x128/apps/firefox-bin.png
--- /usr/share/icons/hicolor/32x32/
--- /usr/share/icons/hicolor/32x32/apps/
>>> /usr/share/icons/hicolor/32x32/apps/firefox-bin.png
--- /usr/share/icons/hicolor/symbolic/
--- /usr/share/icons/hicolor/symbolic/apps/
>>> /usr/share/icons/hicolor/symbolic/apps/firefox-bin-symbolic.svg
--- /usr/share/icons/hicolor/16x16/
--- /usr/share/icons/hicolor/16x16/apps/
>>> /usr/share/icons/hicolor/16x16/apps/firefox-bin.png
--- /usr/share/icons/hicolor/64x64/
--- /usr/share/icons/hicolor/64x64/apps/
>>> /usr/share/icons/hicolor/64x64/apps/firefox-bin.png
--- /usr/share/icons/hicolor/48x48/
--- /usr/share/icons/hicolor/48x48/apps/
>>> /usr/share/icons/hicolor/48x48/apps/firefox-bin.png
--- /usr/share/pixmaps/
>>> /usr/share/pixmaps/firefox-bin.png
--- /usr/share/applications/
>>> /usr/share/applications/firefox-bin.desktop
>>> Safely unmerging already-installed instance...
>>> Original instance of package unmerged safely.
 * Updating .desktop files database ...
 [ ok ]
 * Updating icons cache ...
 [ ok ]
 * 
 * For using the crashreporter, you need gnome-base/gconf,
 * gnome-base/orbit and net-misc/curl emerged.
 * 
>>> www-client/firefox-bin-81.0.1-r1 merged.
The second appears to be an install (?) log
Code:
cat /var/log/portage/www-client\:firefox-bin-81.0.1-r1\:20201009-170058.log 
No package files given... Grabbing a set.
--- replaced obj /usr/share/pixmaps/firefox-bin.png
--- replaced dir /usr/share/pixmaps
--- replaced obj /usr/share/icons/hicolor/symbolic/apps/firefox-bin-symbolic.svg
--- replaced dir /usr/share/icons/hicolor/symbolic/apps
--- replaced dir /usr/share/icons/hicolor/symbolic
--- replaced obj /usr/share/icons/hicolor/64x64/apps/firefox-bin.png
--- replaced dir /usr/share/icons/hicolor/64x64/apps
--- replaced dir /usr/share/icons/hicolor/64x64
--- replaced obj /usr/share/icons/hicolor/48x48/apps/firefox-bin.png
--- replaced dir /usr/share/icons/hicolor/48x48/apps
--- replaced dir /usr/share/icons/hicolor/48x48
--- replaced obj /usr/share/icons/hicolor/32x32/apps/firefox-bin.png
--- replaced dir /usr/share/icons/hicolor/32x32/apps
--- replaced dir /usr/share/icons/hicolor/32x32
--- replaced obj /usr/share/icons/hicolor/16x16/apps/firefox-bin.png
--- replaced dir /usr/share/icons/hicolor/16x16/apps
--- replaced dir /usr/share/icons/hicolor/16x16
--- replaced obj /usr/share/icons/hicolor/128x128/apps/firefox-bin.png
--- replaced dir /usr/share/icons/hicolor/128x128/apps
--- replaced dir /usr/share/icons/hicolor/128x128
--- replaced dir /usr/share/icons/hicolor
--- replaced dir /usr/share/icons
--- replaced obj /usr/share/applications/firefox-bin.desktop
--- replaced dir /usr/share/applications
--- replaced dir /usr/share
--- replaced obj /usr/bin/firefox-bin
--- replaced dir /usr/bin
--- replaced dir /usr
--- replaced obj /opt/firefox/updater.ini
--- replaced obj /opt/firefox/updater
--- replaced obj /opt/firefox/update-settings.ini
--- replaced obj /opt/firefox/removed-files
--- replaced obj /opt/firefox/precomplete
--- replaced obj /opt/firefox/plugin-container.sig
--- replaced obj /opt/firefox/plugin-container
--- replaced obj /opt/firefox/platform.ini
--- replaced obj /opt/firefox/pingsender
--- replaced obj /opt/firefox/omni.ja
--- replaced obj /opt/firefox/minidump-analyzer
--- replaced obj /opt/firefox/libxul.so.sig
--- replaced obj /opt/firefox/libxul.so
--- replaced obj /opt/firefox/libssl3.so
--- replaced obj /opt/firefox/libsoftokn3.so
--- replaced obj /opt/firefox/libsmime3.so
--- replaced obj /opt/firefox/libplds4.so
--- replaced obj /opt/firefox/libplc4.so
--- replaced obj /opt/firefox/liboggwasm.so
--- replaced obj /opt/firefox/libnssutil3.so
--- replaced obj /opt/firefox/libnssckbi.so
--- replaced obj /opt/firefox/libnss3.so
--- replaced obj /opt/firefox/libnspr4.so
--- replaced obj /opt/firefox/libmozwayland.so
--- replaced obj /opt/firefox/libmozsqlite3.so
--- replaced obj /opt/firefox/libmozsandbox.so
--- replaced obj /opt/firefox/libmozgtk.so
--- replaced obj /opt/firefox/libmozavutil.so
--- replaced obj /opt/firefox/libmozavcodec.so
--- replaced obj /opt/firefox/liblgpllibs.so
--- replaced obj /opt/firefox/libgraphitewasm.so
--- replaced obj /opt/firefox/libfreeblpriv3.so
--- replaced obj /opt/firefox/icons/updater.png
--- replaced dir /opt/firefox/icons
--- replaced obj /opt/firefox/gtk2/libmozgtk.so
--- replaced dir /opt/firefox/gtk2
--- replaced obj /opt/firefox/gmp-clearkey/0.1/manifest.json
--- replaced obj /opt/firefox/gmp-clearkey/0.1/libclearkey.so.sig
--- replaced obj /opt/firefox/gmp-clearkey/0.1/libclearkey.so
--- replaced dir /opt/firefox/gmp-clearkey/0.1
--- replaced dir /opt/firefox/gmp-clearkey
--- replaced obj /opt/firefox/fonts/TwemojiMozilla.ttf
--- replaced dir /opt/firefox/fonts
--- replaced obj /opt/firefox/firefox.sig
--- replaced obj /opt/firefox/firefox-bin.sig
--- replaced obj /opt/firefox/firefox-bin
--- replaced obj /opt/firefox/firefox
--- replaced obj /opt/firefox/distribution/policies.json
--- replaced dir /opt/firefox/distribution
--- replaced obj /opt/firefox/dependentlibs.list
--- replaced obj /opt/firefox/defaults/pref/channel-prefs.js
--- replaced dir /opt/firefox/defaults/pref
--- replaced dir /opt/firefox/defaults
--- replaced obj /opt/firefox/crashreporter.ini
--- replaced obj /opt/firefox/crashreporter
--- replaced obj /opt/firefox/browser/omni.ja
--- replaced obj /opt/firefox/browser/features/webcompat@mozilla.org.xpi
--- replaced obj /opt/firefox/browser/features/webcompat-reporter@mozilla.org.xpi
--- replaced obj /opt/firefox/browser/features/screenshots@mozilla.org.xpi
--- replaced obj /opt/firefox/browser/features/formautofill@mozilla.org.xpi
--- replaced obj /opt/firefox/browser/features/doh-rollout@mozilla.org.xpi
--- replaced dir /opt/firefox/browser/features
--- replaced obj /opt/firefox/browser/defaults/preferences/all-gentoo.js
--- replaced dir /opt/firefox/browser/defaults/preferences
--- replaced dir /opt/firefox/browser/defaults
--- replaced obj /opt/firefox/browser/crashreporter-override.ini
--- replaced obj /opt/firefox/browser/chrome/icons/default/default64.png
--- replaced obj /opt/firefox/browser/chrome/icons/default/default48.png
--- replaced obj /opt/firefox/browser/chrome/icons/default/default32.png
--- replaced obj /opt/firefox/browser/chrome/icons/default/default16.png
--- replaced obj /opt/firefox/browser/chrome/icons/default/default128.png
--- replaced dir /opt/firefox/browser/chrome/icons/default
--- replaced dir /opt/firefox/browser/chrome/icons
--- replaced dir /opt/firefox/browser/chrome
--- replaced dir /opt/firefox/browser
--- replaced obj /opt/firefox/application.ini
--- replaced obj /opt/firefox/Throbber-small.gif
--- replaced dir /opt/firefox
--- replaced dir /opt
 * Updating .desktop files database ...
 [ ok ]
 * Updating icons cache ...
 [ ok ]
The third log appears to be a setup (?) log
Code:
cat /var/log/portage/elog/www-client/firefox-bin-81.0.1-r1\:20201009-170100.log 
INFO: setup
Package:    www-client/firefox-bin-81.0.1-r1
Repository: gentoo
Maintainer: tripolar@gmx.at mozilla@gentoo.org,proxy-maint@gentoo.org
USE:        abi_x86_64 alsa amd64 elibc_glibc ffmpeg gmp-autoupdate kernel_linux pulseaudio userland_GNU
FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
INFO: install
Final size of build directory:     12 KiB
Final size of installed tree:  212864 KiB (207.8 MiB)
INFO: postinst
Updating .desktop files database ...
Updating icons cache ...

For using the crashreporter, you need gnome-base/gconf,
gnome-base/orbit and net-misc/curl emerged.
There is a python module responsible for saving logs to file. This appears to be fine, taking the package log key and writing it to a file in the elog subdir, but I'm not a python guru and hope someone will correct me if I am wrong.
Code:
cat /usr/lib/python3.7/site-packages/portage/elog/mod_save.py 
# elog/mod_save.py - elog dispatch module
# Copyright 2006-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

import errno
import io
import time
import portage
from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
from portage.data import portage_gid, portage_uid
from portage.package.ebuild.prepare_build_dirs import _ensure_log_subdirs
from portage.util import apply_permissions, ensure_dirs, normalize_path

def process(mysettings, key, logentries, fulltext):

	if mysettings.get("PORTAGE_LOGDIR"):
		logdir = normalize_path(mysettings["PORTAGE_LOGDIR"])
	else:
		logdir = os.path.join(os.sep, mysettings["EPREFIX"].lstrip(os.sep),
			"var", "log", "portage")

	if not os.path.isdir(logdir):
		# Only initialize group/mode if the directory doesn't
		# exist, so that we don't override permissions if they
		# were previously set by the administrator.
		# NOTE: These permissions should be compatible with our
		# default logrotate config as discussed in bug 374287.
		uid = -1
		if portage.data.secpass >= 2:
			uid = portage_uid
		ensure_dirs(logdir, uid=uid, gid=portage_gid, mode=0o2770)

	cat, pf = portage.catsplit(key)

	elogfilename = pf + ":" + _unicode_decode(
		time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time())),
		encoding=_encodings['content'], errors='replace') + ".log"

	if "split-elog" in mysettings.features:
		log_subdir = os.path.join(logdir, "elog", cat)
		elogfilename = os.path.join(log_subdir, elogfilename)
	else:
		log_subdir = os.path.join(logdir, "elog")
		elogfilename = os.path.join(log_subdir, cat + ':' + elogfilename)
	_ensure_log_subdirs(logdir, log_subdir)

	try:
		with io.open(_unicode_encode(elogfilename,
			encoding=_encodings['fs'], errors='strict'), mode='w',
			encoding=_encodings['content'],
			errors='backslashreplace') as elogfile:
			elogfile.write(_unicode_decode(fulltext))
	except IOError as e:
		func_call = "open('%s', 'w')" % elogfilename
		if e.errno == errno.EACCES:
			raise portage.exception.PermissionDenied(func_call)
		elif e.errno == errno.EPERM:
			raise portage.exception.OperationNotPermitted(func_call)
		elif e.errno == errno.EROFS:
			raise portage.exception.ReadOnlyFileSystem(func_call)
		else:
			raise

	# Copy group permission bits from parent directory.
	elogdir_st = os.stat(log_subdir)
	elogdir_gid = elogdir_st.st_gid
	elogdir_grp_mode = 0o060 & elogdir_st.st_mode

	# Copy the uid from the parent directory if we have privileges
	# to do so, for compatibility with our default logrotate
	# config (see bug 378451). With the "su portage portage"
	# directive and logrotate-3.8.0, logrotate's chown call during
	# the compression phase will only succeed if the log file's uid
	# is portage_uid.
	logfile_uid = -1
	if portage.data.secpass >= 2:
		logfile_uid = elogdir_st.st_uid
	apply_permissions(elogfilename, uid=logfile_uid, gid=elogdir_gid,
		mode=elogdir_grp_mode, mask=0)

	return elogfilename
So what is creating the other two log files in /var/log/portage/? or Why is portage not adhering to FEATURES="split-elog"?
Why does eread see nothing?

The full eread script is
Code:
# cat /usr/bin/eread 
#!/bin/bash

# This is a script to read portage log items from einfo, ewarn etc, new in the
# portage-2.1 series.
#
# Author: Donnie Berkholz <spyderous@gentoo.org>
# Updated by: Uwe Klosa <uwe.klosa@gmail.com>
# Updated by: Slawomir Nizio <slawomir.nizio@sabayon.org>

# Get prefix
EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}

# set decent PATH for bug 172969

PATH=${EPREFIX}/usr/bin:${EPREFIX}/bin:${PATH}

# Set ELOGDIR
PORT_LOGDIR="$(portageq envvar PORT_LOGDIR)"
[ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="${EPREFIX}/var/log/portage"
ELOGDIR="$PORT_LOGDIR/elog"

# Verify that ELOGDIR exists
if [ ! -d "$ELOGDIR" ]; then
	echo "ELOG directory: $ELOGDIR does not exist!"
	exit 1
fi

# Use the pager from the users environment
[ -z "$PAGER" ] && PAGER="less"

# Set up select prompt
PS3="Choice? "

SORT=${EREAD_SORT_ORDER}

find_unsorted() {
	find . -name '*:*:*.log*' | sed -e "s:\./::g"
}
find_by_name() {
	find . -name '*:*:*.log*' | sort | sed -e "s:\./::g"
}
find_by_time() {
	find . -name '*:*:*.log*' | sort -k 3 -t : | sed -e "s:\./::g"
}
find_files() {
	case ${SORT} in
		alphabet)
			find_by_name
			;;
		time)
			find_by_time
			;;
		*)
			find_unsorted
		;;
	esac
}

select_loop() {
	until [[ -n ${QUIT} ]]; do
		ANY_FILES=$(find_files)

		if [[ -z ${ANY_FILES} ]]; then
			echo "No log items to read"
			break
		fi

		echo
		echo "This is a list of portage log items. Choose a number to view that file or type q to quit."
		echo

		# Pick which file to read
		select FILE in ${ANY_FILES}; do
			case ${REPLY} in
				q)
					echo "Quitting"
					QUIT="yes"
					break
					;;
				a)
					SORT="alphabet"
					;;
				t)
					SORT="time"
					;;
				*)
					if [ -f "$FILE" ]; then
						${PAGER} ${FILE}
						read -p "Delete file? [y/N] " DELETE
						case ${DELETE} in
							q)
								echo "Quitting"
								QUIT="yes"
								break
								;;
							y|Y)
								rm -f ${FILE}
								SUCCESS=$?
								if [[ ${SUCCESS} = 0 ]]; then
									echo "Deleted ${FILE}"
								else
									echo "Unable to delete ${FILE}"
								fi
								;;
							# Empty string defaults to N (save file)
							n|N|"")
								echo "Saving ${FILE}"
								;;
							*)
								echo "Invalid response. Saving ${FILE}"
								;;
						esac
					else
						echo
						echo "Invalid response."
					fi
					;;
			esac
			break
		done
	done
}

pushd ${ELOGDIR} > /dev/null

select_loop

popd > /dev/null
But the error is in the find commands, which assume that split-elog is not set
Code:
find . -name '*:*:*.log*' | sed -e "s:\./::g"
So it looks like a patch needs to be made to check whether split-elog is set and adjust the file name scheme accordingly?
 
  


Reply

Tags
gentoo, log, portage



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help: wide character ?inconsistencies? maxreason Fedora 3 01-29-2008 11:44 PM
Disk space reporting inconsistencies, lvm/df rarr Linux - Software 2 01-18-2006 11:26 AM
Timestamp inconsistencies J.W. LQ Suggestions & Feedback 3 03-07-2005 04:47 PM
SuSE Yast/RPM inconsistencies Oninit Linux - Software 1 02-13-2004 07:51 PM
Is there a land where inconsistencies dont live? JoeLinux Linux - Distributions 5 01-27-2002 05:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

All times are GMT -5. The time now is 11:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration