libxbps: modify xbps_get_binpkg_repo_uri() to accept repository URL as 2nd arg.

This commit is contained in:
Juan RP
2011-01-20 16:41:49 +01:00
parent 6f8b2ca33a
commit 84b578b0e4
7 changed files with 22 additions and 20 deletions

View File

@@ -409,7 +409,7 @@ out:
int
xbps_unpack_binary_pkg(prop_dictionary_t pkg_repod)
{
const char *pkgname, *version;
const char *pkgname, *version, *repoloc;
struct archive *ar = NULL;
char *binfile = NULL;
int pkg_fd, rv = 0;
@@ -418,8 +418,9 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg_repod)
prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgname", &pkgname);
prop_dictionary_get_cstring_nocopy(pkg_repod, "version", &version);
prop_dictionary_get_cstring_nocopy(pkg_repod, "repository", &repoloc);
binfile = xbps_get_binpkg_repo_uri(pkg_repod);
binfile = xbps_get_binpkg_repo_uri(pkg_repod, repoloc);
if (binfile == NULL)
return EINVAL;

View File

@@ -194,6 +194,7 @@ prop_dictionary_t
xbps_repository_get_pkg_plist_dict(const char *pkgname, const char *plistf)
{
prop_dictionary_t pkgd = NULL, plistd = NULL;
const char *repoloc;
char *url;
int rv = 0;
@@ -214,7 +215,8 @@ xbps_repository_get_pkg_plist_dict(const char *pkgname, const char *plistf)
if (pkgd == NULL)
goto out;
url = xbps_get_binpkg_repo_uri(pkgd);
prop_dictionary_get_cstring_nocopy(pkgd, "repository", &repoloc);
url = xbps_get_binpkg_repo_uri(pkgd, repoloc);
if (url == NULL) {
errno = EINVAL;
goto out;

View File

@@ -374,14 +374,17 @@ xbps_get_pkg_index_plist(const char *uri)
}
char *
xbps_get_binpkg_repo_uri(prop_dictionary_t pkg_repod)
xbps_get_binpkg_repo_uri(prop_dictionary_t pkg_repod, const char *repoloc)
{
const char *filen, *arch, *cdir, *repoloc;
const char *filen, *arch, *cdir;
char *lbinpkg = NULL;
prop_dictionary_get_cstring_nocopy(pkg_repod, "filename", &filen);
prop_dictionary_get_cstring_nocopy(pkg_repod, "architecture", &arch);
prop_dictionary_get_cstring_nocopy(pkg_repod, "repository", &repoloc);
if (!prop_dictionary_get_cstring_nocopy(pkg_repod,
"filename", &filen))
return NULL;
if (!prop_dictionary_get_cstring_nocopy(pkg_repod,
"architecture", &arch))
return NULL;
cdir = xbps_get_cachedir();
if (cdir == NULL)
@@ -398,7 +401,6 @@ xbps_get_binpkg_repo_uri(prop_dictionary_t pkg_repod)
return lbinpkg;
free(lbinpkg);
/*
* Local and remote repositories use the same path.
*/