Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Any way to get CONTENTS without installing?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Tyler H
n00b
n00b


Joined: 11 May 2013
Posts: 21

PostPosted: Fri Jul 24, 2015 12:39 pm    Post subject: Any way to get CONTENTS without installing? Reply with quote

I want to build a better cruft finder. My idea is to grep /var/log/emerge.log for ">>> unmerge success" and the CONTENTS of each unmerged package. This would eliminate the problem of possibly considering basic files (e.g. fstab) as cruft. So, the question is, how do I get CONTENTS after a package has been unmerged? Is it possible?
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 962
Location: Somewhere in Denmark

PostPosted: Fri Jul 24, 2015 3:13 pm    Post subject: Reply with quote

Code:
equery f <package-name>
tells you which files are installed by the given package.
equery being a part of app-portage/gentoolkit

Maybe you can use that?
Back to top
View user's profile Send private message
Tyler H
n00b
n00b


Joined: 11 May 2013
Posts: 21

PostPosted: Sat Jul 25, 2015 2:16 am    Post subject: Reply with quote

equery f only works only works for installed packages. Since my cruft cleaner would only try to clean unmerged packages, equery won't work.
Back to top
View user's profile Send private message
russK
l33t
l33t


Joined: 27 Jun 2006
Posts: 665

PostPosted: Sat Jul 25, 2015 3:59 am    Post subject: Reply with quote

Maybe build and keep binpkg's, you can find out the contents : https://wiki.gentoo.org/wiki/Binary_package_guide
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sat Jul 25, 2015 7:53 am    Post subject: Re: Any way to get CONTENTS without installing? Reply with quote

Tyler H wrote:
how do I get CONTENTS after a package has been unmerged? Is it possible?

No, it is not possible. Of course, you could hook into portage (and any other package manager which is possibly used to install/remove packages) and copy the CONTENTS file somewhere before it is removed by portage.

However, I do not really understand the meaning why you want to do this: When portage unmerges a package, it removes all the file from CONTENTS, so these should never be on your machine, anyway. The only exceptions are if portage would have a bug (or dies unexpectedly e.g. because of a power failure) or if a file is CONFIG_PROTECTED and was explicitly modified by the user. (In the latter case, one can discuss whether it is cruft; but a good cruft fimder will spot these files anyway.)

The main bulk of cruft files are exactly those which are never contained in any CONTENTS.

If you want some clever algorithm to minimize the number of false positives, I suggest that you start with (and extend the configuratoin to your setting of) find_cruft from the mv overlay.
Back to top
View user's profile Send private message
Tyler H
n00b
n00b


Joined: 11 May 2013
Posts: 21

PostPosted: Sat Jul 25, 2015 1:04 pm    Post subject: Re: Any way to get CONTENTS without installing? Reply with quote

mv wrote:
Tyler H wrote:
how do I get CONTENTS after a package has been unmerged? Is it possible?

No, it is not possible. Of course, you could hook into portage (and any other package manager which is possibly used to install/remove packages) and copy the CONTENTS file somewhere before it is removed by portage.

However, I do not really understand the meaning why you want to do this: When portage unmerges a package, it removes all the file from CONTENTS, so these should never be on your machine, anyway. The only exceptions are if portage would have a bug (or dies unexpectedly e.g. because of a power failure) or if a file is CONFIG_PROTECTED and was explicitly modified by the user. (In the latter case, one can discuss whether it is cruft; but a good cruft fimder will spot these files anyway.)

The main bulk of cruft files are exactly those which are never contained in any CONTENTS.

If you want some clever algorithm to minimize the number of false positives, I suggest that you start with (and extend the configuratoin to your setting of) find_cruft from the mv overlay.
Exactly, I didn't know the terms for what I wanted before. To restate it: I wanted something that can list files that were CONFIG_PROTECTED during an unmerge.

I tried find_cruft and it found all the files I had in mind as cruft, but it also had a lot of false positives. That's to be expected, of course. I'm going to start running my system with lazytime (efficient atime) and filter your find_cruft for files that haven't been accessed in X days. I think that will be very accurate.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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