xbps-repo: fixed 'genindex' target when removing obsoletes in index-files.
This commit is contained in:
parent
7289547432
commit
356bd655cf
@ -37,6 +37,7 @@ struct index_files_data {
|
|||||||
prop_array_t idxfiles;
|
prop_array_t idxfiles;
|
||||||
prop_array_t obsoletes;
|
prop_array_t obsoletes;
|
||||||
const char *pkgdir;
|
const char *pkgdir;
|
||||||
|
const char *targetarch;
|
||||||
bool flush;
|
bool flush;
|
||||||
bool new;
|
bool new;
|
||||||
};
|
};
|
||||||
@ -44,9 +45,9 @@ struct index_files_data {
|
|||||||
static int
|
static int
|
||||||
rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
||||||
{
|
{
|
||||||
prop_string_t ps;
|
|
||||||
struct index_files_data *ifd = arg;
|
struct index_files_data *ifd = arg;
|
||||||
const char *pkgver, *arch;
|
const char *pkgver, *arch;
|
||||||
|
char *str;
|
||||||
|
|
||||||
(void)done;
|
(void)done;
|
||||||
|
|
||||||
@ -56,13 +57,16 @@ rmobsoletes_files_cb(prop_object_t obj, void *arg, bool *done)
|
|||||||
/* pkg found, do nothing */
|
/* pkg found, do nothing */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ps = prop_string_create_cstring(pkgver);
|
if ((str = xbps_xasprintf("%s,%s", pkgver, arch)) == NULL)
|
||||||
if (ps == NULL)
|
return ENOMEM;
|
||||||
return EINVAL;
|
|
||||||
if (!xbps_add_obj_to_array(ifd->obsoletes, ps))
|
|
||||||
return EINVAL;
|
|
||||||
|
|
||||||
|
if (!prop_array_add_cstring(ifd->obsoletes, str)) {
|
||||||
|
free(str);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
free(str);
|
||||||
ifd->flush = true;
|
ifd->flush = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +233,7 @@ repo_genindex_files(const char *pkgdir)
|
|||||||
prop_array_t idx;
|
prop_array_t idx;
|
||||||
struct index_files_data *ifd = NULL;
|
struct index_files_data *ifd = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
const char *pkgver;
|
char *plist, *tmppkgver, *pkgver, *arch, *saveptr;
|
||||||
char *plist;
|
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
plist = xbps_pkg_index_plist(pkgdir);
|
plist = xbps_pkg_index_plist(pkgdir);
|
||||||
@ -278,10 +281,12 @@ repo_genindex_files(const char *pkgdir)
|
|||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
goto out;
|
goto out;
|
||||||
for (i = 0; i < prop_array_count(ifd->obsoletes); i++) {
|
for (i = 0; i < prop_array_count(ifd->obsoletes); i++) {
|
||||||
prop_array_get_cstring_nocopy(ifd->obsoletes,
|
prop_array_get_cstring(ifd->obsoletes, i, &tmppkgver);
|
||||||
i, &pkgver);
|
pkgver = strtok_r(tmppkgver, ",", &saveptr);
|
||||||
|
arch = strtok_r(NULL, ",", &saveptr);
|
||||||
|
free(tmppkgver);
|
||||||
if (!xbps_remove_pkg_from_array_by_pkgver(
|
if (!xbps_remove_pkg_from_array_by_pkgver(
|
||||||
ifd->idxfiles, pkgver, NULL)) {
|
ifd->idxfiles, pkgver, arch)) {
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user