xbps-rindex: fixes to remove old binpkg when arch not matched and entry from index-files.
This commit is contained in:
parent
c899572bd4
commit
66bb87d053
@ -141,8 +141,8 @@ index_files_add(struct xbps_handle *xhp, int argc, char **argv)
|
|||||||
prop_object_t obj, fileobj;
|
prop_object_t obj, fileobj;
|
||||||
prop_dictionary_t pkgprops, pkg_filesd, pkgd;
|
prop_dictionary_t pkgprops, pkg_filesd, pkgd;
|
||||||
prop_array_t files, pkg_cffiles, pkg_files, pkg_links;
|
prop_array_t files, pkg_cffiles, pkg_files, pkg_links;
|
||||||
const char *binpkg, *pkgver, *arch;
|
const char *binpkg, *pkgver, *arch, *version;
|
||||||
char *plist, *repodir, *p;
|
char *plist, *repodir, *p, *pkgname;
|
||||||
size_t x;
|
size_t x;
|
||||||
int i, rv = 0;
|
int i, rv = 0;
|
||||||
bool found, flush;
|
bool found, flush;
|
||||||
@ -328,12 +328,33 @@ index_files_add(struct xbps_handle *xhp, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
flush = true;
|
flush = true;
|
||||||
printf("index-files: added `%s' (%s)\n", pkgver, arch);
|
printf("index-files: added `%s' (%s)\n", pkgver, arch);
|
||||||
prop_object_release(pkgprops);
|
|
||||||
prop_object_release(pkg_filesd);
|
prop_object_release(pkg_filesd);
|
||||||
prop_object_release(files);
|
prop_object_release(files);
|
||||||
prop_object_release(pkgd);
|
prop_object_release(pkgd);
|
||||||
pkgprops = pkg_filesd = pkgd = NULL;
|
pkg_filesd = pkgd = NULL;
|
||||||
files = NULL;
|
files = NULL;
|
||||||
|
/*
|
||||||
|
* Remove old entry (if exists).
|
||||||
|
*/
|
||||||
|
pkgname = xbps_pkg_name(pkgver);
|
||||||
|
assert(pkgname);
|
||||||
|
version = xbps_pkg_version(pkgver);
|
||||||
|
assert(version);
|
||||||
|
|
||||||
|
p = xbps_xasprintf("%s<%s", pkgname, version);
|
||||||
|
pkgd = xbps_find_pkg_in_array_by_pattern(xhp, idxfiles, p, NULL);
|
||||||
|
if (pkgd) {
|
||||||
|
prop_dictionary_get_cstring_nocopy(pkgd,
|
||||||
|
"pkgver", &pkgver);
|
||||||
|
prop_dictionary_get_cstring_nocopy(pkgd,
|
||||||
|
"architecture", &arch);
|
||||||
|
printf("index-files: remove obsolete entry `%s' (%s)\n",
|
||||||
|
pkgver, arch);
|
||||||
|
xbps_remove_pkg_from_array_by_pkgver(xhp,
|
||||||
|
idxfiles, pkgver, NULL);
|
||||||
|
}
|
||||||
|
prop_object_release(pkgprops);
|
||||||
|
free(pkgname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flush && !prop_array_externalize_to_zfile(idxfiles, plist)) {
|
if (flush && !prop_array_externalize_to_zfile(idxfiles, plist)) {
|
||||||
|
@ -173,7 +173,7 @@ index_add(struct xbps_handle *xhp, int argc, char **argv)
|
|||||||
* pass to the next one.
|
* pass to the next one.
|
||||||
*/
|
*/
|
||||||
curpkgd =
|
curpkgd =
|
||||||
xbps_find_pkg_in_array_by_name(xhp, idx, pkgname, arch);
|
xbps_find_pkg_in_array_by_name(xhp, idx, pkgname, NULL);
|
||||||
if (curpkgd == NULL) {
|
if (curpkgd == NULL) {
|
||||||
if (errno && errno != ENOENT) {
|
if (errno && errno != ENOENT) {
|
||||||
prop_object_release(newpkgd);
|
prop_object_release(newpkgd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user