Patterns are no longer pseudo installed (Fate#309385)
[platform/upstream/libzypp.git] / libzypp.spec.cmake
index f9575bb..a6fa468 100644 (file)
@@ -1,36 +1,86 @@
 #
 # 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
+
+%define force_gcc_46 0
 
 Name:           @PACKAGE@
-License:        GPL v2 or later
-Group:          System/Packages
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Autoreqprov:    on
 Summary:        Package, Patch, Pattern, and Product Management
+License:        GPL-2.0+
+Group:          System/Packages
 Version:        @VERSION@
 Release:        0
-Source:         @PACKAGE@-@VERSION@.tar.bz2
-Source1:        @PACKAGE@-rpmlintrc
-Prefix:         /usr
+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) = 1
+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:  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
+%if 0%{?suse_version} >= 1130 || 0%{?fedora_version} >= 16
+BuildRequires:  libudev-devel
+%else
+BuildRequires:  hal-devel
+%endif
+BuildRequires:  boost-devel
+BuildRequires:  dejagnu
+BuildRequires:  doxygen
+%if 0%{?force_gcc_46}
+BuildRequires:  gcc46
+BuildRequires:  gcc46-c++
+%else
+BuildRequires:  gcc-c++ >= 4.6
+%endif
+BuildRequires:  gettext-devel
+BuildRequires:  graphviz
+BuildRequires:  libxml2-devel
+%if 0%{?suse_version} != 1110
+# No libproxy on SLES
+BuildRequires:  libproxy-devel
+%endif
+
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+BuildRequires:  pkgconfig
+%else
+BuildRequires:  pkg-config
+%endif
+
+BuildRequires:  libsolv-devel >= 0.4.1
+%if 0%{?suse_version} >= 1100
+%requires_eq    libsolv-tools
+%else
+Requires:       libsolv-tools
+%endif
 
 # required for testsuite, webrick
 BuildRequires:  ruby
-BuildRequires: aria2 >= 1.1.2
 
 %if 0%{?suse_version}
 BuildRequires:  libexpat-devel
@@ -38,30 +88,44 @@ BuildRequires:  libexpat-devel
 BuildRequires:  expat-devel
 %endif
 
+Requires:       rpm
+
 %if 0%{?suse_version}
-BuildRequires:  hicolor-icon-theme update-desktop-files rpm-devel
-Requires: uuid-runtime
+BuildRequires:  rpm-devel
 %endif
 
-%if 0%{?fedora_version}
-BuildRequires: glib2-devel popt-devel dbus-glib-devel rpm-devel
+%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
+BuildRequires:  glib2-devel
+BuildRequires:  popt-devel
+BuildRequires:  rpm-devel
 %endif
 
 %if 0%{?mandriva_version}
 BuildRequires:  glib2-devel
 BuildRequires:  librpm-devel
-# uuidgen
-Requires: e2fsprogs
 %endif
 
 %if 0%{?suse_version}
 Requires:       gpg2
 %else
-Requires:       gnupg
+Requires:       gnupg2
 %endif
-%requires_eq    satsolver-tools
 
-Requires:       aria2 >= 1.1.2
+%define min_curl_version 7.19.4
+%if 0%{?suse_version}
+%if 0%{?suse_version} >= 1100
+# Code11+
+BuildRequires:  libcurl-devel >= %{min_curl_version}
+Requires:       libcurl4   >= %{min_curl_version}
+%else
+# 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
@@ -78,10 +142,39 @@ 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:       bzip2 popt-devel dbus-1-devel glib2-devel hal-devel boost-devel libstdc++-devel
-Requires:       cmake libsatsolver-devel >= 0.13.0
+Requires:       boost-devel
+Requires:       bzip2
+Requires:       glibc-devel
+Requires:       libstdc++-devel
+Requires:       libxml2-devel
+Requires:       libzypp = %{version}
+Requires:       openssl-devel
+Requires:       popt-devel
+Requires:       rpm-devel
+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+
+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:       libsolv-devel
+%endif
 Summary:        Package, Patch, Pattern, and Product Management - developers files
 Group:          System/Packages
 Provides:       yast2-packagemanager-devel
@@ -107,22 +200,37 @@ Authors:
 %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="$CFLAGS"
-cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
+export CXXFLAGS="$RPM_OPT_FLAGS"
+unset TRANSLATION_SET
+unset EXTRA_CMAKE_OPTIONS
+# 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
+  export EXTRA_CMAKE_OPTIONS="-DDISABLE_LIBPROXY=ON"
+fi
+%endif
+cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
       -DDOC_INSTALL_DIR=%{_docdir} \
       -DLIB=%{_lib} \
       -DCMAKE_BUILD_TYPE=Release \
       -DCMAKE_SKIP_RPATH=1 \
+      -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
+      ${EXTRA_CMAKE_OPTIONS} \
       ..
-make %{?jobs:-j %jobs} VERBOSE=1
-make -C doc/autodoc %{?jobs:-j %jobs}
-make -C po %{?jobs:-j %jobs} translations
+make %{?_smp_mflags} VERBOSE=1
+make -C doc/autodoc %{?_smp_mflags}
+make -C po %{?_smp_mflags} translations
 
 %if 0%{?run_testsuite}
-  make -C tests %{?jobs:-j %jobs}
+  make -C tests %{?_smp_mflags}
   pushd tests
-  ctest -A
+  LD_LIBRARY_PATH=$PWD/../zypp:$LD_LIBRARY_PATH ctest .
   popd
 %endif
 
@@ -133,32 +241,38 @@ rm -rf "$RPM_BUILD_ROOT"
 cd build
 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/%{_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
+%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/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/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
 cd ..
 %{find_lang} zypp
 
-
 %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?
 # TODO run the sript only when updating form pre-11.0 libzypp versions
-LOCKSFILE=/etc/zypp/locks
-OLDLOCKSFILE=/etc/zypp/locks.old
+LOCKSFILE=%{_sysconfdir}/zypp/locks
+OLDLOCKSFILE=%{_sysconfdir}/zypp/locks.old
 
 is_old(){
   # if no such file, exit with false (1 in bash)
@@ -214,43 +328,40 @@ if is_old ${LOCKSFILE}
   done
 fi
 
-
-%postun
-%run_ldconfig
+%postun -p /sbin/ldconfig
 
 %clean
 rm -rf "$RPM_BUILD_ROOT"
 
 %files -f zypp.lang
 %defattr(-,root,root)
-%dir               /etc/zypp
-%dir               /etc/zypp/repos.d
-%dir               /etc/zypp/services.d
-%config(noreplace) /etc/zypp/zypp.conf
-%config(noreplace) /etc/zypp/systemCheck
+%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/vendors.d
+%dir               %{_sysconfdir}/zypp/multiversion.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               %{_var}/cache/zypp
-%{prefix}/share/zypp
-%{prefix}/share/applications/package-manager.desktop
-%{prefix}/share/icons/hicolor/scalable/apps/package-manager-icon.svg
-%{prefix}/share/icons/hicolor/16x16/apps/package-manager-icon.png
-%{prefix}/share/icons/hicolor/22x22/apps/package-manager-icon.png
-%{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}/lib/zypp
+%{_datadir}/zypp
+%{_bindir}/*
 %{_libdir}/libzypp*so.*
-%doc %_mandir/man5/locks.5.*
+%doc %{_mandir}/man5/locks.5.*
 
 %files devel
 %defattr(-,root,root)
 %{_libdir}/libzypp.so
 %{_docdir}/%{name}
-%{prefix}/include/zypp
-%{prefix}/share/cmake/Modules/*
+%{_includedir}/zypp
+%{_datadir}/cmake/Modules/*
 %{_libdir}/pkgconfig/libzypp.pc
 
 %changelog