Welcome "repository index format 1.5". See NEWS for information.
This commit is contained in:
@@ -36,13 +36,18 @@ int
|
||||
list_pkgs_in_dict(prop_object_t obj, void *arg, bool *loop_done)
|
||||
{
|
||||
struct list_pkgver_cb *lpc = arg;
|
||||
const char *pkgver, *short_desc;
|
||||
const char *pkgver, *short_desc, *arch;
|
||||
char *tmp = NULL;
|
||||
pkg_state_t curstate;
|
||||
size_t i = 0;
|
||||
bool chkarch;
|
||||
|
||||
(void)loop_done;
|
||||
|
||||
chkarch = prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
||||
if (chkarch && !xbps_pkg_arch_match(arch, NULL))
|
||||
return 0;
|
||||
|
||||
if (lpc->check_state) {
|
||||
if (xbps_pkg_state_dictionary(obj, &curstate))
|
||||
return EINVAL;
|
||||
|
@@ -44,9 +44,9 @@ int repo_genindex_files(const char *);
|
||||
int repo_find_files_in_packages(int, char **);
|
||||
|
||||
/* From list.c */
|
||||
int repo_pkg_list_cb(struct repository_pool_index *, void *, bool *);
|
||||
int repo_list_uri_cb(struct repository_pool_index *, void *, bool *);
|
||||
int repo_search_pkgs_cb(struct repository_pool_index *, void *, bool *);
|
||||
int repo_pkg_list_cb(struct xbps_rpool_index *, void *, bool *);
|
||||
int repo_list_uri_cb(struct xbps_rpool_index *, void *, bool *);
|
||||
int repo_search_pkgs_cb(struct xbps_rpool_index *, void *, bool *);
|
||||
|
||||
/* From show.c */
|
||||
int show_pkg_info_from_repolist(const char *, const char *);
|
||||
|
@@ -35,56 +35,38 @@
|
||||
struct ffdata {
|
||||
int npatterns;
|
||||
char **patterns;
|
||||
const char *repouri;
|
||||
};
|
||||
|
||||
static void
|
||||
match_files_by_pattern(prop_dictionary_t pkg_filesd, struct ffdata *ffd)
|
||||
{
|
||||
prop_object_iterator_t iter;
|
||||
prop_array_t array, allkeys;
|
||||
prop_object_t obj;
|
||||
prop_dictionary_keysym_t key;
|
||||
const char *keyname, *filestr, *typestr, *pkgver;
|
||||
prop_array_t array;
|
||||
const char *filestr, *pkgver, *arch;
|
||||
size_t i;
|
||||
int x;
|
||||
|
||||
allkeys = prop_dictionary_all_keys(pkg_filesd);
|
||||
for (i = 0; i < prop_array_count(allkeys); i++) {
|
||||
key = prop_array_get(allkeys, i);
|
||||
keyname = prop_dictionary_keysym_cstring_nocopy(key);
|
||||
array = prop_dictionary_get_keysym(pkg_filesd, key);
|
||||
if (prop_object_type(array) != PROP_TYPE_ARRAY)
|
||||
break;
|
||||
prop_dictionary_get_cstring_nocopy(pkg_filesd, "architecture", &arch);
|
||||
if (!xbps_pkg_arch_match(arch, NULL))
|
||||
return;
|
||||
|
||||
if (strcmp(keyname, "files") == 0)
|
||||
typestr = "regular file";
|
||||
else if (strcmp(keyname, "links") == 0)
|
||||
typestr = "link";
|
||||
else
|
||||
typestr = "configuration file";
|
||||
|
||||
iter = prop_array_iterator(array);
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &filestr);
|
||||
for (x = 1; x < ffd->npatterns; x++) {
|
||||
if ((strcmp(filestr, ffd->patterns[x]) == 0) ||
|
||||
(strstr(filestr, ffd->patterns[x])) ||
|
||||
(xbps_pkgpattern_match(filestr,
|
||||
ffd->patterns[x]) == 1)) {
|
||||
prop_dictionary_get_cstring_nocopy(
|
||||
pkg_filesd, "pkgver", &pkgver);
|
||||
printf(" %s: %s (%s)\n",
|
||||
pkgver, filestr, typestr);
|
||||
}
|
||||
array = prop_dictionary_get(pkg_filesd, "files");
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
prop_array_get_cstring_nocopy(array, i, &filestr);
|
||||
for (x = 1; x < ffd->npatterns; x++) {
|
||||
if ((xbps_pkgpattern_match(filestr, ffd->patterns[x])) ||
|
||||
(strstr(filestr, ffd->patterns[x]))) {
|
||||
prop_dictionary_get_cstring_nocopy(pkg_filesd,
|
||||
"pkgver", &pkgver);
|
||||
printf("%s: %s (%s)\n",
|
||||
pkgver, filestr, ffd->repouri);
|
||||
}
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
}
|
||||
prop_object_release(allkeys);
|
||||
}
|
||||
|
||||
static int
|
||||
find_files_in_package(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
find_files_in_package(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
prop_array_t idxfiles;
|
||||
struct ffdata *ffd = arg;
|
||||
@@ -93,17 +75,15 @@ find_files_in_package(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
|
||||
(void)done;
|
||||
|
||||
printf("Looking in repository '%s', please wait...\n", rpi->rpi_uri);
|
||||
plist = xbps_pkg_index_files_plist(rpi->rpi_uri);
|
||||
if (plist == NULL)
|
||||
if ((plist = xbps_pkg_index_files_plist(rpi->uri)) == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
idxfiles = prop_array_internalize_from_zfile(plist);
|
||||
if (idxfiles == NULL) {
|
||||
if ((idxfiles = prop_array_internalize_from_zfile(plist)) == NULL) {
|
||||
free(plist);
|
||||
return errno;
|
||||
}
|
||||
free(plist);
|
||||
ffd->repouri = rpi->uri;
|
||||
|
||||
for (i = 0; i < prop_array_count(idxfiles); i++)
|
||||
match_files_by_pattern(prop_array_get(idxfiles, i), ffd);
|
||||
@@ -115,16 +95,10 @@ find_files_in_package(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
int
|
||||
repo_find_files_in_packages(int npatterns, char **patterns)
|
||||
{
|
||||
struct ffdata *ffd;
|
||||
int rv;
|
||||
struct ffdata ffd;
|
||||
|
||||
ffd = malloc(sizeof(*ffd));
|
||||
if (ffd == NULL)
|
||||
return ENOMEM;
|
||||
ffd.npatterns = npatterns;
|
||||
ffd.patterns = patterns;
|
||||
|
||||
ffd->npatterns = npatterns;
|
||||
ffd->patterns = patterns;
|
||||
rv = xbps_rpool_foreach(find_files_in_package, ffd);
|
||||
free(ffd);
|
||||
return rv;
|
||||
return xbps_rpool_foreach(find_files_in_package, &ffd);
|
||||
}
|
||||
|
@@ -46,12 +46,13 @@ rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
{
|
||||
prop_string_t ps;
|
||||
struct index_files_data *ifd = arg;
|
||||
const char *pkgver;
|
||||
const char *pkgver, *arch;
|
||||
|
||||
(void)done;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
if (xbps_find_pkg_in_array_by_pkgver(ifd->idx, pkgver)) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
||||
if (xbps_find_pkg_in_array_by_pkgver(ifd->idx, pkgver, arch)) {
|
||||
/* pkg found, do nothing */
|
||||
return 0;
|
||||
}
|
||||
@@ -68,17 +69,20 @@ rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
static int
|
||||
genindex_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
{
|
||||
prop_object_t obj2, fileobj;
|
||||
prop_dictionary_t pkg_filesd, pkgd, regpkgd;
|
||||
prop_array_t array;
|
||||
prop_array_t array, files;
|
||||
struct index_files_data *ifd = arg;
|
||||
const char *binpkg, *pkgver, *rpkgver, *version;
|
||||
const char *binpkg, *pkgver, *rpkgver, *version, *arch;
|
||||
char *file, *pkgname, *pattern;
|
||||
bool found = false;
|
||||
size_t i;
|
||||
|
||||
(void)done;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(obj, "filename", &binpkg);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
||||
|
||||
if (ifd->new)
|
||||
goto start;
|
||||
@@ -97,7 +101,7 @@ genindex_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
return ENOMEM;
|
||||
}
|
||||
free(pkgname);
|
||||
regpkgd = xbps_find_pkg_in_array_by_pattern(ifd->idxfiles, pattern);
|
||||
regpkgd = xbps_find_pkg_in_array_by_pattern(ifd->idxfiles, pattern, arch);
|
||||
if (regpkgd) {
|
||||
/*
|
||||
* pkg already registered, check if same version
|
||||
@@ -111,12 +115,13 @@ genindex_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
return 0;
|
||||
}
|
||||
/* pkgver does not match, remove it from index-files */
|
||||
if (!xbps_remove_pkg_from_array_by_pkgver(ifd->idxfiles, rpkgver))
|
||||
if (!xbps_remove_pkg_from_array_by_pkgver(ifd->idxfiles,
|
||||
rpkgver, arch))
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
start:
|
||||
file = xbps_xasprintf("%s/%s", ifd->pkgdir, binpkg);
|
||||
file = xbps_xasprintf("%s/%s/%s", ifd->pkgdir, arch, binpkg);
|
||||
if (file == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
@@ -129,39 +134,73 @@ start:
|
||||
free(file);
|
||||
|
||||
/* create pkg dictionary */
|
||||
pkgd = prop_dictionary_create();
|
||||
if (pkgd == NULL) {
|
||||
if ((pkgd = prop_dictionary_create()) == NULL) {
|
||||
prop_object_release(pkg_filesd);
|
||||
return ENOMEM;
|
||||
}
|
||||
/* add conf_files array in pkgd */
|
||||
/* add pkgver and architecture objects into pkg dictionary */
|
||||
if (!prop_dictionary_set_cstring(pkgd, "architecture", arch)) {
|
||||
prop_object_release(pkg_filesd);
|
||||
prop_object_release(pkgd);
|
||||
return EINVAL;
|
||||
}
|
||||
if (!prop_dictionary_set_cstring(pkgd, "pkgver", pkgver)) {
|
||||
prop_object_release(pkg_filesd);
|
||||
prop_object_release(pkgd);
|
||||
return EINVAL;
|
||||
}
|
||||
/* add files array obj into pkg dictionary */
|
||||
if ((files = prop_array_create()) == NULL) {
|
||||
prop_object_release(pkg_filesd);
|
||||
prop_object_release(pkgd);
|
||||
return EINVAL;
|
||||
}
|
||||
if (!prop_dictionary_set(pkgd, "files", files)) {
|
||||
prop_object_release(pkg_filesd);
|
||||
prop_object_release(pkgd);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* add conf_files in pkgd */
|
||||
array = prop_dictionary_get(pkg_filesd, "conf_files");
|
||||
if (array != NULL && prop_array_count(array)) {
|
||||
found = true;
|
||||
if (!prop_dictionary_set(pkgd, "conf_files", array)) {
|
||||
prop_object_release(pkgd);
|
||||
prop_object_release(pkg_filesd);
|
||||
return EINVAL;
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
obj2 = prop_array_get(array, i);
|
||||
fileobj = prop_dictionary_get(obj2, "file");
|
||||
if (!prop_array_add(files, fileobj)) {
|
||||
prop_object_release(pkgd);
|
||||
prop_object_release(pkg_filesd);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* add files array in pkgd */
|
||||
array = prop_dictionary_get(pkg_filesd, "files");
|
||||
if (array != NULL && prop_array_count(array)) {
|
||||
found = true;
|
||||
if (!prop_dictionary_set(pkgd, "files", array)) {
|
||||
prop_object_release(pkgd);
|
||||
prop_object_release(pkg_filesd);
|
||||
return EINVAL;
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
obj2 = prop_array_get(array, i);
|
||||
fileobj = prop_dictionary_get(obj2, "file");
|
||||
if (!prop_array_add(files, fileobj)) {
|
||||
prop_object_release(pkgd);
|
||||
prop_object_release(pkg_filesd);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* add links array in pkgd */
|
||||
array = prop_dictionary_get(pkg_filesd, "links");
|
||||
if (array != NULL && prop_array_count(array)) {
|
||||
found = true;
|
||||
if (!prop_dictionary_set(pkgd, "links", array)) {
|
||||
prop_object_release(pkgd);
|
||||
prop_object_release(pkg_filesd);
|
||||
return EINVAL;
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
obj2 = prop_array_get(array, i);
|
||||
fileobj = prop_dictionary_get(obj2, "file");
|
||||
if (!prop_array_add(files, fileobj)) {
|
||||
prop_object_release(pkgd);
|
||||
prop_object_release(pkg_filesd);
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
prop_object_release(pkg_filesd);
|
||||
@@ -169,12 +208,6 @@ start:
|
||||
prop_object_release(pkgd);
|
||||
return 0;
|
||||
}
|
||||
/* pkgver obj in pkgd */
|
||||
if (!prop_dictionary_set_cstring(pkgd, "pkgver", pkgver)) {
|
||||
prop_object_release(pkgd);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* add pkgd into provided array */
|
||||
if (!prop_array_add(ifd->idxfiles, pkgd)) {
|
||||
prop_object_release(pkgd);
|
||||
@@ -233,7 +266,7 @@ repo_genindex_files(const char *pkgdir)
|
||||
ifd->new = true;
|
||||
}
|
||||
|
||||
/* iterate over index.plist packages array */
|
||||
/* iterate over index.plist array */
|
||||
rv = xbps_callback_array_iter(idx, genindex_files_cb, ifd);
|
||||
if (rv != 0)
|
||||
goto out;
|
||||
@@ -248,7 +281,7 @@ repo_genindex_files(const char *pkgdir)
|
||||
prop_array_get_cstring_nocopy(ifd->obsoletes,
|
||||
i, &pkgver);
|
||||
if (!xbps_remove_pkg_from_array_by_pkgver(
|
||||
ifd->idxfiles, pkgver)) {
|
||||
ifd->idxfiles, pkgver, NULL)) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -258,7 +291,7 @@ repo_genindex_files(const char *pkgdir)
|
||||
if (!ifd->flush)
|
||||
goto out;
|
||||
|
||||
/* externalize index-files dictionary to the plist file */
|
||||
/* externalize index-files array */
|
||||
if (!prop_array_externalize_to_zfile(ifd->idxfiles, plist)) {
|
||||
rv = errno;
|
||||
goto out;
|
||||
|
@@ -30,12 +30,18 @@
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <libgen.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <xbps_api.h>
|
||||
#include "defs.h"
|
||||
|
||||
#ifndef __arraycount
|
||||
#define __arraycount(a) (sizeof(a) / sizeof(*a))
|
||||
#endif
|
||||
|
||||
static const char *archs[] = { "noarch", "i686", "x86_64" };
|
||||
|
||||
/*
|
||||
* Removes stalled pkg entries in repository's index.plist file, if any
|
||||
* binary package cannot be read (unavailable, not enough perms, etc).
|
||||
@@ -45,7 +51,7 @@ remove_missing_binpkg_entries(const char *repodir)
|
||||
{
|
||||
prop_array_t array;
|
||||
prop_dictionary_t pkgd;
|
||||
const char *filen, *pkgver;
|
||||
const char *filen, *pkgver, *arch;
|
||||
char *binpkg, *plist;
|
||||
size_t i;
|
||||
int rv = 0;
|
||||
@@ -72,7 +78,8 @@ again:
|
||||
pkgd = prop_array_get(array, i);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "filename", &filen);
|
||||
binpkg = xbps_xasprintf("%s/%s", repodir, filen);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "architecture", &arch);
|
||||
binpkg = xbps_xasprintf("%s/%s/%s", repodir, arch, filen);
|
||||
if (binpkg == NULL) {
|
||||
errno = ENOMEM;
|
||||
rv = -1;
|
||||
@@ -129,7 +136,7 @@ add_binpkg_to_index(prop_array_t idx,
|
||||
{
|
||||
prop_dictionary_t newpkgd, curpkgd;
|
||||
struct stat st;
|
||||
const char *pkgname, *version, *regver, *oldfilen, *oldpkgver;
|
||||
const char *pkgname, *version, *regver, *oldfilen, *oldpkgver, *arch;
|
||||
char *sha256, *filen, *tmpfilen, *oldfilepath, *buf;
|
||||
int rv = 0;
|
||||
|
||||
@@ -151,20 +158,21 @@ add_binpkg_to_index(prop_array_t idx,
|
||||
}
|
||||
prop_dictionary_get_cstring_nocopy(newpkgd, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(newpkgd, "version", &version);
|
||||
prop_dictionary_get_cstring_nocopy(newpkgd, "architecture", &arch);
|
||||
/*
|
||||
* Check if this package exists already in the index, but first
|
||||
* checking the version. If current package version is greater
|
||||
* than current registered package, update the index; otherwise
|
||||
* pass to the next one.
|
||||
*/
|
||||
curpkgd = xbps_find_pkg_in_array_by_name(idx, pkgname);
|
||||
curpkgd = xbps_find_pkg_in_array_by_name(idx, pkgname, arch);
|
||||
if (curpkgd == NULL) {
|
||||
if (errno && errno != ENOENT) {
|
||||
prop_object_release(newpkgd);
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
} else if (curpkgd) {
|
||||
} else {
|
||||
prop_dictionary_get_cstring_nocopy(curpkgd, "version", ®ver);
|
||||
if (xbps_cmpver(version, regver) <= 0) {
|
||||
xbps_warn_printf("skipping `%s', `%s-%s' already "
|
||||
@@ -206,7 +214,7 @@ add_binpkg_to_index(prop_array_t idx,
|
||||
goto out;
|
||||
}
|
||||
free(oldfilepath);
|
||||
if (!xbps_remove_pkg_from_array_by_name(idx, pkgname)) {
|
||||
if (!xbps_remove_pkg_from_array_by_name(idx, pkgname, arch)) {
|
||||
xbps_error_printf("failed to remove `%s' "
|
||||
"from plist index: %s\n", pkgname, strerror(errno));
|
||||
prop_object_release(newpkgd);
|
||||
@@ -274,6 +282,8 @@ repo_genindex(const char *pkgdir)
|
||||
prop_array_t idx = NULL;
|
||||
struct dirent *dp;
|
||||
DIR *dirp;
|
||||
size_t i;
|
||||
char *curdir;
|
||||
char *binfile, *plist;
|
||||
int rv = 0;
|
||||
bool registered_newpkgs = false, foundpkg = false;
|
||||
@@ -291,43 +301,51 @@ repo_genindex(const char *pkgdir)
|
||||
return errno;
|
||||
}
|
||||
|
||||
dirp = opendir(pkgdir);
|
||||
if (dirp == NULL) {
|
||||
xbps_error_printf("xbps-repo: cannot open `%s': %s\n",
|
||||
pkgdir, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
for (i = 0; i < __arraycount(archs); i++) {
|
||||
curdir = xbps_xasprintf("%s/%s", pkgdir, archs[i]);
|
||||
assert(curdir != NULL);
|
||||
|
||||
dirp = opendir(curdir);
|
||||
if (dirp == NULL) {
|
||||
if (errno == ENOENT) {
|
||||
free(curdir);
|
||||
continue;
|
||||
}
|
||||
xbps_error_printf("xbps-repo: cannot open `%s': %s\n",
|
||||
curdir, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
while ((dp = readdir(dirp)) != NULL) {
|
||||
if ((strcmp(dp->d_name, ".") == 0) ||
|
||||
(strcmp(dp->d_name, "..") == 0))
|
||||
continue;
|
||||
/* Ignore unknown files */
|
||||
if (strstr(dp->d_name, ".xbps") == NULL)
|
||||
continue;
|
||||
|
||||
foundpkg = true;
|
||||
binfile = xbps_xasprintf("%s/%s", curdir, dp->d_name);
|
||||
if (binfile == NULL) {
|
||||
(void)closedir(dirp);
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
rv = add_binpkg_to_index(idx, curdir, binfile);
|
||||
free(binfile);
|
||||
if (rv == EEXIST) {
|
||||
rv = 0;
|
||||
continue;
|
||||
} else if (rv != 0) {
|
||||
(void)closedir(dirp);
|
||||
free(curdir);
|
||||
goto out;
|
||||
}
|
||||
registered_newpkgs = true;
|
||||
}
|
||||
(void)closedir(dirp);
|
||||
free(curdir);
|
||||
}
|
||||
|
||||
while ((dp = readdir(dirp)) != NULL) {
|
||||
if ((strcmp(dp->d_name, ".") == 0) ||
|
||||
(strcmp(dp->d_name, "..") == 0))
|
||||
continue;
|
||||
|
||||
/* Ignore unknown files */
|
||||
if (strstr(dp->d_name, ".xbps") == NULL)
|
||||
continue;
|
||||
|
||||
foundpkg = true;
|
||||
binfile = xbps_xasprintf("%s/%s", pkgdir, dp->d_name);
|
||||
if (binfile == NULL) {
|
||||
(void)closedir(dirp);
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
rv = add_binpkg_to_index(idx, pkgdir, binfile);
|
||||
free(binfile);
|
||||
if (rv == EEXIST) {
|
||||
rv = 0;
|
||||
continue;
|
||||
}
|
||||
else if (rv != 0) {
|
||||
(void)closedir(dirp);
|
||||
goto out;
|
||||
}
|
||||
registered_newpkgs = true;
|
||||
}
|
||||
(void)closedir(dirp);
|
||||
|
||||
if (foundpkg == false) {
|
||||
/* No packages were found in directory */
|
||||
rv = ENOENT;
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#include "../xbps-bin/defs.h"
|
||||
|
||||
int
|
||||
repo_pkg_list_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
repo_pkg_list_cb(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
struct list_pkgver_cb lpc;
|
||||
uint16_t idx;
|
||||
@@ -44,42 +44,41 @@ repo_pkg_list_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
(void)done;
|
||||
if (arg != NULL) {
|
||||
idx = (uint16_t)strtoul(arg, &cp, 0);
|
||||
if (rpi->rpi_index != idx)
|
||||
if (rpi->index != idx)
|
||||
return 0;
|
||||
}
|
||||
lpc.check_state = false;
|
||||
lpc.state = 0;
|
||||
lpc.pkgver_len = find_longest_pkgver(rpi->rpi_repo);
|
||||
lpc.pkgver_len = find_longest_pkgver(rpi->repo);
|
||||
|
||||
if (arg == NULL)
|
||||
printf("From %s repository ...\n", rpi->rpi_uri);
|
||||
printf("From %s repository ...\n", rpi->uri);
|
||||
|
||||
(void)xbps_callback_array_iter(rpi->rpi_repo, list_pkgs_in_dict, &lpc);
|
||||
(void)xbps_callback_array_iter(rpi->repo, list_pkgs_in_dict, &lpc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
repo_list_uri_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
repo_list_uri_cb(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
(void)arg;
|
||||
(void)done;
|
||||
|
||||
printf("[%u] %s (%zu packages)\n",
|
||||
rpi->rpi_index, rpi->rpi_uri,
|
||||
(size_t)prop_array_count(rpi->rpi_repo));
|
||||
rpi->index, rpi->uri, (size_t)prop_array_count(rpi->repo));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
repo_search_pkgs_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
repo_search_pkgs_cb(struct xbps_rpool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
struct repo_search_data *rsd = arg;
|
||||
(void)done;
|
||||
|
||||
rsd->pkgver_len = find_longest_pkgver(rpi->rpi_repo);
|
||||
rsd->pkgver_len = find_longest_pkgver(rpi->repo);
|
||||
|
||||
printf("From %s repository ...\n", rpi->rpi_uri);
|
||||
(void)xbps_callback_array_iter(rpi->rpi_repo, show_pkg_namedesc, rsd);
|
||||
printf("From %s repository ...\n", rpi->uri);
|
||||
(void)xbps_callback_array_iter(rpi->repo, show_pkg_namedesc, rsd);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -95,12 +95,16 @@ int
|
||||
show_pkg_namedesc(prop_object_t obj, void *arg, bool *loop_done)
|
||||
{
|
||||
struct repo_search_data *rsd = arg;
|
||||
const char *pkgver, *pkgname, *desc;
|
||||
const char *pkgver, *pkgname, *desc, *arch;
|
||||
char *tmp = NULL;
|
||||
size_t i, x;
|
||||
|
||||
(void)loop_done;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
||||
if (!xbps_pkg_arch_match(arch, NULL))
|
||||
return 0;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "short_desc", &desc);
|
||||
|
Reference in New Issue
Block a user