Imported Upstream version 17.2.2
[platform/upstream/libzypp.git] / libzypp.spec.cmake
index cb1e0fb..c97c532 100644 (file)
 #
 # spec file for package libzypp
 #
-# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
-# This file and all modifications and additions to the pristine
-# package are under the same license as the package itself.
+# Copyright (c) 2005-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
 
 Name:           @PACKAGE@
-License:        GPLv2+
-Group:          System/Packages
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Summary:        Package, Patch, Pattern, and Product Management
 Version:        @VERSION@
 Release:        0
+License:        GPL-2.0+
+Url:            git://gitorious.org/opensuse/libzypp.git
+Summary:        Package, Patch, Pattern, and Product Management
+Group:          System/Packages
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 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.1
+Provides:       libzypp(plugin:appdata) = 0
+Provides:       libzypp(plugin:commit) = 1
+Provides:       libzypp(plugin:services) = 1
+Provides:       libzypp(plugin:system) = 1
+Provides:       libzypp(plugin:urlresolver) = 0
+Provides:       libzypp(repovarexpand) = 1.1
+
 %if 0%{?suse_version}
 Recommends:     logrotate
+# lsof is used for 'zypper ps':
+Recommends:     lsof
 %endif
 BuildRequires:  cmake
 BuildRequires:  openssl-devel
-BuildRequires:  libudev-devel
+%if 0%{?suse_version} >= 1130 || 0%{?fedora_version} >= 16
+BuildRequires:  pkgconfig(libudev)
+%else
+BuildRequires:  hal-devel
+%endif
+%if 0%{?suse_version} >= 1330
+BuildRequires:  libboost_headers-devel
+BuildRequires:  libboost_program_options-devel
+BuildRequires:  libboost_test-devel
+BuildRequires:  libboost_thread-devel
+%else
 BuildRequires:  boost-devel
+%endif
 BuildRequires:  dejagnu
 BuildRequires:  doxygen
-BuildRequires:  gcc-c++
+BuildRequires:  gcc-c++ >= 4.6
 BuildRequires:  gettext-devel
 BuildRequires:  graphviz
 BuildRequires:  libxml2-devel
+%if 0%{?suse_version} != 1110
+# No libproxy on SLES
+BuildRequires:  libproxy-devel
+%endif
 
-BuildRequires:  libsatsolver-devel >= 0.14.17
-%if 0%{?suse_version}
-%requires_eq    satsolver-tools
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+BuildRequires:  pkgconfig
+%else
+BuildRequires:  pkg-config
+%endif
+
+BuildRequires:  libsolv-devel >= 0.6.27
+%if 0%{?suse_version} >= 1100
+BuildRequires:  libsolv-tools
+%requires_eq    libsolv-tools
 %else
-Requires:       satsolver-tools
+Requires:       libsolv-tools
 %endif
 
 # required for testsuite, webrick
 BuildRequires:  ruby
 
-%if 0%{?suse_version}
-BuildRequires:  libexpat-devel
-%else
-BuildRequires:  expat-devel
-%endif
+Requires:       rpm
 
 %if 0%{?suse_version}
-BuildRequires:  hicolor-icon-theme
-BuildRequires:  update-desktop-files
-BuildRequires:  rpm-devel
-Requires:       uuid-runtime
+BuildRequires:  rpm-devel > 4.4
 %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
+BuildRequires:  rpm-devel > 4.4
 %endif
 
 %if 0%{?mandriva_version}
 BuildRequires:  glib2-devel
-BuildRequires:  librpm-devel
-# uuidgen
-Requires:       e2fsprogs
+BuildRequires:  librpm-devel > 4.4
 %endif
 
 %if 0%{?suse_version}
-Requires:       gpg2
+BuildRequires:  libgpgme-devel
 %else
-Requires:       gnupg2
+BuildRequires:  gpgme-devel
 %endif
 
-%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}
+%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
+
+# required for documentation
+%if 0%{?suse_version} >= 1330
+BuildRequires:  rubygem(asciidoctor)
+%else
+BuildRequires:  asciidoc
+BuildRequires:  libxslt-tools
+%endif
 
 %description
 Package, Patch, Pattern, and Product Management
 
-Authors:
---------
-    Michael Andres <ma@suse.de>
-    Jiri Srain <jsrain@suse.cz>
-    Stefan Schubert <schubi@suse.de>
-    Duncan Mac-Vicar <dmacvicar@suse.de>
-    Klaus Kaempf <kkaempf@suse.de>
-    Marius Tomaschewski <mt@suse.de>
-    Stanislav Visnovsky <visnov@suse.cz>
-    Ladislav Slezak <lslezak@suse.cz>
-
 %package devel
-Requires:       libzypp = %{version}
+Summary:        Package, Patch, Pattern, and Product Management - developers files
+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
 Requires:       libxml2-devel
+Requires:       libzypp = %{version}
 Requires:       openssl-devel
-Requires:       rpm-devel
-Requires:       glibc-devel
-Requires:       zlib-devel
-Requires:       bzip2
 Requires:       popt-devel
-Requires:       boost-devel
-Requires:       libstdc++-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
-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
-Requires:       libsatsolver-devel
+# 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:       libsolv-devel
 %endif
-Summary:        Package, Patch, Pattern, and Product Management - developers files
-Group:          System/Packages
-Provides:       yast2-packagemanager-devel
-Obsoletes:      yast2-packagemanager-devel
 
-%description -n libzypp-devel
+%description devel
 Package, Patch, Pattern, and Product Management - developers files
 
-Authors:
---------
-    Michael Andres <ma@suse.de>
-    Jiri Srain <jsrain@suse.cz>
-    Stefan Schubert <schubi@suse.de>
-    Duncan Mac-Vicar <dmacvicar@suse.de>
-    Klaus Kaempf <kkaempf@suse.de>
-    Marius Tomaschewski <mt@suse.de>
-    Stanislav Visnovsky <visnov@suse.cz>
-    Ladislav Slezak <lslezak@suse.cz>
+%package devel-doc
+Summary:        Package, Patch, Pattern, and Product Management - developers files
+Group:          Documentation/HTML
+
+%description devel-doc
+Package, Patch, Pattern, and Product Management - developers files
 
 %prep
 %setup -q
@@ -168,40 +200,54 @@ mkdir build
 cd build
 export CFLAGS="$RPM_OPT_FLAGS"
 export CXXFLAGS="$RPM_OPT_FLAGS"
+unset EXTRA_CMAKE_OPTIONS
+# No libproxy on SLE11
+%if 0%{?suse_version} == 1110
+export EXTRA_CMAKE_OPTIONS="-DDISABLE_LIBPROXY=ON"
+%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} \
+      ${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
+make -C tests %{?_smp_mflags}
 
 %install
 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} || 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
+%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/vars.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/vendors.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/multiversion.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/credentials.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
 
-%if 0%{?suse_version}
-%suse_update_desktop_file -G "" -C "" package-manager
+# 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
 
 make -C po install DESTDIR=$RPM_BUILD_ROOT
@@ -209,6 +255,10 @@ make -C po install DESTDIR=$RPM_BUILD_ROOT
 cd ..
 %{find_lang} zypp
 
+%check
+pushd build/tests
+LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir}:${LD_LIBRARY_PATH} ctest .
+popd
 
 %post
 /sbin/ldconfig
@@ -274,7 +324,6 @@ if is_old ${LOCKSFILE}
   done
 fi
 
-
 %postun -p /sbin/ldconfig
 
 %clean
@@ -283,8 +332,17 @@ rm -rf "$RPM_BUILD_ROOT"
 %files -f zypp.lang
 %defattr(-,root,root)
 %dir               %{_sysconfdir}/zypp
+%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
+%{_sysconfdir}/zypp/repos.d
+%else
 %dir               %{_sysconfdir}/zypp/repos.d
+%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
+%dir               %{_sysconfdir}/zypp/credentials.d
 %config(noreplace) %{_sysconfdir}/zypp/zypp.conf
 %config(noreplace) %{_sysconfdir}/zypp/systemCheck
 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
@@ -293,23 +351,20 @@ rm -rf "$RPM_BUILD_ROOT"
 %dir               %{_var}/cache/zypp
 %{_prefix}/lib/zypp
 %{_datadir}/zypp
-%{_datadir}/applications/package-manager.desktop
-%{_datadir}/icons/hicolor/scalable/apps/package-manager-icon.svg
-%{_datadir}/icons/hicolor/16x16/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/22x22/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/24x24/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/32x32/apps/package-manager-icon.png
-%{_datadir}/icons/hicolor/48x48/apps/package-manager-icon.png
 %{_bindir}/*
 %{_libdir}/libzypp*so.*
-%doc %{_mandir}/man5/locks.5.*
+%doc %{_mandir}/man1/*.1.*
+%doc %{_mandir}/man5/*.5.*
 
 %files devel
 %defattr(-,root,root)
 %{_libdir}/libzypp.so
-%{_docdir}/%{name}
 %{_includedir}/zypp
 %{_datadir}/cmake/Modules/*
 %{_libdir}/pkgconfig/libzypp.pc
 
+%files devel-doc
+%defattr(-,root,root)
+%{_docdir}/%{name}
+
 %changelog