[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

%iflibcversion %ifnlibcversion



Hello,

I am interested in knowing which version of libc the system is running to know 
whether one should apply patches or not. I looked in chapter 13 in "Maximum 
RPM" under the "conditionals section" and I could not find anything there.

I added the macro _libcversion in macros, maybe a more proper name could have 
been used.

Syntax is as follows:

%iflibcversion 2.2.2
echo "Yes, we are running 2.2.2."
%endif

The matching is done the same way as %ifos and similar tags. Patch is below, 
use it at your own risk, it seems to be working for me though. Patch is 
against 4.0.2.

/ Peter

--- rpm-4.0.2.orig/build/parseSpec.c    Tue Jan 16 14:08:55 2001
+++ rpm-4.0.2/build/parseSpec.c Wed Jul 18 13:23:58 2001
@@ -261,6 +261,16 @@
        s += 6;
        match = !matchTok(os, s);
        free((void *)os);
+    } else if (! strncmp("%iflibcversion", s, sizeof("%iflibcversion")-1)) {
+        const char *os = rpmExpand("%{_libcversion}", NULL);
+        s += 14;
+        match = matchTok(os, s);
+        free((void *)os);
+    } else if (! strncmp("%ifnlibcversion", s, sizeof("%ifnlibcversion")-1)) {
+        const char *os = rpmExpand("%{_libcversion}", NULL);
+        s += 15;
+        match = matchTok(os, s);
+        free((void *)os);
     } else if (! strncmp("%if", s, sizeof("%if")-1)) {
        s += 3;
         match = parseExpressionBoolean(spec, s);
diff -Naur rpm-4.0.2.orig/configure.in rpm-4.0.2/configure.in
--- rpm-4.0.2.orig/configure.in Sun Feb 25 18:13:26 2001
+++ rpm-4.0.2/configure.in      Wed Jul 18 13:19:20 2001
@@ -1016,9 +1016,21 @@
        ;;
 esac
 RPMCANONOS="$build_os_noversion"
+
+dnl
+dnl Find the libc version if glibc. This is ugly.
+dnl
+
+RPMCANONLIBCVERSION=1
+case "${build_os_noversion}" in
+linux)
+         RPMCANONLIBCVERSION=`/lib/libc.so.6  | awk 
'first==0{first=1;sub(",","",$7);print $7}'`
+esac
+
 AC_SUBST(RPMCANONARCH)
 AC_SUBST(RPMCANONVENDOR)
 AC_SUBST(RPMCANONOS)
+AC_SUBST(RPMCANONLIBCVERSION)
 
 if test -n "$LIBOBJS" ; then
     LIBMISC='$(top_builddir)/misc/libmisc.a'
diff -Naur rpm-4.0.2.orig/macros.in rpm-4.0.2/macros.in
--- rpm-4.0.2.orig/macros.in    Mon Dec 11 19:40:56 2000
+++ rpm-4.0.2/macros.in Wed Jul 18 13:19:38 2001
@@ -276,6 +276,7 @@
 %_arch                 @RPMCANONARCH@
 %_vendor               @RPMCANONVENDOR@
 %_os                   @RPMCANONOS@
+%_libcversion           @RPMCANONLIBCVERSION@
 %_target_platform      %{_target_cpu}-%{_vendor}-%{_target_os}
 
 #






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []