backup
[platform/upstream/libzypp.git] / libzypp.spec.cmake
index 9dcc7ef..6cbcdca 100644 (file)
@@ -18,19 +18,27 @@ Autoreqprov:    on
 Summary:        Package, Patch, Pattern, and Product Management
 Version:        @VERSION@
 Release:        0
-Source:         @PACKAGE@-@VERSION@.tar.bz2
-Source1:        @PACKAGE@-rpmlintrc
+Source:         %{name}-%{version}.tar.bz2
+Source1:        %{name}-rpmlintrc
 Prefix:         /usr
 Provides:       yast2-packagemanager
 Obsoletes:      yast2-packagemanager
+%if 0%{?suse_version}
 Recommends:     logrotate
+%endif
 BuildRequires:  cmake
-BuildRequires:  libsatsolver-devel >= 0.13.0 openssl-devel
-BuildRequires:  boost-devel curl-devel dejagnu doxygen gcc-c++ gettext-devel graphviz hal-devel libxml2-devel
+BuildRequires:  openssl-devel
+BuildRequires:  boost-devel dejagnu doxygen gcc-c++ gettext-devel graphviz hal-devel libxml2-devel
+
+BuildRequires:  libsatsolver-devel >= 0.14.13
+%if 0%{?suse_version}
+%requires_eq    satsolver-tools
+%else
+Requires:      satsolver-tools
+%endif
 
 # required for testsuite, webrick
 BuildRequires:  ruby
-BuildRequires: aria2 >= 1.1.2
 
 %if 0%{?suse_version}
 BuildRequires:  libexpat-devel
@@ -57,11 +65,39 @@ Requires: e2fsprogs
 %if 0%{?suse_version}
 Requires:       gpg2
 %else
-Requires:       gnupg
+Requires:       gnupg2
 %endif
-%requires_eq    satsolver-tools
 
-Requires:       aria2 >= 1.1.2
+%define min_aria_version 1.1.2
+# ---------------------------------------------------------------
+%if 0%{?suse_version} == 1110
+# (almost) common codebase, but on SLES11-SP1 (according to Rudi
+# suse_version == 1110) we have a patched libcurl-7.19.0-11.22,
+# and no aria2. Furthermore SLE may use it's own set of .po files
+# from po/sle-zypp-po.tar.bz2.
+%define min_curl_version 7.19.0-11.22
+%define use_translation_set sle-zypp
+# No requirement, but as we'd use it in case it is present,
+# check for a sufficient version:
+Conflicts:     aria2 < %{min_aria_version}
+# ---------------------------------------------------------------
+%else
+# ---------------------------------------------------------------
+# This is 11.2 (better not sles11-sp1)
+# need CURLOPT_REDIR_PROTOCOLS:
+%define min_curl_version 7.19.4
+# want aria2:
+Requires:      aria2 >= %{min_aria_version}
+BuildRequires: aria2 >= %{min_aria_version}
+%endif
+# ---------------------------------------------------------------
+
+%if 0%{?suse_version}
+Requires:       libcurl4   >= %{min_curl_version}
+%else
+Requires:       libcurl   >= %{min_curl_version}
+%endif
+BuildRequires:  libcurl-devel >= %{min_curl_version}
 
 %description
 Package, Patch, Pattern, and Product Management
@@ -78,10 +114,16 @@ Authors:
     Ladislav Slezak <lslezak@suse.cz>
 
 %package devel
-Requires:       libzypp == @VERSION@
-Requires:       libxml2-devel curl-devel openssl-devel rpm-devel glibc-devel zlib-devel
+Requires:       libzypp == %{version}
+Requires:       libxml2-devel openssl-devel rpm-devel glibc-devel zlib-devel
 Requires:       bzip2 popt-devel dbus-1-devel glib2-devel hal-devel boost-devel libstdc++-devel
-Requires:       cmake libsatsolver-devel >= 0.13.0
+Requires:       cmake
+Requires:       libcurl-devel >= %{min_curl_version}
+%if 0%{?suse_version}
+%requires_ge    libsatsolver-devel
+%else
+Requires:      libsatsolver-devel
+%endif
 Summary:        Package, Patch, Pattern, and Product Management - developers files
 Group:          System/Packages
 Provides:       yast2-packagemanager-devel
@@ -114,13 +156,17 @@ cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
       -DLIB=%{_lib} \
       -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_SKIP_RPATH=1 \
+      %{?use_translation_set:-DUSE_TRANSLATION_SET=%use_translation_set} \
       ..
 make %{?jobs:-j %jobs} VERBOSE=1
 make -C doc/autodoc %{?jobs:-j %jobs}
 make -C po %{?jobs:-j %jobs} translations
 
 %if 0%{?run_testsuite}
-  ctest .
+  make -C tests %{?jobs:-j %jobs}
+  pushd tests
+  LD_LIBRARY_PATH=$PWD/../zypp:$LD_LIBRARY_PATH ctest .
+  popd
 %endif
 
 #make check
@@ -132,6 +178,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
 make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT/etc/zypp/repos.d
 mkdir -p $RPM_BUILD_ROOT/etc/zypp/services.d
+mkdir -p $RPM_BUILD_ROOT/%{_usr}/lib/zypp
 mkdir -p $RPM_BUILD_ROOT/%{_var}/lib/zypp
 mkdir -p $RPM_BUILD_ROOT/%{_var}/log/zypp
 mkdir -p $RPM_BUILD_ROOT/%{_var}/cache/zypp
@@ -147,9 +194,8 @@ cd ..
 
 
 %post
-%run_ldconfig
+/sbin/ldconfig
 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
-#%{prefix}/lib/zypp/zypp-migrate-sources
 
 # convert old lock file to new
 # TODO make this a separate file?
@@ -212,8 +258,7 @@ if is_old ${LOCKSFILE}
 fi
 
 
-%postun
-%run_ldconfig
+%postun -p /sbin/ldconfig
 
 %clean
 rm -rf "$RPM_BUILD_ROOT"
@@ -226,9 +271,11 @@ rm -rf "$RPM_BUILD_ROOT"
 %config(noreplace) /etc/zypp/zypp.conf
 %config(noreplace) /etc/zypp/systemCheck
 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
+                   %{_usr}/lib/zypp
 %dir               %{_var}/lib/zypp
 %dir               %{_var}/log/zypp
 %dir               %{_var}/cache/zypp
+%dir               %{prefix}/lib/zypp
 %{prefix}/share/zypp
 %{prefix}/share/applications/package-manager.desktop
 %{prefix}/share/icons/hicolor/scalable/apps/package-manager-icon.svg
@@ -237,8 +284,7 @@ rm -rf "$RPM_BUILD_ROOT"
 %{prefix}/share/icons/hicolor/24x24/apps/package-manager-icon.png
 %{prefix}/share/icons/hicolor/32x32/apps/package-manager-icon.png
 %{prefix}/share/icons/hicolor/48x48/apps/package-manager-icon.png
-%{prefix}/bin/package-manager
-%{prefix}/bin/package-manager-su
+%{prefix}/bin/*
 %{_libdir}/libzypp*so.*
 %doc %_mandir/man5/locks.5.*