2 Name: download-provider
3 Summary: download the contents in background.
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
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-base-common)
22 BuildRequires: pkgconfig(capi-appfw-app-manager)
23 BuildRequires: pkgconfig(capi-network-connection)
24 BuildRequires: pkgconfig(notification)
25 BuildRequires: pkgconfig(appsvc)
26 BuildRequires: pkgconfig(dbus-1)
29 Description: download the contents in background
32 Summary: download-provider
33 Group: Development/Libraries
34 Requires: %{name} = %{version}-%{release}
37 Description: download the contents in background (developement files)
42 %define _imagedir /usr/share/download-provider
43 %define _databasedir /opt/usr/dbspace
44 %define _databasefile %{_databasedir}/.download-provider.db
45 %define _dbusservicedir /usr/share/dbus-1/services
46 %define _licensedir /usr/share/license
49 CFLAGS="${CFLAGS:-%optflags} -fPIC -D_REENTRANT -fvisibility=hidden"; export CFLAGS \
50 FFLAGS="${FFLAGS:-%optflags} -fPIC -fvisibility=hidden"; export FFLAGS \
51 LDFLAGS+=" -Wl,--as-needed -Wl,--hash-style=both"; export LDFLAGS \
53 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
54 -DBIN_INSTALL_DIR:PATH=%{_bindir} \\\
55 -DLIB_INSTALL_DIR:PATH=%{_libdir} \\\
56 -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \\\
57 -DPKG_NAME=%{name} \\\
58 -DPKG_VERSION=%{version} \\\
59 -DPKG_RELEASE=%{release} \\\
60 -DIMAGE_DIR:PATH=%{_imagedir} \\\
61 -DDATABASE_FILE:PATH=%{_databasefile} \\\
62 -DDBUS_SERVICE_DIR:PATH=%{_dbusservicedir} \\\
63 -DLICENSE_DIR:PATH=%{_licensedir} \\\
64 -DSUPPORT_DBUS_SYSTEM:BOOL=ON \\\
65 %if "%{?_lib}" == "lib64" \
66 %{?_cmake_lib_suffix64} \\\
68 %{?_cmake_skip_rpath} \\\
69 -DBUILD_SHARED_LIBS:BOOL=ON
78 mkdir -p %{buildroot}%{_licensedir}
79 mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d
80 ln -s %{_sysconfdir}/rc.d/init.d/download-provider-service %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70download-provider-service
81 mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d
82 ln -s %{_sysconfdir}/rc.d/init.d/download-provider-service %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70download-provider-service
84 mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
85 install %{SOURCE1} %{buildroot}%{_libdir}/systemd/user/
86 ln -s ../download-provider.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/
88 mkdir -p %{buildroot}/opt/data/%{name}
89 mkdir -p %{buildroot}%{_databasedir}
90 if [ ! -f %{buildroot}%{_databasefile} ];
92 sqlite3 %{buildroot}%{_databasefile} 'PRAGMA journal_mode=PERSIST;
93 PRAGMA foreign_keys=ON;
96 id INTEGER UNIQUE PRIMARY KEY,
97 state INTEGER DEFAULT 0,
98 errorcode INTEGER DEFAULT 0,
99 startcount INTEGER DEFAULT 0,
100 packagename TEXT DEFAULT NULL,
105 CREATE TABLE requestinfo
107 id INTEGER UNIQUE PRIMARY KEY,
108 auto_download BOOLEAN DEFAULT 0,
109 state_event BOOLEAN DEFAULT 0,
110 progress_event BOOLEAN DEFAULT 0,
111 noti_enable BOOLEAN DEFAULT 0,
112 network_type TINYINT DEFAULT 0,
113 filename TEXT DEFAULT NULL,
114 destination TEXT DEFAULT NULL,
115 url TEXT DEFAULT NULL,
116 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
119 CREATE TABLE downloadinfo
121 id INTEGER UNIQUE PRIMARY KEY,
122 http_status INTEGER DEFAULT 0,
123 content_size UNSIGNED BIG INT DEFAULT 0,
124 mimetype VARCHAR(64) DEFAULT NULL,
125 content_name TEXT DEFAULT NULL,
126 saved_path TEXT DEFAULT NULL,
127 tmp_saved_path TEXT DEFAULT NULL,
128 etag TEXT DEFAULT NULL,
129 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
132 CREATE TABLE httpheaders
135 header_field TEXT DEFAULT NULL,
136 header_data TEXT DEFAULT NULL,
137 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
140 CREATE TABLE notification
143 extra_key TEXT DEFAULT NULL,
144 extra_data TEXT DEFAULT NULL,
145 FOREIGN KEY(id) REFERENCES logging(id) ON DELETE CASCADE
148 CREATE UNIQUE INDEX requests_index ON logging (id, state, errorcode, packagename, createtime, accesstime);
153 %defattr(-,root,root,-)
154 %dir %attr(0775,root,app) /opt/data/%{name}
155 %manifest download-provider.manifest
157 %{_libdir}/libdownloadagent2.so.0.0.1
158 %{_libdir}/libdownloadagent2.so
159 %{_libdir}/systemd/user/download-provider.service
160 %{_libdir}/systemd/user/tizen-middleware.target.wants/download-provider.service
161 %{_libdir}/libdownload-provider-interface.so.%{version}
162 %{_libdir}/libdownload-provider-interface.so.0
164 %{_sysconfdir}/rc.d/init.d/download-provider-service
165 %{_sysconfdir}/rc.d/rc3.d/S70download-provider-service
166 %{_sysconfdir}/rc.d/rc5.d/S70download-provider-service
167 %{_licensedir}/%{name}
168 %{_dbusservicedir}/org.download-provider.service
169 %attr(660,root,app) /opt/usr/dbspace/.download-provider.db
170 %attr(660,root,app) /opt/usr/dbspace/.download-provider.db-journal
173 %defattr(-,root,root,-)
174 %{_libdir}/libdownloadagent2.so.0.0.1
175 %{_libdir}/libdownloadagent2.so
176 %{_libdir}/libdownload-provider-interface.so
177 %{_includedir}/download-provider/download-provider.h
178 %{_includedir}/download-provider/download-provider-defs.h
179 %{_includedir}/download-provider/download-provider-interface.h
181 %{_libdir}/pkgconfig/download-provider.pc
182 %{_libdir}/pkgconfig/download-provider-interface.pc
185 * Tue Mar 05 2013 Jungki Kwak <jungki.kwak@samsung.com>
186 - Add function to handle credential URL
187 - Add functions for notification extra list.
188 - Close socket and group if failed to read the packet
189 - Return errorcode if failed to copy string
190 - Resolve wrong initialization
191 - Remove warning message in build time
192 - Functionize accepting the client
193 - Support N values per a extra-parem key
194 - Resolve a bug about converting error from agent
195 - Modify to check return value about DRM API
196 - Use enum value same with url-download
197 - Add to ignore SIGPIPE
198 - [prevent defect] Dereference before null check (REVERSE_INULL)
199 - [prevent defect] Logically dead code (DEADCODE)
200 - Check System Signal in all read call
201 - Apply "ignore EINTR" patch of url-download to provider-interface
203 * Fri Feb 01 2013 Kwangmin Bang <justine.bang@samsung.com>
204 - [smack] manifest for booting-script
205 - [prevent defect] Dereference after null check
207 * Thu Jan 31 2013 Kwangmin Bang <justine.bang@samsung.com>
208 - add the state which means is connecting to remote
210 * Wed Jan 30 2013 Kwangmin Bang <justine.bang@samsung.com>
211 - [smack] labeling for booting script
212 - [prevent defect] Dereference before/after null check
214 * Tue Jan 29 2013 Jungki Kwak <jungki.kwak@samsung.com>
215 - Add to check invalid state when setting the callback
216 - Resolve prevent defects
217 - Remove the dependancy with unnecessary package
218 - Remove the dependancy with dbus-glib
219 - Modify smack label of shared library
221 * Mon Jan 28 2013 Kwangmin Bang <justine.bang@samsung.com>
222 - recognize who launch me by parameter of main function
223 - ready the socket first before initializing dbus service
225 * Fri Jan 25 2013 Jungki Kwak <jungki.kwak@samsung.com>
226 - Resolve compile error with GCC-4.7
227 - Convert error value in case the download start is failed
228 - Add to check the user's install direcoty
229 - Modify the name of license and add notice file
230 - Call sqlite3 in install section in spec file
231 - Terminate Only when support DBUS-Activation
233 * Fri Jan 11 2013 Kwangmin Bang <justine.bang@samsung.com>
234 - crash when terminated after clear requests all in timeout
235 - Change the flow of playready download
236 - audo_download need start_time
238 * Tue Jan 08 2013 Jungki Kwak <jungki.kwak@samsung.com>
239 - Resolve prevent defects
240 - [Title] Fixed a bug that the icon of txt file can't be recognized and the txt file can't be opend
241 - Modify to check returned value of sqlite API
242 - Show error string in case of download CAPI failure
244 * Fri Dec 21 2012 Jungki Kwak <jungki.kwak@samsung.com>
245 - Send file_size from memory first
246 - Add error code about libsoup error message
247 - Change the session time-out to 60 seconds
248 - Remove duplicated dlog message
249 - Modify a bug to get mime type from db
250 - Modify license information at spec file
251 - Resolve prevent defects
252 - Add missed existed db file when creaing db table
253 - The temporary file is not used any more
254 - Use SQL without MUTEX LOCK
255 - Support ECHO command
256 - Reduce SQL query to prevent SQL Error
257 - replace snprintf to sqlite3_mprintf for prepare sqlite3_stmt
259 * Fri Dec 14 2012 Kwangmin Bang <justine.bang@samsung.com>
260 - add credential in request structure
261 - change to ORDER BY createtime ASC from DESC in getting old list
262 - Resolve prevent defects
264 - Remove old source codes
265 - apply the authentication by packagename for all commands
266 - fix memory leak in error case of DB query
267 - Add micro seconds value for temporary file name
268 - apply the limit count and sorting in SQL query
269 - do not load PAUSED request in booting time
270 - Add define statement for OMA DRM
271 - call IPC for sending event at the tail of function
272 - maintain DB info in DESTROY command
273 - Separate DB Table, reduce the amount of memory
275 * Fri Dec 07 2012 Kwangmin Bang <justine.bang@samsung.com>
276 - fix the crash when terminating by itself
278 * Thu Dec 06 2012 Kwangmin Bang <justine.bang@samsung.com>
279 - Fix the crash when accessing the history
281 * Fri Nov 30 2012 Kwangmin Bang <justine.bang@samsung.com>
282 - support DBUS-activation
283 - apply int64 for file size
284 - most API support ID_NOT_FOUND errorcode
285 - fix crash and memory leak in SET_EXTRA_PARAM
286 - fix memory leak in HTTP_HEADER case
287 - remove servicedata column
288 - Add to update the last received size
290 * Tue Nov 27 2012 Jungki Kwak <jungki.kwak@samsung.com>
291 - Change to parse the content name
292 - Change the policy for temporary file name
293 - Change to get etag when download is failed
294 - DP_ERROR_ID_NOT_FOUND for set_url COMMAND
295 - new common sql function for getting/setting a column
296 - Add operation when registering notification
297 - disable flexible timeout, use 60 sec for timeout
298 - allow set_url even if unloaded from memory
299 - Add functions for notification extra param
300 - Block to can not re-use the request is completed
301 - send errorcode to client why failed to create request
302 - unload the request which not setted auto_download when client is terminated
303 - call da_agent_cancel after free slot
304 - Add debug message for event queue of client mgr
305 - Modify abort flow in case of deinit
307 * Fri Nov 16 2012 Jungki Kwak <jungki.kwak@samsung.com>
308 - Resolve a bug about execute option API of ongoing notification
309 - load all request in queue in booting time
310 - stay on the memory although no client
311 - Dead default in switch
312 - Enable to register notification message
313 - Add to add, get and remove http header values
314 - Change functions to pause and resume which is based on download ID
315 - Unchecked return value
316 - clear history if registered before 48 hours or total of histories is over 1000.
317 - stay on memory if client is connected with provider
318 - advance auto-download feature
319 - remove __thread keyword for sqlite handle
320 - update regdate after copy history from queue
321 - concede network is connected although detail get API is failed in connection state changed callback.
322 - read pid from client when no support SO_PEERCRED
323 - wake up Queue thread only when exist ready request
324 - Add functions to save and submit http status code to client
325 - detect network changes using connection callback
327 * Thu Nov 08 2012 Jungki Kwak <jungki.kwak@samsung.com>
328 - In Offline state, do not search queue
329 - Apply changed enum value of connection CAPI
331 * Wed Oct 31 2012 Jungki Kwak <jungki.kwak@samsung.com>
332 - change the limitaiton count can download at once
333 - support Cancel after Pause
334 - Change the installation directory according to guide
335 - deal as error if write() return 0
337 * Mon Oct 28 2012 Kwangmin Bang <justine.bang@samsung.com>
338 - increase the timout of socket
339 - enhance socket update feature
341 * Thu Oct 25 2012 Kwangmin Bang <justine.bang@samsung.com>
343 - change the limitation of length
344 - improve the performance logging to DB
345 - check packagename for resume call
346 - refresh FD_SET when only new socket is accepted
347 - Fix the socket error when a client is crashed
349 * Tue Oct 23 2012 Kwangmin Bang <justine.bang@samsung.com>
350 - terminate daemon in main socket error
351 - apply reading timeout for socket
353 * Mon Oct 22 2012 Jungki Kwak <jungki.kwak@samsung.com>
354 - Resolve the lockup when client app is crashed
355 - Check the state before starting download
356 - Support paused callback
358 * Fri Oct 19 2012 Kwangmin Bang <justine.bang@samsung.com>
359 - replace ID based download-provider to Major Process
361 * Tue Oct 16 2012 Jungki Kwak <jungki.kwak@samsung.com>
362 - Install LICENSE file
364 * Fri Oct 12 2012 Jungki Kwak <jungki.kwak@samsung.com>
365 - Install LICENSE file
367 * Thu Oct 11 2012 Jungki Kwak <jungki.kwak@samsung.com>
368 - Use mutex when calling xdgmime API
369 - Do not use fsync function
371 * Mon Oct 08 2012 Kwangmin Bang <justine.bang@samsung.com>
372 - Fix the crash when come many stop with terminating App
374 * Fri Sep 28 2012 Kwangmin Bang <justine.bang@samsung.com>
375 - Add exception code about content-dispostion
376 - wait to free till callback is finished
378 * Mon Sep 24 2012 Jungki Kwak <jungki.kwak@samsung.com>
379 - Add to define for db an library in manifest file
381 * Fri Sep 21 2012 Kwangmin Bang <justine.bang@samsung.com>
382 - prevent free slot till called notify_cb
383 - socket descriptor can be zero
385 * Fri Sep 21 2012 Jungki Kwak <jungki.kwak@samsung.com>
386 - Apply manifest file in which the domain is defined
387 - Change way to pass extension data
389 * Fri Sep 14 2012 Kwangmin Bang <justine.bang@samsung.com>
390 - fix the crash by assert of pthread_mutex_lock
391 - NULL-check before free
392 - guarantee instant download for pended requests
394 - fix the memory leak in error case of ipc_receive_request_msg
395 - guarantee one instant download per app
396 - call pthread_exit to terminate the currently running thread
397 - Remove pthread_cancel function
399 * Fri Sep 07 2012 Kwangmin Bang <justine.bang@samsung.com>
401 - Add to search download id from history db
403 * Thu Sep 06 2012 Kwangmin Bang <justine.bang@samsung.com>
404 - start to download again even if already finished
405 - change thread style
406 - arrange the request priority
408 - wait till getting the response from client
410 * Mon Sep 03 2012 Kwangmin Bang <justine.bang@samsung.com>
413 * Mon Sep 03 2012 Kwangmin Bang <justine.bang@samsung.com>
414 - free slot after getting event from url-download
415 - fix INTEGER OVERFLOW
417 * Thu Aug 30 2012 Kwangmin Bang <justine.bang@samsung.com>
418 - initialize mutex for auto-redownloading
419 - support Pause/Resume with new connection
420 - fix the memory leak
422 * Mon Aug 27 2012 Kwangmin Bang <justine.bang@samsung.com>
423 - Change the ownership of downloaded file
424 - Add detached option when pthread is created
425 - fix the failure getting history info from database
426 - fix first timeout takes a long time
427 - fix wrong checking of network status
428 - fix the crash by double free
430 - Resolve prevent defects for agent module
431 - Resolve a bug to join domain in case of playready
433 * Tue Aug 23 2012 Kwangmin Bang <justine.bang@samsung.com>
434 - event thread does not deal in some state
435 - fix the lockup by mutex and the crash by invaild socket event
437 * Tue Aug 22 2012 Jungki Kwak <jungki.kwak@samsung.com>
438 - Fix the crash when use notification
439 - One thread model for socket
440 - Fix the defects found by prevent tool
441 - Remove mutex lock/unlock in case of invalid id
442 - Support the status of download in case of getting new connection with requestid
443 - Clear db and register notification when stopped the download
444 - Update notification function
445 - Enable to set the defined file name by user
447 * Tue Aug 17 2012 Jungki Kwak <jungki.kwak@samsung.com>
448 - Enable to use destination path
449 - Add to handle invalid id
451 * Tue Aug 16 2012 Jungki Kwak <jungki.kwak@samsung.com>
452 - Change socket close timing
454 * Mon Aug 13 2012 Kwangmin Bang <justine.bang@samsung.com>
455 - Disable default dlog in launching script.
457 * Tue Aug 09 2012 Jungki Kwak <jungki.kwak@samsung.com>
458 - The function to init dbus glib is removed
460 * Tue Aug 08 2012 Jungki Kwak <jungki.kwak@samsung.com>
461 - The function to init dbus glib is added for connection network CAPI
463 * Tue Aug 07 2012 Jungki Kwak <jungki.kwak@samsung.com>
464 - Change the name of temp direcoty.
465 - When add requestinfo to slot, save it to DB.
467 * Mon Aug 06 2012 Jungki Kwak <jungki.kwak@samsung.com>
468 - Initial version is updated.