fixup Fix to build with libxml 2.12.x (fixes #505)
[platform/upstream/libzypp.git] / libzypp.spec.cmake
index 7585a65..cf444d5 100644 (file)
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+%if 0%{?is_opensuse} && (0%{?sle_version} >= 150100 || 0%{?suse_version} > 1500)
+%bcond_without zchunk
+%else
+%bcond_with zchunk
+%endif
 
-%define force_gcc_46 0
+%bcond_without mediabackend_tests
 
-Name:           @PACKAGE@
+Name:           libzypp
 Version:        @VERSION@
 Release:        0
 License:        GPL-2.0+
-Url:            git://gitorious.org/opensuse/libzypp.git
-Summary:        Package, Patch, Pattern, and Product Management
+Url:            https://github.com/openSUSE/libzypp
+Summary:        Library for package, patch, pattern and product management
 Group:          System/Packages
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source:         %{name}-%{version}.tar.bz2
@@ -32,38 +37,35 @@ Provides:       yast2-packagemanager
 Obsoletes:      yast2-packagemanager
 
 # Features we provide (update doc/autoinclude/FeatureTest.doc):
-Provides:       libzypp(plugin) = 0
+Provides:       libzypp(plugin) = 0.1
 Provides:       libzypp(plugin:appdata) = 0
 Provides:       libzypp(plugin:commit) = 1
-Provides:       libzypp(plugin:services) = 0
-Provides:       libzypp(plugin:system) = 0
+Provides:       libzypp(plugin:services) = 1
+Provides:       libzypp(plugin:system) = 1
 Provides:       libzypp(plugin:urlresolver) = 0
-Provides:       libzypp(repovarexpand) = 0
+Provides:       libzypp(repovarexpand) = 1.1
 
 %if 0%{?suse_version}
 Recommends:     logrotate
 # lsof is used for 'zypper ps':
 Recommends:     lsof
 %endif
-BuildRequires:  cmake
+BuildRequires:  cmake >= 3.1
 BuildRequires:  openssl-devel
-%if 0%{?suse_version} >= 1130 || 0%{?fedora_version} >= 16
-BuildRequires:  libudev-devel
+BuildRequires:  pkgconfig(libudev)
+%if 0%{?suse_version} >= 1330
+BuildRequires:  libboost_headers-devel
+BuildRequires:  libboost_program_options-devel
+BuildRequires:  libboost_test-devel
+BuildRequires:  libboost_thread-devel
 %else
-BuildRequires:  hal-devel
-%endif
 BuildRequires:  boost-devel
+%endif
 BuildRequires:  dejagnu
 BuildRequires:  doxygen
-%if 0%{?force_gcc_46}
-BuildRequires:  gcc46
-BuildRequires:  gcc46-c++
-%else
-BuildRequires:  gcc-c++ >= 4.6
-%endif
+BuildRequires:  gcc-c++ >= 7
 BuildRequires:  gettext-devel
 BuildRequires:  graphviz
-BuildRequires:  graphviz-gnome
 BuildRequires:  libxml2-devel
 %if 0%{?suse_version} != 1110
 # No libproxy on SLES
@@ -76,7 +78,7 @@ BuildRequires:  pkgconfig
 BuildRequires:  pkg-config
 %endif
 
-BuildRequires:  libsolv-devel >= 0.6.7
+BuildRequires:  libsolv-devel >= 0.7.11
 %if 0%{?suse_version} >= 1100
 BuildRequires:  libsolv-tools
 %requires_eq    libsolv-tools
@@ -84,36 +86,41 @@ BuildRequires:  libsolv-tools
 Requires:       libsolv-tools
 %endif
 
-# required for testsuite, webrick
-BuildRequires:  ruby
+BuildRequires:  glib2-devel
+BuildRequires:  libsigc++2-devel
 
-%if 0%{?suse_version}
-BuildRequires:  libexpat-devel
-%else
-BuildRequires:  expat-devel
+# required for testsuite
+%if %{with mediabackend_tests}
+BuildRequires:  nginx
 %endif
 
 Requires:       rpm
 
 %if 0%{?suse_version}
-BuildRequires:  rpm-devel
+BuildRequires:  rpm-devel > 4.4
 %endif
 
 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
-BuildRequires:  glib2-devel
 BuildRequires:  popt-devel
-BuildRequires:  rpm-devel
+BuildRequires:  rpm-devel > 4.4
 %endif
 
 %if 0%{?mandriva_version}
-BuildRequires:  glib2-devel
-BuildRequires:  librpm-devel
+BuildRequires:  librpm-devel > 4.4
 %endif
 
 %if 0%{?suse_version}
-Requires:       gpg2
+BuildRequires:  libgpgme-devel
+#testsuite
+%if %{with mediabackend_tests}
+BuildRequires:  FastCGI-devel
+%endif
 %else
-Requires:       gnupg2
+BuildRequires:  gpgme-devel
+#testsuite
+%if %{with mediabackend_tests}
+BuildRequires: fcgi-devel
+%endif
 %endif
 
 %define min_curl_version 7.19.4
@@ -132,15 +139,48 @@ BuildRequires:  libcurl-devel >= %{min_curl_version}
 Requires:       libcurl   >= %{min_curl_version}
 %endif
 
+# required for documentation
+%if 0%{?suse_version} >= 1330
+BuildRequires:  rubygem(asciidoctor)
+%else
+BuildRequires:  asciidoc
+BuildRequires:  libxslt-tools
+%endif
+
+%if %{with zchunk}
+BuildRequires:  libzck-devel
+%endif
+
 %description
-Package, Patch, Pattern, and Product Management
+libzypp is the package management library that powers applications
+like YaST, zypper and the openSUSE/SLE implementation of PackageKit.
+
+libzypp provides functionality for a package manager:
+
+  * An API for package repository management, supporting most common
+    repository metadata formats and signed repositories.
+  * An API for solving packages, products, patterns and patches
+    (installation, removal, update and distribution upgrade
+    operations) dependencies, with additional features like locking.
+  * An API for commiting the transaction to the system over a rpm
+    target. Supporting deltarpm calculation, media changing and
+    installation order calculation.
+  * An API for browsing available and installed software, with some
+    facilities for programs with an user interface.
 
 %package devel
-Summary:        Package, Patch, Pattern, and Product Management - developers files
+Summary:        Header files for libzypp, a library for package management
 Group:          Development/Libraries/C and C++
 Provides:       yast2-packagemanager-devel
 Obsoletes:      yast2-packagemanager-devel
+%if 0%{?suse_version} >= 1330
+Requires:       libboost_headers-devel
+Requires:       libboost_program_options-devel
+Requires:       libboost_test-devel
+Requires:       libboost_thread-devel
+%else
 Requires:       boost-devel
+%endif
 Requires:       bzip2
 Requires:       glibc-devel
 Requires:       libstdc++-devel
@@ -148,14 +188,9 @@ Requires:       libxml2-devel
 Requires:       libzypp = %{version}
 Requires:       openssl-devel
 Requires:       popt-devel
-Requires:       rpm-devel
+Requires:       rpm-devel > 4.4
 Requires:       zlib-devel
-%if 0%{?suse_version} >= 1130 || 0%{?fedora_version} >= 16
 Requires:       libudev-devel
-%else
-Requires:       hal-devel
-%endif
-Requires:       cmake
 %if 0%{?suse_version}
 %if 0%{?suse_version} >= 1100
 # Code11+
@@ -175,14 +210,15 @@ Requires:       libsolv-devel
 %endif
 
 %description devel
-Package, Patch, Pattern, and Product Management - developers files
+Development files for libzypp, a library for package, patch, pattern
+and product management.
 
 %package devel-doc
-Summary:        Package, Patch, Pattern, and Product Management - developers files
+Summary:        Developer documentation for libzypp
 Group:          Documentation/HTML
 
 %description devel-doc
-Package, Patch, Pattern, and Product Management - developers files
+Developer documentation for libzypp.
 
 %prep
 %setup -q
@@ -190,79 +226,69 @@ Package, Patch, Pattern, and Product Management - developers files
 %build
 mkdir build
 cd build
-%if 0%{?force_gcc_46}
-export CC=gcc-4.6
-export CXX=g++-4.6
-%endif
-export CFLAGS="$RPM_OPT_FLAGS"
-export CXXFLAGS="$RPM_OPT_FLAGS"
-unset TRANSLATION_SET
+export CFLAGS="%{optflags}"
+export CXXFLAGS="%{optflags}"
 unset EXTRA_CMAKE_OPTIONS
-# Same codebase, but SLES may use it's own translation set.
-#     suse_version
-#      1110            SLES11
-#      1315-1319       SLES12
-%if 0%{?suse_version} == 1110 || ( 0%{?suse_version} >= 1315 && 0%{?suse_version} <= 1319 )
-if [ -f ../po/sle-zypp-po.tar.bz2 ]; then
-  export TRANSLATION_SET=sle-zypp
-fi
-%endif
 # No libproxy on SLE11
 %if 0%{?suse_version} == 1110
 export EXTRA_CMAKE_OPTIONS="-DDISABLE_LIBPROXY=ON"
 %endif
 
 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+      -DENABLE_BUILD_DOCS=TRUE \
+      -DENABLE_BUILD_TRANS=TRUE \
+      -DENABLE_BUILD_TESTS=TRUE \
       -DDOC_INSTALL_DIR=%{_docdir} \
       -DLIB=%{_lib} \
       -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_SKIP_RPATH=1 \
-      -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
+      %{?with_zchunk:-DENABLE_ZCHUNK_COMPRESSION=1} \
+      %{!?with_mediabackend_tests:-DDISABLE_MEDIABACKEND_TESTS=1} \
       ${EXTRA_CMAKE_OPTIONS} \
       ..
 make %{?_smp_mflags} VERBOSE=1
-make -C doc/autodoc %{?_smp_mflags}
-make -C po %{?_smp_mflags} translations
-
-%if 0%{?run_testsuite}
-  make -C tests %{?_smp_mflags}
-  pushd tests
-  LD_LIBRARY_PATH=$PWD/../zypp:$LD_LIBRARY_PATH ctest .
-  popd
-%endif
-
-#make check
 
 %install
-rm -rf "$RPM_BUILD_ROOT"
 cd build
-make install DESTDIR=$RPM_BUILD_ROOT
-make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
+%make_install
 %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
+ln -s %{_sysconfdir}/yum.repos.d %{buildroot}/%{_sysconfdir}/zypp/repos.d
 %else
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/repos.d
 %endif
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/services.d
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/systemCheck.d
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/vendors.d
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/multiversion.d
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/appdata
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/commit
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/services
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/system
-mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/urlresolver
-mkdir -p $RPM_BUILD_ROOT%{_var}/lib/zypp
-mkdir -p $RPM_BUILD_ROOT%{_var}/log/zypp
-mkdir -p $RPM_BUILD_ROOT%{_var}/cache/zypp
-
-make -C po install DESTDIR=$RPM_BUILD_ROOT
-# Create filelist with translations
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/services.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/systemCheck.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vars.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vendors.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/multiversion.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/needreboot.d
+mkdir -p %{buildroot}/%{_sysconfdir}/zypp/credentials.d
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/appdata
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/commit
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/services
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/system
+mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/urlresolver
+mkdir -p %{buildroot}/%{_var}/lib/zypp
+mkdir -p %{buildroot}/%{_var}/log/zypp
+mkdir -p %{buildroot}/%{_var}/cache/zypp
+
+# Default to 'solver.dupAllowVendorChange = false' on TW and post SLE12
+%if 0%{?suse_version} >= 1330 || "%{distribution}" == "openSUSE Tumbleweed"
+sed -i "s|# solver.dupAllowVendorChange = true|solver.dupAllowVendorChange = false|g" %{buildroot}%{_sysconfdir}/zypp/zypp.conf
+%endif
+
 cd ..
+
+# Create filelist with translations
 %{find_lang} zypp
 
+%check
+pushd build/tests
+LD_LIBRARY_PATH="$(pwd)/../zypp:$LD_LIBRARY_PATH" ctest --output-on-failure .
+popd
+
 %post
 /sbin/ldconfig
 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
@@ -329,11 +355,11 @@ fi
 
 %postun -p /sbin/ldconfig
 
-%clean
-rm -rf "$RPM_BUILD_ROOT"
-
 %files -f zypp.lang
 %defattr(-,root,root)
+%if 0%{?suse_version} >= 1500
+%license COPYING
+%endif
 %dir               %{_sysconfdir}/zypp
 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
 %{_sysconfdir}/zypp/repos.d
@@ -342,13 +368,17 @@ rm -rf "$RPM_BUILD_ROOT"
 %endif
 %dir               %{_sysconfdir}/zypp/services.d
 %dir               %{_sysconfdir}/zypp/systemCheck.d
+%dir               %{_sysconfdir}/zypp/vars.d
 %dir               %{_sysconfdir}/zypp/vendors.d
 %dir               %{_sysconfdir}/zypp/multiversion.d
+%config(noreplace) %{_sysconfdir}/zypp/needreboot
+%dir               %{_sysconfdir}/zypp/needreboot.d
+%dir               %{_sysconfdir}/zypp/credentials.d
 %config(noreplace) %{_sysconfdir}/zypp/zypp.conf
 %config(noreplace) %{_sysconfdir}/zypp/systemCheck
 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
 %dir               %{_var}/lib/zypp
-%dir               %{_var}/log/zypp
+%dir %attr(750,root,root) %{_var}/log/zypp
 %dir               %{_var}/cache/zypp
 %{_prefix}/lib/zypp
 %{_datadir}/zypp