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