Re: RPM: file versions

2011-07-19 Thread Andrew Z
On Fri, Jul 15, 2011 at 10:58 PM, Nico Kadel-Garcia nka...@gmail.comwrote:

 On Fri, Jul 15, 2011 at 2:51 PM, Phil Perry p...@pendre.co.uk wrote:
  On 15/07/11 19:28, Andrew Z wrote:
 
  Hello,
   i just got curios (google is not helping me @ the moment)...
  What is the right way to handle versions of the files during
  installation and removal of the rpm?
  Example:
  ls -l ./
  no files
 
  rpm -uhv   lib_andrew-123.rpm:
   lib_andrew.so -  lib_andrew.so.123
 
  rpm -uhv   lib_andrew-456.rpm:
lib_andrew.so -  lib_andrew.so.456
 
  ls -l ./
   lib_andrew.so -  lib_andrew.so.456
  lib_andrew.so.123
 
  now, what if i want to remove version 123 ???
 
  Andrew
 
 
  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.

 This is normally handled by autoconf based installations installing
 the software into the RPM build environments buildroot, and RPM
 collecting up a list of the files, based on the SPEC file settings.
 RPM is also good about reporting discrepancies.

 I've done amazing amounts of turning sloppy, hard coded build
 structures into autoconf and RPM compatible structures.


Nico, mind to shed more light on how to do this ?


Re: RPM: file versions

2011-07-19 Thread Nico Kadel-Garcia
On Tue, Jul 19, 2011 at 9:50 AM, Andrew Z form...@gmail.com wrote:

 On Fri, Jul 15, 2011 at 10:58 PM, Nico Kadel-Garcia nka...@gmail.com
 wrote:

 On Fri, Jul 15, 2011 at 2:51 PM, Phil Perry p...@pendre.co.uk wrote:
  On 15/07/11 19:28, Andrew Z wrote:
 
  Hello,
   i just got curios (google is not helping me @ the moment)...
  What is the right way to handle versions of the files during
  installation and removal of the rpm?
  Example:
  ls -l ./
  no files
 
  rpm -uhv   lib_andrew-123.rpm:
   lib_andrew.so -  lib_andrew.so.123
 
  rpm -uhv   lib_andrew-456.rpm:
    lib_andrew.so -  lib_andrew.so.456
 
  ls -l ./
   lib_andrew.so -  lib_andrew.so.456
  lib_andrew.so.123
 
  now, what if i want to remove version 123 ???
 
  Andrew
 
 
  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.

 This is normally handled by autoconf based installations installing
 the software into the RPM build environments buildroot, and RPM
 collecting up a list of the files, based on the SPEC file settings.
 RPM is also good about reporting discrepancies.

 I've done amazing amounts of turning sloppy, hard coded build
 structures into autoconf and RPM compatible structures.


 Nico, mind to shed more light on how to do this ?

Oh, boy, where do I start Have you worked with autoconf and
Makefiles? Does your software have an autoconf or other Makefile
based setup for compiling and installing it? Do the Makefiles support
the use of DESTDIR, a prefix used for instaling the software and
which most .spec files use to say actually put the binaries and links
and man pages over here, where we can bundle it up safely, rather than
on the local system?

If not be ready to upgrade the software's build system and installers
to do support DESTDIR, and to include the full installed configuration
or enough for someone deploying the software to complete themselves
after installation. This would run in the '%install' part of your
.spec file, to put all the important bits, including symlinks, in the
build target directory.

Take a good look at the upstream vendor's SRPM's and .spec files for
examples of how this works.


RPM: file versions

2011-07-15 Thread Andrew Z
Hello,
 i just got curios (google is not helping me @ the moment)...
What is the right way to handle versions of the files during
installation and removal of the rpm?
Example:
ls -l ./
no files

rpm -uhv   lib_andrew-123.rpm:
 lib_andrew.so - lib_andrew.so.123

rpm -uhv   lib_andrew-456.rpm:
  lib_andrew.so - lib_andrew.so.456

ls -l ./
 lib_andrew.so - lib_andrew.so.456
lib_andrew.so.123

now, what if i want to remove version 123 ???

Andrew


Re: RPM: file versions

2011-07-15 Thread Andrew Z
On Fri, Jul 15, 2011 at 2:42 PM, Phil Perry p...@pendre.co.uk 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


Re: RPM: file versions

2011-07-15 Thread Phil Perry

On 15/07/11 19:54, Andrew Z wrote:

On Fri, Jul 15, 2011 at 2:42 PM, Phil Perryp...@pendre.co.uk  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


Re: RPM: file versions

2011-07-15 Thread Andrew Z
On Fri, Jul 15, 2011 at 3:41 PM, Phil Perry p...@pendre.co.uk wrote:

 On 15/07/11 19:54, Andrew Z wrote:

 On Fri, Jul 15, 2011 at 2:42 PM, Phil Perryp...@pendre.co.uk  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


Phil this is very helpful indeed. But the links are created by make not by
mr (rpm).  So how should we go around this?

Andrew


Re: RPM: file versions

2011-07-15 Thread Mark Stodola

Andrew Z wrote:
On Fri, Jul 15, 2011 at 3:41 PM, Phil Perry p...@pendre.co.uk 
mailto:p...@pendre.co.uk wrote:


On 15/07/11 19:54, Andrew Z wrote:

On Fri, Jul 15, 2011 at 2:42 PM, Phil Perryp...@pendre.co.uk
mailto:p...@pendre.co.uk  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


Phil this is very helpful indeed. But the links are created by make 
not by mr (rpm).  So how should we go around this?
 
Andrew


If I'm not mistaken, you should not need to manually link libraries.  
ldconfig should be taking care of this for you, so all you would need is 
the %post entry to run ldconfig with the proper flags after 
install/upgrade/removal.  Assuming it ends up in a standard path, 
otherwise the ld.so.conf entries are needed as well.


-Mark

--
Mr. Mark V. Stodola
Digital Systems Engineer

National Electrostatics Corp.
P.O. Box 620310
Middleton, WI 53562-0310 USA
Phone: (608) 831-7600
Fax: (608) 831-9591


Re: RPM: file versions

2011-07-15 Thread Phil Perry

On 15/07/11 21:59, Mark Stodola wrote:

If I'm not mistaken, you should not need to manually link libraries.
ldconfig should be taking care of this for you, so all you would need is
the %post entry to run ldconfig with the proper flags after
install/upgrade/removal. Assuming it ends up in a standard path,
otherwise the ld.so.conf entries are needed as well.

-Mark



Correct. Running ldconfig in %post will create the symlinks from the 
SONAME, assuming they are present in the lib. But you must still ensure 
the symlinks are owned by the package otherwise they get left behind 
when the package is removed. A wildcard entry in %files might be all 
that's needed (e.g, %{_libdir}/lib_andrew.so*)


You can query the SONAME with objdump:

objdump -p /usr/lib/lib_andrew.so.1.2.3 | grep SONAME


Re: RPM: file versions

2011-07-15 Thread Nico Kadel-Garcia
On Fri, Jul 15, 2011 at 2:51 PM, Phil Perry p...@pendre.co.uk wrote:
 On 15/07/11 19:28, Andrew Z wrote:

 Hello,
  i just got curios (google is not helping me @ the moment)...
 What is the right way to handle versions of the files during
 installation and removal of the rpm?
 Example:
 ls -l ./
 no files

 rpm -uhv   lib_andrew-123.rpm:
  lib_andrew.so -  lib_andrew.so.123

 rpm -uhv   lib_andrew-456.rpm:
   lib_andrew.so -  lib_andrew.so.456

 ls -l ./
  lib_andrew.so -  lib_andrew.so.456
 lib_andrew.so.123

 now, what if i want to remove version 123 ???

 Andrew


 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.

This is normally handled by autoconf based installations installing
the software into the RPM build environments buildroot, and RPM
collecting up a list of the files, based on the SPEC file settings.
RPM is also good about reporting discrepancies.

I've done amazing amounts of turning sloppy, hard coded build
structures into autoconf and RPM compatible structures.

 Take a look in any relevant package SPEC file from the distro for examples
 of how this should be handled.