Adding eread utility for reading and managing ELOG files. Courtesy of Donnie Berkholz
authorfuzzyray <fuzzyray@gentoo.org>
Fri, 22 Sep 2006 03:29:28 +0000 (03:29 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Fri, 22 Sep 2006 03:29:28 +0000 (03:29 -0000)
svn path=/; revision=318

trunk/Makefile
trunk/src/eread/AUTHORS [new file with mode: 0644]
trunk/src/eread/Makefile [new file with mode: 0644]
trunk/src/eread/eread [new file with mode: 0755]
trunk/src/eread/eread.1 [new file with mode: 0644]

index 2707c793d70c502221450da1a869c3f8f0a2ed8b..93d992aae54014720248dbf054f0e54c2f8760c5 100644 (file)
@@ -39,7 +39,7 @@ dist-gentoolkit-dev:
 dist-gentoolkit:
        mkdir -p release/gentoolkit-$(VERSION)$(RELEASE_TAG)
        rm -rf release/gentoolkit-$(VERSION)$(RELEASE_TAG)/
-       for x in eclean equery etcat euse qpkg gentoolkit revdep-rebuild glsa-check genpkgindex; do \
+       for x in eclean equery eread etcat euse qpkg gentoolkit revdep-rebuild glsa-check genpkgindex; do \
                ( cd src/$$x ; make distdir=release/gentoolkit-$(VERSION)$(RELEASE_TAG) dist ) \
        done
        cp Makefile AUTHORS README TODO COPYING NEWS ChangeLog release/gentoolkit-$(VERSION)$(RELEASE_TAG)/
@@ -65,7 +65,7 @@ install-gentoolkit:
        install -m 0644 AUTHORS ChangeLog COPYING NEWS README TODO $(docdir)/
        install -m 0644 src/99gentoolkit-env $(sysconfdir)/env.d/
 
-       for x in eclean equery etcat euse qpkg gentoolkit revdep-rebuild glsa-check genpkgindex; do \
+       for x in eclean equery eread etcat euse qpkg gentoolkit revdep-rebuild glsa-check genpkgindex; do \
                ( cd src/$$x ; make DESTDIR=$(DESTDIR) install )  \
        done
 
diff --git a/trunk/src/eread/AUTHORS b/trunk/src/eread/AUTHORS
new file mode 100644 (file)
index 0000000..68064ce
--- /dev/null
@@ -0,0 +1,2 @@
+Author: Donnie Berkholz <dberkholz@gentoo.org>
+Updated by: Uwe Klosa <uwe.klosa@gmail.com>
diff --git a/trunk/src/eread/Makefile b/trunk/src/eread/Makefile
new file mode 100644 (file)
index 0000000..1d9b284
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright 2006 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+all:
+       echo "ELY (n.) The first, tiniest inkling you get that something, somewhere, has gone terribly wrong."
+
+dist:
+       mkdir -p ../../$(distdir)/src/eread
+       cp AUTHORS Makefile eread eread.1 ../../$(distdir)/src/eread/
+
+install:
+
+       install -m 0755 eread $(bindir)/
+       install -d $(docdir)/eread
+       install -m 0644 AUTHORS $(docdir)/eread/
+       install -m 0644 eread.1 $(mandir)/
diff --git a/trunk/src/eread/eread b/trunk/src/eread/eread
new file mode 100755 (executable)
index 0000000..69db604
--- /dev/null
@@ -0,0 +1,85 @@
+#!/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>
+
+# Set ELOGDIR
+PORT_LOGDIR="$(portageq envvar PORT_LOGDIR)"
+[ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="/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="/usr/bin/less"
+
+# Set up select prompt
+PS3="Choice? "
+
+select_loop() {
+       ANY_FILES=$(/usr/bin/find . -type f)
+       ANY_FILES=$(echo ${ANY_FILES} | /bin/sed -e "s:\./::g")
+
+       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
+                               ;;
+                       *)
+                               ${PAGER} ${FILE}
+                               read -p "Delete file? [y/N] " DELETE
+                               case ${DELETE} in
+                                       q)
+                                               echo "Quitting"
+                                               QUIT="yes"
+                                               break
+                                               ;;
+                                       y|Y)
+                                               /usr/bin/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
+                               ;;
+               esac
+               break
+       done
+}
+
+pushd ${ELOGDIR} > /dev/null
+
+until [[ -n ${QUIT} ]]; do
+       select_loop
+done
+
+popd > /dev/null
diff --git a/trunk/src/eread/eread.1 b/trunk/src/eread/eread.1
new file mode 100644 (file)
index 0000000..5e18214
--- /dev/null
@@ -0,0 +1,12 @@
+.TH "eread" "1" "1.0" "Donnie Berkholz" "gentoolkit"
+.SH "NAME"
+.LP 
+eread \- Gentoo: Tool to display and manage ELOG files from portage
+.SH "SYNTAX"
+.LP 
+eread
+.SH "DESCRIPTION"
+.LP 
+This tool is used to display and manage ELOG files produced by portage version 2.1 and higher.
+.SH "ENVIRONMENT VARIABLES"
+The eread utility uses the PAGER environment variable to display the ELOG files. If the variable is not set, it defaults to /usr/bin/less.