1 |
On Wed, 2007-05-23 at 20:51 +0200, Fabian Groffen wrote: |
2 |
> On 07-05-2007 13:25:48 +0200, Michael Haubenwallner wrote: |
3 |
> > > What if a relative link is given? |
4 |
> > |
5 |
> > Valid point: then this is resolved to a file which is unlikely to exist, |
6 |
> > because it is started relative to $D, and the check will abort. |
7 |
> > |
8 |
> > OTOH, gen_usr_ldscript() generates absolute symlinks, and this check |
9 |
> > ensures that: if there is no usr/lib/lib.so, there must not be a |
10 |
> > lib/lib.so. |
11 |
> > |
12 |
> > But ok - what about this followup-patch: |
13 |
> > |
14 |
> > for a in "${ED}"usr/lib*/*.a ; do |
15 |
> a = usr/lib/libfoo.a |
16 |
|
17 |
better to be more exact here: |
18 |
a = /D/prefix/usr/lib/libfoo.a |
19 |
|
20 |
> > s=${a%.a}.so |
21 |
> s = usr/lib/libfoo.so |
22 |
|
23 |
s = /D/prefix/usr/lib/libfoo.so |
24 |
|
25 |
> > - if [[ -L ${s} ]] ; then |
26 |
> > - s=${D}$(readlink "${s}") || s=${a%.a}.so |
27 |
> > + if [[ -L ${s} ]] && rs=$(readlink "${s}"); then |
28 |
> rs = ../lib/libfoo.so.1 |
29 |
|
30 |
err, need to get out of usr/lib/: |
31 |
|
32 |
rs = ../../lib/libfoo.so (if relative symlink) |
33 |
or |
34 |
rs = /prefix/lib/libfoo.so (if absolute symlink) |
35 |
|
36 |
> > + [[ ${rs} == /* ]] && s="${D}${rs}" || s="${ED}usr/lib/${rs}" |
37 |
> s = lib/libfoo.so.1 |
38 |
|
39 |
s = /D/prefix/usr/lib/../../lib/libfoo.so (if relative symlink) |
40 |
or |
41 |
s = /D/prefix/lib/libfoo.so (if absolute symlink) |
42 |
|
43 |
> > fi |
44 |
|
45 |
s = /D/prefix/usr/lib/../../lib/libfoo.so (if relative symlink) |
46 |
or |
47 |
s = /D/prefix/lib/libfoo.so (if absolute symlink) |
48 |
or |
49 |
s = /D/prefix/usr/lib/libfoo.so (if ld script) |
50 |
or |
51 |
s = /D/prefix/usr/lib/libfoo.so (if nonexistent) |
52 |
|
53 |
> > if [[ ! -e ${s} ]] ; then |
54 |
|
55 |
s = /D/prefix/usr/lib/libfoo.so (the nonexistent one only) |
56 |
|
57 |
way to result: missing usr/lib/libfoo.so |
58 |
|
59 |
> > + s=${a%.a}.so |
60 |
> s = lib/libfoo.so.1.so |
61 |
> or |
62 |
> s = usr/lib/libfoo.so.so |
63 |
> I think this is wrong. Is the replacement really necessary? I think .a |
64 |
> has always been replaced in this case. |
65 |
|
66 |
err, s is recreated from (still initial) $a, not (current) $s: |
67 |
|
68 |
s = /D/prefix/usr/lib/libfoo.so |
69 |
|
70 |
> > s=${s%usr/*}${s##*/usr/} |
71 |
> s = lib/libfoo.so(.so) |
72 |
|
73 |
s = /D/prefix/lib/libfoo.so |
74 |
|
75 |
> > + if [[ -L ${s} ]] && rs=$(readlink "${s}"); then |
76 |
|
77 |
lib/libfoo.so could be a symlink '-> libfoo.so.1'. |
78 |
|
79 |
rs = libfoo.so.1 |
80 |
|
81 |
Hmm, could this also be a symlink to somewhere outside lib/ ? |
82 |
Or even '-> /prefix/lib/libfoo.so.1' ? |
83 |
If not, we might not need to resolve symlinks (to $D) again here at all, |
84 |
as [[ -e ]] succeeds if symlink is resolveable. |
85 |
|
86 |
> > + [[ ${rs} == /* ]] && s="${D}${rs}" || s="${ED}usr/lib/${rs}" |
87 |
> Hmmm... if s is a link, and it is relative, should it start from |
88 |
> ${ED}lib in that case? |
89 |
|
90 |
oops, you're right, should read: |
91 |
+ [[ ${rs} == /* ]] && s="${D}${rs}" || s="${ED}lib/${rs}" |
92 |
|
93 |
s = /D/prefix/lib/libfoo.so.1 |
94 |
|
95 |
> > + fi |
96 |
|
97 |
s = /D/prefix/lib/libfoo.so.1 (if versioning-symlink) |
98 |
or |
99 |
s = /D/prefix/lib/libfoo.so (if normal file) |
100 |
or |
101 |
s = /D/prefix/lib/libfoo.so (if we do not resolve symlinks again) |
102 |
or |
103 |
s = /D/prefix/lib/libfoo.so (if nonexistent) |
104 |
|
105 |
> > if [[ -e ${s} ]] ; then |
106 |
|
107 |
way to result: but existing lib/libfoo.so |
108 |
|
109 |
> > vecho -ne '\a\n' |
110 |
> > eqawarn "QA Notice: Missing gen_usr_ldscript for ${s##*/}" |
111 |
> > abort="yes" |
112 |
> > fi |
113 |
> > fi |
114 |
> > done |
115 |
> |
116 |
> Really difficult stuff... |
117 |
|
118 |
and this around midnight... |
119 |
|
120 |
/haubi/ |
121 |
> |
122 |
> > > Apparently an invalid symlink makes -e (existence test) fail? |
123 |
> > |
124 |
> > Exactly. |
125 |
> > The symlink ${ED}usr/lib/lib.so points to ${EPREFIX}/lib/lib.so, which |
126 |
> > does not exist because the package is not merged yet. Thus, 'test -e' |
127 |
> > fails on that symlink. |
128 |
> > |
129 |
> > /haubi/ |
130 |
> |
131 |
> -- |
132 |
> Fabian Groffen |
133 |
> Gentoo on a different level |
134 |
|
135 |
|
136 |
-- |
137 |
gentoo-alt@g.o mailing list |