On SLE aria2 is not required, so conflict with too old versions (bnc #578052)
[platform/upstream/libzypp.git] / libzypp.spec.cmake
1 #
2 # spec file for package libzypp
3 #
4 # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
5 # This file and all modifications and additions to the pristine
6 # package are under the same license as the package itself.
7 #
8 # Please submit bugfixes or comments via http://bugs.opensuse.org/
9 #
10
11 # norootforbuild
12
13 Name:           @PACKAGE@
14 License:        GPL v2 or later
15 Group:          System/Packages
16 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
17 Autoreqprov:    on
18 Summary:        Package, Patch, Pattern, and Product Management
19 Version:        @VERSION@
20 Release:        0
21 Source:         %{name}-%{version}.tar.bz2
22 Source1:        %{name}-rpmlintrc
23 Prefix:         /usr
24 Provides:       yast2-packagemanager
25 Obsoletes:      yast2-packagemanager
26 Recommends:     logrotate
27 BuildRequires:  cmake
28 BuildRequires:  openssl-devel
29 BuildRequires:  boost-devel dejagnu doxygen gcc-c++ gettext-devel graphviz hal-devel libxml2-devel
30
31 BuildRequires:  libsatsolver-devel >= 0.14.13
32 %requires_eq    satsolver-tools
33
34 # required for testsuite, webrick
35 BuildRequires:  ruby
36
37 %if 0%{?suse_version}
38 BuildRequires:  libexpat-devel
39 %else
40 BuildRequires:  expat-devel
41 %endif
42
43 %if 0%{?suse_version}
44 BuildRequires:  hicolor-icon-theme update-desktop-files rpm-devel
45 Requires: uuid-runtime
46 %endif
47
48 %if 0%{?fedora_version}
49 BuildRequires: glib2-devel popt-devel dbus-glib-devel rpm-devel
50 %endif
51
52 %if 0%{?mandriva_version}
53 BuildRequires:  glib2-devel
54 BuildRequires:  librpm-devel
55 # uuidgen
56 Requires: e2fsprogs
57 %endif
58
59 %if 0%{?suse_version}
60 Requires:       gpg2
61 %else
62 Requires:       gnupg
63 %endif
64
65 %define min_aria_version 1.1.2
66 # ---------------------------------------------------------------
67 %if 0%{?suse_version} == 1110
68 # (almost) common codebase, but on SLES11-SP1 (according to Rudi
69 # suse_version == 1110) we have a patched libcurl-7.19.0-11.22,
70 # and no aria2. Furthermore SLE may use it's own set of .po files
71 # from po/sle-zypp-po.tar.bz2.
72 %define min_curl_version 7.19.0-11.22
73 %define use_translation_set sle-zypp
74 # No requirement, but as we'd use it in case it is present,
75 # check for a sufficient version:
76 Conflicts:      aria2 < %{min_aria_version}
77 # ---------------------------------------------------------------
78 %else
79 # ---------------------------------------------------------------
80 # This is 11.2 (better not sles11-sp1)
81 # need CURLOPT_REDIR_PROTOCOLS:
82 %define min_curl_version 7.19.4
83 # want aria2:
84 Requires:      aria2 >= %{min_aria_version}
85 BuildRequires: aria2 >= %{min_aria_version}
86 %endif
87 # ---------------------------------------------------------------
88
89 Requires:       libcurl4   >= %{min_curl_version}
90 BuildRequires:  libcurl-devel >= %{min_curl_version}
91
92 %description
93 Package, Patch, Pattern, and Product Management
94
95 Authors:
96 --------
97     Michael Andres <ma@suse.de>
98     Jiri Srain <jsrain@suse.cz>
99     Stefan Schubert <schubi@suse.de>
100     Duncan Mac-Vicar <dmacvicar@suse.de>
101     Klaus Kaempf <kkaempf@suse.de>
102     Marius Tomaschewski <mt@suse.de>
103     Stanislav Visnovsky <visnov@suse.cz>
104     Ladislav Slezak <lslezak@suse.cz>
105
106 %package devel
107 Requires:       libzypp == %{version}
108 Requires:       libxml2-devel openssl-devel rpm-devel glibc-devel zlib-devel
109 Requires:       bzip2 popt-devel dbus-1-devel glib2-devel hal-devel boost-devel libstdc++-devel
110 Requires:       cmake
111 Requires:       libcurl-devel >= %{min_curl_version}
112 %requires_ge    libsatsolver-devel
113
114 Summary:        Package, Patch, Pattern, and Product Management - developers files
115 Group:          System/Packages
116 Provides:       yast2-packagemanager-devel
117 Obsoletes:      yast2-packagemanager-devel
118
119 %description -n libzypp-devel
120 Package, Patch, Pattern, and Product Management - developers files
121
122 Authors:
123 --------
124     Michael Andres <ma@suse.de>
125     Jiri Srain <jsrain@suse.cz>
126     Stefan Schubert <schubi@suse.de>
127     Duncan Mac-Vicar <dmacvicar@suse.de>
128     Klaus Kaempf <kkaempf@suse.de>
129     Marius Tomaschewski <mt@suse.de>
130     Stanislav Visnovsky <visnov@suse.cz>
131     Ladislav Slezak <lslezak@suse.cz>
132
133 %prep
134 %setup -q
135
136 %build
137 mkdir build
138 cd build
139 export CFLAGS="$RPM_OPT_FLAGS"
140 export CXXFLAGS="$CFLAGS"
141 cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
142       -DDOC_INSTALL_DIR=%{_docdir} \
143       -DLIB=%{_lib} \
144       -DCMAKE_BUILD_TYPE=Release \
145       -DCMAKE_SKIP_RPATH=1 \
146       %{?use_translation_set:-DUSE_TRANSLATION_SET=%use_translation_set} \
147       ..
148 make %{?jobs:-j %jobs} VERBOSE=1
149 make -C doc/autodoc %{?jobs:-j %jobs}
150 make -C po %{?jobs:-j %jobs} translations
151
152 %if 0%{?run_testsuite}
153   make -C tests %{?jobs:-j %jobs}
154   pushd tests
155   LD_LIBRARY_PATH=$PWD/../zypp:$LD_LIBRARY_PATH ctest .
156   popd
157 %endif
158
159 #make check
160
161 %install
162 rm -rf "$RPM_BUILD_ROOT"
163 cd build
164 make install DESTDIR=$RPM_BUILD_ROOT
165 make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
166 mkdir -p $RPM_BUILD_ROOT/etc/zypp/repos.d
167 mkdir -p $RPM_BUILD_ROOT/etc/zypp/services.d
168 mkdir -p $RPM_BUILD_ROOT/%{_usr}/lib/zypp
169 mkdir -p $RPM_BUILD_ROOT/%{_var}/lib/zypp
170 mkdir -p $RPM_BUILD_ROOT/%{_var}/log/zypp
171 mkdir -p $RPM_BUILD_ROOT/%{_var}/cache/zypp
172
173 %if 0%{?suse_version}
174 %suse_update_desktop_file -G "" -C "" package-manager
175 %endif
176
177 make -C po install DESTDIR=$RPM_BUILD_ROOT
178 # Create filelist with translations
179 cd ..
180 %{find_lang} zypp
181
182
183 %post
184 %run_ldconfig
185 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
186
187 # convert old lock file to new
188 # TODO make this a separate file?
189 # TODO run the sript only when updating form pre-11.0 libzypp versions
190 LOCKSFILE=/etc/zypp/locks
191 OLDLOCKSFILE=/etc/zypp/locks.old
192
193 is_old(){
194   # if no such file, exit with false (1 in bash)
195   test -f ${LOCKSFILE} || return 1
196   TEMP_FILE=`mktemp`
197   cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
198   if [ -s ${TEMP_FILE} ]
199   then
200     RES=0
201   else
202     RES=1
203   fi
204   rm -f ${TEMP_FILE}
205   return ${RES}
206 }
207
208 append_new_lock(){
209   case "$#" in
210     1 )
211   echo "
212 solvable_name: $1
213 match_type: glob
214 " >> ${LOCKSFILE}
215 ;;
216     2 ) #TODO version
217   echo "
218 solvable_name: $1
219 match_type: glob
220 version: $2
221 " >> ${LOCKSFILE}
222 ;;
223     3 ) #TODO version
224   echo "
225 solvable_name: $1
226 match_type: glob
227 version: $2 $3
228 " >> ${LOCKSFILE}
229   ;;
230 esac
231 }
232
233 die() {
234   echo $1
235   exit 1
236 }
237
238 if is_old ${LOCKSFILE}
239   then
240   mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
241   cat ${OLDLOCKSFILE}| sed "/^\#.*/d"| while read line
242   do
243     append_new_lock $line
244   done
245 fi
246
247
248 %postun
249 %run_ldconfig
250
251 %clean
252 rm -rf "$RPM_BUILD_ROOT"
253
254 %files -f zypp.lang
255 %defattr(-,root,root)
256 %dir               /etc/zypp
257 %dir               /etc/zypp/repos.d
258 %dir               /etc/zypp/services.d
259 %config(noreplace) /etc/zypp/zypp.conf
260 %config(noreplace) /etc/zypp/systemCheck
261 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
262                    %{_usr}/lib/zypp
263 %dir               %{_var}/lib/zypp
264 %dir               %{_var}/log/zypp
265 %dir               %{_var}/cache/zypp
266 %dir               %{prefix}/lib/zypp
267 %{prefix}/share/zypp
268 %{prefix}/share/applications/package-manager.desktop
269 %{prefix}/share/icons/hicolor/scalable/apps/package-manager-icon.svg
270 %{prefix}/share/icons/hicolor/16x16/apps/package-manager-icon.png
271 %{prefix}/share/icons/hicolor/22x22/apps/package-manager-icon.png
272 %{prefix}/share/icons/hicolor/24x24/apps/package-manager-icon.png
273 %{prefix}/share/icons/hicolor/32x32/apps/package-manager-icon.png
274 %{prefix}/share/icons/hicolor/48x48/apps/package-manager-icon.png
275 %{prefix}/bin/*
276 %{_libdir}/libzypp*so.*
277 %doc %_mandir/man5/locks.5.*
278
279 %files devel
280 %defattr(-,root,root)
281 %{_libdir}/libzypp.so
282 %{_docdir}/%{name}
283 %{prefix}/include/zypp
284 %{prefix}/share/cmake/Modules/*
285 %{_libdir}/pkgconfig/libzypp.pc
286
287 %changelog