From d19ef98fea6eca0b714e0f7ce5c1380ba43cc7f5 Mon Sep 17 00:00:00 2001 From: Nepenthe Root Date: Thu, 14 Sep 2023 17:33:52 -0700 Subject: [PATCH] Changes per https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273641 --- misc/gtime/Makefile | 41 ++++++++++++++++++++ misc/gtime/distinfo | 3 ++ misc/gtime/files/patch-tests_time-max-rss.sh | 38 ++++++++++++++++++ misc/gtime/pkg-descr | 2 + 4 files changed, 84 insertions(+) create mode 100644 misc/gtime/Makefile create mode 100644 misc/gtime/distinfo create mode 100644 misc/gtime/files/patch-tests_time-max-rss.sh create mode 100644 misc/gtime/pkg-descr diff --git a/misc/gtime/Makefile b/misc/gtime/Makefile new file mode 100644 index 0000000000..1e7af891f7 --- /dev/null +++ b/misc/gtime/Makefile @@ -0,0 +1,41 @@ +PORTNAME= time +DISTVERSION= 1.9 +CATEGORIES= misc +MASTER_SITES= GNU/time +PKGNAMEPREFIX= g + +MAINTAINER= ivalentine@arizona.edu +COMMENT= GNU version of 'time' utility +WWW= https://www.gnu.org/software/time/ + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/COPYING + +BUILD_DEPENDS= help2man:misc/help2man + +USES= cpe makeinfo gmake + +GNU_CONFIGURE= yes +CONFIGURE_ARGS= --program-prefix=g +CONFIGURE_ENV+= MAKEINFO="${MAKEINFO} --no-split" +INSTALL_TARGET= install-strip +TEST_TARGET= check +CPE_VENDOR= gnu + +PLIST_FILES= bin/gtime \ + man/man1/gtime.1.gz \ + share/info/time.info + +post-build: + ${MKDIR} ${WRKDIR}/man1 + help2man -Nn "run programs and summarize system resource usage" ${WRKSRC}/time -o ${WRKDIR}/man1/${PKGBASE}.1 + +post-install: + ${INSTALL_MAN} ${WRKDIR}/man1/${PKGBASE}.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/ + +pre-test: +.for f in help-version.sh time-exit-codes.sh time-max-rss.sh time-posix-quiet.sh + @${REINPLACE_CMD} -e 's|env time|env ${WRKSRC}/time|g' ${WRKSRC}/tests/${f} +.endfor + +.include diff --git a/misc/gtime/distinfo b/misc/gtime/distinfo new file mode 100644 index 0000000000..54c6f79551 --- /dev/null +++ b/misc/gtime/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1694660083 +SHA256 (time-1.9.tar.gz) = fbacf0c81e62429df3e33bda4cee38756604f18e01d977338e23306a3e3b521e +SIZE (time-1.9.tar.gz) = 596779 diff --git a/misc/gtime/files/patch-tests_time-max-rss.sh b/misc/gtime/files/patch-tests_time-max-rss.sh new file mode 100644 index 0000000000..7f5d8f9157 --- /dev/null +++ b/misc/gtime/files/patch-tests_time-max-rss.sh @@ -0,0 +1,38 @@ +--- tests/time-max-rss.sh.orig 2023-09-14 02:47:32 UTC ++++ tests/time-max-rss.sh +@@ -32,13 +32,13 @@ time-aux || framework_failure_ "time-aux is missing/no + env time -o mem-baseline -f "%M" time-aux \ + || framework_failure_ "failed to run time/time-aux (baseline max-rss)" + +-# Allocate 5MB of RAM +-env time -o mem-5MB -f "%M" time-aux -m 5M \ +- || framework_failure_ "failed to run time/time-aux (5M max-rss)" ++# Allocate 400MB of RAM ++env time -o mem-400MB -f "%M" time-aux -m 400M \ ++ || framework_failure_ "failed to run time/time-aux (400M max-rss)" + + # Calculate the difference + b=$(cat mem-baseline) || framework_failure_ "failed to read mem-baseline" +-c=$(cat mem-5MB) || framework_failure_ "failed to read mem-5MB" ++c=$(cat mem-400MB) || framework_failure_ "failed to read mem-400MB" + d=$(( c - b )) + + # On some systems (e.g. OpenSolaris) getrusage(2) returns zero in ru_maxrss. +@@ -48,13 +48,13 @@ test "$b" -eq "0" && test "$c" -eq 0 \ + + # There could be alot of variation between each invocation, + # accept a reasonable range +-if test "$d" -ge 5000 && test "$d" -le 6000 ; then +- : # acceptable values: 5000-6000 KB ++if test "$d" -ge 400000 && test "$d" -le 500000 ; then ++ : # acceptable values: 400000-500000 KB + else + cat<&2 +-time(1) failed to detect 5MB allcoation. ++time(1) failed to detect 400MB allcoation. + mem-baseline(kb): $b +- mem-5MB(kb): $c ++ mem-400MB(kb): $c + delta(kb): $d + EOF + fail=1 diff --git a/misc/gtime/pkg-descr b/misc/gtime/pkg-descr new file mode 100644 index 0000000000..57ab9872c9 --- /dev/null +++ b/misc/gtime/pkg-descr @@ -0,0 +1,2 @@ +GNU time runs another program, then displays information about the +resources used by that program. -- 2.42.0