Add feature provides for supported plugins.
[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:        GPLv2
15 Group:          System/Packages
16 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
17 Summary:        Package, Patch, Pattern, and Product Management
18 Version:        @VERSION@
19 Release:        0
20 Source:         %{name}-%{version}.tar.bz2
21 Source1:        %{name}-rpmlintrc
22 Provides:       yast2-packagemanager
23 Obsoletes:      yast2-packagemanager
24
25 # Features we provide (update doc/autoinclude/FeatureTest.doc):
26 Provides:       libzypp(plugin:commit) = 0
27 Provides:       libzypp(plugin:services) = 0
28 Provides:       libzypp(plugin:system) = 0
29 Provides:       libzypp(plugin:urlresolver) = 0
30
31 %if 0%{?suse_version}
32 Recommends:     logrotate
33 # lsof is used for 'zypper ps':
34 Recommends:     lsof
35 %endif
36 BuildRequires:  cmake
37 BuildRequires:  openssl-devel
38 %if 0%{?suse_version} >= 1130
39 BuildRequires:  libudev-devel
40 %else
41 BuildRequires:  hal-devel
42 %endif
43 BuildRequires:  boost-devel
44 BuildRequires:  dejagnu
45 BuildRequires:  doxygen
46 BuildRequires:  gcc-c++
47 BuildRequires:  gettext-devel
48 BuildRequires:  graphviz
49 BuildRequires:  libxml2-devel
50 BuildRequires:  libproxy-devel
51
52 BuildRequires:  libsatsolver-devel >= 0.14.17
53 %if 0%{?suse_version} >= 1100
54 %requires_eq    satsolver-tools
55 %else
56 Requires:       satsolver-tools
57 %endif
58
59 # required for testsuite, webrick
60 BuildRequires:  ruby
61
62 %if 0%{?suse_version}
63 BuildRequires:  libexpat-devel
64 %else
65 BuildRequires:  expat-devel
66 %endif
67
68 %if 0%{?suse_version}
69 BuildRequires:  rpm-devel
70 Requires:       /usr/bin/uuidgen
71 %if 0%{?suse_version} > 1020
72 BuildRequires:  hicolor-icon-theme
73 %endif
74 %endif
75
76 %if 0%{?fedora_version}
77 BuildRequires:  glib2-devel
78 BuildRequires:  popt-devel
79 BuildRequires:  rpm-devel
80 %endif
81
82 %if 0%{?mandriva_version}
83 BuildRequires:  glib2-devel
84 BuildRequires:  librpm-devel
85 # uuidgen
86 Requires:       e2fsprogs
87 %endif
88
89 %if 0%{?suse_version}
90 Requires:       gpg2
91 %else
92 Requires:       gnupg2
93 %endif
94
95 %define min_aria_version 1.1.2
96 # ---------------------------------------------------------------
97 %if 0%{?suse_version} >= 1110
98 # (almost) common codebase, but on SLES11-SP1 (according to Rudi
99 # suse_version == 1110) we have a patched libcurl-7.19.0-11.22,
100 # and no aria2. Furthermore SLE may use it's own set of .po files
101 # from po/sle-zypp-po.tar.bz2.
102
103 # this check should use 7.19.0 if SLE and 7.19.4 if not (backported
104 # CURLOPT_REDIR_PROTOCOLS)
105 %define min_curl_version 7.19.0-11.22
106 %endif
107
108 # ---------------------------------------------------------------
109
110 %if 0%{?suse_version}
111 %if 0%{?suse_version} >= 1100
112 # Code11+
113 BuildRequires:  libcurl-devel >= %{min_curl_version}
114 Requires:       libcurl4   >= %{min_curl_version}
115 %else
116 # Code10
117 BuildRequires:  curl-devel
118 %endif
119 %else
120 # Other distros (Fedora)
121 BuildRequires:  libcurl-devel >= %{min_curl_version}
122 Requires:       libcurl   >= %{min_curl_version}
123 %endif
124
125 %description
126 Package, Patch, Pattern, and Product Management
127
128 Authors:
129 --------
130     Michael Andres <ma@suse.de>
131     Jiri Srain <jsrain@suse.cz>
132     Stefan Schubert <schubi@suse.de>
133     Duncan Mac-Vicar <dmacvicar@suse.de>
134     Klaus Kaempf <kkaempf@suse.de>
135     Marius Tomaschewski <mt@suse.de>
136     Stanislav Visnovsky <visnov@suse.cz>
137     Ladislav Slezak <lslezak@suse.cz>
138
139 %package devel
140 Requires:       libzypp = %{version}
141 Requires:       libxml2-devel
142 Requires:       openssl-devel
143 Requires:       rpm-devel
144 Requires:       glibc-devel
145 Requires:       zlib-devel
146 Requires:       bzip2
147 Requires:       popt-devel
148 Requires:       boost-devel
149 Requires:       libstdc++-devel
150 %if 0%{?suse_version} >= 1130
151 Requires:       libudev-devel
152 %else
153 Requires:       hal-devel
154 %endif
155 Requires:       cmake
156 %if 0%{?suse_version}
157 %if 0%{?suse_version} >= 1100
158 # Code11+
159 Requires:  libcurl-devel >= %{min_curl_version}
160 %else
161 # Code10
162 Requires:  curl-devel
163 %endif
164 %else
165 # Other distros (Fedora)
166 Requires:  libcurl-devel >= %{min_curl_version}
167 %endif
168 %if 0%{?suse_version} >= 1100
169 %requires_ge    libsatsolver-devel
170 %else
171 Requires:       libsatsolver-devel
172 %endif
173 Summary:        Package, Patch, Pattern, and Product Management - developers files
174 Group:          System/Packages
175 Provides:       yast2-packagemanager-devel
176 Obsoletes:      yast2-packagemanager-devel
177
178 %description -n libzypp-devel
179 Package, Patch, Pattern, and Product Management - developers files
180
181 Authors:
182 --------
183     Michael Andres <ma@suse.de>
184     Jiri Srain <jsrain@suse.cz>
185     Stefan Schubert <schubi@suse.de>
186     Duncan Mac-Vicar <dmacvicar@suse.de>
187     Klaus Kaempf <kkaempf@suse.de>
188     Marius Tomaschewski <mt@suse.de>
189     Stanislav Visnovsky <visnov@suse.cz>
190     Ladislav Slezak <lslezak@suse.cz>
191
192 %prep
193 %setup -q
194
195 %build
196 mkdir build
197 cd build
198 export CFLAGS="$RPM_OPT_FLAGS"
199 export CXXFLAGS="$RPM_OPT_FLAGS"
200 unset TRANSLATION_SET
201 # SLE11-* might want its own translation set:
202 %if 0%{?suse_version} == 1110
203 if [ -f ../po/sle-zypp-po.tar.bz ]; then
204   export TRANSLATION_SET=sle-zypp
205 fi
206 %endif
207 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
208       -DDOC_INSTALL_DIR=%{_docdir} \
209       -DLIB=%{_lib} \
210       -DCMAKE_BUILD_TYPE=Release \
211       -DCMAKE_SKIP_RPATH=1 \
212       -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
213       ..
214 make %{?_smp_mflags} VERBOSE=1
215 make -C doc/autodoc %{?_smp_mflags}
216 make -C po %{?_smp_mflags} translations
217
218 %if 0%{?run_testsuite}
219   make -C tests %{?_smp_mflags}
220   pushd tests
221   LD_LIBRARY_PATH=$PWD/../zypp:$LD_LIBRARY_PATH ctest .
222   popd
223 %endif
224
225 #make check
226
227 %install
228 rm -rf "$RPM_BUILD_ROOT"
229 cd build
230 make install DESTDIR=$RPM_BUILD_ROOT
231 make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
232 %if 0%{?fedora_version}
233 ln -s %{_sysconfdir}/yum.repos.d $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
234 %else
235 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
236 %endif
237 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/services.d
238 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp
239 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins
240 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/commit
241 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/services
242 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/system
243 mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/zypp/plugins/urlresolver
244 mkdir -p $RPM_BUILD_ROOT%{_var}/lib/zypp
245 mkdir -p $RPM_BUILD_ROOT%{_var}/log/zypp
246 mkdir -p $RPM_BUILD_ROOT%{_var}/cache/zypp
247
248 make -C po install DESTDIR=$RPM_BUILD_ROOT
249 # Create filelist with translations
250 cd ..
251 %{find_lang} zypp
252
253
254 %post
255 /sbin/ldconfig
256 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
257
258 # convert old lock file to new
259 # TODO make this a separate file?
260 # TODO run the sript only when updating form pre-11.0 libzypp versions
261 LOCKSFILE=%{_sysconfdir}/zypp/locks
262 OLDLOCKSFILE=%{_sysconfdir}/zypp/locks.old
263
264 is_old(){
265   # if no such file, exit with false (1 in bash)
266   test -f ${LOCKSFILE} || return 1
267   TEMP_FILE=`mktemp`
268   cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
269   if [ -s ${TEMP_FILE} ]
270   then
271     RES=0
272   else
273     RES=1
274   fi
275   rm -f ${TEMP_FILE}
276   return ${RES}
277 }
278
279 append_new_lock(){
280   case "$#" in
281     1 )
282   echo "
283 solvable_name: $1
284 match_type: glob
285 " >> ${LOCKSFILE}
286 ;;
287     2 ) #TODO version
288   echo "
289 solvable_name: $1
290 match_type: glob
291 version: $2
292 " >> ${LOCKSFILE}
293 ;;
294     3 ) #TODO version
295   echo "
296 solvable_name: $1
297 match_type: glob
298 version: $2 $3
299 " >> ${LOCKSFILE}
300   ;;
301 esac
302 }
303
304 die() {
305   echo $1
306   exit 1
307 }
308
309 if is_old ${LOCKSFILE}
310   then
311   mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
312   cat ${OLDLOCKSFILE}| sed "/^\#.*/d"| while read line
313   do
314     append_new_lock $line
315   done
316 fi
317
318
319 %postun -p /sbin/ldconfig
320
321 %clean
322 rm -rf "$RPM_BUILD_ROOT"
323
324 %files -f zypp.lang
325 %defattr(-,root,root)
326 %dir               %{_sysconfdir}/zypp
327 %if 0%{?fedora_version}
328 %{_sysconfdir}/zypp/repos.d
329 %else
330 %dir               %{_sysconfdir}/zypp/repos.d
331 %endif
332 %dir               %{_sysconfdir}/zypp/services.d
333 %config(noreplace) %{_sysconfdir}/zypp/zypp.conf
334 %config(noreplace) %{_sysconfdir}/zypp/systemCheck
335 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
336 %dir               %{_var}/lib/zypp
337 %dir               %{_var}/log/zypp
338 %dir               %{_var}/cache/zypp
339 %{_prefix}/lib/zypp
340 %{_datadir}/zypp
341 %{_bindir}/*
342 %{_libdir}/libzypp*so.*
343 %doc %{_mandir}/man5/locks.5.*
344
345 %files devel
346 %defattr(-,root,root)
347 %{_libdir}/libzypp.so
348 %{_docdir}/%{name}
349 %{_includedir}/zypp
350 %{_datadir}/cmake/Modules/*
351 %{_libdir}/pkgconfig/libzypp.pc
352
353 %changelog