Bump to 17.31.23
[platform/upstream/libzypp.git] / packaging / libzypp.spec
1 Name:           libzypp
2 License:        GPL-2.0+
3 Group:          System/Package Management
4 Summary:        Package, Patch, Pattern, and Product Management
5 Version:        17.31.23
6 Release:        1
7 Source:         %{name}-%{version}.tar.bz2
8 Source1:        %{name}-rpmlintrc
9 Source10:       Exclude_subdirectory.patch
10 Source11:       add_pie_compile_option.patch
11 Source12:       fix_swig_syntax_error.patch
12 Source1001:     libzypp.manifest
13
14 # Features we provide (update doc/autoinclude/FeatureTest.doc):
15 Provides:       libzypp(plugin) = 0.1
16 Provides:       libzypp(plugin:appdata) = 0
17 Provides:       libzypp(plugin:commit) = 1
18 Provides:       libzypp(plugin:services) = 1
19 Provides:       libzypp(plugin:system) = 1
20 Provides:       libzypp(plugin:urlresolver) = 0
21 Provides:       libzypp(repovarexpand) = 1.1
22
23 BuildRequires:  cmake
24 BuildRequires:  libgpgme-devel
25 BuildRequires:  libxslt-tools
26 BuildRequires:  asciidoc
27 BuildRequires:  pkgconfig(openssl1.1)
28 BuildRequires:  libudev-devel
29 BuildRequires:  boost-devel
30 BuildRequires:  doxygen
31 BuildRequires:  gcc-c++ >= 4.6
32 BuildRequires:  gettext-devel
33 BuildRequires:  libxml2-devel
34 BuildRequires:  pkgconfig(libproxy-1.0)
35 BuildRequires:  pkgconfig(sigc++-2.0)
36 BuildRequires:  protobuf-devel
37 BuildRequires:  protobuf-static
38 BuildRequires:  protobuf-lite-static
39 BuildRequires:  protobuf-lite
40 BuildRequires:  yaml-cpp-devel
41 BuildRequires:  libsolv-devel
42 Requires:       libsolv-tools
43
44 # should be recommends
45 Requires:       lsof
46
47 BuildRequires:  expat-devel
48
49 Requires:       rpm
50
51 BuildRequires:  rpm-devel
52
53 BuildRequires:  glib2-devel
54 BuildRequires:  popt-devel
55 BuildRequires:  rpm-devel
56
57 %define min_curl_version 7.19.4
58 BuildRequires:  libcurl-devel >= %{min_curl_version}
59 Requires:       libcurl   >= %{min_curl_version}
60
61 # Without gpg, any repos with public key sign will fail.
62 Requires:       gpg
63
64 %description
65 Package, Patch, Pattern, and Product Management
66
67 Authors:
68 --------
69     Michael Andres <ma@suse.de>
70     Jiri Srain <jsrain@suse.cz>
71     Stefan Schubert <schubi@suse.de>
72     Duncan Mac-Vicar <dmacvicar@suse.de>
73     Klaus Kaempf <kkaempf@suse.de>
74     Marius Tomaschewski <mt@suse.de>
75     Stanislav Visnovsky <visnov@suse.cz>
76     Ladislav Slezak <lslezak@suse.cz>
77
78 %package devel
79 Summary:        Package, Patch, Pattern, and Product Management - developers files
80 License:        GPL-2.0+
81 Requires:       libzypp = %{version}
82 Requires:       libxml2-devel
83 Requires:       pkgconfig(openssl1.1)
84 Requires:       rpm-devel
85 Requires:       glibc-devel
86 Requires:       zlib-devel
87 Requires:       bzip2
88 Requires:       popt-devel
89 Requires:       boost-devel
90 Requires:       libstdc++-devel
91 Requires:       libudev-devel
92 Requires:       cmake
93 Requires:       libcurl-devel >= %{min_curl_version}
94 Requires:       libsolv-devel
95 Group:          Development/Libraries
96
97 %description -n libzypp-devel
98 Package, Patch, Pattern, and Product Management - developers files
99
100 Authors:
101 --------
102     Michael Andres <ma@suse.de>
103     Jiri Srain <jsrain@suse.cz>
104     Stefan Schubert <schubi@suse.de>
105     Duncan Mac-Vicar <dmacvicar@suse.de>
106     Klaus Kaempf <kkaempf@suse.de>
107     Marius Tomaschewski <mt@suse.de>
108     Stanislav Visnovsky <visnov@suse.cz>
109     Ladislav Slezak <lslezak@suse.cz>
110
111 %prep
112 %setup -q
113 cp %{SOURCE1001} .
114 %{__patch} -p1 < %{SOURCE10}
115 %{__patch} -p1 < %{SOURCE11}
116 %{__patch} -p1 < %{SOURCE12}
117
118 %build
119 mkdir build
120 cd build
121 export CFLAGS="$RPM_OPT_FLAGS"
122 export CXXFLAGS="$RPM_OPT_FLAGS"
123 unset TRANSLATION_SET
124 unset EXTRA_CMAKE_OPTIONS
125 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
126       -DDOC_INSTALL_DIR=%{_docdir} \
127       -DLIB=%{_lib} \
128       -DCMAKE_BUILD_TYPE=Release \
129       -DCMAKE_SKIP_RPATH=1 \
130       -DUSE_TRANSLATION_SET=${TRANSLATION_SET:-zypp} \
131       ${EXTRA_CMAKE_OPTIONS} \
132       ..
133 make %{?_smp_mflags} VERBOSE=1
134 # make -C doc/autodoc %{?_smp_mflags}
135 make -C po %{?_smp_mflags} translations
136
137 %install
138 rm -rf "$RPM_BUILD_ROOT"
139 cd build
140 make install DESTDIR=$RPM_BUILD_ROOT
141 # make -C doc/autodoc install DESTDIR=$RPM_BUILD_ROOT
142 %if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
143 ln -s %{_sysconfdir}/yum.repos.d $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
144 %else
145 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zypp/repos.d
146 %endif
147 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/services.d
148 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/systemCheck.d
149 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vars.d
150 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/vendors.d
151 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/multiversion.d
152 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/needreboot.d
153 mkdir -p %{buildroot}/%{_sysconfdir}/zypp/credentials.d
154 mkdir -p %{buildroot}/%{_prefix}/lib/zypp
155 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins
156 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/appdata
157 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/commit
158 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/services
159 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/system
160 mkdir -p %{buildroot}/%{_prefix}/lib/zypp/plugins/urlresolver
161 mkdir -p %{buildroot}/%{_var}/lib/zypp
162 mkdir -p %{buildroot}/%{_var}/log/zypp
163 mkdir -p %{buildroot}/%{_var}/cache/zypp
164
165 make -C po install DESTDIR=$RPM_BUILD_ROOT
166 # Create filelist with translations
167 cd ..
168 %{find_lang} zypp
169
170 %{remove_docs}
171
172 %post
173 /sbin/ldconfig
174 if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
175
176 # convert old lock file to new
177 # TODO make this a separate file?
178 # TODO run the sript only when updating form pre-11.0 libzypp versions
179 LOCKSFILE=%{_sysconfdir}/zypp/locks
180 OLDLOCKSFILE=%{_sysconfdir}/zypp/locks.old
181
182 is_old(){
183   # if no such file, exit with false (1 in bash)
184   test -f ${LOCKSFILE} || return 1
185   TEMP_FILE=`mktemp`
186   cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
187   if [ -s ${TEMP_FILE} ]
188   then
189     RES=0
190   else
191     RES=1
192   fi
193   rm -f ${TEMP_FILE}
194   return ${RES}
195 }
196
197 append_new_lock(){
198   case "$#" in
199     1 )
200   echo "
201 solvable_name: $1
202 match_type: glob
203 " >> ${LOCKSFILE}
204 ;;
205     2 ) #TODO version
206   echo "
207 solvable_name: $1
208 match_type: glob
209 version: $2
210 " >> ${LOCKSFILE}
211 ;;
212     3 ) #TODO version
213   echo "
214 solvable_name: $1
215 match_type: glob
216 version: $2 $3
217 " >> ${LOCKSFILE}
218   ;;
219 esac
220 }
221
222 die() {
223   echo $1
224   exit 1
225 }
226
227 if is_old ${LOCKSFILE}
228   then
229   mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
230   cat ${OLDLOCKSFILE}| sed "/^\#.*/d"| while read line
231   do
232     append_new_lock $line
233   done
234 fi
235
236 %postun -p /sbin/ldconfig
237
238 %lang_package -f zypp
239
240 %files
241 %manifest %{name}.manifest
242 %license           COPYING
243 %dir               %{_sysconfdir}/zypp
244 %dir               %{_sysconfdir}/zypp/repos.d
245 %dir               %{_sysconfdir}/zypp/services.d
246 %dir               %{_sysconfdir}/zypp/systemCheck.d
247 %dir               %{_sysconfdir}/zypp/vars.d
248 %dir               %{_sysconfdir}/zypp/vendors.d
249 %dir               %{_sysconfdir}/zypp/multiversion.d
250 %config(noreplace) %{_sysconfdir}/zypp/needreboot
251 %dir               %{_sysconfdir}/zypp/needreboot.d
252 %dir               %{_sysconfdir}/zypp/credentials.d
253 %config(noreplace) %{_sysconfdir}/zypp/zypp.conf
254 %config(noreplace) %{_sysconfdir}/zypp/systemCheck
255 %config(noreplace) %{_sysconfdir}/logrotate.d/zypp-history.lr
256 %dir               %{_var}/lib/zypp
257 %dir %attr(750,root,root) %{_var}/log/zypp
258 %dir               %{_var}/cache/zypp
259 %{_prefix}/lib/zypp
260 %{_datadir}/zypp
261 %{_bindir}/*
262 %{_libdir}/libzypp*so.*
263 %{_libexecdir}/zypp/zypp-rpm
264
265 %files devel
266 %manifest %{name}.manifest
267 %license           COPYING
268 %{_libdir}/libzypp.so
269 %{_includedir}/zypp
270 %{_includedir}/zypp-core
271 %{_includedir}/zypp-curl
272 %{_includedir}/zypp-media
273 %{_includedir}/zypp-tui
274 %{_datadir}/cmake/Modules/*
275 %{_libdir}/pkgconfig/libzypp.pc
276 %{_libdir}/libzypp-tui.a
277
278 %changelog