Added support for a cachedir to store downloaded binpkgs.
libxbps: * Added xbps_set_cachedir() and xbps_get_cachedir(). By default it's set to /var/cache/xbps if not specified and it's always relative to the root directory. * Move mkpath() code from sync_remote_pkgidc.c into its own file mkpath.c to use it in another parts of the code. * Added xbps_get_binpkg_local_path(), that returns the local path to a binary package file, stored in cachedir or local repo. * Remote pkg index files are now stored directly in metadir/repodir, skipping the arch directory because binpkgs are now in cachedir. xbps-bin: * Added -c flag to set the cachedir. * Check sha256 hashes in the download stage so that it can check a downloaded binpkg immediately once is stored. * If a binpkg doesn't match the hash it will be refetched. Bump XBPS_RELVER to 20091128. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091128013841-kkcvk07lsqdr26w8
This commit is contained in:
17
lib/unpack.c
17
lib/unpack.c
@ -39,30 +39,17 @@ static void set_extract_flags(int *);
|
||||
int SYMEXPORT
|
||||
xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
{
|
||||
prop_string_t filename, repoloc, arch;
|
||||
struct archive *ar = NULL;
|
||||
const char *pkgname;
|
||||
struct archive *ar = NULL;
|
||||
char *binfile = NULL;
|
||||
int pkg_fd, rv = 0;
|
||||
|
||||
assert(pkg != NULL);
|
||||
|
||||
/*
|
||||
* Append filename to the full path for binary pkg.
|
||||
*/
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
|
||||
return errno;
|
||||
|
||||
filename = prop_dictionary_get(pkg, "filename");
|
||||
arch = prop_dictionary_get(pkg, "architecture");
|
||||
repoloc = prop_dictionary_get(pkg, "repository");
|
||||
if (filename == NULL || arch == NULL || repoloc == NULL)
|
||||
return ENOTSUP;
|
||||
|
||||
binfile = xbps_xasprintf("%s/%s/%s",
|
||||
prop_string_cstring_nocopy(repoloc),
|
||||
prop_string_cstring_nocopy(arch),
|
||||
prop_string_cstring_nocopy(filename));
|
||||
binfile = xbps_get_binpkg_local_path(pkg);
|
||||
if (binfile == NULL)
|
||||
return EINVAL;
|
||||
|
||||
|
Reference in New Issue
Block a user