# [obsolete] update deeper than --deep

## gnumake

mod edit: This thread is obsolete, --deep has been fixed a long time ago and does what you want. See GF16: Corrupt or empty world file, what do I do? if not.

--Earthwings 2006/01/22

I found that emerge -u --deep world did not update everything. So I

wrote a python script that checks all installed packages with qpkg -I

It takes about a second per package you have installed ( I have 278 )

It will only do the full test if you have rsync'ed lately.

Here is the skinny:

-you need the qpkg script installed. I think it is installed with gentoolkit

-copy the script below into a folder. It creates 2 files to store stuff in

-run ./script.py (this first time will build the update file list)

 running ./script.py again will just print out what is out of date

-then you can run ./script.py [ -p, -f, -u] to pretend, fetch, install

   it will pass one argument to emerge so you can do -pf also

It is a good idea to run a (./script -p) before (./script -u) because there

might be some NEW packages installed with the updates. The -p should

show you what its going to install.

I took a guess at getting it to only run the full test after a new rsync, but

if I flubbed it you can force an update with --b arg

```
#!/usr/bin/python

import os

import sys

import string

import re

import commands as com

Bash = 'gen.bash.sh'

bf_updates = '_Updates'

message = "These packages are out of date\ntype "+sys.argv[0]+" -u or \

-p or -f to update, pretend, fetch.\nIt tries to update if you have rsync'ed, if it does not you \

 can force it to by using --b\n\n"

def updateBuffers():

   Installed = com.getoutput("qpkg -I -nc")

   Installed = string.split(Installed)

   Len = len(Installed)

   Z = []

   print "You have  "+ `Len`+" packages to check"

   for x in Installed:

      print "checking package "+` Len`

      Len -= 1

      temp = com.getoutput("emerge -p "+x)

      if string.find(temp, r'U ]') != -1:

         Z.append(x+'\n')

   f = open(bf_updates, 'w')

   f.writelines(Z)

   f.close()

   print message

   for x in Z: print x,

   print '\n'

def update_if_older():

   u = com.getstatus(bf_updates)

   u = string.split(u)

   w = com.getstatus("/var/cache/edb/world")

   w = string.split(w)

   if u[5] != w[5]: updateBuffers()

   elif int(u[6]) < int(w[6]): updateBuffers()

   else:

      u = u[7]

      w = w[7]

      if u[0] < w[0]: updateBuffers()

      elif u[0] > w[0]: return

      elif u[1] < w[1]: updateBuffers()

      elif u[1] > w[1]: return

      elif u[3] < w[3]: updateBuffers()

      elif u[3] > w[3]: return

      elif u[4] < w[4]: updateBuffers()

if len(sys.argv) > 1:

   if sys.argv[1] == '--b':

      updateBuffers()

   else:

      update_if_older()

      f = open(bf_updates, 'r')

      for x in f:

         g = open(Bash,'w')

         g.write("#!/bin/bash\n$1 $2 $3 $4 $5 $6 $7 $8 $9\n")

         g.close()

         os.spawnv(os.P_WAIT, Bash, (Bash, 'emerge',sys.argv[1],x))

      f.close()

else :

   update_if_older()

   f = open(bf_updates)

   print message

   for x in f: print x,

   print '\n'

   f.close()

```

----------

## S_aIN_t

sounds cool... i will give it a try.. and be sure to post the results..

----------

## steveb

not bad  :Smile: 

```

gentoo root # ./edeep.py

You have 706 packages to check

checking package 706

checking package 705

checking package 704

---cut---

.

.

.

---cut---

checking package 3

checking package 2

checking package 1

These packages are out of date

type ./edeep.py -u or -p or -f to update, pretend, fetch.

It tries to update if you have rsync'ed, if it does not you can force it to by using --b

dev-java/jikes

dev-util/eclipse-jdt-bin

dev-util/eclipse-platform-bin

dev-util/gob

gnome-base/gdm

media-gfx/gimp

media-libs/svgalib

sys-apps/shadow

sys-devel/gcc-config

x11-base/xfree

x11-themes/sylpheed-iconset

These packages are out of date

type ./edeep.py -u or -p or -f to update, pretend, fetch.

It tries to update if you have rsync'ed, if it does not you can force it to by using --b

dev-java/jikes

dev-util/eclipse-jdt-bin

dev-util/eclipse-platform-bin

dev-util/gob

gnome-base/gdm

media-gfx/gimp

media-libs/svgalib

sys-apps/shadow

sys-devel/gcc-config

x11-base/xfree

x11-themes/sylpheed-iconset

```

i don't know why it prints twice the output... but it looks like it works not bad.

cheers

SteveB

----------

## hook

anyone considered to send a bug report about the --deep flag?!?

----------

## steveb

another way to get a list of packages wich needs a update is to use a one-liner in the shell:

```
for i in `qpkg -I -nc`;do emerge -p $i|grep "U \]"|sed 's/^.*U \] \(.*\)\-[0-9]*\.[0-9]*.*$/\1/g';done
```

or

```
for i in `qpkg -I -nc`;do if (emerge -p $i|grep -q "U \]");then echo $i;fi;done
```

if you want to update them as well, then use something like this:

```
for i in `qpkg -I -nc`;do if (emerge -p $i|grep -q "U \]");then emerge $i;fi;done
```

cheers

SteveB

----------

## castorilo

Am I missing something, or this would do the trick

to see what needs updating:

```
qpkg -I -nc | xargs emerge -up
```

to update the system:

```
qpkg -I -nc | xargs emerge -u
```

Is there any reason you have such complicated ways to do it?

----------

## pjp

 *paulpach wrote:*   

> Am I missing something, or this would do the trick

 Have you actually tested this?  It doesn't work for me.  This uses the portage directory that the package is in.  As in:

```
# emerge x11-wm/fluxbox
```

Get rid of the x11-wm/ part, and I think it would work.

----------

## relyt

 *hook wrote:*   

> anyone considered to send a bug report about the --deep flag?!?

 

I thought that, as documented, the --deep flag was only supposed to check package dependencies, and the dependency's dependencies.  3 levels deep in other words, not everything.

By which I mean that I believe it is working as intended.

----------

## pjp

 *kanuslupus wrote:*   

> Get rid of the x11-wm/ part, and I think it would work.

 

```
sed -e 's/.*\///g'
```

Will Get rid of that part, but then this happens:

```
# qpkg -I -nc | sed -e 's/.*\///g' | xargs emerge -up      

emerge: the "sync" and "rsync" actions do not support "--pretend."
```

I'm not all that interested in solving this part.  When it gets to the package rsync, it is trying to do a:

```
emerge -up rsync
```

----------

## frew

 *steveb wrote:*   

> another way to get a list of packages wich needs a update is to use a one-liner in the shell:
> 
> ```
> for i in `qpkg -I -nc`;do emerge -p $i|grep "U \]"|sed 's/^.*U \] \(.*\)\-[0-9]*\.[0-9]*.*$/\1/g';done
> ```
> ...

 

Very nice!

----------

## zhenlin

You cna leave the category there in place. qpkg -I -nc | xargs emerge -p works fine for me.

----------

## castorilo

 *kanuslupus wrote:*   

>  *paulpach wrote:*   Am I missing something, or this would do the trick Have you actually tested this?  It doesn't work for me.  This uses the portage directory that the package is in.  As in:
> 
> ```
> # emerge x11-wm/fluxbox
> ```
> ...

 

Yes, I have tested this and it works just fine. No need to get rid of the category.

I am using

```
 ACCEPT_KEYWORDS="~x86" 
```

in my make.conf. Maybe it does not work in the stable packages. That would answer my question on why the other methods.

----------

## JeDi

How about this one:

```
emerge -up $(qpkg -I -nc | awk '{printf $1 " "}')
```

Works just fine for me, actually I'm using it now to generate binary packages of all the installed progs (with the -B option in stead of -up).

Greetz,

JeDi

----------

## The_Saint

Isn´t there any easy way to add the dependencies in the world file?

This way a simple emerge -u world command would update everything.

----------

## justabssplyr

adding them to the world file would make sure they're always updated, but thats not what the world file is for.

the world file lists packages explicitly added to the system, not pulled in as dependencies.

----------

## iamben

fyi, qpkg is deprecated in favor of equery.  it is even missing from the latest ~x86 gentoolkit.  might consider doing this with equery instead so the bleeding edge guys can use it too... and so it wont break as soon as gentoolkit 0.2.1 goes stable.

----------

## My_World

 *iamben wrote:*   

> fyi, qpkg is deprecated in favor of equery.  it is even missing from the latest ~x86 gentoolkit.  might consider doing this with equery instead so the bleeding edge guys can use it too... and so it wont break as soon as gentoolkit 0.2.1 goes stable.

 

It changed form qpkg to quickpkg, installed with gentoolkit, just modify the script to correct the new spelling.

----------

## iamben

quickpkg creates binary packages from what you have already emerged, it is not the same as qpkg.

----------

## The_Saint

 *justabssplyr wrote:*   

> adding them to the world file would make sure they're always updated, but thats not what the world file is for.
> 
> the world file lists packages explicitly added to the system, not pulled in as dependencies.

 

I can see your point, but I had the impression that the use of emerge -u world is to update everything. I realise now that this functionality is missing, since even the emerge -uD world command may ignore some packages.

----------

## moocha

Did you guys even bother check the date on the original post and on the next replies? There's a more than two year gap (not to mention a two major portage version gap) between JeDi's post and The_Saint's post. This thread is ancient.

--deep has been fixed a long time ago.

----------

## mirko_3

But I still managed to find one file which wasn't updated....

----------

## moocha

Hasn't happened to me in a long time (read: over a year). Would that perchance have been a package that would have been shown as removable by emerge -pv --depclean? If yes, then it's not surprising that --deep doesn't update it - it shouldn't update it in the first place since that package is orphaned and should be removed, not updated. Works as designed in this case.

And I seldom use --deep since it more often causes things to break over the medium to long term rather than fixing them.

----------

## mirko_3

Nope, I run emerge depclean quite often, and it's not one of those; the package is speech-tools, and qpkg told me that festival (which I do have installed and updated) depends on it ...

----------

## moocha

That's odd, and not a good sign... I'll try to reproduce it.

----------

## Sheepdogj15

hmm yeah. if you check the man page for emerge, it now says that --deep checks the entire dep. tree. 

so yeah, this is obsolete.

----------

## thepi

Maybe a Mod should add "[obsolete]" to the title...

Regards,

 pi~

----------

