Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
print outdated packages
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
jukka
Apprentice
Apprentice


Joined: 06 Jun 2002
Posts: 249
Location: Zurich, Switzerland

PostPosted: Fri Aug 30, 2002 2:12 pm    Post subject: print outdated packages Reply with quote

print outdated packages

to print all installed packages whose version number don't match the latest available version you can use this small bash script:
Code:
#!/bin/bash
#
# filters 'emerge -s' style output and prints
#   - all installed packages whose version numbers don't match the latest
#     available version (default)
#   - all installed packages (if -a of --all specified)
#
# Jukka Salmi 2002-08-30
#


declare line avlb inst

print_element ()
{
  echo -e "${line#\*  }:"
  echo -e "\tlatest version: ${avlb##*: }\n\tinstalled: ${inst##*: }\n"
}

while read line; do
  [ "${line:0:3}" != "*  " ] && continue
  read avlb
  read inst
  [ "${inst##*: }" == "[ Not Installed ]" ] && continue
  case "$1" in
    -a|--all) print_element ;;
    *) [ "${avlb##*: }" != "${inst##*: }" ] && print_element ;;
  esac
done

exit 0


you can use it like this:
Code:
$ emerge -s '.*' | /path/to/the/script_above
of course you can limit the search to whatever you want to.

an example output of this filter script looks as follows:
Code:
dev-libs/expat:
        latest version: 1.95.4
        installed: 1.95.3

dev-libs/glib:
        latest version: 2.0.6-r1
        installed: 1.2.10-r4

net-libs/libnet:
        latest version: 1.1.0
        installed: 1.0.2a-r1

sys-apps/console-tools:
        latest version: 0.2.3-r4
        installed: 1.06-r1

sys-apps/miscfiles:
        latest version: 1.3
        installed: 1.2-r1


invoking the script with -a or --all prints all installed packages, not only the outdated ones.

HTH and cheers,

jukka

p.s.: i didn't search the forum, so maybe there are scripts which do the same thing much better / faster...


Last edited by jukka on Mon Sep 02, 2002 12:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
TaboZ
n00b
n00b


Joined: 30 May 2002
Posts: 49

PostPosted: Sun Sep 01, 2002 3:39 pm    Post subject: i am probably dumb... Reply with quote

Whats the difference with a emerge rsync; emerge -up world ?
Back to top
View user's profile Send private message
TripKnot
Apprentice
Apprentice


Joined: 29 May 2002
Posts: 213

PostPosted: Mon Sep 02, 2002 1:16 am    Post subject: Reply with quote

I haven't tried the above script yet, but I assume it checks for dependencies.(my miscfiles shows the same versioning diffs as in the above post even though 'emerge world -up' shows nothing to update)

emerge world -u only updates programs listed in the world file which does not include dependencies. When a program is updated only then are its dependencies updated too. So identifying dependencies that could be updated makes this script have some use.
Back to top
View user's profile Send private message
jukka
Apprentice
Apprentice


Joined: 06 Jun 2002
Posts: 249
Location: Zurich, Switzerland

PostPosted: Mon Sep 02, 2002 11:35 am    Post subject: Reply with quote

hi TaboZ,

what TripKnot said is correct. my script parses the output of 'emerge -s ...', so if you list all packages (emerge -s '.*'), the script examines ALL installed packages, not only those listed in the world file.

some examples:
Code:
$ emerge -s '.*' | my_script

prints all installed and outdated packages.

Code:
$ emerge -s '.*' | my_script --all

prints a list of ALL installed packages, whether they are outdated or not.


greetings, jukka
Back to top
View user's profile Send private message
TaboZ
n00b
n00b


Joined: 30 May 2002
Posts: 49

PostPosted: Mon Sep 02, 2002 1:22 pm    Post subject: Right Reply with quote

Thanx for the reply. I see it now

T
Back to top
View user's profile Send private message
63nt00
n00b
n00b


Joined: 29 Aug 2002
Posts: 15
Location: Netherlands (Alkmaar)

PostPosted: Mon Sep 02, 2002 8:39 pm    Post subject: Reply with quote

and what's the difference then between your script and a "emerge -p clean" ?
_________________
"Music is the answer"
Back to top
View user's profile Send private message
TaboZ
n00b
n00b


Joined: 30 May 2002
Posts: 49

PostPosted: Mon Sep 02, 2002 9:14 pm    Post subject: qpkg -d Reply with quote

emerge rsync; emerge -u world; emerge -p clean

what to think of this?

example:

Code:


giant root # emerge -p clean

>>> These are the packages that I would unmerge:

>>> No outdated packages were found on your system.

giant root # qpkg -d
app-text/docbook-sgml-dtd
dev-libs/glib
gnome-base/control-center
gnome-base/gconf
gnome-base/gnome-panel
gnome-base/gnome-vfs
gnome-base/libglade
sys-apps/baselayout
sys-devel/gcc
sys-libs/db
sys-libs/glibc
x11-libs/gtk+
x11-libs/qt



But maybe this discussion should be moved to another forum?
Back to top
View user's profile Send private message
wzzrd
Apprentice
Apprentice


Joined: 18 Jul 2002
Posts: 245

PostPosted: Thu Sep 05, 2002 8:50 am    Post subject: Reply with quote

Very useful script! Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum