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