View previous topic :: View next topic |
Author |
Message |
r8dhex Tux's lil' helper
Joined: 25 Jul 2002 Posts: 120
|
Posted: Thu Aug 21, 2003 5:19 am Post subject: How does portage treat modified files? |
|
|
For example i emerge xfree, then i compile xfree drm drivers from cvs, then i overwrite some of xfree's files.
If I unmerge xfree, would it remove the files that i manually installed, or would it leave it there?
If I re-emerge xfree, would it overwrite the files from the drm drivers?
Thanks |
|
Back to top |
|
|
chardros Tux's lil' helper
Joined: 18 Apr 2002 Posts: 136 Location: Andromeda
|
Posted: Thu Aug 21, 2003 2:39 pm Post subject: Re: How does portage treat modified files? |
|
|
r8dhex wrote: | For example i emerge xfree, then i compile xfree drm drivers from cvs, then i overwrite some of xfree's files.
If I unmerge xfree, would it remove the files that i manually installed, or would it leave it there? |
They would be left there, lingering.
Quote: |
If I re-emerge xfree, would it overwrite the files from the drm drivers?
|
Yes.
It's all about the timestamps. |
|
Back to top |
|
|
r8dhex Tux's lil' helper
Joined: 25 Jul 2002 Posts: 120
|
Posted: Thu Aug 21, 2003 3:56 pm Post subject: |
|
|
so, is there an easy way to find out which files are still lying around? especially for those cases where a manually compiled package makes a lot of files |
|
Back to top |
|
|
chardros Tux's lil' helper
Joined: 18 Apr 2002 Posts: 136 Location: Andromeda
|
Posted: Thu Aug 21, 2003 4:23 pm Post subject: |
|
|
Well, every file laying around will belong to some package if you used portage. In your example above, unmerging xfree AND xfree-drm would remove everything.
As for manual builds, portage provides no way of managing those files. You'll need to use another piece of software if you want to manage manual builds in that manner. Two that I'm aware of are Encap and Stow. There's also Xstow but I have no experience with it. Stow and Xstow are in portage, but I prefer Encap. |
|
Back to top |
|
|
r8dhex Tux's lil' helper
Joined: 25 Jul 2002 Posts: 120
|
Posted: Thu Aug 21, 2003 4:33 pm Post subject: |
|
|
ok, thanks |
|
Back to top |
|
|
quixoticsycophant n00b
Joined: 10 Jan 2003 Posts: 16
|
Posted: Sat Aug 23, 2003 9:09 am Post subject: |
|
|
r8dhex wrote: | so, is there an easy way to find out which files are still lying around? especially for those cases where a manually compiled package makes a lot of files |
Well using qpkg from gentoolkit you could do
Code: | perl -MFile::Find -e 'find(sub{$f=$File::Find::name ; `qpkg -f $f` || print "$f\n"}, qw(/usr/X11R6))' |
but that could take days.
Save this to a file called "orphans": Code: | #!/usr/bin/perl
#
# Usage: orphans dir1 dir2 ...
#
# Prints out files not appearing in the package database.
use warnings ;
use strict ;
use File::Find ;
my $pkgdb = "/var/db/pkg" ;
my $dirs = [ @ARGV ] ;
my $owned = {} ;
sub contents_file
{
return unless m!CONTENTS$! ;
local @ARGV = ($_) ;
while(<>)
{
my($type,$filename) = split ;
$owned->{$type}->{$filename} = 1 if $filename ;
}
}
sub each_file
{
if (-l) { print "$_\n" unless $owned->{sym}->{$_} }
elsif(-d) { print "$_\n" unless $owned->{dir}->{$_} }
elsif(-f) { print "$_\n" unless $owned->{obj}->{$_} }
}
find(\&contents_file,$pkgdb) ;
find({no_chdir => 1, wanted => \&each_file},@$dirs) ;
|
Now run
Code: | chmod u+x ./orphans
./orphans /usr/X11R6 |
This will print out all files in /usr/X11R6 which are not registered with the package database ("qpkg -f" will return nothing for each of these files).
Suprisingly quite a large number of files are orphaned -- not only /usr/X11R6 but the rest of the filesystem.
Code: | ./orphans /bin/ /sbin/ /lib/ /usr/X11R6/ /usr/bin/ /usr/include/ /usr/lib/ /usr/libexec/ /usr/sbin/ /usr/share/ /opt/ | wc |
reports over 3000 files. These are all directories which I never touch outside of portage.
Apart from modified files which weren't unmerged, I guess the rest are handled by ebuild cleanup scripts or are simply ebuild bugs. Notice I'm not grabbing the mtimes, which would make the list even longer.
-qs |
|
Back to top |
|
|
|