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