public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] A quick and easy set of eix extension scripts for you holiday present.
@ 2013-12-14 23:13 Greg Woodbury
  2013-12-15  2:11 ` [gentoo-user] " James
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Woodbury @ 2013-12-14 23:13 UTC (permalink / raw
  To: gentoo-user

I have found some of the tools of portage a little opaque and confusing.
 Once
I found eix, I put together a little set of shell scripts to make lists
of the
packages in portage.

The script 'makeeixall' goes through and does an eix update and then
generates
a set of lists of packages: all, installed, new (not installed) and updates.

The script 'eixall' and its aliases 'eixupdate' 'eixnew' and 'eixinst' grep
the associated lists and print matches to the standard out.

You will need to make the '/usr/local/tmp' directory or point EIXDIR to
some other location.
------------------------------------------------------------------------------
#!/bin/bash

# script to create a database of packages for quick reference
# 27 June 2013  version to make system-wide db
# 05  Aug 2013  add "downgrades" to the eixupdate listing

EIXDIR="/usr/local/tmp"
EIXALL="$EIXDIR/eix-all.txt"
EIXINST="$EIXDIR/eix-installed.txt"
EIXUPD="$EIXDIR/eix-updates.txt"
EIXNEW="$EIXDIR/eix-new.txt"

# first: get rid of the old db
rm $EIXALL

# second: have EIX update its binary db
eix-update

# third: run through the categories and build the eix-all text file
echo -n "Prepping files: all..."
cd /usr/portage
cat profiles/categories | while read dname
do
        eix --care -c -x -C $dname
done >>$EIXALL

# fourth: make some utility text databases
#         the installed packages
echo -n "install..."
grep -F '[I]' $EIXALL >$EIXINST

#         the upgradeable packages
#               be careful to append the "downgrades"
echo -n "updates..."
grep -F '[U]' $EIXALL >$EIXUPD
grep -F '[D]' $EIXALL >>$EIXUPD
grep -F '[UD]' $EIXALL >>$EIXUPD

#       these files are also "installed", append to inst file
cat $EIXUPD >>$EIXINST

#         the "new" uninstalled packages
echo "not-installed (new)"
grep -F '[N]' $EIXALL >$EIXNEW

# fifth: make the text file readable by anyone
chmod 0444 /usr/local/tmp/eix*.txt

exit 0
-------------------------------------------------------------------------------


The script 'eixall' is for searching the outputs of 'makeeixall'


--------------------------------------------------------------------------------
#!/bin/bash

# script to search a database of packages for quick reference (see
makeeixall)
# 27 June 2013  version 1: to use system-wide db

EIXDIR="/usr/local/tmp"
EIXALL="$EIXDIR/eix-all.txt"
EIXINST="$EIXDIR/eix-installed.txt"
EIXUPD="$EIXDIR/eix-updates.txt"
EIXNEW="$EIXDIR/eix-new.txt"

# first: do we have an argument to search for?
if [ $# -eq 0 ]
then
        echo "usage: $0 [<grep-options>] <pattern>"
        exit 1
fi

# second: find out which database we want to search
EIXNAME=`basename $0`
case $EIXNAME in
eixall )
        EIXDB=$EIXALL
        ;;
eixinst )
        EIXDB=$EIXINST
        ;;
eixupdates )
        EIXDB=$EIXUPD
        ;;
eixnew )
        EIXDB=$EIXNEW
        ;;
* )
        echo "usage: $0 [<grep-options>] <pattern>"
        exit 1
        ;;
esac

# third: is the database in existence and readable?
if [ ! -r "$EIXDB" ]
then                    #no - run makeixall to make dbs
        sudo -E makeeixall
fi

# third: do the search
grep "$@" $EIXDB

exit $?
------------------------------------------------------------------------------

Once eixall is in place, symlink the script to the aliases.


-----------------------------------------------------------------------------
cd /usr/local/bin
ln -s eixall eixnew
ln -s eixall eixinst
ln -s eixall eixupdate
---------------------------------------------------------------------------


Typical usage would be:
  1.    emerge --sync
  2.    makeeixall
  3.    eixupdates . | less

and then do whatever to update your packages.


These scrips written by me are placed in the public domain, enjoy!

Gregory "Wolfe" Woodbury    14 Dec 2013
redwolfe@gmail.com


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

* [gentoo-user] Re: A quick and easy set of eix extension scripts for you holiday present.
  2013-12-14 23:13 [gentoo-user] A quick and easy set of eix extension scripts for you holiday present Greg Woodbury
@ 2013-12-15  2:11 ` James
  0 siblings, 0 replies; 2+ messages in thread
From: James @ 2013-12-15  2:11 UTC (permalink / raw
  To: gentoo-user

Greg Woodbury <redwolfe <at> gmail.com> writes:


> I have found some of the tools of portage a little opaque and confusing.

bugs.gentoo.org

is a place where issues can be posted, and patches offered up.

ymmv,
James



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

end of thread, other threads:[~2013-12-15  2:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-14 23:13 [gentoo-user] A quick and easy set of eix extension scripts for you holiday present Greg Woodbury
2013-12-15  2:11 ` [gentoo-user] " James

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