Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 351958 - eclean enhancment portage logs and /var/tmp/portage
Summary: eclean enhancment portage logs and /var/tmp/portage
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement with 1 vote (vote)
Assignee: Portage Tools Team
Depends on:
Blocks: 346443
  Show dependency tree
Reported: 2011-01-18 00:27 UTC by David J Cozatt
Modified: 2015-08-18 14:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description David J Cozatt 2011-01-18 00:27:46 UTC
Should like to see eclean have switches to clean old failed emerge failures from /var/tmp/portage
and the PORTAGE_ELOG dir 

Reproducible: Always
Comment 1 Paul Varner (RETIRED) gentoo-dev 2011-01-18 18:44:11 UTC
If we decide to do this, let's target for 0.3.1
Comment 2 Rick Jenkins 2012-01-09 18:20:46 UTC
Great idea. I just checked and was duly horrified to find that /var/log/portage is 2.4G, and has logs going back into the mists of time, so possibly this might be included too.
Comment 3 Zac Medico gentoo-dev 2012-01-09 19:04:59 UTC
You can also use FEATURES=clean-logs to have emerge automatically remove old logs. See `man make.conf` if you're interested.
Comment 4 Brian Dolbec gentoo-dev 2012-01-28 01:31:18 UTC
I have also added a new emaint module by moving the log cleaning code from emerge to an emaint module.  Emerge will still do automatic log cleaning for you by running the code in the emaint module.  I also added options to do a pretend check and option to override the default time with a new value.  It can also be set to 0 (zero) to remove all the pkg logs.  This way log cleaning can be done automatically, and/or manually by running emaint.

It is currently in the emaint branch in my github portage repo waiting for review and integration into portage.

Please test it and report your success, not just any problems you encounter.  As there was a lot of change to the code, it would help Zac to know it has been tested quite extensively.
The code does not need to be installed to run, it can run from the git checkout as long as you add the correct path to PATH & PYTHONPATH  so it can find the bin and python modules there.

Adding log cleaning to eclean should be quite easy.  One method would use the new emaint module, but would not include the file size info.  Another would be to create an eclean style module which would include the file size info.

As for the PORTAGE_TMPDIR a module could be created for the emaint rewrite mentioned above.  Which it too could be imported and used in eclean as part of it's operation.
Comment 5 Zac Medico gentoo-dev 2012-09-04 02:59:35 UTC
(In reply to comment #4)
> I have also added a new emaint module by moving the log cleaning code from
> emerge to an emaint module.

That's release in portage- and 2.2.0_alpha121:;a=commit;h=9e19ac0a16a57f3dded8124e650fb6bf6f3d00be
Comment 6 David J Cozatt 2013-01-20 03:39:06 UTC
Thank you very much for your work on this...I have done some testing ...
a few comments.

It seems that the timestamp is the driving decision maker in the case of cleaning the logs (from reading the make.conf entry and what little usage testing I have done); while this is far better than nothing it is not what I would consider ideal. In the best case scenario (and I realize that it would be much more difficult to implement)the latest build log would be retained and anything removed by say a --depclean or a previous version would be removed.

So the best case would weem to be to have only the latest build log of any installed application/etc on the machine and that would be retained by default until removed by an updated log.

Nevertheless...I see no reason why this cannot be in stable. I found no issues.

And thanks again.

#emerge -ep world -->Total: 1159 packages (2 upgrades, 1 downgrade, 1156 reinstalls), Size of downloads: 4,308 kB

penguin4 david # ls /var/log/portage/ | wc
   4186    4186  198879

Several 'emerge -e' done recently contributed to the number of logs above done since gcc and a few other things were done ...including removing gnome and moving on to kde.

That said if the latest build log were the criteria and not timestamps I should have 1159 logs and not 4186

I realize that would mean a lot of work though and likely a database to consult though eix is installed and might provide the needed info.
Comment 7 David J Cozatt 2015-08-18 14:53:55 UTC
Closing this as done since the cleaning is done now. Still would like to see portage remove previous logs for each pkg as it installs the new build log. Should be easier I would think to just remove old ones when the new one is installed since portage at that moment has the $PATH and $name on installing the log(s).

As well it would seem to be proper to remove old build logs when uninstalling a package.

Of course feel free to disagree and if you feel the need to reopen