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:
@@ -3,8 +3,8 @@
|
||||
RANLIB ?= ranlib
|
||||
|
||||
LIBXBPS_MAJOR = 4
|
||||
LIBXBPS_MINOR = 0
|
||||
LIBXBPS_MICRO = 1
|
||||
LIBXBPS_MINOR = 1
|
||||
LIBXBPS_MICRO = 0
|
||||
LIBXBPS_SHLIB = libxbps.so.$(LIBXBPS_MAJOR).$(LIBXBPS_MINOR).$(LIBXBPS_MICRO)
|
||||
LDFLAGS += $(LIBXBPS_LDFLAGS) -shared -Wl,-soname,libxbps.so.$(LIBXBPS_MAJOR)
|
||||
|
||||
|
@@ -67,23 +67,25 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
||||
/*
|
||||
* 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",
|
||||
pkgver, strerror(errno));
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (strftime(outstr, sizeof(outstr)-1, "%F %R %Z", tmp) == 0) {
|
||||
xbps_dbg_printf(xhp, "%s: strftime failed: %s\n",
|
||||
pkgver, strerror(errno));
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!xbps_dictionary_set_cstring(pkgd, "install-date", outstr)) {
|
||||
xbps_dbg_printf(xhp, "%s: install-date set failed!\n", pkgver);
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
if ((xhp->flags & XBPS_FLAG_INSTALL_REPRO) == 0) {
|
||||
t = time(NULL);
|
||||
if ((tmp = localtime(&t)) == NULL) {
|
||||
xbps_dbg_printf(xhp, "%s: localtime failed: %s\n",
|
||||
pkgver, strerror(errno));
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (strftime(outstr, sizeof(outstr)-1, "%F %R %Z", tmp) == 0) {
|
||||
xbps_dbg_printf(xhp, "%s: strftime failed: %s\n",
|
||||
pkgver, strerror(errno));
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!xbps_dictionary_set_cstring(pkgd, "install-date", outstr)) {
|
||||
xbps_dbg_printf(xhp, "%s: install-date set failed!\n", pkgver);
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Create a hash for the pkg's metafile if it exists.
|
||||
@@ -115,7 +117,7 @@ xbps_register_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkgrd)
|
||||
}
|
||||
if (!xbps_dictionary_set(xhp->pkgdb, pkgname, pkgd)) {
|
||||
xbps_dbg_printf(xhp,
|
||||
"%s: failed to set pkgd for %s\n", __func__, pkgver);
|
||||
"%s: failed to set pkgd for %s\n", __func__, pkgver);
|
||||
}
|
||||
out:
|
||||
xbps_object_release(pkgd);
|
||||
|
Reference in New Issue
Block a user