lib/transaction_files.c: skip preserved files while looking for obsoletes

This commit is contained in:
Duncaen 2019-06-20 13:03:29 +02:00 committed by Duncan Overbruck
parent 2cccb31508
commit dc547d9f50

View File

@ -139,6 +139,16 @@ typestr(enum type typ)
} }
} }
static bool
match_preserved_file(struct xbps_handle *xhp, const char *file)
{
if (xhp->preserved_files == NULL)
return false;
assert(file && *file == '.');
return xbps_match_string_in_array(xhp->preserved_files, file+1);
}
static bool static bool
can_delete_directory(struct xbps_handle *xhp, const char *file, size_t len, size_t max) can_delete_directory(struct xbps_handle *xhp, const char *file, size_t len, size_t max)
{ {
@ -232,6 +242,11 @@ collect_obsoletes(struct xbps_handle *xhp)
item = items[i]; item = items[i];
if (match_preserved_file(xhp, item->file)) {
xbps_dbg_printf(xhp, "[obsoletes] %s: file exists on disk"
" and must be preserved: %s\n", item->old.pkgver, item->file);
continue;
}
if (item->new.type == 0) { if (item->new.type == 0) {
/* /*