Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Keeping portage and build deps separate from main system
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
pll
n00b
n00b


Joined: 16 Dec 2011
Posts: 19

PostPosted: Sun Nov 02, 2014 10:41 am    Post subject: Keeping portage and build deps separate from main system Reply with quote

Hello,

I was wondering if there is a way to keep portage, GCC and other build dependencies contained in a separate directory or filesystem or partition to the rest of the system.

My eventual goal is to build a small system which I can squashfs and mount in RAM. Since this environment will not be persistent it makes so sense to include things like Portage and I would like to save as much space as possible.

Any advice or documentation I can look at to help me create such a system would be greatly appreciated.

Thank you.
_________________
Peace, love, linux
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Nov 02, 2014 11:24 am    Post subject: Reply with quote

pll,

Its not really practical to partition a Gentoo install that way. About the best you can do is to put /usr/portage and /usr/src on their own partitions.
I do that to build for my netbook on an external USB drive. I do copy the toolchain over as it still fits into the 8G SSD anh leaves me space for /home.
You can get more fine grained control with the --exclude option to tar or rsync, when you make your binary image.

You can even test the image in a chroot, to see if you can pare it down some more.

To do it the other way round, you can make portage install to some other root dir by setting a variable in make.conf
I know it exits but I don't know what its called.
_________________
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
pll
n00b
n00b


Joined: 16 Dec 2011
Posts: 19

PostPosted: Sun Nov 02, 2014 11:37 am    Post subject: Reply with quote

Using the exclude option for tar is something that has worked well for me in the past however, looking at my current system the majority of bloat is in places like /usr/lib where it impractical to manually filter which libraries or binaries are needed and which aren't. That's why I thought addressing the issue on a package level with Portage may be a step forward.

Setting a different root directory in Portage sounds interesting. I'll look into that further.

Thank you for your help.
_________________
Peace, love, linux
Back to top
View user's profile Send private message
krinn
Advocate
Advocate


Joined: 02 May 2003
Posts: 4433

PostPosted: Sun Nov 02, 2014 11:37 am    Post subject: Reply with quote

Build binary version of package, and you can extract the file in the real root, leaving any source... out of the device.
It work (and it is) how people fix big trouble (damage portage, gcc...)

compA: emerge -b "package"
compB: untar "package" in its /
This way compB doesn't even need/use or have portage.
Back to top
View user's profile Send private message
fpemud
Apprentice
Apprentice


Joined: 15 Feb 2012
Posts: 174

PostPosted: Sun Nov 02, 2014 1:08 pm    Post subject: Reply with quote

I think the best way would be to write a script to copy all the needed files out and squash them.
I heard Google Chromebook is based on Gentoo, may be this is the solution they are using?

If I were to have a smart phone that can run GNU/Linux, I would prefer using this solution to cross-compile and install Gentoo on it.

The main difficulty is to analyse the dependencies and get the final package list, but I think it can be overcome.
Back to top
View user's profile Send private message
pll
n00b
n00b


Joined: 16 Dec 2011
Posts: 19

PostPosted: Sun Nov 02, 2014 5:51 pm    Post subject: Reply with quote

krinn wrote:
Build binary version of package, and you can extract the file in the real root, leaving any source... out of the device.
It work (and it is) how people fix big trouble (damage portage, gcc...)

compA: emerge -b "package"
compB: untar "package" in its /
This way compB doesn't even need/use or have portage.


Ah you can just untar the binary packages? I thought you needed a package manager to install them again. That's useful to know thank you.
_________________
Peace, love, linux
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Nov 02, 2014 6:55 pm    Post subject: Reply with quote

pll,

When you use portage or quickpkg to build binary packages for you, you get a .bz2 file with some extra portage specicific things at the end.
Its a little like a single package stage3. If you use
Code:
tar xpf <filename> -C /
the package is installed correctly to your root filesystem.
Its often used to recover from things like
Code:
emerge -C glibc python gcc
Don't do that at home!
~ARCH users also use it as a get out of jail free card, when an update breakes and they need to back it out in a hurry.
e.g. I have all my binary pakages goind back to April 2009, when I installed this box.

If you have the packages, you can use
Code:
emerge -Ke @world
to install all the parkages in your world set, along with all the dependencies that they need.
Given that you don't have to install to your normal root, you can use portage to install the binaries into another target location.

Thats intended to give you some ideas - not solve your problem :)

Oh, if it helps you cam write your own sets.
@world is all the packages you have explicitly installed
@preserved-rebuild is everything needed to be rebuilt due to library updates
@debian would allow you to emerge @debian but you need to write the set first :)
_________________
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
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2584
Location: UK

PostPosted: Mon Nov 03, 2014 8:23 pm    Post subject: Reply with quote

The emerge --root and --root-deps options might do what you want. All the build deps go onto a host system as normal and anything you want to keep goes into a separate filesystem tree. I haven't tried it though.
_________________
runit-init howto | Overlay
Back to top
View user's profile Send private message
pll
n00b
n00b


Joined: 16 Dec 2011
Posts: 19

PostPosted: Mon Nov 03, 2014 8:23 pm    Post subject: Reply with quote

Ah, I feel like I haven't read as much of the Portage documentation as I should have before posting here.

Thank you for your help.
_________________
Peace, love, linux
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Nov 03, 2014 8:27 pm    Post subject: Reply with quote

pll,

You might want to read up on Prefix too. It does some of the things you want.
Its main purpose is to allow you to install Gentoo on a machine where you have no root access.
_________________
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
yoshi314
l33t
l33t


Joined: 30 Dec 2004
Posts: 823
Location: PL

PostPosted: Thu Dec 04, 2014 9:24 am    Post subject: Re: Keeping portage and build deps separate from main system Reply with quote

pll wrote:
Hello,

I was wondering if there is a way to keep portage, GCC and other build dependencies contained in a separate directory or filesystem or partition to the rest of the system.

My eventual goal is to build a small system which I can squashfs and mount in RAM. Since this environment will not be persistent it makes so sense to include things like Portage and I would like to save as much space as possible.

Any advice or documentation I can look at to help me create such a system would be greatly appreciated.

Thank you.


Keeping some build deps separate is actually fairly simple (or it used to be).

- setup a build installation, like typical gentoo
- inside it do ROOT=/some/other/directory emerge <somepackage>

portage will proceed to build things, but DEPEND packages go into build host, RDEPEND packages go into target installation. I don't remember if configs are read from host or from $ROOT . This will mean sometimes building packages twice sometimes, for either environment.

This is how it used to work, but it was quite a few years ago, so i am not sure if it's still valid.



For building a small system, you could leverage portage hooks. You could make a hook that e.g. makees a copy of installed package files, removes unnecessary things, and packs it into squashfs file, for instance. Coupled with aforementioned method, you might end up with reasonably reduced installation. There are various possiblities to plug into package manager's process.
_________________
~amd64
shrink your /usr/portage with squashfs+aufs
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