View previous topic :: View next topic |
Author |
Message |
Tyler H n00b
Joined: 11 May 2013 Posts: 21
|
Posted: Fri Jul 24, 2015 12:39 pm Post subject: Any way to get CONTENTS without installing? |
|
|
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 |
|
|
freke l33t
Joined: 23 Jan 2003 Posts: 977 Location: Somewhere in Denmark
|
Posted: Fri Jul 24, 2015 3:13 pm Post subject: |
|
|
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 |
|
|
Tyler H n00b
Joined: 11 May 2013 Posts: 21
|
Posted: Sat Jul 25, 2015 2:16 am Post subject: |
|
|
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 |
|
|
russK l33t
Joined: 27 Jun 2006 Posts: 665
|
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Sat Jul 25, 2015 7:53 am Post subject: Re: Any way to get CONTENTS without installing? |
|
|
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 |
|
|
Tyler H n00b
Joined: 11 May 2013 Posts: 21
|
Posted: Sat Jul 25, 2015 1:04 pm Post subject: Re: Any way to get CONTENTS without installing? |
|
|
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 |
|
|
|