1 |
On Thu, Jul 26, 2012 at 2:40 PM, Michael Mol <mikemol@×××××.com> wrote: |
2 |
> (Really, this observation is more about simply making the information |
3 |
> available; distcc could consume that information if someone chose to |
4 |
> do the work to add that functionality.) |
5 |
|
6 |
Well, I'm not sure how to get the info out of the internals of portage |
7 |
itself (I have to imagine it would be fast since portage has to know |
8 |
about it already), but for a list of packages you can xargs them into |
9 |
qlist to get a list of all files, and then pipe that into a script |
10 |
that will populate a chroot for you. |
11 |
|
12 |
Quick script for those curious to try it out: |
13 |
|
14 |
mkdir newroot |
15 |
mount -t tmpfs none newroot |
16 |
cd newroot |
17 |
unshare -m /bin/bash |
18 |
echo "list of packages" | xargs qlist | linkfile |
19 |
(poke around) |
20 |
exit |
21 |
(note that bind mounts are gone) |
22 |
cd .. |
23 |
umount newroot ; rmdir newroot |
24 |
(note that all traces gone) |
25 |
|
26 |
Contents of linkfile script: |
27 |
#!/bin/bash |
28 |
install -D /dev/null "./$1" |
29 |
mount -n --bind "$1" "./$1" |
30 |
|
31 |
(That -n is important if you don't want to muck up your /etc/mtab ) |
32 |
|
33 |
BTW, unshare is a fun command to play around with if you've never used |
34 |
namespaces. You can do things like replace commands by bind-mounting |
35 |
right over them. |
36 |
|
37 |
Rich |