1 |
On 06/01/13 07:36, Duncan wrote: |
2 |
> As in subject, is portage bin/usr-bin merge safe? |
3 |
> |
4 |
> It appears most of my clashing files are /usr/bin/* -> /bin/* symlinks. |
5 |
> (That's just bin, I've not looked at sbin.) |
6 |
Most but not all, I'm also quite sure in the past I've encountered one |
7 |
(and only one) files collision (not symlinks), cannot remember which though. |
8 |
> |
9 |
> Does portage "just do the right thing" if the dirs are linked to each |
10 |
> other? |
11 |
Trust the answers of Zac and Mike on this ;-) |
12 |
> |
13 |
> Meanwhile, a quick eyeball of the results says 50-60% of the hits are |
14 |
> coreutils, so if portage doesn't handle it automatically, fixing it for |
15 |
> just that one package, even just using a USE flag instead of trying to |
16 |
> detect it automatically, would kill a majority of the birds with a single |
17 |
> stone. |
18 |
> |
19 |
> (Since I don't have a separate /usr anyway, I've been thinking about |
20 |
> it... If it's not easily doable anyway, that cuts short the internal |
21 |
> debate.) |
22 |
While portage can be safe, for various reason (including the resultant |
23 |
pkg) I do prefer to do the move in post_src_install() #1 |
24 |
All my tests have been done against a manually converted filesystem, |
25 |
i.e. manually moving stuff around, creating the symlinks, putting the |
26 |
code in bashrc and only after that (re)building everything inside the |
27 |
system. |
28 |
So I've no idea if this approach can work in a stage1 or equivalent. |
29 |
It has been used for quite a long time from a "build server" => |
30 |
"consumer machine" environment. |
31 |
|
32 |
|
33 |
#1 excerpt from bashrc, this code is rough but work in the gentoo |
34 |
ebuilds tree domain |
35 |
|
36 |
move_root_to_usr() { |
37 |
|
38 |
pushd "${D}" |
39 |
|
40 |
echo "PHASE: ${EBUILD_PHASE} move something around"; |
41 |
|
42 |
for d in lib* *bin; do |
43 |
|
44 |
if [[ -d ${d} ]] ; then |
45 |
# move directories |
46 |
for f in $(find ${d}/ -type d) ; do |
47 |
if [[ -e usr/${f} ]] ; then |
48 |
if [[ -e ${f} ]] ; then |
49 |
echo "usr/${f} : exist, cannot move" |
50 |
else |
51 |
: # parent has already been moved |
52 |
fi |
53 |
else |
54 |
echo "${f} : ok to move" |
55 |
mv ${f} usr/${f} |
56 |
fi |
57 |
done |
58 |
|
59 |
# move files |
60 |
for f in $(find ${d}/ -type f -or -type l) ; do |
61 |
if [[ ( -e usr/${f} ) || (-L usr/${f}) ]] ; then |
62 |
if [[ ( -L ${f} ) && ( -f usr/${f} ) ]] ; then |
63 |
echo "${f} : is a symlink, remove" |
64 |
rm -f ${f} |
65 |
else |
66 |
if [[ ( -f ${f} ) && ( -L usr/${f} ) ]] ; then |
67 |
echo "${f} : file in usr is a symlink remove e move" |
68 |
rm -f usr/${f} |
69 |
mv ${f} usr/${f} |
70 |
else |
71 |
ls -ld ${f} usr/${f} |
72 |
echo "${f} : UNHANDLED CASE prepare to breakage" |
73 |
fi |
74 |
fi |
75 |
else |
76 |
echo "${f} : ok to move" |
77 |
mv ${f} usr/${f} |
78 |
fi |
79 |
done |
80 |
|
81 |
rmdir -p ${d} && [[ -e usr/${d} ]] || ln -s usr/${d} ${d} |
82 |
|
83 |
fi # if [[ -d ${d} ]] ; then |
84 |
|
85 |
done # for d in lib64 lib32 bin sbin; do |
86 |
|
87 |
rm -f lib/lib |
88 |
|
89 |
popd |
90 |
} |
91 |
|
92 |
post_src_install() { |
93 |
move_root_to_usr |
94 |
} |