xbps-install: fix --reproducable.

The 'repository' obj also needs to be skipped to be fully
reproducable between different repositories.

Updated the test case accordingly.
This commit is contained in:
Juan RP
2019-12-29 16:31:23 +01:00
parent 2c7c4e1bf0
commit d68ff7ebf0
5 changed files with 38 additions and 28 deletions

View File

@@ -64,10 +64,17 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
rv = EINVAL;
goto out;
}
/*
* Set the "install-date" object to know the pkg installation date.
*/
if ((xhp->flags & XBPS_FLAG_INSTALL_REPRO) == 0) {
if (xhp->flags & XBPS_FLAG_INSTALL_REPRO) {
/*
* Reproducible mode. Some objects must not be recorded:
* - install-date
* - repository
*/
xbps_dictionary_remove(pkgd, "repository");
} else {
/*
* Set the "install-date" object to know the pkg installation date.
*/
t = time(NULL);
if ((tmp = localtime(&t)) == NULL) {
xbps_dbg_printf(xhp, "%s: localtime failed: %s\n",
@@ -105,6 +112,7 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
xbps_dictionary_remove(pkgd, "skip-obsoletes");
xbps_dictionary_remove(pkgd, "pkgname");
xbps_dictionary_remove(pkgd, "version");
/*
* Remove self replacement when applicable.
*/