Switch to using libsolv instead of satsolver
[platform/upstream/libzypp.git] / libzypp.spec.cmake
index 7937ebf..d4b2ad6 100644 (file)
@@ -11,7 +11,7 @@
 # norootforbuild
 
 Name:           @PACKAGE@
-License:        GPLv2+
+License:        GPLv2
 Group:          System/Packages
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Summary:        Package, Patch, Pattern, and Product Management
@@ -21,26 +21,40 @@ Source:         %{name}-%{version}.tar.bz2
 Source1:        %{name}-rpmlintrc
 Provides:       yast2-packagemanager
 Obsoletes:      yast2-packagemanager
+
+# Features we provide (update doc/autoinclude/FeatureTest.doc):
+Provides:       libzypp(plugin) = 0
+Provides:       libzypp(plugin:commit) = 0
+Provides:       libzypp(plugin:services) = 0
+Provides:       libzypp(plugin:system) = 0
+Provides:       libzypp(plugin:urlresolver) = 0
+
 %if 0%{?suse_version}
 Recommends:     logrotate
+# lsof is used for 'zypper ps':
+Recommends:     lsof
 %endif
 BuildRequires:  cmake
 BuildRequires:  openssl-devel
+%if 0%{?suse_version} >= 1130
 BuildRequires:  libudev-devel
+%else
+BuildRequires:  hal-devel
+%endif
 BuildRequires:  boost-devel
 BuildRequires:  dejagnu
 BuildRequires:  doxygen
-BuildRequires:  gcc-c++
+BuildRequires:  gcc-c++ >= 4.5
 BuildRequires:  gettext-devel
 BuildRequires:  graphviz
 BuildRequires:  libxml2-devel
 BuildRequires:  libproxy-devel
 
-BuildRequires:  libsatsolver-devel >= 0.14.17
-%if 0%{?suse_version}
-%requires_eq    satsolver-tools
+BuildRequires:  libsolv-devel
+%if 0%{?suse_version} >= 1100
+%requires_eq    libsolv-tools
 %else
-Requires:       satsolver-tools
+Requires:       libsolv-tools
 %endif
 
 # required for testsuite, webrick
@@ -52,12 +66,17 @@ BuildRequires:  libexpat-devel
 BuildRequires:  expat-devel
 %endif
 
+Requires:      rpm
+
 %if 0%{?suse_version}
 BuildRequires:  rpm-devel
 Requires:       /usr/bin/uuidgen
+%if 0%{?suse_version} > 1020
+BuildRequires:  hicolor-icon-theme
+%endif
 %endif
 
-%if 0%{?fedora_version}
+%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
 BuildRequires:  glib2-devel
 BuildRequires:  popt-devel
 BuildRequires:  rpm-devel
@@ -77,32 +96,33 @@ Requires:       gnupg2
 %endif
 
 # ---------------------------------------------------------------
-%if 0%{?suse_version} == 1110
+%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.
+
+# this check should use 7.19.0 if SLE and 7.19.4 if not (backported
+# CURLOPT_REDIR_PROTOCOLS)
 %define min_curl_version 7.19.0-11.22
-%define use_translation_set sle-zypp
-# ---------------------------------------------------------------
-%else
-# ---------------------------------------------------------------
-# This is >=11.2 (better not sles11-sp1)
-# need CURLOPT_REDIR_PROTOCOLS:
-%define min_curl_version 7.19.4
 %endif
-# No requirement, but as we'd use it in case it is present,
-# check for a sufficient version:
-%define min_aria_version 1.1.2
-Conflicts:      aria2 < %{min_aria_version}
+
 # ---------------------------------------------------------------
 
 %if 0%{?suse_version}
-Requires:       libcurl4 >= %{min_curl_version}
+%if 0%{?suse_version} >= 1100
+# Code11+
+BuildRequires:  libcurl-devel >= %{min_curl_version}
+Requires:       libcurl4   >= %{min_curl_version}
 %else
-Requires:       libcurl >= %{min_curl_version}
+# Code10
+BuildRequires:  curl-devel
 %endif
+%else
+# Other distros (Fedora)
 BuildRequires:  libcurl-devel >= %{min_curl_version}
+Requires:       libcurl   >= %{min_curl_version}
+%endif
 
 %description
 Package, Patch, Pattern, and Product Management
@@ -129,13 +149,28 @@ Requires:       bzip2
 Requires:       popt-devel
 Requires:       boost-devel
 Requires:       libstdc++-devel
+%if 0%{?suse_version} >= 1130
 Requires:       libudev-devel
+%else
+Requires:       hal-devel
+%endif
 Requires:       cmake
-Requires:       libcurl-devel >= %{min_curl_version}
 %if 0%{?suse_version}
-%requires_ge    libsatsolver-devel
+%if 0%{?suse_version} >= 1100
+# Code11+
+Requires:  libcurl-devel >= %{min_curl_version}
+%else
+# Code10
+Requires:  curl-devel
+%endif
+%else
+# Other distros (Fedora)
+Requires:  libcurl-devel >= %{min_curl_version}
+%endif
+%if 0%{?suse_version} >= 1100
+%requires_ge    libsolv-devel
 %else
-Requires:       libsatsolver-devel
+Requires:       libsolv-devel
 %endif
 Summary:        Package, Patch, Pattern, and Product Management - developers files
 Group:          System/Packages
@@ -164,12 +199,19 @@ mkdir build
 cd build
 export CFLAGS="$RPM_OPT_FLAGS"
 export CXXFLAGS="$RPM_OPT_FLAGS"
+unset TRANSLATION_SET
+# SLE11-* might want its own translation set:
+%if 0%{?suse_version} == 1110
+if [ -f ../po/sle-zypp-po.tar.bz ]; then
+  export TRANSLATION_SET=sle-zypp
+fi
+%endif
 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
       -DDOC_INSTALL_DIR=%{_docdir} \
       -DLIB=%{_lib} \
       -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_SKIP_RPATH=1 \
-      %{?use_translation_set:-DUSE_TRANSLATION_SET=%use_translation_set} \
+      -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
       ..
 make %{?_smp_mflags} VERBOSE=1
 make -C doc/autodoc %{?_smp_mflags}
@@ -189,7 +231,7 @@ rm -rf "$RPM_BUILD_ROOT"
 cd build
 make install DESTDIR=$RPM_BUILD_ROOT
 make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
-%if 0%{?fedora_version}
+%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
 ln -s %{_sysconfdir}/yum.repos.d $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
 %else
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
@@ -284,7 +326,7 @@ rm -rf "$RPM_BUILD_ROOT"
 %files -f zypp.lang
 %defattr(-,root,root)
 %dir               %{_sysconfdir}/zypp
-%if 0%{?fedora_version}
+%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
 %{_sysconfdir}/zypp/repos.d
 %else
 %dir               %{_sysconfdir}/zypp/repos.d