Add noextract configuration option

Closes #208
Fixes #165
This commit is contained in:
Duncan Overbruck
2020-01-18 14:49:59 +01:00
parent ef9260a16e
commit 6794077efd
10 changed files with 269 additions and 3 deletions

View File

@ -305,6 +305,15 @@ unpack_archive(struct xbps_handle *xhp,
xucd_stats = true;
}
}
/*
* Skip files that match noextract patterns from configuration file.
*/
if (xhp->noextract && xbps_patterns_match(xhp->noextract, entry_pname+1)) {
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
pkgver, "%s: file `%s' won't be extracted, "
"it matches a noextract pattern.", pkgver, entry_pname);
continue;
}
/*
* Always check that extracted file exists and hash
* doesn't match, in that case overwrite the file.
@ -323,7 +332,7 @@ unpack_archive(struct xbps_handle *xhp,
"and must be preserved, skipping.\n", entry_pname);
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
pkgver, "%s: file `%s' won't be extracted, "
"it's preserved.\n", pkgver, entry_pname);
"it's preserved.", pkgver, entry_pname);
continue;
}