Release version 0.11.2
[platform/core/appfw/slp-pkgmgr.git] / packaging / pkgmgr.spec
1 Name:       pkgmgr
2 Summary:    Packager Manager client library package
3 Version:    0.11.2
4 Release:    0
5 Group:      Application Framework/Package Management
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1001: %{name}.manifest
9 Source1002: %{name}-client.manifest
10 Source1003: %{name}-client-devel.manifest
11 Source1004: %{name}-installer.manifest
12 Source1005: %{name}-installer-devel.manifest
13 Source1006: %{name}-types-devel.manifest
14 Source1007: %{name}.conf
15 Source1008: %{name}-installer-signal-agent.service
16 Source1009: %{name}-installer-signal-agent.socket
17 Source1010: %{name}-installer-signal-agent@.service
18 Source1011: %{name}-installer-signal-agent@.socket
19 Requires(post): /usr/sbin/useradd
20 Requires(post): capi-system-info
21
22 BuildRequires:  cmake
23 BuildRequires:  unzip
24 BuildRequires:  gettext-tools
25 BuildRequires:  pkgconfig(glib-2.0)
26 BuildRequires:  pkgconfig(gio-2.0)
27 BuildRequires:  pkgconfig(dlog)
28 BuildRequires:  pkgconfig(bundle)
29 BuildRequires:  pkgconfig(pkgmgr-info)
30 BuildRequires:  pkgconfig(iniparser)
31 BuildRequires:  pkgconfig(libtzplatform-config)
32 BuildRequires:  pkgconfig(xdgmime)
33 BuildRequires:  pkgconfig(db-util)
34 BuildRequires:  pkgconfig(libsmack)
35 BuildRequires:  pkgconfig(libsystemd-daemon)
36 BuildRequires:  pkgconfig(minizip)
37 BuildRequires:  pkgmgr-info-parser-devel
38 BuildRequires:  pkgmgr-info-parser
39 BuildRequires:  fdupes
40
41 %description
42 Packager Manager client library package for packaging
43
44
45 %package client
46 Summary:    Package Manager client library develpoment package
47 Requires:   %{name} = %{version}-%{release}
48 Requires: shared-mime-info
49 Requires(post): pkgmgr
50
51 %description client
52 Package Manager client library develpoment package for packaging
53
54
55 %package client-devel
56 Summary:    Package Manager client library develpoment package
57 Requires:   %{name} = %{version}-%{release}
58 Requires: pkgmgr-client
59
60 %description client-devel
61 Package Manager client library develpoment package for packaging
62
63
64 %package installer
65 Summary:    Library for installer frontend/backend
66 Requires:   %{name} = %{version}-%{release}
67
68 %description installer
69 Library for installer frontend/backend for packaging.
70
71
72 %package installer-devel
73 Summary:    Dev package for libpkgmgr-installer
74 Requires:   %{name} = %{version}-%{release}
75 Requires:   pkgmgr-installer = %{version}-%{release}
76
77 %description installer-devel
78 Dev package for libpkgmgr-installer for packaging.
79
80
81 %package types-devel
82 Summary:    Package Manager manifest parser develpoment package
83 Requires:   %{name} = %{version}-%{release}
84
85 %description types-devel
86 Package Manager client types develpoment package for packaging
87
88 %prep
89 %setup -q
90 cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} %{SOURCE1004} %{SOURCE1005} %{SOURCE1006} .
91
92 %build
93 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
94 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
95
96 %__make %{?_smp_mflags}
97
98 %install
99 %make_install
100 rm -f  %{buildroot}%{_bindir}/pkgmgr_backend_sample
101 rm -f %{buildroot}%{_libdir}/libpkgmgr_backend_lib_sample.so
102 rm -f %{buildroot}%{_libdir}/libpkgmgr_parser_lib_sample.so
103
104 mkdir -p %{buildroot}%{_tmpfilesdir}/
105 install -m 0644 %{SOURCE1007} %{buildroot}%{_tmpfilesdir}/pkgmgr.conf
106
107 mkdir -p %{buildroot}%{_unitdir_user}/sockets.target.wants
108 install -m 0644 %{SOURCE1008} %{buildroot}%{_unitdir_user}/pkgmgr-installer-signal-agent.service
109 install -m 0644 %{SOURCE1009} %{buildroot}%{_unitdir_user}/pkgmgr-installer-signal-agent.socket
110 ln -sf ../pkgmgr-installer-signal-agent.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/pkgmgr-installer-signal-agent.socket
111
112 mkdir -p %{buildroot}%{_unitdir}/user-sockets@.target.wants
113 install -m 0644 %{SOURCE1010} %{buildroot}%{_unitdir}/pkgmgr-installer-signal-agent@.service
114 install -m 0644 %{SOURCE1011} %{buildroot}%{_unitdir}/pkgmgr-installer-signal-agent@.socket
115 ln -sf ../pkgmgr-installer-signal-agent@.socket %{buildroot}%{_unitdir}/user-sockets@.target.wants/pkgmgr-installer-signal-agent@.socket
116
117 mkdir -p %{buildroot}%{_sysconfdir}/package-manager/backend
118 mkdir -p %{buildroot}%{_sysconfdir}/package-manager/backendlib
119 mkdir -p %{buildroot}%{_sysconfdir}/opt/upgrade
120
121 touch  %{buildroot}%{_sysconfdir}/package-manager/backend/default
122 chmod 755 %{buildroot}%{_sysconfdir}/package-manager/backend/default
123 touch  %{buildroot}%{_sysconfdir}/package-manager/backend/pkgtool
124 chmod 755 %{buildroot}%{_sysconfdir}/package-manager/backend/pkgtool
125
126
127 %fdupes %{buildroot}
128
129 %post
130 /sbin/ldconfig
131
132 # Create tizenglobalapp user needed for global installation
133 useradd %TZ_SYS_GLOBALAPP_USER -r -c "system user for common applications" -g root -u 201
134
135 # change owner of TZ_USER_APP (/etc/skel/apps_rw) to tizenglobalapp
136 saveHOME="$HOME"
137 HOME="%{_sysconfdir}/skel"
138 . "%{_sysconfdir}/tizen-platform.conf"
139
140 chown %TZ_SYS_GLOBALAPP_USER:root $TZ_USER_APP
141 HOME="$saveHOME"
142
143 %post -n pkgmgr-client -p /sbin/ldconfig
144
145 %postun -n pkgmgr-client -p /sbin/ldconfig
146
147 %post -n pkgmgr-installer -p /sbin/ldconfig
148
149 %postun -n pkgmgr-installer -p /sbin/ldconfig
150
151 %posttrans
152 if [ ! -f %{TZ_SYS_DB}/.pkgmgr_parser.db ]; then
153   pkg_initdb --ro
154   install_preload_pkg
155   if [ -f /tmp/.preload_install_error ]; then
156     if [ ! -d /tmp/.postscript/error ]; then
157       mkdir -p /tmp/.postscript/error
158     fi
159     echo "preload install failed" > /tmp/.postscript/error/%{name}_error
160   else
161     pkgcmd -l --global 1>&2
162   fi
163   %{_sysconfdir}/package-manager/pkgmgr-label-initial-image.sh
164 fi
165 rm -rf %{_sysconfdir}/package-manager/pkgmgr-label-initial-image.sh
166
167 %files
168 %manifest %{name}.manifest
169 %defattr(-,root,root,-)
170 %dir %{_sysconfdir}/package-manager/backend
171 %dir %{_sysconfdir}/package-manager/backendlib
172 %{_sysconfdir}/package-manager/backend/*
173 %{_tmpfilesdir}/pkgmgr.conf
174
175 %files client
176 %manifest %{name}-client.manifest
177 %license LICENSE
178 %defattr(-,root,root,-)
179 %dir %{_sysconfdir}/package-manager
180 %config %{_sysconfdir}/package-manager/pkg_path.conf
181 %{_libdir}/libpkgmgr-client.so.*
182
183 %files client-devel
184 %manifest %{name}-client-devel.manifest
185 %defattr(-,root,root,-)
186 %{_includedir}/*.h
187 %{_libdir}/pkgconfig/pkgmgr.pc
188 %{_libdir}/libpkgmgr-client.so
189
190 %files installer
191 %manifest %{name}-installer.manifest
192 %license LICENSE
193 %defattr(-,root,root,-)
194 %{_libdir}/libpkgmgr_installer.so.*
195 %{_bindir}/pkgmgr-installer-signal-agent
196 %{_unitdir_user}/pkgmgr-installer-signal-agent.service
197 %{_unitdir_user}/pkgmgr-installer-signal-agent.socket
198 %{_unitdir_user}/sockets.target.wants/pkgmgr-installer-signal-agent.socket
199 %{_unitdir}/pkgmgr-installer-signal-agent@.service
200 %{_unitdir}/pkgmgr-installer-signal-agent@.socket
201 %{_unitdir}/user-sockets@.target.wants/pkgmgr-installer-signal-agent@.socket
202
203 %files installer-devel
204 %manifest %{name}-installer-devel.manifest
205 %defattr(-,root,root,-)
206 %dir %{_includedir}/pkgmgr
207 %{_includedir}/pkgmgr/*.h
208 %{_libdir}/pkgconfig/pkgmgr-installer.pc
209 %{_libdir}/libpkgmgr_installer.so
210
211 %files types-devel
212 %manifest %{name}-types-devel.manifest
213 %defattr(-,root,root,-)
214 %{_includedir}/package-manager-*.h
215 %{_libdir}/pkgconfig/pkgmgr-types.pc