Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-30 Thread Paul Stear
On Monday 29 September 2008, Daniel Pielmeier wrote:

 Don't rely on this script to much. Because it works for me must not
 mean it does for you. I have tested some cases and I worked every time
 until now. So verify the output of a manual emerge -pv --depclean
 atom on the unneeded entry first to be sure it is really not
 needed.
Hi Daniel,
I thought I would try your script but I get an error when I run it:-
Uncaught exception from user code:
Unrecognized character \xC2 at ./WorldCleanCheck line 29.
 at ./WorldCleanCheck line 29
I do not know what \xC2 is
Any ideas how to resolve this?
Thanks for your time
Paul



-- 
This message has been sent using kmail with gentoo linux



Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-30 Thread Daniel Pielmeier
2008/9/30 Paul Stear [EMAIL PROTECTED]:
 Hi Daniel,
 I thought I would try your script but I get an error when I run it:-
 Uncaught exception from user code:
Unrecognized character \xC2 at ./WorldCleanCheck line 29.
  at ./WorldCleanCheck line 29
 I do not know what \xC2 is
 Any ideas how to resolve this?
 Thanks for your time
 Paul

Thank you for testing my script! Maybe it needs some more work.
Can you send me your world file off-list, so I can try to reproduce
this error. I can not check it this week as I am away but next week I
will take a look at it. It looks like there is an entry in your world
file my script can not process. In line 29 from the error message the
script tries to remove the new-line after the world file entry, which
probably causes this problem.

Regards,

Daniel



Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-29 Thread Daniel Pielmeier
James schrieb am 25.09.2008 20:32:
 Surely many folks would benefit from a formal, systematic approach
 to cleaning the world file?  I know every now and then, when a gentoo
 workstation gives me fits, I just emerge and unemerge things until
 it's happy (while multitasking too much). Often this leads to
 a polluted world file... because I do not follow closely to
 the process details (distracted) during the repair-episode.
 

Something in addition to this topic.

I asked on IRC (#gentoo-portage) if it is possible to show the reverse
dependencies of a package with portage. Zac Medico, one of the main
portage developers told me that it is possible with depclean.

emerge -pv --depclean atom

So I thought of writing a little script which calls this command for
every entry in the world file. As I have only limited programming skills
I wrote something quick in perl. It should be no problem to do it with a
shell script or something else too. It simply checks the output of
depclean for strings which only occur when the package has or has no
reverse dependencies. Then it prints the package to be checked and if it
is needed in world or not. It actually does not remove anything, so it
is up to you if you want to leave a package in world or not for whatever
reason you have.

The script could probably be improved in a few ways and it is slow as
depclean takes some time. It works for current stable portage. I don't
know if it will work for portage-2.2 as the output of depclean has
changed as far as I know.

Don't rely on this script to much. Because it works for me must not mean
it does for you. I have tested some cases and I worked every time until
now. So verify the output of a manual emerge -pv --depclean atom on
the unneeded entry first to be sure it is really not needed.

Regards,

Daniel

#!/usr/bin/perl
#
#
#

use strict;
use diagnostics;
use warnings;

my ($package,$status,$line) = ();
my @depclean = ();
my $vdb_path = qx(portageq vdb_path);
chomp($vdb_path);

format STDOUT_TOP =
Atom:Status: (required in world)
.

format STDOUT =
@ @
$package, $status
.

print Examining: $vdb_path/world\n\n;

open(WORLD,$vdb_path/world) || die(world: $!);

foreach $package (WORLD) {
chomp $package;
@depclean = qx(emerge -pv --depclean $package);
foreach $line ( @depclean ) {
if ( $line =~  These are the packages that would be 
unmerged: ) {
$status = needed;
write;
} elsif ( $line =~  No packages selected for removal by 
depclean ) {
$status = unneeded;
write;
} else {
$status = Error: Something bad happened;
}
}
}




Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Neil Bothwick
On Thu, 25 Sep 2008 15:08:23 + (UTC), James wrote:

 Do you have any further advice, more detail or some more formalized
 methodology to 'clean' the world file,

Hack out anything you think is unnecessary
Run emerge --depclean -p
Add anything you need with emerge -n
Rinse and repeat


-- 
Neil Bothwick

BORG spreadsheet program: Locutus 1-2-3.


signature.asc
Description: PGP signature


Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Daniel Pielmeier
2008/9/25 James [EMAIL PROTECTED]:

 Do you have any further advice, more detail or some more formalized 
 methodology
 to 'clean' the world file, in addition to what you have stated above?


Every entry in the world file that has a reverse dependency could be
removed. Unfortunately there is no tool I know which can calculate
reverse dependencies correctly. Maybe there is some functionality in
pkgcore or paludis which I am not aware of. So others need to inform
us about this.

However, this question has already been raised and Alber Hopkins
attached a python script in an earlier thread which should show
unneeded entries in the world file. It did not work for me but I have
attached it, maybe you have more luck than I.

The solution I use is app-portage/udept. It is not maintained anymore
so I recommend to use the ebuild from this bug [1] which at least has
a few advantages over the ebuild in the tree. Udept used to be a
powerful script but a few functions do not work properly anymore. The
option for cleaning the world file works reliable though. Just invoke
it with dep -w

[1] http://bugs.gentoo.org/show_bug.cgi?id=172611

Regards,

Daniel
#!/usr/bin/python

Report any packages in world which have direct dependencies also in world


__version__ = (0,3,0)

import os
import sys
sys.path.insert(0, '/usr/lib/gentoolkit/pym')
os.environ['PORTAGE_CALLER'] = 'repoman'

import portage
TREE = portage.db[/][vartree]

import gentoolkit


def get_versions_installed(pkg):

Return a list containt versions of pkg installed (in cpv format)
may be an empty list.

return TREE.dbapi.match(pkg)


def get_world():
Return a list of all packages in world
_file = sys.stdin
_list = [line.strip() for line in _file]
return _list

def get_deps(pkg):
Return a list of all packages depending on pkg (directly)
deps = set()
for cpv in get_versions_installed(pkg):
gentoolkit_pkg = gentoolkit.Package(cpv)
rdeps = [i[2] for i in gentoolkit_pkg.get_runtime_deps() if not
i[2].startswith('virtual/')]
for rdep in rdeps:
split = portage.pkgsplit(rdep)
if split is not None:
deps.add(split[0])
else:
deps.add(rdep)

pdeps = [i[2] for i in gentoolkit_pkg.get_postmerge_deps() if not
i[2].startswith('virtual/')]
for pdep in pdeps:
split = portage.pkgsplit(pdep)
if split is not None:
deps.add(split[0])
else:
deps.add(pdep)
#print deps
#command= '/usr/bin/equery -q -C d %s' % pkg
#pipe = os.popen(command, 'r')
#_list = [portage.pkgsplit(line.strip())[0] for line in pipe]
return deps

if __name__ == '__main__':
world = get_world()
for pkg in world:
deps = get_deps(pkg)
for dep in deps:
if (dep != pkg) and (dep in world):
print '%(pkg)s already depends on %(dep)s' % locals()


Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Alan McKinnon
On Thursday 25 September 2008 17:51:58 Daniel Pielmeier wrote:
  Do you have any further advice, more detail or some more formalized
  methodology to 'clean' the world file, in addition to what you have
  stated above?

 Every entry in the world file that has a reverse dependency could be
 removed. Unfortunately there is no tool I know which can calculate
 reverse dependencies correctly. Maybe there is some functionality in
 pkgcore or paludis which I am not aware of. So others need to inform
 us about this.

The loong way round is to run 'emerge -pvte world' and look for things 
listed that are both highlighted in green and indented. Such packages could 
in theory be removed from world as they must be a dep of something.

Intelligence must also be applied of course - somethings are deps and you DO 
want them in world

-- 
alan dot mckinnon at gmail dot com



Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Paul Hartman
On Thu, Sep 25, 2008 at 3:15 PM, Alan McKinnon [EMAIL PROTECTED] wrote:
 On Thursday 25 September 2008 17:51:58 Daniel Pielmeier wrote:
  Do you have any further advice, more detail or some more formalized
  methodology to 'clean' the world file, in addition to what you have
  stated above?

 Every entry in the world file that has a reverse dependency could be
 removed. Unfortunately there is no tool I know which can calculate
 reverse dependencies correctly. Maybe there is some functionality in
 pkgcore or paludis which I am not aware of. So others need to inform
 us about this.

 The loong way round is to run 'emerge -pvte world' and look for things
 listed that are both highlighted in green and indented. Such packages could
 in theory be removed from world as they must be a dep of something.

 Intelligence must also be applied of course - somethings are deps and you DO
 want them in world

Yes, basically my philosophy is only to list in world the actual
programs I want to use. Everything else required for them will come in
automatically (assuming I also set my USE flags in package.use
properly). Some packages have optional run-time deps, say a multimedia
program that can convert files if you have ffmpeg installed, so in
those cases those optional packages will also be in world.

Learning when to use --oneshot and when not was the key to keeping
away the clutter :)



Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Neil Bothwick
On Thu, 25 Sep 2008 15:55:10 -0500, Paul Hartman wrote:

 Yes, basically my philosophy is only to list in world the actual
 programs I want to use.

Same here, which is why I recommended editing the world file. Anything
you don't use directly can go. It's also a good way of cleaning
out those programs that you installed, thinking they were a good
idea, but never used.

 Some packages have optional run-time deps, say a multimedia
 program that can convert files if you have ffmpeg installed, so in
 those cases those optional packages will also be in world.

That shouldn't happen. Portage is supposed to control everything with USE
flags. In your example. the ebuild should run configure with either the
--enable-ffmpeg or --disable-ffmpeg option, depending on your flags.
Compile time features are to be controlled by the user, not decided for
him by the configure script. That's the Gentoo way.


-- 
Neil Bothwick

NOTE: In order to control energy costs the light at the end
of the tunnel has been shut off until further notice...


signature.asc
Description: PGP signature


Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Alan McKinnon
On Thursday 25 September 2008 23:43:07 Neil Bothwick wrote:
  Some packages have optional run-time deps, say a multimedia
  program that can convert files if you have ffmpeg installed, so in
  those cases those optional packages will also be in world.

 That shouldn't happen. Portage is supposed to control everything with USE
 flags. In your example. the ebuild should run configure with either the
 --enable-ffmpeg or --disable-ffmpeg option, depending on your flags.
 Compile time features are to be controlled by the user, not decided for
 him by the configure script. That's the Gentoo way.

That would indeed be a truly wonderful thing...

If only the ./configure authors would put the damn --enable- in the script in 
the first place grumble grumble

which means you can force support for it to be present via DEPEND but not 
remove support if the dep is present and shouldn't be muttermutter

-- 
alan dot mckinnon at gmail dot com



Re: [gentoo-user] Re: Question about difference between emerge --update world and emerge vigra

2008-09-25 Thread Neil Bothwick
On Thu, 25 Sep 2008 23:59:36 +0200, Alan McKinnon wrote:

  That shouldn't happen.

 That would indeed be a truly wonderful thing...

Note that I used shouldn't and not doesn't :(


-- 
Neil Bothwick

He's so cool, he could get frostbite from masturbating.


signature.asc
Description: PGP signature