9fca5cceca0fd5af32a4efa03cca0d6f7d48486f
[platform/framework/web/download-provider.git] / packaging / download-provider.spec
1
2 Name:       download-provider
3 Summary:    download the contents in background.
4 Version:    1.0.2
5 Release:    15
6 Group:      Development/Libraries
7 License:    Apache License, Version 2.0
8 Source0:    %{name}-%{version}.tar.gz
9 Source1:    download-provider.service
10 Requires(post): /usr/bin/sqlite3
11 BuildRequires:  cmake
12 BuildRequires:  pkgconfig(glib-2.0)
13 BuildRequires:  pkgconfig(gobject-2.0)
14 BuildRequires:  pkgconfig(dlog)
15 BuildRequires:  pkgconfig(libsoup-2.4)
16 BuildRequires:  pkgconfig(xdgmime)
17 BuildRequires:  pkgconfig(vconf)
18 BuildRequires:  pkgconfig(db-util)
19 BuildRequires:  pkgconfig(sqlite3)
20 BuildRequires:  pkgconfig(bundle)
21 BuildRequires:  pkgconfig(capi-appfw-app-manager)
22 BuildRequires:  pkgconfig(capi-network-connection)
23 BuildRequires:  pkgconfig(notification)
24 BuildRequires:  pkgconfig(appsvc)
25 BuildRequires:  pkgconfig(dbus-1)
26
27 %description
28 Description: download the contents in background
29
30 %package devel
31 Summary:    download-provider
32 Group:      Development/Libraries
33 Requires:   %{name} = %{version}-%{release}
34
35 %description devel
36 Description: download the contents in background (developement files)
37
38 %prep
39 %setup -q
40
41 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
42
43 %build
44 make %{?jobs:-j%jobs}
45
46 %install
47 rm -rf %{buildroot}
48 %make_install
49 mkdir -p %{buildroot}/usr/share/license
50 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc3.d
51 ln -s %{_sysconfdir}/rc.d/init.d/download-provider-service  %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70download-provider-service
52 mkdir -p  %{buildroot}%{_sysconfdir}/rc.d/rc5.d
53 ln -s %{_sysconfdir}/rc.d/init.d/download-provider-service  %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70download-provider-service
54
55 mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
56 install %{SOURCE1} %{buildroot}%{_libdir}/systemd/user/
57 ln -s ../download-provider.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/
58
59 mkdir -p %{buildroot}/opt/data/download-provider
60 mkdir -p %{buildroot}/opt/usr/dbspace/
61 if [ ! -f %{buildroot}/opt/usr/dbspace/.download-provider.db ];
62 then
63 sqlite3 %{buildroot}/opt/usr/dbspace/.download-provider.db 'PRAGMA journal_mode=PERSIST;
64 PRAGMA foreign_keys=ON;
65 CREATE TABLE logging
66 (
67 id INTEGER UNIQUE PRIMARY KEY,
68 state INTEGER DEFAULT 0,
69 errorcode INTEGER DEFAULT 0,
70 startcount INTEGER DEFAULT 0,
71 packagename TEXT DEFAULT NULL,
72 createtime DATE,
73 accesstime DATE
74 );
75
76 CREATE TABLE requestinfo
77 (
78 id INTEGER UNIQUE PRIMARY KEY,
79 auto_download BOOLEAN DEFAULT 0,
80 state_event BOOLEAN DEFAULT 0,
81 progress_event BOOLEAN DEFAULT 0,
82 network_type TINYINT DEFAULT 0,
83 filename TEXT DEFAULT NULL,
84 destination TEXT DEFAULT NULL,
85 url TEXT DEFAULT NULL,
86 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
87 );
88
89 CREATE TABLE downloadinfo
90 (
91 id INTEGER UNIQUE PRIMARY KEY,
92 http_status INTEGER DEFAULT 0,
93 content_size UNSIGNED BIG INT DEFAULT 0,
94 mimetype VARCHAR(64) DEFAULT NULL,
95 content_name TEXT DEFAULT NULL,
96 saved_path TEXT DEFAULT NULL,
97 tmp_saved_path TEXT DEFAULT NULL,
98 etag TEXT DEFAULT NULL,
99 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
100 );
101
102 CREATE TABLE httpheaders
103 (
104 id INTEGER NOT NULL,
105 header_field TEXT DEFAULT NULL,
106 header_data TEXT DEFAULT NULL,
107 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
108 );
109
110 CREATE TABLE notification
111 (
112 id INTEGER UNIQUE PRIMARY KEY,
113 noti_enable BOOLEAN DEFAULT 0,
114 extra_key TEXT DEFAULT NULL,
115 extra_data TEXT DEFAULT NULL,
116 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
117 );
118
119 CREATE UNIQUE INDEX requests_index ON logging (id, state, errorcode, packagename, createtime, accesstime);
120 '
121 fi
122
123 %files
124 %defattr(-,root,root,-)
125 %dir %attr(0775,root,app) /opt/data/download-provider
126 %manifest download-provider.manifest
127 /usr/share/download-provider/*.png
128 %{_libdir}/libdownloadagent2.so.0.0.1
129 %{_libdir}/libdownloadagent2.so
130 %{_libdir}/systemd/user/download-provider.service
131 %{_libdir}/systemd/user/tizen-middleware.target.wants/download-provider.service
132 %{_bindir}/download-provider
133 %{_sysconfdir}/rc.d/init.d/download-provider-service
134 %{_sysconfdir}/rc.d/rc3.d/S70download-provider-service
135 %{_sysconfdir}/rc.d/rc5.d/S70download-provider-service
136 /usr/share/license/%{name}
137 /usr/share/dbus-1/services/download-provider-service.service
138 %attr(660,root,app) /opt/usr/dbspace/.download-provider.db
139 %attr(660,root,app) /opt/usr/dbspace/.download-provider.db-journal
140
141 %files devel
142 %defattr(-,root,root,-)
143 %{_libdir}/libdownloadagent2.so.0.0.1
144 %{_libdir}/libdownloadagent2.so
145 %{_bindir}/download-provider
146 %{_includedir}/download-provider/download-provider.h
147 %{_libdir}/pkgconfig/download-provider.pc
148
149 %changelog
150 * Fri Feb 01 2013 Kwangmin Bang <justine.bang@samsung.com>
151 - [smack] manifest for booting-script
152 - [prevent defect] Dereference after null check
153
154 * Thu Jan 31 2013 Kwangmin Bang <justine.bang@samsung.com>
155 - add the state which means is connecting to remote
156
157 * Wed Jan 30 2013 Kwangmin Bang <justine.bang@samsung.com>
158 - [smack] labeling for booting script
159 - [prevent defect] Dereference before/after null check 
160
161 * Tue Jan 29 2013 Jungki Kwak <jungki.kwak@samsung.com>
162 - Add to check invalid state when setting the callback
163 - Resolve prevent defects
164 - Remove the dependancy with unnecessary package
165 - Remove the dependancy with dbus-glib
166 - Modify smack label of shared library
167
168 * Mon Jan 28 2013 Kwangmin Bang <justine.bang@samsung.com>
169 - recognize who launch me by parameter of main function
170 - ready the socket first before initializing dbus service
171
172 * Fri Jan 25 2013 Jungki Kwak <jungki.kwak@samsung.com>
173 - Resolve compile error with GCC-4.7
174 - Convert error value in case the download start is failed
175 - Add to check the user's install direcoty
176 - Modify the name of license and add notice file
177 - Call sqlite3 in install section in spec file
178 - Terminate Only when support DBUS-Activation
179
180 * Fri Jan 11 2013 Kwangmin Bang <justine.bang@samsung.com>
181 - crash when terminated after clear requests all in timeout
182 - Change the flow of playready download
183 - audo_download need start_time
184
185 * Tue Jan 08 2013 Jungki Kwak <jungki.kwak@samsung.com>
186 - Resolve prevent defects
187 - [Title] Fixed a bug that the icon of txt file can't be recognized and the txt file can't be opend
188 - Modify to check returned value of sqlite API
189 - Show error string in case of download CAPI failure
190
191 * Fri Dec 21 2012 Jungki Kwak <jungki.kwak@samsung.com>
192 - Send file_size from memory first
193 - Add error code about libsoup error message
194 - Change the session time-out to 60 seconds
195 - Remove duplicated dlog message
196 - Modify a bug to get mime type from db
197 - Modify license information at spec file
198 - Resolve prevent defects
199 - Add missed existed db file when creaing db table
200 - The temporary file is not used any more
201 - Use SQL without MUTEX LOCK
202 - Support ECHO command
203 - Reduce SQL query to prevent SQL Error
204 - replace snprintf to sqlite3_mprintf for prepare sqlite3_stmt
205
206 * Fri Dec 14 2012 Kwangmin Bang <justine.bang@samsung.com>
207 - add credential in request structure
208 - change to ORDER BY createtime ASC from DESC in getting old list
209 - Resolve prevent defects
210 - Add boiler plates
211 - Remove old source codes
212 - apply the authentication by packagename for all commands
213 - fix memory leak in error case of DB query
214 - Add micro seconds value for temporary file name
215 - apply the limit count and sorting in SQL query
216 - do not load PAUSED request in booting time
217 - Add define statement for OMA DRM
218 - call IPC for sending event at the tail of function
219 - maintain DB info in DESTROY command
220 - Separate DB Table, reduce the amount of memory
221
222 * Fri Dec 07 2012 Kwangmin Bang <justine.bang@samsung.com>
223 - fix the crash when terminating by itself
224
225 * Thu Dec 06 2012 Kwangmin Bang <justine.bang@samsung.com>
226 - Fix the crash when accessing the history
227
228 * Fri Nov 30 2012 Kwangmin Bang <justine.bang@samsung.com>
229 - support DBUS-activation
230 - apply int64 for file size
231 - most API support ID_NOT_FOUND errorcode
232 - fix crash and memory leak in SET_EXTRA_PARAM
233 - fix memory leak in HTTP_HEADER case
234 - remove servicedata column
235 - Add to update the last received size
236
237 * Tue Nov 27 2012 Jungki Kwak <jungki.kwak@samsung.com>
238 - Change to parse the content name
239 - Change the policy for temporary file name
240 - Change to get etag when download is failed
241 - DP_ERROR_ID_NOT_FOUND for set_url COMMAND
242 - new common sql function for getting/setting a column
243 - Add operation when registering notification
244 - disable flexible timeout, use 60 sec for timeout
245 - allow set_url even if unloaded from memory
246 - Add functions for notification extra param
247 - Block to can not re-use the request is completed
248 - send errorcode to client why failed to create request
249 - unload the request which not setted auto_download when client is terminated
250 - call da_agent_cancel after free slot
251 - Add debug message for event queue of client mgr
252 - Modify abort flow in case of deinit
253
254 * Fri Nov 16 2012 Jungki Kwak <jungki.kwak@samsung.com>
255 - Resolve a bug about execute option API of ongoing notification
256 - load all request in queue in booting time
257 - stay on the memory although no client
258 - Dead default in switch
259 - Enable to register notification message
260 - Add to add, get and remove http header values
261 - Change functions to pause and resume which is based on download ID
262 - Unchecked return value
263 - clear history if registered before 48 hours or total of histories is over 1000.
264 - stay on memory if client is connected with provider
265 - advance auto-download feature
266 - remove __thread keyword for sqlite handle
267 - update regdate after copy history from queue
268 - concede network is connected although detail get API is failed in connection state changed callback.
269 - read pid from client when no support SO_PEERCRED
270 - wake up Queue thread only when exist ready request
271 - Add functions to save and submit http status code to client
272 - detect network changes using connection callback
273
274 * Thu Nov 08 2012 Jungki Kwak <jungki.kwak@samsung.com>
275 - In Offline state, do not search queue
276 - Apply changed enum value of connection CAPI
277
278 * Wed Oct 31 2012 Jungki Kwak <jungki.kwak@samsung.com>
279 - change the limitaiton count can download at once
280 - support Cancel after Pause
281 - Change the installation directory according to guide
282 - deal as error if write() return 0
283
284 * Mon Oct 28 2012 Kwangmin Bang <justine.bang@samsung.com>
285 - increase the timout of socket
286 - enhance socket update feature
287
288 * Thu Oct 25 2012 Kwangmin Bang <justine.bang@samsung.com>
289 - prevent defects
290 - change the limitation of length
291 - improve the performance logging to DB
292 - check packagename for resume call
293 - refresh FD_SET when only new socket is accepted
294 - Fix the socket error when a client is crashed
295
296 * Tue Oct 23 2012 Kwangmin Bang <justine.bang@samsung.com>
297 - terminate daemon in main socket error
298 - apply reading timeout for socket
299
300 * Mon Oct 22 2012 Jungki Kwak <jungki.kwak@samsung.com>
301 - Resolve the lockup when client app is crashed
302 - Check the state before starting download
303 - Support paused callback
304
305 * Fri Oct 19 2012 Kwangmin Bang <justine.bang@samsung.com>
306  - replace ID based download-provider to Major Process
307
308 * Tue Oct 16 2012 Jungki Kwak <jungki.kwak@samsung.com>
309 - Install LICENSE file
310
311 * Fri Oct 12 2012 Jungki Kwak <jungki.kwak@samsung.com>
312 - Install LICENSE file
313
314 * Thu Oct 11 2012 Jungki Kwak <jungki.kwak@samsung.com>
315 - Use mutex when calling xdgmime API
316 - Do not use fsync function
317
318 * Mon Oct 08 2012 Kwangmin Bang <justine.bang@samsung.com>
319 - Fix the crash when come many stop with terminating App
320
321 * Fri Sep 28 2012 Kwangmin Bang <justine.bang@samsung.com>
322 - Add exception code about content-dispostion
323 - wait to free till callback is finished
324
325 * Mon Sep 24 2012 Jungki Kwak <jungki.kwak@samsung.com>
326 - Add to define for db an library in manifest file
327
328 * Fri Sep 21 2012 Kwangmin Bang <justine.bang@samsung.com>
329 - prevent free slot till called notify_cb
330 - socket descriptor can be zero
331
332 * Fri Sep 21 2012 Jungki Kwak <jungki.kwak@samsung.com>
333 - Apply manifest file in which the domain is defined
334 - Change way to pass extension data
335
336 * Fri Sep 14 2012 Kwangmin Bang <justine.bang@samsung.com>
337 - fix the crash by assert of pthread_mutex_lock
338 - NULL-check before free
339 - guarantee instant download for pended requests
340 - add descriptor
341 - fix the memory leak in error case of ipc_receive_request_msg
342 - guarantee one instant download per app
343 - call pthread_exit to terminate the currently running thread
344 - Remove pthread_cancel function
345
346 * Fri Sep 07 2012 Kwangmin Bang <justine.bang@samsung.com>
347 - add LICENSE
348 - Add to search download id from history db
349
350 * Thu Sep 06 2012 Kwangmin Bang <justine.bang@samsung.com>
351 - start to download again even if already finished
352 - change thread style
353 - arrange the request priority
354 - change data type
355 - wait till getting the response from client
356
357 * Mon Sep 03 2012 Kwangmin Bang <justine.bang@samsung.com>
358 - fix timeout error
359
360 * Mon Sep 03 2012 Kwangmin Bang <justine.bang@samsung.com>
361 - free slot after getting event from url-download
362 - fix INTEGER OVERFLOW
363
364 * Thu Aug 30 2012 Kwangmin Bang <justine.bang@samsung.com>
365 - initialize mutex for auto-redownloading
366 - support Pause/Resume with new connection
367 - fix the memory leak
368
369 * Mon Aug 27 2012 Kwangmin Bang <justine.bang@samsung.com>
370 - Change the ownership of downloaded file
371 - Add detached option when pthread is created
372 - fix the failure getting history info from database
373 - fix first timeout takes a long time
374 - fix wrong checking of network status
375 - fix the crash by double free
376 - divide log level
377 - Resolve prevent defects for agent module
378 - Resolve a bug to join domain in case of playready
379
380 * Tue Aug 23 2012 Kwangmin Bang <justine.bang@samsung.com>
381 - event thread does not deal in some state
382 - fix the lockup by mutex and the crash by invaild socket event
383
384 * Tue Aug 22 2012 Jungki Kwak <jungki.kwak@samsung.com>
385 - Fix the crash when use notification
386 - One thread model for socket
387 - Fix the defects found by prevent tool
388 - Remove mutex lock/unlock in case of invalid id
389 - Support the status of download in case of getting new connection with requestid
390 - Clear db and register notification when stopped the download
391 - Update notification function
392 - Enable to set the defined file name by user
393
394 * Tue Aug 17 2012 Jungki Kwak <jungki.kwak@samsung.com>
395 - Enable to use destination path
396 - Add to handle invalid id
397
398 * Tue Aug 16 2012 Jungki Kwak <jungki.kwak@samsung.com>
399 - Change socket close timing
400
401 * Mon Aug 13 2012 Kwangmin Bang <justine.bang@samsung.com>
402 - Disable default dlog in launching script.
403
404 * Tue Aug 09 2012 Jungki Kwak <jungki.kwak@samsung.com>
405 - The function to init dbus glib is removed
406
407 * Tue Aug 08 2012 Jungki Kwak <jungki.kwak@samsung.com>
408 - The function to init dbus glib is added for connection network CAPI
409
410 * Tue Aug 07 2012 Jungki Kwak <jungki.kwak@samsung.com>
411 - Change the name of temp direcoty.
412 - When add requestinfo to slot, save it to DB.
413
414 * Mon Aug 06 2012 Jungki Kwak <jungki.kwak@samsung.com>
415 - Initial version is updated.
416