[NEW] devel/libfaketime: Modifies the system time for a single application
libfaketime intercepts various system calls which programs use to retrieve the current date and time. It can then report faked dates and times (as specified by you, the user) to these programs. This means you can modify the system time a program sees without having to change the time system-wide. libfaketime allows you to specify both absolute dates (e.g., 01/01/2004) and relative dates (e.g., 10 days ago). libfaketime might be used for various purposes, for example - Running legacy software with y2k bugs - Testing software for year-2038 compliance - Debugging time-related issues, such as expired SSL certificates - Running software which ceases to run outside a certain timeframe - Using different system-wide date and time settings, e.g., on OpenVZ- based virtual machines running on the same host - Deterministic build processes. WWW: https://github.com/wolfcw/libfaketime
This commit is contained in:
parent
1b9ce9b4ff
commit
af7a1aedf9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=424827
10 changed files with 185 additions and 0 deletions
|
@ -1239,6 +1239,7 @@
|
|||
SUBDIR += libewf
|
||||
SUBDIR += libexecinfo
|
||||
SUBDIR += libexplain
|
||||
SUBDIR += libfaketime
|
||||
SUBDIR += libfastcommon
|
||||
SUBDIR += libfastjson
|
||||
SUBDIR += libffi
|
||||
|
|
41
devel/libfaketime/Makefile
Normal file
41
devel/libfaketime/Makefile
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Created by: Kubilay Kocak <koobs@FreeBSD.org>
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= libfaketime
|
||||
DISTVERSIONPREFIX= v
|
||||
DISTVERSION= 0.9.6-20160627
|
||||
CATEGORIES= devel
|
||||
|
||||
MAINTAINER= koobs@FreeBSD.org
|
||||
COMMENT= Modifies the system time for a single application
|
||||
|
||||
LICENSE= GPLv2
|
||||
LICENSE_FILE= ${WRKSRC}/COPYING
|
||||
|
||||
USES= gmake shebangfix
|
||||
USE_GITHUB= yes
|
||||
USE_LDCONFIG= yes
|
||||
|
||||
GH_ACCOUNT= wolfcw
|
||||
GH_TAGNAME= da77808
|
||||
|
||||
MAKE_ENV+= WARNS="-Wall" \
|
||||
MANIR="${MANDIRS}"
|
||||
|
||||
PLIST_FILES= bin/faketime \
|
||||
lib/faketime/libfaketime.so.1 \
|
||||
lib/faketime/libfaketimeMT.so.1 \
|
||||
share/doc/faketime/NEWS \
|
||||
share/doc/faketime/README \
|
||||
share/man/man1/faketime.1.gz
|
||||
|
||||
SHEBANG_FILES= test/testframe.sh \
|
||||
test/functests/common.inc
|
||||
|
||||
TEST_TARGET= test
|
||||
|
||||
post-install:
|
||||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/faketime \
|
||||
${STAGEDIR}${PREFIX}/lib/faketime/*.so.*
|
||||
|
||||
.include <bsd.port.mk>
|
3
devel/libfaketime/distinfo
Normal file
3
devel/libfaketime/distinfo
Normal file
|
@ -0,0 +1,3 @@
|
|||
TIMESTAMP = 1477653378
|
||||
SHA256 (wolfcw-libfaketime-v0.9.6-20160627-da77808_GH0.tar.gz) = 59d42d762fa1372325486082d9498c0ce6dcb2446ed567bc5f0d85a7c2f1b017
|
||||
SIZE (wolfcw-libfaketime-v0.9.6-20160627-da77808_GH0.tar.gz) = 55667
|
22
devel/libfaketime/files/patch-man_Makefile
Normal file
22
devel/libfaketime/files/patch-man_Makefile
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- man/Makefile.orig 2016-06-27 06:54:00 UTC
|
||||
+++ man/Makefile
|
||||
@@ -1,14 +1,16 @@
|
||||
INSTALL ?= install
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
+MANDIR ?= /share/man
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
- $(INSTALL) -Dm0644 faketime.1 "${DESTDIR}${PREFIX}/share/man/man1/faketime.1"
|
||||
- gzip -f "${DESTDIR}${PREFIX}/share/man/man1/faketime.1"
|
||||
+ $(INSTALL) -dm0755 "${DESTDIR}${PREFIX}$(MANDIR)/man1"
|
||||
+ $(INSTALL) -Dm0644 faketime.1 "$(DESTDIR)$(PREFIX)$(MANDIR)/man1"
|
||||
+ gzip -f $(DESTDIR)$(PREFIX)$(MANDIR)/man1/faketime.1
|
||||
|
||||
uninstall:
|
||||
- rm -f "${DESTDIR}${PREFIX}/share/man/man1/faketime.1.gz"
|
||||
+ rm -f "$(DESTDIR)$(PREFIX)$(MANDIR)/man1/faketime.1.gz"
|
||||
|
||||
.PHONY: all install uninstall
|
33
devel/libfaketime/files/patch-src_Makefile
Normal file
33
devel/libfaketime/files/patch-src_Makefile
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- src/Makefile.orig 2016-06-27 06:54:00 UTC
|
||||
+++ src/Makefile
|
||||
@@ -62,11 +62,19 @@ PREFIX ?= /usr/local
|
||||
LIBDIRNAME ?= /lib/faketime
|
||||
PLATFORM ?=$(shell uname)
|
||||
|
||||
-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
|
||||
+# Honour/Respect User *FLAGS
|
||||
+# User variables come LAST. Do NOT append to them.
|
||||
+
|
||||
+WARNS ?= -Wall -Wextra -Werror
|
||||
+FEATS ?= -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS
|
||||
+FLAGS ?= -std=gnu99 -fPIC $(WARNS) -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
|
||||
+
|
||||
ifeq ($(PLATFORM),SunOS)
|
||||
-CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
|
||||
+FLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
|
||||
endif
|
||||
|
||||
+CFLAGS := $(FLAGS) $(CFLAGS)
|
||||
+
|
||||
LIB_LDFLAGS += -shared
|
||||
|
||||
LDFLAGS += -lpthread
|
||||
@@ -74,7 +82,7 @@ ifneq ($(PLATFORM),SunOS)
|
||||
LDFLAGS += -Wl,--version-script=libfaketime.map
|
||||
endif
|
||||
|
||||
-LDADD += -ldl -lm -lrt
|
||||
+LDADD += -lm -lrt
|
||||
BIN_LDFLAGS += -lrt
|
||||
|
||||
SRC = libfaketime.c
|
29
devel/libfaketime/files/patch-src_libfaketime.c
Normal file
29
devel/libfaketime/files/patch-src_libfaketime.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
--- src/libfaketime.c.orig 2016-06-27 06:54:00 UTC
|
||||
+++ src/libfaketime.c
|
||||
@@ -23,6 +23,17 @@
|
||||
|
||||
#define _GNU_SOURCE /* required to get RTLD_NEXT defined */
|
||||
|
||||
+/*
|
||||
+ * libfaketime.c:1246:5: error: conflicting types for 'gettimeofday'
|
||||
+ * int gettimeofday(struct timeval *tv, void *tz)
|
||||
+ * vs
|
||||
+ * int gettimeofday(struct timeval *, struct timezone *);
|
||||
+ */
|
||||
+
|
||||
+#define gettimeofday bsd_gettimeofday
|
||||
+#include <sys/time.h>
|
||||
+#undef gettimeofday
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
@@ -58,6 +69,8 @@
|
||||
extern char *__progname;
|
||||
#ifdef __sun
|
||||
#include "sunos_endian.h"
|
||||
+#elif defined(__FreeBSD__)
|
||||
+#include <sys/endian.h>
|
||||
#else
|
||||
#include <endian.h>
|
||||
#endif
|
13
devel/libfaketime/files/patch-test_Makefile
Normal file
13
devel/libfaketime/files/patch-test_Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
--- test/Makefile.orig 2016-06-27 06:54:00 UTC
|
||||
+++ test/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
-CC = gcc
|
||||
+CC ?= gcc
|
||||
|
||||
-CFLAGS = -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra
|
||||
-LDFLAGS = -lrt
|
||||
+CFLAGS ?= -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra
|
||||
+LDFLAGS = -lrt -lcompat
|
||||
|
||||
SRC = timetest.c
|
||||
OBJ = ${SRC:.c=.o}
|
12
devel/libfaketime/files/patch-test_functests_common.inc
Normal file
12
devel/libfaketime/files/patch-test_functests_common.inc
Normal file
|
@ -0,0 +1,12 @@
|
|||
--- test/functests/common.inc.orig 2016-10-28 11:24:53 UTC
|
||||
+++ test/functests/common.inc
|
||||
@@ -8,7 +8,8 @@ platform()
|
||||
case "$out" in
|
||||
*Darwin*) echo "mac" ;;
|
||||
*Linux*) echo "linuxlike" ;;
|
||||
- GNU|GNU/kFreeBSD) echo "linuxlike" ;;
|
||||
+ GNU|GNU/kFreeBSD) echo "linuxlike" ;;
|
||||
+ *FreeBSD*) echo "linuxlike" ;;
|
||||
*SunOS*) echo "sunos" ;;
|
||||
*) echo 1>&2 unsupported platform, uname=\"$out\" ;;
|
||||
esac
|
|
@ -0,0 +1,11 @@
|
|||
--- test/functests/test_exclude_mono.sh.orig 2016-06-27 06:54:00 UTC
|
||||
+++ test/functests/test_exclude_mono.sh
|
||||
@@ -65,7 +65,7 @@ get_monotonic_time()
|
||||
dont_fake_mono=$1; shift;
|
||||
clock_id=$1; shift;
|
||||
DONT_FAKE_MONOTONIC=${dont_fake_mono} fakecmd "2014-07-21 09:00:00" \
|
||||
- /bin/bash -c "for i in 1 2; do \
|
||||
+ /usr/bin/env bash -c "for i in 1 2; do \
|
||||
perl -w -MTime::HiRes=clock_gettime,${clock_id} -E \
|
||||
'say clock_gettime(${clock_id})'; \
|
||||
sleep 1; \
|
20
devel/libfaketime/pkg-descr
Normal file
20
devel/libfaketime/pkg-descr
Normal file
|
@ -0,0 +1,20 @@
|
|||
libfaketime intercepts various system calls which programs use to
|
||||
retrieve the current date and time. It can then report faked dates and
|
||||
times (as specified by you, the user) to these programs. This means you
|
||||
can modify the system time a program sees without having to change the
|
||||
time system-wide.
|
||||
|
||||
libfaketime allows you to specify both absolute dates (e.g., 01/01/2004)
|
||||
and relative dates (e.g., 10 days ago).
|
||||
|
||||
libfaketime might be used for various purposes, for example
|
||||
|
||||
- Running legacy software with y2k bugs
|
||||
- Testing software for year-2038 compliance
|
||||
- Debugging time-related issues, such as expired SSL certificates
|
||||
- Running software which ceases to run outside a certain timeframe
|
||||
- Using different system-wide date and time settings, e.g., on OpenVZ-
|
||||
based virtual machines running on the same host
|
||||
- Deterministic build processes.
|
||||
|
||||
WWW: https://github.com/wolfcw/libfaketime
|
Loading…
Reference in a new issue