Use the repo list to find binary packages.
--HG-- extra : convert_revision : c35e25604d0e417115cd1c30d77d23fee3c39f92
This commit is contained in:
parent
4101025318
commit
9a0c175c18
3 changed files with 45 additions and 12 deletions
|
@ -163,7 +163,6 @@ main(int argc, char **argv)
|
|||
prop_dictionary_t dict;
|
||||
repo_info_t *rinfo = NULL;
|
||||
char dpkgidx[PATH_MAX], repolist[PATH_MAX];
|
||||
int rv = 0;
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
@ -273,7 +272,6 @@ main(int argc, char **argv)
|
|||
if (argc != 3)
|
||||
usage();
|
||||
|
||||
#if 0
|
||||
dict = getrepolist_dict();
|
||||
if (!xbps_callback_array_iter_in_dict(dict, "repository-list",
|
||||
xbps_install_binary_pkg_from_repolist, argv[2])) {
|
||||
|
@ -282,16 +280,6 @@ main(int argc, char **argv)
|
|||
"for %s.\n", argv[2]);
|
||||
exit(EINVAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
dict = prop_dictionary_internalize_from_file("/storage/xbps/binpkgs/pkg-index.plist");
|
||||
if (dict == NULL)
|
||||
exit(EINVAL);
|
||||
|
||||
rv = xbps_install_binary_pkg(dict, argv[2],
|
||||
"/home/juan/root_xbps");
|
||||
if (rv)
|
||||
exit(rv);
|
||||
prop_object_release(dict);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -161,6 +161,7 @@ char * xbps_get_pkg_name(const char *);
|
|||
int xbps_install_pkg_deps(prop_dictionary_t, prop_dictionary_t);
|
||||
int xbps_install_binary_pkg(prop_dictionary_t, const char *,
|
||||
const char *);
|
||||
bool xbps_install_binary_pkg_from_repolist(prop_object_t, void *, bool *);
|
||||
int xbps_unpack_binary_pkg(prop_dictionary_t, int (*cb)(struct archive *));
|
||||
int xbps_unpack_archive_cb(struct archive *);
|
||||
|
||||
|
|
|
@ -32,6 +32,50 @@
|
|||
|
||||
#include <xbps_api.h>
|
||||
|
||||
bool
|
||||
xbps_install_binary_pkg_from_repolist(prop_object_t obj, void *arg, bool *done)
|
||||
{
|
||||
prop_dictionary_t dict;
|
||||
prop_string_t oloc;
|
||||
const char *repofile, *repoloc;
|
||||
char plist[PATH_MAX];
|
||||
int rv = 0;
|
||||
|
||||
assert(prop_object_type(obj) == PROP_TYPE_STRING);
|
||||
|
||||
/* Get the location */
|
||||
repofile = prop_string_cstring_nocopy(obj);
|
||||
|
||||
/* Get string for pkg-index.plist with full path. */
|
||||
if (!xbps_append_full_path(plist, repofile, XBPS_PKGINDEX))
|
||||
return false;
|
||||
|
||||
dict = prop_dictionary_internalize_from_file(plist);
|
||||
if (dict == NULL || prop_dictionary_count(dict) == 0)
|
||||
return false;
|
||||
|
||||
oloc = prop_dictionary_get(dict, "location-remote");
|
||||
if (oloc == NULL)
|
||||
oloc = prop_dictionary_get(dict, "location-local");
|
||||
|
||||
if (oloc && prop_object_type(oloc) == PROP_TYPE_STRING)
|
||||
repoloc = prop_string_cstring_nocopy(oloc);
|
||||
else {
|
||||
prop_object_release(dict);
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("Searching in repository: %s\n", repoloc);
|
||||
rv = xbps_install_binary_pkg(dict, arg, "/home/juan/root_xbps");
|
||||
*done = true;
|
||||
prop_object_release(dict);
|
||||
|
||||
if (rv != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
xbps_install_binary_pkg(prop_dictionary_t repo, const char *pkgname,
|
||||
const char *dest)
|
||||
|
|
Loading…
Reference in a new issue