libxbps: added XBPS_FLAG_INSTALL_REPRO for xbps_handle::flags.

If set, enable reproducible mode; skips adding the
"install-date" obj into pkgdb.
This commit is contained in:
Juan RP 2019-12-29 10:37:17 +01:00
parent d1c93bed52
commit 95a3ba651f
3 changed files with 30 additions and 21 deletions

View File

@ -50,7 +50,7 @@
* *
* This header documents the full API for the XBPS Library. * This header documents the full API for the XBPS Library.
*/ */
#define XBPS_API_VERSION "20191227" #define XBPS_API_VERSION "20191229"
#ifndef XBPS_VERSION #ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET" #define XBPS_VERSION "UNSET"
@ -230,6 +230,13 @@
*/ */
#define XBPS_FLAG_IGNORE_FILE_CONFLICTS 0x00004000 #define XBPS_FLAG_IGNORE_FILE_CONFLICTS 0x00004000
/**
* @def XBPS_FLAG_INSTALL_REPRO
* Enabled reproducible mode; skips adding the "install-date" obj into pkgdb.
* Must be set through the xbps_handle::flags member.
*/
#define XBPS_FLAG_INSTALL_REPRO 0x00008000
/** /**
* @def XBPS_FETCH_CACHECONN * @def XBPS_FETCH_CACHECONN
* Default (global) limit of cached connections used in libfetch. * Default (global) limit of cached connections used in libfetch.

View File

@ -3,8 +3,8 @@
RANLIB ?= ranlib RANLIB ?= ranlib
LIBXBPS_MAJOR = 4 LIBXBPS_MAJOR = 4
LIBXBPS_MINOR = 0 LIBXBPS_MINOR = 1
LIBXBPS_MICRO = 1 LIBXBPS_MICRO = 0
LIBXBPS_SHLIB = libxbps.so.$(LIBXBPS_MAJOR).$(LIBXBPS_MINOR).$(LIBXBPS_MICRO) LIBXBPS_SHLIB = libxbps.so.$(LIBXBPS_MAJOR).$(LIBXBPS_MINOR).$(LIBXBPS_MICRO)
LDFLAGS += $(LIBXBPS_LDFLAGS) -shared -Wl,-soname,libxbps.so.$(LIBXBPS_MAJOR) LDFLAGS += $(LIBXBPS_LDFLAGS) -shared -Wl,-soname,libxbps.so.$(LIBXBPS_MAJOR)

View File

@ -67,6 +67,7 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
/* /*
* Set the "install-date" object to know the pkg installation date. * Set the "install-date" object to know the pkg installation date.
*/ */
if ((xhp->flags & XBPS_FLAG_INSTALL_REPRO) == 0) {
t = time(NULL); t = time(NULL);
if ((tmp = localtime(&t)) == NULL) { if ((tmp = localtime(&t)) == NULL) {
xbps_dbg_printf(xhp, "%s: localtime failed: %s\n", xbps_dbg_printf(xhp, "%s: localtime failed: %s\n",
@ -85,6 +86,7 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
rv = EINVAL; rv = EINVAL;
goto out; goto out;
} }
}
/* /*
* Create a hash for the pkg's metafile if it exists. * Create a hash for the pkg's metafile if it exists.
*/ */