Repository index 1.4 -- see NEWS file for info.
This commit is contained in:
parent
9147488b19
commit
9a088937b5
5
NEWS
5
NEWS
@ -1,5 +1,10 @@
|
||||
xbps-0.12.0 (???):
|
||||
|
||||
* Repository index 1.4: the file is now externalized to a proplib array
|
||||
and has been renamed to "rindex.plist" to not break compatibility
|
||||
with previous XBPS versions. This helps in simplifying the API
|
||||
implementation substantially.
|
||||
|
||||
* Added a pkg-config file to simplify writing code with libxbps.
|
||||
|
||||
* libxbps: improved support for finding newest package versions available
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2009-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -102,7 +102,7 @@ void show_pkg_info(prop_dictionary_t);
|
||||
void show_pkg_info_one(prop_dictionary_t, const char *);
|
||||
int list_strings_in_array(prop_object_t, void *, bool *);
|
||||
int list_strings_sep_in_array(prop_object_t, void *, bool *);
|
||||
size_t find_longest_pkgver(prop_dictionary_t);
|
||||
size_t find_longest_pkgver(prop_object_t);
|
||||
void print_package_line(const char *, bool);
|
||||
|
||||
/* from list.c */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2008-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -186,12 +186,12 @@ _find_longest_pkgver_cb(prop_object_t obj, void *arg, bool *loop_done)
|
||||
}
|
||||
|
||||
size_t
|
||||
find_longest_pkgver(prop_dictionary_t d)
|
||||
find_longest_pkgver(prop_object_t o)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
if (prop_object_type(d) == PROP_TYPE_DICTIONARY)
|
||||
(void)xbps_callback_array_iter_in_dict(d, "packages",
|
||||
if (prop_object_type(o) == PROP_TYPE_ARRAY)
|
||||
(void)xbps_callback_array_iter(o,
|
||||
_find_longest_pkgver_cb, &len);
|
||||
else
|
||||
(void)xbps_regpkgdb_foreach_pkg_cb(
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "defs.h"
|
||||
|
||||
struct index_files_data {
|
||||
prop_dictionary_t idxdict;
|
||||
prop_array_t idx;
|
||||
prop_array_t idxfiles;
|
||||
prop_array_t obsoletes;
|
||||
const char *pkgdir;
|
||||
@ -44,7 +44,6 @@ struct index_files_data {
|
||||
static int
|
||||
rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
{
|
||||
prop_array_t array;
|
||||
prop_string_t ps;
|
||||
struct index_files_data *ifd = arg;
|
||||
const char *pkgver;
|
||||
@ -52,8 +51,7 @@ rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||
(void)done;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||
array = prop_dictionary_get(ifd->idxdict, "packages");
|
||||
if (xbps_find_pkg_in_array_by_pkgver(array, pkgver)) {
|
||||
if (xbps_find_pkg_in_array_by_pkgver(ifd->idx, pkgver)) {
|
||||
/* pkg found, do nothing */
|
||||
return 0;
|
||||
}
|
||||
@ -195,9 +193,9 @@ start:
|
||||
int
|
||||
repo_genindex_files(const char *pkgdir)
|
||||
{
|
||||
prop_dictionary_t idxdict;
|
||||
prop_array_t idx;
|
||||
struct index_files_data *ifd = NULL;
|
||||
size_t idx;
|
||||
size_t i;
|
||||
const char *pkgver;
|
||||
char *plist;
|
||||
int rv;
|
||||
@ -207,8 +205,8 @@ repo_genindex_files(const char *pkgdir)
|
||||
return ENOMEM;
|
||||
|
||||
/* internalize repository index plist */
|
||||
idxdict = prop_dictionary_internalize_from_zfile(plist);
|
||||
if (idxdict == NULL) {
|
||||
idx = prop_array_internalize_from_zfile(plist);
|
||||
if (idx == NULL) {
|
||||
free(plist);
|
||||
return errno;
|
||||
}
|
||||
@ -227,7 +225,7 @@ repo_genindex_files(const char *pkgdir)
|
||||
}
|
||||
ifd->pkgdir = pkgdir;
|
||||
ifd->idxfiles = prop_array_internalize_from_zfile(plist);
|
||||
ifd->idxdict = prop_dictionary_copy(idxdict);
|
||||
ifd->idx = prop_array_copy(idx);
|
||||
ifd->obsoletes = prop_array_create();
|
||||
if (ifd->idxfiles == NULL) {
|
||||
/* missing file, create new one */
|
||||
@ -236,8 +234,7 @@ repo_genindex_files(const char *pkgdir)
|
||||
}
|
||||
|
||||
/* iterate over index.plist packages array */
|
||||
rv = xbps_callback_array_iter_in_dict(idxdict,
|
||||
"packages", genindex_files_cb, ifd);
|
||||
rv = xbps_callback_array_iter(idx, genindex_files_cb, ifd);
|
||||
if (rv != 0)
|
||||
goto out;
|
||||
|
||||
@ -247,9 +244,9 @@ repo_genindex_files(const char *pkgdir)
|
||||
rmobsoletes_files_cb, ifd);
|
||||
if (rv != 0)
|
||||
goto out;
|
||||
for (idx = 0; idx < prop_array_count(ifd->obsoletes); idx++) {
|
||||
for (i = 0; i < prop_array_count(ifd->obsoletes); i++) {
|
||||
prop_array_get_cstring_nocopy(ifd->obsoletes,
|
||||
idx, &pkgver);
|
||||
i, &pkgver);
|
||||
if (!xbps_remove_pkg_from_array_by_pkgver(
|
||||
ifd->idxfiles, pkgver)) {
|
||||
rv = EINVAL;
|
||||
@ -274,14 +271,14 @@ out:
|
||||
prop_object_release(ifd->obsoletes);
|
||||
if (ifd->idxfiles != NULL)
|
||||
prop_object_release(ifd->idxfiles);
|
||||
if (ifd->idxdict != NULL)
|
||||
prop_object_release(ifd->idxdict);
|
||||
if (ifd->idx != NULL)
|
||||
prop_object_release(ifd->idx);
|
||||
if (plist != NULL)
|
||||
free(plist);
|
||||
if (ifd != NULL)
|
||||
free(ifd);
|
||||
if (idxdict != NULL)
|
||||
prop_object_release(idxdict);
|
||||
if (idx != NULL)
|
||||
prop_object_release(idx);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2009-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,8 +43,8 @@
|
||||
static int
|
||||
remove_missing_binpkg_entries(const char *repodir)
|
||||
{
|
||||
prop_array_t pkgarray;
|
||||
prop_dictionary_t idxd, pkgd;
|
||||
prop_array_t array;
|
||||
prop_dictionary_t pkgd;
|
||||
const char *filen;
|
||||
char *binpkg, *plist;
|
||||
size_t i;
|
||||
@ -55,8 +55,8 @@ remove_missing_binpkg_entries(const char *repodir)
|
||||
if (plist == NULL)
|
||||
return -1;
|
||||
|
||||
idxd = prop_dictionary_internalize_from_zfile(plist);
|
||||
if (idxd == NULL) {
|
||||
array = prop_array_internalize_from_zfile(plist);
|
||||
if (array == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
xbps_error_printf("xbps-repo: cannot read `%s': %s\n",
|
||||
plist, strerror(errno));
|
||||
@ -68,12 +68,8 @@ remove_missing_binpkg_entries(const char *repodir)
|
||||
}
|
||||
|
||||
again:
|
||||
pkgarray = prop_dictionary_get(idxd, "packages");
|
||||
if (prop_object_type(pkgarray) != PROP_TYPE_ARRAY)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < prop_array_count(pkgarray); i++) {
|
||||
pkgd = prop_array_get(pkgarray, i);
|
||||
for (i = 0; i < prop_array_count(array); i++) {
|
||||
pkgd = prop_array_get(array, i);
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "filename", &filen);
|
||||
binpkg = xbps_xasprintf("%s/%s", repodir, filen);
|
||||
if (binpkg == NULL) {
|
||||
@ -85,7 +81,7 @@ again:
|
||||
xbps_warn_printf("xbps-repo: `%s' unavailable, "
|
||||
"removing entry from index... (%s)\n",
|
||||
filen, strerror(errno));
|
||||
prop_array_remove(pkgarray, i);
|
||||
prop_array_remove(array, i);
|
||||
free(binpkg);
|
||||
found = true;
|
||||
goto again;
|
||||
@ -93,10 +89,7 @@ again:
|
||||
free(binpkg);
|
||||
}
|
||||
if (found) {
|
||||
prop_dictionary_set_uint64(idxd, "total-pkgs",
|
||||
prop_array_count(pkgarray));
|
||||
prop_dictionary_set(idxd, "packages", pkgarray);
|
||||
if (!prop_dictionary_externalize_to_zfile(idxd, plist))
|
||||
if (!prop_array_externalize_to_zfile(array, plist))
|
||||
rv = errno;
|
||||
}
|
||||
free(plist);
|
||||
@ -104,14 +97,12 @@ again:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static prop_dictionary_t
|
||||
repoidx_getdict(const char *pkgdir)
|
||||
static prop_array_t
|
||||
repoidx_get(const char *pkgdir)
|
||||
{
|
||||
prop_dictionary_t dict;
|
||||
prop_array_t array;
|
||||
char *plist;
|
||||
int rv;
|
||||
|
||||
/*
|
||||
* Remove entries in repositories index for unexistent
|
||||
* packages, i.e dangling entries.
|
||||
@ -123,50 +114,25 @@ repoidx_getdict(const char *pkgdir)
|
||||
if (plist == NULL)
|
||||
return NULL;
|
||||
|
||||
dict = prop_dictionary_internalize_from_zfile(plist);
|
||||
if (dict == NULL) {
|
||||
dict = prop_dictionary_create();
|
||||
if (dict == NULL)
|
||||
goto out;
|
||||
|
||||
array = prop_array_create();
|
||||
if (array == NULL) {
|
||||
prop_object_release(dict);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!prop_dictionary_set(dict, "packages", array)) {
|
||||
prop_object_release(dict);
|
||||
prop_object_release(array);
|
||||
goto out;
|
||||
}
|
||||
prop_object_release(array);
|
||||
if (!prop_dictionary_set_cstring_nocopy(dict,
|
||||
"pkgindex-version", XBPS_PKGINDEX_VERSION)) {
|
||||
prop_object_release(dict);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
out:
|
||||
array = prop_array_internalize_from_zfile(plist);
|
||||
free(plist);
|
||||
return dict;
|
||||
if (array == NULL)
|
||||
array = prop_array_create();
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
static int
|
||||
add_binpkg_to_index(prop_dictionary_t idxdict,
|
||||
add_binpkg_to_index(prop_array_t idx,
|
||||
const char *filedir,
|
||||
const char *file)
|
||||
{
|
||||
prop_dictionary_t newpkgd, curpkgd;
|
||||
prop_array_t pkgar;
|
||||
struct stat st;
|
||||
const char *pkgname, *version, *regver, *oldfilen, *oldpkgver;
|
||||
char *sha256, *filen, *tmpfilen, *oldfilepath, *buf;
|
||||
int rv = 0;
|
||||
|
||||
if (idxdict == NULL || file == NULL)
|
||||
return EINVAL;
|
||||
|
||||
tmpfilen = strdup(file);
|
||||
if (tmpfilen == NULL)
|
||||
return errno;
|
||||
@ -191,7 +157,7 @@ add_binpkg_to_index(prop_dictionary_t idxdict,
|
||||
* than current registered package, update the index; otherwise
|
||||
* pass to the next one.
|
||||
*/
|
||||
curpkgd = xbps_find_pkg_in_dict_by_name(idxdict, "packages", pkgname);
|
||||
curpkgd = xbps_find_pkg_in_array_by_name(idx, pkgname);
|
||||
if (curpkgd == NULL) {
|
||||
if (errno && errno != ENOENT) {
|
||||
prop_object_release(newpkgd);
|
||||
@ -240,8 +206,7 @@ add_binpkg_to_index(prop_dictionary_t idxdict,
|
||||
goto out;
|
||||
}
|
||||
free(oldfilepath);
|
||||
if (!xbps_remove_pkg_from_dict_by_name(idxdict,
|
||||
"packages", pkgname)) {
|
||||
if (!xbps_remove_pkg_from_array_by_name(idx, pkgname)) {
|
||||
xbps_error_printf("failed to remove `%s' "
|
||||
"from plist index: %s\n", pkgname, strerror(errno));
|
||||
prop_object_release(newpkgd);
|
||||
@ -286,28 +251,16 @@ add_binpkg_to_index(prop_dictionary_t idxdict,
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
/* Get package array in repo index file */
|
||||
pkgar = prop_dictionary_get(idxdict, "packages");
|
||||
if (pkgar == NULL) {
|
||||
prop_object_release(newpkgd);
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Add dictionary into the index and update package count.
|
||||
*/
|
||||
if (!xbps_add_obj_to_array(pkgar, newpkgd)) {
|
||||
prop_object_release(newpkgd);
|
||||
if (!xbps_add_obj_to_array(idx, newpkgd)) {
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
printf("Registered `%s-%s' (%s) in repository index.\n",
|
||||
pkgname, version, filen);
|
||||
|
||||
if (!prop_dictionary_set_uint64(idxdict, "total-pkgs",
|
||||
prop_array_count(pkgar)))
|
||||
rv = errno;
|
||||
|
||||
out:
|
||||
if (tmpfilen)
|
||||
free(tmpfilen);
|
||||
@ -318,10 +271,9 @@ out:
|
||||
int
|
||||
repo_genindex(const char *pkgdir)
|
||||
{
|
||||
prop_dictionary_t idxdict = NULL;
|
||||
prop_array_t idx = NULL;
|
||||
struct dirent *dp;
|
||||
DIR *dirp;
|
||||
uint64_t npkgcnt = 0;
|
||||
char *binfile, *plist;
|
||||
int rv = 0;
|
||||
bool registered_newpkgs = false, foundpkg = false;
|
||||
@ -329,13 +281,13 @@ repo_genindex(const char *pkgdir)
|
||||
/*
|
||||
* Create or read existing package index plist file.
|
||||
*/
|
||||
idxdict = repoidx_getdict(pkgdir);
|
||||
if (idxdict == NULL)
|
||||
idx = repoidx_get(pkgdir);
|
||||
if (idx == NULL)
|
||||
return errno;
|
||||
|
||||
plist = xbps_pkg_index_plist(pkgdir);
|
||||
if (plist == NULL) {
|
||||
prop_object_release(idxdict);
|
||||
prop_object_release(idx);
|
||||
return errno;
|
||||
}
|
||||
|
||||
@ -362,7 +314,7 @@ repo_genindex(const char *pkgdir)
|
||||
rv = errno;
|
||||
goto out;
|
||||
}
|
||||
rv = add_binpkg_to_index(idxdict, pkgdir, binfile);
|
||||
rv = add_binpkg_to_index(idx, pkgdir, binfile);
|
||||
free(binfile);
|
||||
if (rv == EEXIST) {
|
||||
rv = 0;
|
||||
@ -383,8 +335,8 @@ repo_genindex(const char *pkgdir)
|
||||
/*
|
||||
* Show total count registered packages.
|
||||
*/
|
||||
prop_dictionary_get_uint64(idxdict, "total-pkgs", &npkgcnt);
|
||||
printf("%ju packages registered in repository index.\n", npkgcnt);
|
||||
printf("%zu packages registered in repository index.\n",
|
||||
(size_t)prop_array_count(idx));
|
||||
/*
|
||||
* Don't write plist file if no packages were registered.
|
||||
*/
|
||||
@ -394,12 +346,12 @@ repo_genindex(const char *pkgdir)
|
||||
* If any package was registered in package index, write
|
||||
* plist file to storage.
|
||||
*/
|
||||
if (!prop_dictionary_externalize_to_zfile(idxdict, plist))
|
||||
if (!prop_array_externalize_to_zfile(idx, plist))
|
||||
rv = errno;
|
||||
}
|
||||
out:
|
||||
free(plist);
|
||||
prop_object_release(idxdict);
|
||||
prop_object_release(idx);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2011-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -49,29 +49,22 @@ repo_pkg_list_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
}
|
||||
lpc.check_state = false;
|
||||
lpc.state = 0;
|
||||
lpc.pkgver_len = find_longest_pkgver(rpi->rpi_repod);
|
||||
lpc.pkgver_len = find_longest_pkgver(rpi->rpi_repo);
|
||||
|
||||
printf("From %s repository ...\n", rpi->rpi_uri);
|
||||
(void)xbps_callback_array_iter_in_dict(rpi->rpi_repod,
|
||||
"packages", list_pkgs_in_dict, &lpc);
|
||||
|
||||
(void)xbps_callback_array_iter(rpi->rpi_repo, list_pkgs_in_dict, &lpc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
repo_list_uri_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
{
|
||||
const char *pkgidx;
|
||||
uint64_t npkgs;
|
||||
|
||||
(void)arg;
|
||||
(void)done;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(rpi->rpi_repod,
|
||||
"pkgindex-version", &pkgidx);
|
||||
prop_dictionary_get_uint64(rpi->rpi_repod, "total-pkgs", &npkgs);
|
||||
printf("[%u] %s (index %s, " "%" PRIu64 " packages)\n",
|
||||
rpi->rpi_index, rpi->rpi_uri, pkgidx, npkgs);
|
||||
printf("[%u] %s (%zu packages)\n",
|
||||
rpi->rpi_index, rpi->rpi_uri,
|
||||
(size_t)prop_array_count(rpi->rpi_repo));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -82,11 +75,9 @@ repo_search_pkgs_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
struct repo_search_data *rsd = arg;
|
||||
(void)done;
|
||||
|
||||
rsd->pkgver_len = find_longest_pkgver(rpi->rpi_repod);
|
||||
rsd->pkgver_len = find_longest_pkgver(rpi->rpi_repo);
|
||||
|
||||
printf("From %s repository ...\n", rpi->rpi_uri);
|
||||
(void)xbps_callback_array_iter_in_dict(rpi->rpi_repod,
|
||||
"packages", show_pkg_namedesc, rsd);
|
||||
|
||||
(void)xbps_callback_array_iter(rpi->rpi_repo, show_pkg_namedesc, rsd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
#
|
||||
# By default we use the official "public" repositories. You can add
|
||||
# your own repositories by specifying the path to the directory
|
||||
# where the index.plist file is stored.
|
||||
# where the plist index file (rindex.plist) is stored.
|
||||
#
|
||||
# Repositories not matching the host architecture are simply ignored.
|
||||
#
|
||||
|
@ -54,9 +54,9 @@
|
||||
* @def XBPS_PKGINDEX_VERSION
|
||||
* Current version for the repository package index format.
|
||||
*/
|
||||
#define XBPS_PKGINDEX_VERSION "1.3"
|
||||
#define XBPS_PKGINDEX_VERSION "1.4"
|
||||
|
||||
#define XBPS_API_VERSION "20120118"
|
||||
#define XBPS_API_VERSION "20120119"
|
||||
#define XBPS_VERSION "0.12"
|
||||
|
||||
/**
|
||||
@ -101,13 +101,13 @@
|
||||
* @def XBPS_PKGINDEX
|
||||
* Filename for the repository package index property list.
|
||||
*/
|
||||
#define XBPS_PKGINDEX "index.plist"
|
||||
#define XBPS_PKGINDEX "rindex.plist"
|
||||
|
||||
/**
|
||||
* @def XBPS_PKGINDEX_FILES
|
||||
* Filename for the repository package index files property list.
|
||||
*/
|
||||
#define XBPS_PKGINDEX_FILES "index-files.plist"
|
||||
#define XBPS_PKGINDEX_FILES "rindex-files.plist"
|
||||
|
||||
/**
|
||||
* @def XBPS_SYSCONF_PATH
|
||||
@ -1388,12 +1388,12 @@ prop_dictionary_t xbps_dictionary_metadata_plist_by_url(const char *url,
|
||||
*/
|
||||
struct repository_pool_index {
|
||||
/**
|
||||
* @var rpi_repod
|
||||
* @var rpi_repo
|
||||
*
|
||||
* Internalized Proplib dictionary of the index plist file
|
||||
* Internalized proplib array of the index plist file
|
||||
* associated with repository.
|
||||
*/
|
||||
prop_dictionary_t rpi_repod;
|
||||
prop_array_t rpi_repo;
|
||||
/**
|
||||
* @var rpi_uri
|
||||
*
|
||||
|
@ -175,11 +175,15 @@ prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_in_dict_by_pattern(prop_dictionary_t,
|
||||
const char *,
|
||||
const char *);
|
||||
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_conf_in_array_by_name(prop_array_t, const char *);
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_conf_in_dict_by_name(prop_dictionary_t,
|
||||
const char *,
|
||||
const char *);
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_conf_in_array_by_pattern(prop_array_t,
|
||||
const char *);
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_conf_in_dict_by_pattern(prop_dictionary_t,
|
||||
const char *,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2008-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -211,6 +211,18 @@ find_virtualpkg_user_in_array(prop_array_t array,
|
||||
return find_pkg_in_array(array, vpkgname, false, false);
|
||||
}
|
||||
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_conf_in_array_by_name(prop_array_t array, const char *name)
|
||||
{
|
||||
return find_virtualpkg_user_in_array(array, name, false);
|
||||
}
|
||||
|
||||
prop_dictionary_t HIDDEN
|
||||
xbps_find_virtualpkg_conf_in_array_by_pattern(prop_array_t array, const char *p)
|
||||
{
|
||||
return find_virtualpkg_user_in_array(array, p, true);
|
||||
}
|
||||
|
||||
static prop_dictionary_t
|
||||
find_virtualpkg_user_in_dict(prop_dictionary_t d,
|
||||
const char *key,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2009-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -122,7 +122,7 @@ xbps_repository_pool_init(struct xbps_handle *xhp)
|
||||
goto out;
|
||||
}
|
||||
if (!xbps_add_obj_to_dict(d,
|
||||
prop_dictionary_internalize_from_zfile(plist),
|
||||
prop_array_internalize_from_zfile(plist),
|
||||
"index")) {
|
||||
rv = EINVAL;
|
||||
prop_object_release(d);
|
||||
@ -194,7 +194,7 @@ xbps_repository_pool_sync(const struct xbps_handle *xhp)
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Fetch repository index.plist.
|
||||
* Fetch repository plist index.
|
||||
*/
|
||||
rv = xbps_repository_sync_pkg_index(repouri, XBPS_PKGINDEX);
|
||||
if (rv == -1) {
|
||||
@ -204,7 +204,7 @@ xbps_repository_pool_sync(const struct xbps_handle *xhp)
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Fetch repository index-files.plist.
|
||||
* Fetch repository plist files index.
|
||||
*/
|
||||
rv = xbps_repository_sync_pkg_index(repouri,
|
||||
XBPS_PKGINDEX_FILES);
|
||||
@ -249,7 +249,7 @@ xbps_repository_pool_foreach(
|
||||
|
||||
d = prop_array_get(xhp->repo_pool, i);
|
||||
prop_dictionary_get_cstring_nocopy(d, "uri", &rpi->rpi_uri);
|
||||
rpi->rpi_repod = prop_dictionary_get(d, "index");
|
||||
rpi->rpi_repo = prop_dictionary_get(d, "index");
|
||||
rpi->rpi_index = i;
|
||||
|
||||
rv = (*fn)(rpi, arg, &done);
|
||||
|
@ -54,12 +54,12 @@ repo_find_virtualpkg_cb(struct repository_pool_index *rpi, void *arg, bool *done
|
||||
|
||||
if (rpf->bypattern) {
|
||||
rpf->pkgd =
|
||||
xbps_find_virtualpkg_conf_in_dict_by_pattern(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
xbps_find_virtualpkg_conf_in_array_by_pattern(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
} else {
|
||||
rpf->pkgd =
|
||||
xbps_find_virtualpkg_conf_in_dict_by_name(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
xbps_find_virtualpkg_conf_in_array_by_name(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
}
|
||||
if (rpf->pkgd) {
|
||||
#ifdef DEBUG
|
||||
@ -88,25 +88,25 @@ repo_find_pkg_cb(struct repository_pool_index *rpi, void *arg, bool *done)
|
||||
return 0;
|
||||
}
|
||||
/* exact match by pkgver */
|
||||
rpf->pkgd = xbps_find_pkg_in_dict_by_pkgver(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_pkg_in_array_by_pkgver(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
} else if (rpf->bypattern) {
|
||||
/* match by pkgpattern in pkgver*/
|
||||
rpf->pkgd = xbps_find_pkg_in_dict_by_pattern(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_pkg_in_array_by_pattern(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
/* If no pkg exists matching pattern, look for virtual packages */
|
||||
if (rpf->pkgd == NULL) {
|
||||
rpf->pkgd = xbps_find_virtualpkg_in_dict_by_pattern(
|
||||
rpi->rpi_repod, "packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_virtualpkg_in_array_by_pattern(
|
||||
rpi->rpi_repo, rpf->pattern);
|
||||
}
|
||||
} else {
|
||||
/* match by pkgname */
|
||||
rpf->pkgd = xbps_find_pkg_in_dict_by_name(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_pkg_in_array_by_name(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
/* If no pkg exists matching pattern, look for virtual packages */
|
||||
if (rpf->pkgd == NULL) {
|
||||
rpf->pkgd = xbps_find_virtualpkg_in_dict_by_name(
|
||||
rpi->rpi_repod, "packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_virtualpkg_in_array_by_name(
|
||||
rpi->rpi_repo, rpf->pattern);
|
||||
}
|
||||
}
|
||||
if (rpf->pkgd) {
|
||||
@ -136,11 +136,11 @@ repo_find_best_pkg_cb(struct repository_pool_index *rpi,
|
||||
(void)done;
|
||||
|
||||
if (rpf->bypattern) {
|
||||
rpf->pkgd = xbps_find_pkg_in_dict_by_pattern(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_pkg_in_array_by_pattern(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
} else {
|
||||
rpf->pkgd = xbps_find_pkg_in_dict_by_name(rpi->rpi_repod,
|
||||
"packages", rpf->pattern);
|
||||
rpf->pkgd = xbps_find_pkg_in_array_by_name(rpi->rpi_repo,
|
||||
rpf->pattern);
|
||||
}
|
||||
if (rpf->pkgd == NULL) {
|
||||
if (errno && errno != ENOENT)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
||||
* Copyright (c) 2009-2012 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -130,7 +130,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Remote repository index.plist full URL.
|
||||
* Remote repository plist index full URL.
|
||||
*/
|
||||
rpidx = xbps_xasprintf("%s/%s", uri, plistf);
|
||||
if (rpidx == NULL) {
|
||||
@ -147,7 +147,8 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Full path to repository directory to store the index.plist file.
|
||||
* Full path to repository directory to store the plist
|
||||
* index file.
|
||||
*/
|
||||
lrepodir = xbps_xasprintf("%s/%s/%s",
|
||||
xhp->rootdir, XBPS_META_PATH, uri_fixedp);
|
||||
@ -156,7 +157,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* If directory exists probably the index.plist file
|
||||
* If directory exists probably the plist index file
|
||||
* was downloaded previously...
|
||||
*/
|
||||
rv = stat(lrepodir, &st);
|
||||
@ -170,7 +171,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
|
||||
xbps_set_cb_state(XBPS_STATE_REPOSYNC, 0, NULL, NULL,
|
||||
"Synchronizing index for `%s'...", uri);
|
||||
/*
|
||||
* Download index.plist file from repository.
|
||||
* Download plist index file from repository.
|
||||
*/
|
||||
if (xbps_fetch_file(rpidx, fetch_outputdir, true, NULL) == -1) {
|
||||
/* reposync error cb */
|
||||
@ -206,7 +207,7 @@ xbps_repository_sync_pkg_index(const char *uri, const char *plistf)
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Create local repodir to store index.plist file.
|
||||
* Create local repodir to store plist index file.
|
||||
*/
|
||||
if ((rv = xbps_mkpath(lrepodir, 0755)) == -1) {
|
||||
xbps_set_cb_state(XBPS_STATE_REPOSYNC_FAIL, errno, NULL, NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user