xbps-repo: if fetching info from remote repo for the 'show' and 'show-files'
targets and the binary package exists in cachedir, use it. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091128022129-y6y2tr0vtvy2w745
This commit is contained in:
@@ -136,10 +136,30 @@ open_archive(const char *url)
|
||||
return a;
|
||||
}
|
||||
|
||||
static char *
|
||||
binpkg_in_cachedir(prop_dictionary_t d, const char *uri)
|
||||
{
|
||||
char *lbinfile;
|
||||
|
||||
lbinfile = xbps_get_binpkg_local_path(d, uri);
|
||||
if (lbinfile == NULL)
|
||||
return NULL;
|
||||
|
||||
if (access(lbinfile, R_OK) == 0)
|
||||
return lbinfile;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char SYMEXPORT *
|
||||
xbps_get_path_from_pkg_dict_repo(prop_dictionary_t d, const char *uri)
|
||||
{
|
||||
const char *arch, *filen;
|
||||
char *path = NULL;
|
||||
|
||||
path = binpkg_in_cachedir(d, uri);
|
||||
if (path)
|
||||
return path;
|
||||
|
||||
if (!prop_dictionary_get_cstring_nocopy(d, "architecture", &arch))
|
||||
return NULL;
|
||||
|
@@ -39,7 +39,7 @@ static void set_extract_flags(int *);
|
||||
int SYMEXPORT
|
||||
xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
{
|
||||
const char *pkgname;
|
||||
const char *pkgname, *repoloc;
|
||||
struct archive *ar = NULL;
|
||||
char *binfile = NULL;
|
||||
int pkg_fd, rv = 0;
|
||||
@@ -48,8 +48,9 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
|
||||
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname))
|
||||
return errno;
|
||||
|
||||
binfile = xbps_get_binpkg_local_path(pkg);
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkg, "repository", &repoloc))
|
||||
return errno;
|
||||
binfile = xbps_get_binpkg_local_path(pkg, repoloc);
|
||||
if (binfile == NULL)
|
||||
return EINVAL;
|
||||
|
||||
|
@@ -305,12 +305,10 @@ xbps_get_pkg_index_plist(const char *uri)
|
||||
}
|
||||
|
||||
char SYMEXPORT *
|
||||
xbps_get_binpkg_local_path(prop_dictionary_t pkg)
|
||||
xbps_get_binpkg_local_path(prop_dictionary_t pkg, const char *repoloc)
|
||||
{
|
||||
const char *repoloc, *filen, *arch, *cdir;
|
||||
const char *filen, *arch, *cdir;
|
||||
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkg, "repository", &repoloc))
|
||||
return NULL;
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkg, "filename", &filen))
|
||||
return NULL;
|
||||
if (!prop_dictionary_get_cstring_nocopy(pkg, "architecture", &arch))
|
||||
|
Reference in New Issue
Block a user