Determining KDE version in spec files

Hello,

is there a way, to determine the KDE version of the build environment inside the spec file? Something like the %suse_version macro?

Inside /etc/rpm/macros.kde4 are some macros like %_kde_platform_version defined, but I can not use them for conditions like


%if %_kde_platform_version < 4.1.60

Ok, I have found a solution. Maybe it is not really nice, but I post it. :slight_smile:


KDEVERSION=$(kde4-config --version | grep -o "KDE: [0-9]\.[0-9]\.[0-9]." | sed 's!KDE: !!' | sed 's! !0!' | sed 's!\.!!g')

if test $KDEVERSION -ge 4160 ; then  
    %suse_update_desktop_file -n $RPM_BUILD_ROOT/usr/share/kde4/services/plasma-applet-yasp_temp.desktop
  fi

But this does not work for the files list, so I added two lists as sources and then copy the matching one for using in %files -f files.list


if test $KDEVERSION -ge 4160 ; then
    cp %{S:2} ../files.list ; else
    cp %{S:1} ../files.list
fi

%files -f files.list
%defattr(-,root,root)

All this code is from the spec file of plasmoid-yasp in KDE:KDE4:Community.

As long as it works and it works fine :slight_smile:

Currently this does not work anymore with openSUSE 11.3 and newer. Does anyone know another was to determine the used version of KDE SC? Best way IMHO would be a constant like suse_version in the macros for KDE4. Something like kdesc_version, which could be used like the suse_version macro.