Michael Haubenwallner
Wed, 23 May 2007 14:58:56 -0700
On Wed, 2007-05-23 at 20:51 +0200, Fabian Groffen wrote:
> On 07-05-2007 13:25:48 +0200, Michael Haubenwallner wrote:
> > > What if a relative link is given?
> >
> > Valid point: then this is resolved to a file which is unlikely to exist,
> > because it is started relative to $D, and the check will abort.
> >
> > OTOH, gen_usr_ldscript() generates absolute symlinks, and this check
> > ensures that: if there is no usr/lib/lib.so, there must not be a
> > lib/lib.so.
> >
> > But ok - what about this followup-patch:
> >
> > for a in "${ED}"usr/lib*/*.a ; do
> a = usr/lib/libfoo.a
better to be more exact here:
a = /D/prefix/usr/lib/libfoo.a
> > s=${a%.a}.so
> s = usr/lib/libfoo.so
s = /D/prefix/usr/lib/libfoo.so
> > - if [[ -L ${s} ]] ; then
> > - s=${D}$(readlink "${s}") || s=${a%.a}.so
> > + if [[ -L ${s} ]] && rs=$(readlink "${s}"); then
> rs = ../lib/libfoo.so.1
err, need to get out of usr/lib/:
rs = ../../lib/libfoo.so (if relative symlink)
or
rs = /prefix/lib/libfoo.so (if absolute symlink)
> > + [[ ${rs} == /* ]] && s="${D}${rs}" || s="${ED}usr/lib/${rs}"
> s = lib/libfoo.so.1
s = /D/prefix/usr/lib/../../lib/libfoo.so (if relative symlink)
or
s = /D/prefix/lib/libfoo.so (if absolute symlink)
> > fi
s = /D/prefix/usr/lib/../../lib/libfoo.so (if relative symlink)
or
s = /D/prefix/lib/libfoo.so (if absolute symlink)
or
s = /D/prefix/usr/lib/libfoo.so (if ld script)
or
s = /D/prefix/usr/lib/libfoo.so (if nonexistent)
> > if [[ ! -e ${s} ]] ; then
s = /D/prefix/usr/lib/libfoo.so (the nonexistent one only)
way to result: missing usr/lib/libfoo.so
> > + s=${a%.a}.so
> s = lib/libfoo.so.1.so
> or
> s = usr/lib/libfoo.so.so
> I think this is wrong. Is the replacement really necessary? I think .a
> has always been replaced in this case.
err, s is recreated from (still initial) $a, not (current) $s:
s = /D/prefix/usr/lib/libfoo.so
> > s=${s%usr/*}${s##*/usr/}
> s = lib/libfoo.so(.so)
s = /D/prefix/lib/libfoo.so
> > + if [[ -L ${s} ]] && rs=$(readlink "${s}"); then
lib/libfoo.so could be a symlink '-> libfoo.so.1'.
rs = libfoo.so.1
Hmm, could this also be a symlink to somewhere outside lib/ ?
Or even '-> /prefix/lib/libfoo.so.1' ?
If not, we might not need to resolve symlinks (to $D) again here at all,
as [[ -e ]] succeeds if symlink is resolveable.
> > + [[ ${rs} == /* ]] && s="${D}${rs}" || s="${ED}usr/lib/${rs}"
> Hmmm... if s is a link, and it is relative, should it start from
> ${ED}lib in that case?
oops, you're right, should read:
+ [[ ${rs} == /* ]] && s="${D}${rs}" || s="${ED}lib/${rs}"
s = /D/prefix/lib/libfoo.so.1
> > + fi
s = /D/prefix/lib/libfoo.so.1 (if versioning-symlink)
or
s = /D/prefix/lib/libfoo.so (if normal file)
or
s = /D/prefix/lib/libfoo.so (if we do not resolve symlinks again)
or
s = /D/prefix/lib/libfoo.so (if nonexistent)
> > if [[ -e ${s} ]] ; then
way to result: but existing lib/libfoo.so
> > vecho -ne '\a\n'
> > eqawarn "QA Notice: Missing gen_usr_ldscript for ${s##*/}"
> > abort="yes"
> > fi
> > fi
> > done
>
> Really difficult stuff...
and this around midnight...
/haubi/
>
> > > Apparently an invalid symlink makes -e (existence test) fail?
> >
> > Exactly.
> > The symlink ${ED}usr/lib/lib.so points to ${EPREFIX}/lib/lib.so, which
> > does not exist because the package is not merged yet. Thus, 'test -e'
> > fails on that symlink.
> >
> > /haubi/
>
> --
> Fabian Groffen
> Gentoo on a different level
--
[EMAIL PROTECTED] mailing list