Commit Graph

64 Commits

Author SHA1 Message Date
Juan RP
2434b90d6e libxbps: use xbps_strlc{at,py} everywhere. 2016-04-17 20:17:37 +02:00
Juan RP
791e683e01 fetch: handle GET with offset == length.
While xbps_fetch_file() creates the .part file and for whatever reason
it did not finish properly to rename the file, it could request the server
to restart the download with offset set to file size, resulting in HTTP 416
return code.

Handle this case by checking if the server returns 416 and then checking
if the returned file size matches the requested offset and just rename
the file.

Thanks to @beefcurtains for the test case.
2015-06-28 04:28:55 +02:00
Juan RP
87ca42f399 Remove xdelta support: it never worked and wasn't fully implemented. 2014-10-24 11:04:51 +02:00
Juan RP
3a77ab0847 lib/download.c: CID 62691 (dereference NULL check) 2014-10-06 08:23:34 +02:00
Juan RP
2212a05f89 lib/download.c: CID 62696 (dead code) 2014-10-05 12:13:34 +02:00
Juan RP
b67d4ec975 lib/download.c: debug: print url info only if it's available. 2014-09-07 09:45:47 +02:00
Juan RP
fbf4ed4d2a lib/download.c: unconstify to fix a warning. 2014-08-13 22:11:25 +02:00
Juan RP
431674d733 lib/download.c: style twerks. 2014-08-13 21:49:44 +02:00
Enno Boland
b0c090c39e lib/download.c: delete vcdiffs after applying; cleanups. 2014-08-11 20:00:20 +02:00
Enno Boland
6a8f5d6235 lib/download.c: debug output for binary diffs 2014-08-11 19:24:02 +02:00
Enno Boland
f0f8534273 lib/download.c: use tempfile while decoding new file from binary diff.
this prevents corrupted files when filename == basefile.
2014-08-11 19:05:23 +02:00
Enno Boland
040e114ad4 lib/download.c: add basic support for vcdiffs 2014-08-11 18:40:44 +02:00
Enno Boland
59ee6b6733 Adding xbps_fetch_file_dest().
This function is similiar to xbps_fetch_file(). In contrast to xbps_fetch_file()
xbps_fetch_file_dest has an extra paramenter which allow to define an output file
for the request.
2014-03-04 14:19:52 +01:00
Juan RP
f74bf1c1c8 New custom configuration file format that does not need confuse. 2014-02-25 16:42:52 +01:00
Juan RP
5a7eb2255d Revert "lib/download.c: xbps_fetch_file: remove unnecesary memset() calls."
This reverts commit 74970f2e92.
2013-11-26 10:31:16 +01:00
Juan RP
74970f2e92 lib/download.c: xbps_fetch_file: remove unnecesary memset() calls. 2013-11-18 18:20:41 +01:00
Juan RP
42274f939c Set _BSD_SOURCE before including string.h to get strlc{at,py} with musl. 2013-03-03 08:21:00 +01:00
Juan RP
ae7b76e245 xbps_fetch_file: don't fsync(3) before closing fd; slowdowns considerably slow storage. 2013-02-20 10:46:21 +01:00
Juan RP
bdcdb9f1a0 xbps_fetch_file: don't check for file truncation if server answers with invalid info. 2013-02-01 13:40:27 +01:00
Juan RP
e75fcdd567 xbps_fetch_file: avoid copying from a NULL pointer. 2013-01-15 15:55:18 +01:00
Juan RP
336897d964 xbps_fetch_file: simplify and use libfetch support for If-Modified-Since. 2013-01-13 16:27:59 +01:00
Juan RP
4095290189 xbps_fetch_file: use O_CLOEXEC. 2012-12-15 09:50:37 +01:00
Juan RP
d92c87dbf3 xbps_fetch_file: don't error out if restart and tempfile doesn't exist. 2012-11-19 16:40:27 +01:00
Juan RP
a77727887d Improvements for xbps_fetch_file and xbps_repository_sync_index.
xbps_fetch_file:
	- A temp file is created with .part extension to improve resuming.
	- Files are downloaded in cwd.
	- Switch to futimens(2) and fsync(2).

xbps_repository_sync_index:
	- Do not create local repodir in metadir if it already exists.
	- Simplify the code thanks to new xbps_fetch_file().
2012-11-11 11:29:49 +01:00
Juan RP
d6735d5685 xbps_xasprintf: do not return NULL anymore; remove checks for this. 2012-11-11 09:37:27 +01:00
Juan RP
0ab60b24c5 xbps_fetch_file: enable fetchRestartCalls. 2012-11-08 09:49:03 +01:00
Juan RP
3e9e87fc2a libxbps: require a pointer to xbps_handle in functions that need it.
This removes 2 global vars from lib/initend.c and easier to know
what functions require access to xbps_handle.
2012-06-14 08:22:11 +02:00
Juan RP
0356afba6d Bump copyright year for latest changes. 2012-01-05 16:17:37 +01:00
Juan RP
c83a77c1b5 Fixed issue 19 "xbps-src cannot fetch source with unknown Content-Length". 2012-01-05 12:26:57 +01:00
Juan RP
b0ceeaa58e New configuration file via confuse: xbps.conf. 2011-12-15 11:19:20 +01:00
Juan RP
8be527cbdf xbps_fetch_file: set bytes downloaded correctly for the fetch client cb. 2011-12-01 12:21:13 +01:00
Juan RP
3ccfec7054 Improved callback/states support to make libxbps std{err,out} printf free.
This is a major API/ABI change, documentation has been updated accordingly.
2011-11-24 11:23:08 +01:00
Juan RP
756234e9c3 libxbps: xbps_fetch_error_string: return NULL on libfetch success. 2011-11-11 00:30:01 +01:00
Juan RP
508f119bc9 Moved install transaction code to libxbps, see NEWS file. 2011-07-27 17:13:54 +02:00
Juan RP
5847a11570 xbps_fetch_file: remove local file if bigger than remote and refetch. 2011-06-23 00:06:50 +02:00
Juan RP
fbfa9c5960 New option in conffile to set libfetch's limit (seconds) in timed out connections. 2011-06-22 09:53:44 +02:00
Juan RP
9673c4bd09 XBPS major changes in June 2011.
- A configuration file "xbps-conf.plist" replaces the (un)register target
  in xbps-repo(8) and (un)set-prop in xbps-bin(8). For now, you can set
  the repositories and prefered virtual packages.

- New package pattern matching code from NetBSD. Supports more ways of
  matching patterns in packages.

- Multiple bugs fixed in virtual packages related matching code.

--HG--
rename : LICENSE => COPYING
2011-06-04 13:37:53 +02:00
Juan RP
afe0f3e2f0 Make the xbps_handle struct const internally. 2011-02-21 14:03:08 +01:00
Juan RP
22ae7aa2e8 Introduce struct xbps_handle and use it for xbps_init().
This structure sets up function callbacks for fetching files and
unpacking binary packages, as well as setting the debug boolean.

This way the affected functions (xbps_fetch_file() and
xbps_unpack_binary_pkg()) do not need to accept the fn cb pointers
and data as arguments.

Bump XBPS_RELVER.
2011-02-21 13:38:44 +01:00
Juan RP
35aa4b9951 xbps_fetch_file: memset the stat(2) struct before using it. 2011-01-25 17:49:24 +01:00
Juan RP
008573e1eb Sprinkle a couple of assert(3)ions. 2011-01-25 04:14:33 +01:00
Juan RP
0cc4ba224e Update API documentation for recent changes.
--HG--
branch : progress_callback
2011-01-22 14:24:51 +01:00
Juan RP
984eae1578 Make xbps_fetch_file accept a callback to update its progress.
This also makes xbps_unpack_binary_pkg follow this convention by avoiding
static variables.

--HG--
branch : progress_callback
rename : bin/xbps-repo/util.c => bin/xbps-bin/util.c
2011-01-22 12:40:19 +01:00
Juan RP
992e8c6a14 libxbps::xbps_humanize_number(): use common values and hide implementation details from API.
So now its prototype is the following:

int xbps_humanize_number(char *buf, int64_t bytes)

It is a wrapper around NetBSD's humanize_number(3) which uses 6 digits for max
length, HN_AUTOSCALE and HN_NOSPACE|HN_DECIMAL. All users have been updated.
2011-01-18 23:10:07 +01:00
Juan RP
6051eb29ab Added another bunch of compiler warnings and fix code. 2011-01-15 11:59:44 +01:00
Juan RP
bc28aa77d8 xbps_fetch_file: set a 30seconds timeout. 2010-12-18 10:19:09 +01:00
Juan RP
fdec663855 API clean up (part 2), plus misc changes and improvements.
- Rename regpkgs_dictionary to regpkgdb_dictionary to better describe what is is.
- Change some funcs in plist.c to return a boolean rather than int.
- Hide more internal funcs off the API.
- Simplify xbps_repository_update_pkg() and remove its second arg.
- Hide implementation details in xbps_repository_pool, now to iterate over the
  pool you have to use xbps_repository_pool_foreach and its struct
  repository_pool_index.
- Introduce xbps_{init,end}, to initialize/destroy some stuff in the library.
- Introduce xbps_dbg_printf to printf stuff for debugging purposes.
- xbps-{bin,repo}:  added -d arg to enable debugging output.
- Before checking if a config file needs to be installed or such, check that
  package contains the "conf_files" array.
- Remove obsolete dirs as well while updating packages.
- If transaction dictionary is ready remove the "missing_deps" array.

Bump XBPS_RELVER to 20101118.

--HG--
rename : lib/regpkgs_dictionary.c => lib/regpkgdb_dictionary.c
2010-11-19 13:40:13 +01:00
Juan RP
8ef8d86c12 Some changes for the XBPS libfetch's frontend code.
1) Raise the cache connection settings to more sane defaults (8->6, 16->2).
2) Introduce xbps_fetch_unset_cache_connection() to drop the caches.
2010-11-03 12:23:57 +01:00
Juan RP
28f997bdf7 libxbps: fixed all warnings found by clang.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100428213056-p1b7bh0llq8393r0
2010-04-28 23:30:56 +02:00
Juan RP
088baa7699 Add defs for default fetch cache connection limits and use them in
xbps_fetch_cache_connection() if 0 is passed as argument.

xbps-bin: enable fetch cached connection when downloading binpkgs.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100124153156-4updprik11nwi7c1
2010-01-24 16:31:56 +01:00