xbps-repo: fixed index-files generation, this time for real!
This commit is contained in:
parent
ff2e434b56
commit
65b5e328d8
@ -77,8 +77,8 @@ genindex_files_cb(prop_object_t obj, void *arg, bool *done)
|
|||||||
prop_dictionary_t pkg_filesd, pkgd, regpkgd;
|
prop_dictionary_t pkg_filesd, pkgd, regpkgd;
|
||||||
prop_array_t array, files;
|
prop_array_t array, files;
|
||||||
struct index_files_data *ifd = arg;
|
struct index_files_data *ifd = arg;
|
||||||
const char *binpkg, *pkgver, *rpkgver, *version, *arch;
|
const char *binpkg, *pkgver, *rpkgver, *arch;
|
||||||
char *file, *pkgname, *pattern;
|
char *file;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -91,21 +91,7 @@ genindex_files_cb(prop_object_t obj, void *arg, bool *done)
|
|||||||
if (ifd->new)
|
if (ifd->new)
|
||||||
goto start;
|
goto start;
|
||||||
|
|
||||||
pkgname = xbps_pkg_name(pkgver);
|
regpkgd = xbps_find_pkg_in_array_by_pkgver(ifd->idxfiles, pkgver, arch);
|
||||||
if (pkgname == NULL)
|
|
||||||
return ENOMEM;
|
|
||||||
version = xbps_pkg_version(pkgver);
|
|
||||||
if (version == NULL) {
|
|
||||||
free(pkgname);
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
pattern = xbps_xasprintf("%s>=0", pkgname);
|
|
||||||
if (pattern == NULL) {
|
|
||||||
free(pkgname);
|
|
||||||
return ENOMEM;
|
|
||||||
}
|
|
||||||
free(pkgname);
|
|
||||||
regpkgd = xbps_find_pkg_in_array_by_pattern(ifd->idxfiles, pattern, arch);
|
|
||||||
if (regpkgd) {
|
if (regpkgd) {
|
||||||
/*
|
/*
|
||||||
* pkg already registered, check if same version
|
* pkg already registered, check if same version
|
||||||
@ -122,6 +108,8 @@ genindex_files_cb(prop_object_t obj, void *arg, bool *done)
|
|||||||
if (!xbps_remove_pkg_from_array_by_pkgver(ifd->idxfiles,
|
if (!xbps_remove_pkg_from_array_by_pkgver(ifd->idxfiles,
|
||||||
rpkgver, arch))
|
rpkgver, arch))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
printf("Removed obsolete entry for `%s' from "
|
||||||
|
"files index.\n", rpkgver);
|
||||||
}
|
}
|
||||||
|
|
||||||
start:
|
start:
|
||||||
@ -297,7 +285,8 @@ repo_genindex_files(const char *pkgdir)
|
|||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printf("Removed obsolete entry for `%s'.\n", pkgver);
|
printf("Removed obsolete entry for `%s' "
|
||||||
|
"from files index.\n", pkgver);
|
||||||
free(pkgver);
|
free(pkgver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user