SCIENTIFIC-LINUX-USERS Archives

July 2011

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Phil Perry <[log in to unmask]>
Reply To:
Phil Perry <[log in to unmask]>
Date:
Fri, 15 Jul 2011 20:41:59 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (57 lines)
On 15/07/11 19:54, Andrew Z wrote:
> On Fri, Jul 15, 2011 at 2:42 PM, Phil Perry<[log in to unmask]>  wrote:
>> On 15/07/11 19:28, Andrew Z wrote:
>
> <Skip>
>> You need to have your SPEC file create the symlinks in the buildroot so that
>> they are a part of the package, i.e, the symlinks are owned by the rpm
>> package. Then when you uninstall or update the package rpm will
>> remove/update the symlinks for you rather than leave them dangling as per
>> your example above.
>>
>> Take a look in any relevant package SPEC file from the distro for examples
>> of how this should be handled.
>
> Phil,
>   thank you. That's what i thought and i took a look @
> glibc-2.3.4-2.54.src.rpm. I didn't notice any of the functionality you
> mentioned, which prompted me to write the email.
>
> another question is :
>   do i explicitly add the file.version to the %files section  or just
> mention the link ?
>
> Thank you
> Andrew
>

To summarize,  lib_andrew-123.rpm installs the file lib_andrew.so.123 
and creates a symlink to it called lib_andrew.so

Here is how I would handle it:

# make the libdir directory in the buildroot
%{__mkdir_p} %{buildroot}/path/to/libdir/

# then install the lib
%{__install} -p -m 0755 lib_andrew.so.123 %{buildroot}/path/to/libdir/

# then create the symlink(s) as necessary
%{__ln_s} lib_andrew.so.123 %{buildroot}/path/to/libdir/lib_andrew.so


You must also make sure /path/to/libdir is on the ldconfig path if you 
have installed to a non-standard path - if not, add it like so:

%{__mkdir_p} %{buildroot}%{_sysconfdir}/ld.so.conf.d/
echo /path/to/libdir > 
%{buildroot}%{_sysconfdir}/ld.so.conf.d/lib_andrew.conf

but if you can, it's far easier to just install to /usr/lib(64)

Finally, in %post run /sbin/ldconfig

Your %files section then needs to include all of the above.

Hope that helps

ATOM RSS1 RSS2