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