On 15/07/11 19:54, Andrew Z wrote:
On Fri, Jul 15, 2011 at 2:42 PM, Phil Perry<[email protected]>  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

Reply via email to