Added support for using noarch packages.
--HG-- extra : convert_revision : a96166ddecb6efe65d35283f25e06a944cc4a038
This commit is contained in:
@@ -96,7 +96,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
||||
prop_string_t reqbystr;
|
||||
uint32_t prio = 0;
|
||||
size_t len = 0, dirdepscnt = 0, indirdepscnt = 0;
|
||||
const char *pkgname, *version, *reqbyname, *reqbyver;
|
||||
const char *pkgname, *version, *reqbyname, *reqbyver, *arch;
|
||||
const char *repoloc, *binfile, *originpkg, *short_desc;
|
||||
char *reqby, *pkgnver;
|
||||
int rv = 0;
|
||||
@@ -113,6 +113,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
||||
prop_dictionary_get_cstring_nocopy(depd, "version", &version);
|
||||
prop_dictionary_get_cstring_nocopy(depd, "filename", &binfile);
|
||||
prop_dictionary_get_cstring_nocopy(depd, "short_desc", &short_desc);
|
||||
prop_dictionary_get_cstring_nocopy(depd, "architecture", &arch);
|
||||
prop_dictionary_get_uint32(depd, "priority", &prio);
|
||||
prop_dictionary_get_cstring_nocopy(origind, "pkgname", &reqbyname);
|
||||
prop_dictionary_get_cstring_nocopy(origind, "version", &reqbyver);
|
||||
@@ -203,6 +204,7 @@ store_dependency(prop_dictionary_t origind, prop_dictionary_t depd,
|
||||
prop_dictionary_set_uint32(dict, "priority", prio);
|
||||
prop_dictionary_set_cstring(dict, "short_desc", short_desc);
|
||||
prop_dictionary_set_bool(dict, "indirect_dep", indirectdep);
|
||||
prop_dictionary_set_cstring(dict, "architecture", arch);
|
||||
|
||||
/*
|
||||
* Add the dictionary into the array.
|
||||
@@ -335,8 +337,8 @@ xbps_find_deps_in_pkg(prop_dictionary_t pkg)
|
||||
* all available binary packages.
|
||||
*/
|
||||
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
||||
plist = xbps_append_full_path(false,
|
||||
prop_string_cstring_nocopy(obj), XBPS_PKGINDEX);
|
||||
plist =
|
||||
xbps_get_pkg_index_plist(prop_string_cstring_nocopy(obj));
|
||||
if (plist == NULL) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
@@ -377,8 +379,8 @@ xbps_find_deps_in_pkg(prop_dictionary_t pkg)
|
||||
*/
|
||||
prop_object_iterator_reset(iter);
|
||||
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
||||
plist = xbps_append_full_path(false,
|
||||
prop_string_cstring_nocopy(obj), XBPS_PKGINDEX);
|
||||
plist =
|
||||
xbps_get_pkg_index_plist(prop_string_cstring_nocopy(obj));
|
||||
if (plist == NULL) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
|
||||
@@ -107,8 +107,7 @@ install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done)
|
||||
char *plist;
|
||||
int rv = 0;
|
||||
|
||||
plist = xbps_append_full_path(false,
|
||||
prop_string_cstring_nocopy(obj), XBPS_PKGINDEX);
|
||||
plist = xbps_get_pkg_index_plist(prop_string_cstring_nocopy(obj));
|
||||
if (plist == NULL)
|
||||
return EINVAL;
|
||||
|
||||
|
||||
19
lib/unpack.c
19
lib/unpack.c
@@ -56,25 +56,34 @@ xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg,
|
||||
const char *destdir,
|
||||
void (*cb_print)(prop_dictionary_t))
|
||||
{
|
||||
prop_string_t filename, repoloc;
|
||||
char *binfile;
|
||||
prop_string_t filename, repoloc, arch;
|
||||
char *binfile, *path;
|
||||
int rv = 0;
|
||||
|
||||
assert(pkg != NULL);
|
||||
|
||||
/* Append filename to the full path for binary pkg */
|
||||
filename = prop_dictionary_get(pkg, "filename");
|
||||
arch = prop_dictionary_get(pkg, "architecture");
|
||||
if (repo)
|
||||
repoloc = prop_dictionary_get(repo, "location-local");
|
||||
else
|
||||
repoloc = prop_dictionary_get(pkg, "repository");
|
||||
|
||||
binfile = xbps_append_full_path(false,
|
||||
path = xbps_append_full_path(false,
|
||||
prop_string_cstring_nocopy(repoloc),
|
||||
prop_string_cstring_nocopy(filename));
|
||||
if (binfile == NULL)
|
||||
prop_string_cstring_nocopy(arch));
|
||||
if (path == NULL)
|
||||
return EINVAL;
|
||||
|
||||
binfile = xbps_append_full_path(false, path,
|
||||
prop_string_cstring_nocopy(filename));
|
||||
if (binfile == NULL) {
|
||||
free(path);
|
||||
return EINVAL;
|
||||
}
|
||||
free(path);
|
||||
|
||||
if (!cb_print)
|
||||
unpack_defcb_print(pkg);
|
||||
else
|
||||
|
||||
26
lib/util.c
26
lib/util.c
@@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
|
||||
@@ -141,6 +142,31 @@ xbps_get_pkg_name(const char *pkg)
|
||||
return pkgname;
|
||||
}
|
||||
|
||||
char *
|
||||
xbps_get_pkg_index_plist(const char *path)
|
||||
{
|
||||
struct utsname un;
|
||||
char *plist, *p;
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
if (uname(&un) == -1)
|
||||
return NULL;
|
||||
|
||||
p = xbps_append_full_path(false, path, un.machine);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
plist = xbps_append_full_path(false, p, XBPS_PKGINDEX);
|
||||
if (plist == NULL) {
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
free(p);
|
||||
|
||||
return plist;
|
||||
}
|
||||
|
||||
bool
|
||||
xbps_pkg_has_rundeps(prop_dictionary_t pkg)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user