Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is it possible to make Portage not to keep package sources?
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
donguss
n00b
n00b


Joined: 18 Apr 2018
Posts: 22

PostPosted: Sun Jul 15, 2018 2:55 pm    Post subject: Is it possible to make Portage not to keep package sources? Reply with quote

I'm talking about a sh*t ton of source tarballs corresponding to currently installed packages residing in /usr/portage/distfiles.
This directory is taking about half of all the used disk space on my machine. Even though I'm not actually going to do this since I have enough disk space for now, I should at least know if it's possible for Portage to remove sources immediately after the package is merged.
Is it achieveable?
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8936

PostPosted: Sun Jul 15, 2018 3:05 pm    Post subject: Reply with quote

Run eclean regularly.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Jul 15, 2018 3:06 pm    Post subject: Reply with quote

donguss wrote:
Is it achieveable?
No because it's bad netiquette. The bandwidth to re-download those distfiles is donated; Gentoo users need to be good stewards of that donation.

That said, a periodic cleaning of that directory, especially of packages you no longer have installed, can be a good thing. See eclean from app-portage/gentoolkit. A reasonable invocation would be
Code:
eclean --time-limit=3m distfiles
which would preserved all distfiles for currently installed packages and anything that has been installed in the last 3 months.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
donguss
n00b
n00b


Joined: 18 Apr 2018
Posts: 22

PostPosted: Sun Jul 15, 2018 3:08 pm    Post subject: Reply with quote

asturm wrote:
Run eclean regularly.

IIRC eclean only cleans out outdated tarballs, the ones that correspond to currently installed packages are still there. I'm looking for a way to get rid of all of them completely.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Jul 15, 2018 3:11 pm    Post subject: Reply with quote

Like I said, it's bad netiquette. But if you want to be that indiscriminate, the solution is easy. Left as an exercise for the student.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Jul 15, 2018 3:13 pm    Post subject: Reply with quote

You can share them over NFS if you have more than one Gentoo box.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
donguss
n00b
n00b


Joined: 18 Apr 2018
Posts: 22

PostPosted: Sun Jul 15, 2018 3:19 pm    Post subject: Reply with quote

John R. Graham wrote:
Like I said, it's bad netiquette. But if you want to be that indiscriminate, the solution is easy. Left as an exercise for the student.

- John


As said in the OP, i'm not planning to do that in the first place, it's theoretical question - and it was about whether portage allows such thing out of the box, like "keep-sources=false" in the configs or something. If the exercise you're talking about includes something crutchy like manually editing portage scripts or putting DISTDIR removal in the cron, then the answer to my question is "no, you can't".
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Jul 15, 2018 3:21 pm    Post subject: Reply with quote

And I already answered in my first reply.

Jaglover wrote:
You can share them over NFS if you have more than one Gentoo box.
This is in fact what I do. The stationary machines mount distfiles over NFS from the master and the laptops rsync from the same master.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Jul 15, 2018 3:31 pm    Post subject: Reply with quote

Right, only my laptop uses shared portage and distfiles, too. I figured I have no need to use emerge while on the road.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Sun Jul 15, 2018 3:36 pm    Post subject: Reply with quote

donguss wrote:
John R. Graham wrote:
Like I said, it's bad netiquette. But if you want to be that indiscriminate, the solution is easy. Left as an exercise for the student.

- John


If the exercise you're talking about includes something crutchy like manually editing portage scripts or putting DISTDIR removal in the cron, then the answer to my question is "no, you can't".


The simple solution "cd /usr/portage/distfiles" then "rm -r *"


Me, every month or two, I run "eclean-dist -p" to see what would be deleted and then run without the pretend flag, this will clean out about 80%-90% of the files that aren't currently installed packages.

Or you could set up a backup disk to put all the files from distfiles in it. I've been doing that for years.

Edit to add: you don't need ANYTHING in distfiles after you've installed the package ... well that is until the next rebuild of "whatever" package.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland


Last edited by Anon-E-moose on Sun Jul 15, 2018 3:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Sun Jul 15, 2018 3:38 pm    Post subject: Reply with quote

I run monthly eclean cronjob, it emails me letting me know how much space was freed, usually in range of 3 GB.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!


Last edited by Jaglover on Sun Jul 15, 2018 3:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Sun Jul 15, 2018 3:39 pm    Post subject: Reply with quote

If your complaint is that it is occupying half of all used disk space, I suggest enabling FEATURES=nostrip and building everything with debug symbols. That will consume substantial amounts of disk space for things that are not source files, bringing the overall percentage down considerably. ;)

Otherwise, the answer is that it is not particularly difficult, but it is not exposed as a configuration knob for the exact reasons that JRG explained. In practice, unless you have an extremely fast network connection to the distfile server (which you might, if it was hosted on your LAN), you're better off keeping recent sources anyway.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54239
Location: 56N 3W

PostPosted: Sun Jul 15, 2018 3:48 pm    Post subject: Reply with quote

I keep all my distfiles. You never know when they will be needed again.

Code:
$ df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/vg-distfiles        148G  123G   19G  88% /usr/portage/distfiles

Thats from April 2009.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Jul 15, 2018 3:56 pm    Post subject: Reply with quote

Same here, but only on my aforementioned master server. I only appear to have accumulated about half of what you have, though, in my case since 2005.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8936

PostPosted: Sun Jul 15, 2018 4:06 pm    Post subject: Reply with quote

Update frequency and arch vs. ~arch can make a big difference, even if you supposedly use the same packages.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Jul 15, 2018 7:06 pm    Post subject: Reply with quote

Quote:
LANG=C df /usr/portage/distfiles/ -h
Filesystem Size Used Avail Use% Mounted on
faramir:/export/distfiles 143G 60G 76G 45% /usr/portage/distfiles

well, i should probably run that eclean a few more, but the problem with eclean is that it only take the host it is run on (which would clean sources i have need of for other hosts).
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Sun Jul 15, 2018 7:11 pm    Post subject: Reply with quote

You can compensate for that with some hard link tricks. Instead of having each host download to the same directory, give each their own directory, but prefer hardlinking the file from a sibling directory over downloading it from the mirrors. Then, run eclean on each host, each time targeting that host's distfiles directory. As long as at least one host needs the file, there will be a hard link to it from that host's area. When every host declares the file obsolete, all the hard links will be removed and the file will be deleted.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sun Jul 15, 2018 7:15 pm    Post subject: Reply with quote

krinn wrote:
but the problem with eclean is that it only take the host it is run on

Some years ago, eclean had even a lot more problems like not taking you package-specific USE-flags into account. I don't know whether this has been fixed meanwhile.
A reliable way (solving also your problems with multiple hosts) is to use trickyfetch.
It might be a bit hard to understand how it works, but after configuring portage to use trickyfetch (on every host), essentially you just call the obsolete script and then emerge -ef @world on every host (after having mounted the $DISTDIR with e.g. sshfs). Then the data you can remove remains in $DISTDIR/.obsolete
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sun Jul 15, 2018 7:25 pm    Post subject: Reply with quote

i will probably use subdir in that nfs dir with my hosts name, so everyone will have its own space in it.
but i still have plenty space, so it's low in my priorities.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9532
Location: beyond the rim

PostPosted: Tue Jul 17, 2018 8:34 am    Post subject: Reply with quote

donguss wrote:
As said in the OP, i'm not planning to do that in the first place, it's theoretical question - and it was about whether portage allows such thing out of the box, like "keep-sources=false" in the configs or something.

There is no config setting or commandline option if that's what you're after, because that would be utterly stupid (hint: a single source archive might be used by more than a single package or version).
If one really wants this there are many ways to achieve it however, just requires a little bit of extra work.
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