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