fio: upgraded package to upstream

Upgraded sys-block/fio to version 3.16

BUG=b:145635956
TEST=emerge-${BOARD} fio && cros deploy ${DUT_IP} fio;
hardware_StorageSuspendStress.test (pass)
boards=(hatch, sarien)

Change-Id: If4d67ee046c9e72e69149d25c687f0029d6d53c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/1988706
Tested-by: Trent Begin <tbegin@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Trent Begin <tbegin@chromium.org>
diff --git a/metadata/md5-cache/sys-block/fio-3.16 b/metadata/md5-cache/sys-block/fio-3.16
new file mode 100644
index 0000000..813d9a9
--- /dev/null
+++ b/metadata/md5-cache/sys-block/fio-3.16
@@ -0,0 +1,15 @@
+BDEPEND=virtual/pkgconfig
+DEFINED_PHASES=compile configure install prepare
+DEPEND=!static? ( aio? ( dev-libs/libaio ) curl? ( net-misc/curl:= !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl:0= ) ) glusterfs? ( sys-cluster/glusterfs ) gtk? ( dev-libs/glib:2 ) numa? ( sys-process/numactl ) rbd? ( sys-cluster/ceph ) rdma? ( sys-fabric/libibverbs sys-fabric/librdmacm ) tcmalloc? ( dev-util/google-perftools:= ) zlib? ( sys-libs/zlib ) ) gtk? ( x11-libs/gtk+:2 ) static? ( aio? ( dev-libs/libaio[static-libs(+)] ) curl? ( net-misc/curl:=[static-libs(+)] !libressl? ( dev-libs/openssl:0=[static-libs(+)] ) libressl? ( dev-libs/libressl:0=[static-libs(+)] ) ) glusterfs? ( sys-cluster/glusterfs[static-libs(+)] ) gtk? ( dev-libs/glib:2[static-libs(+)] ) numa? ( sys-process/numactl[static-libs(+)] ) rbd? ( sys-cluster/ceph[static-libs(+)] ) rdma? ( sys-fabric/libibverbs[static-libs(+)] sys-fabric/librdmacm[static-libs(+)] ) tcmalloc? ( dev-util/google-perftools:=[static-libs(+)] ) zlib? ( sys-libs/zlib[static-libs(+)] ) )
+DESCRIPTION=Jens Axboe's Flexible IO tester
+EAPI=7
+HOMEPAGE=https://brick.kernel.dk/snaps/
+IUSE=aio curl glusterfs gnuplot gtk libressl numa rbd rdma static tcmalloc zlib python_targets_python2_7 python_targets_python3_5 python_targets_python3_6
+KEYWORDS=*
+LICENSE=GPL-2
+RDEPEND=!static? ( aio? ( dev-libs/libaio ) curl? ( net-misc/curl:= !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl:0= ) ) glusterfs? ( sys-cluster/glusterfs ) gtk? ( dev-libs/glib:2 ) numa? ( sys-process/numactl ) rbd? ( sys-cluster/ceph ) rdma? ( sys-fabric/libibverbs sys-fabric/librdmacm ) tcmalloc? ( dev-util/google-perftools:= ) zlib? ( sys-libs/zlib ) ) gtk? ( x11-libs/gtk+:2 ) gnuplot? ( sci-visualization/gnuplot || ( ( dev-lang/python:3.6 dev-python/pandas[python_targets_python3_6(-),python_single_target_python3_6(+)] ) ( dev-lang/python:3.5 dev-python/pandas[python_targets_python3_5(-),python_single_target_python3_5(+)] ) ( >=dev-lang/python-2.7.5-r2:2.7 dev-python/pandas[python_targets_python2_7(-),python_single_target_python2_7(+)] ) ) python_targets_python2_7? ( >=dev-lang/python-2.7.5-r2:2.7 ) python_targets_python3_5? ( dev-lang/python:3.5 ) python_targets_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python2_7(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python2_7(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)] )
+REQUIRED_USE=gnuplot? ( || ( python_targets_python2_7 python_targets_python3_5 python_targets_python3_6 ) ) libressl? ( curl )
+SLOT=0
+SRC_URI=https://brick.kernel.dk/snaps/fio-3.16.tar.bz2
+_eclasses_=multibuild	40fe59465edacd730c644ec2bc197809	multilib	b2f01ad412baf81650c23fcf0975fa33	python-r1	ce1cd23cfdc1848e8e32743efe34f299	python-utils-r1	1a4f6b5e7fa7b8da3f7d9753118d10c5	toolchain-funcs	209edad4a5c4812e7b2f8021650974f0
+_md5_=6c5a638a2f4e0193a3bc84c2421c95d8
diff --git a/metadata/md5-cache/sys-block/fio-3.2 b/metadata/md5-cache/sys-block/fio-3.2
deleted file mode 100644
index 897c64a..0000000
--- a/metadata/md5-cache/sys-block/fio-3.2
+++ /dev/null
@@ -1,14 +0,0 @@
-DEFINED_PHASES=compile configure install prepare
-DEPEND=!static? ( aio? ( dev-libs/libaio ) glusterfs? ( sys-cluster/glusterfs ) gtk? ( dev-libs/glib:2 ) numa? ( sys-process/numactl ) rbd? ( sys-cluster/ceph ) rdma? ( sys-fabric/libibverbs sys-fabric/librdmacm ) zlib? ( sys-libs/zlib ) ) gtk? ( x11-libs/gtk+:2 ) static? ( aio? ( dev-libs/libaio[static-libs(+)] ) glusterfs? ( sys-cluster/glusterfs[static-libs(+)] ) gtk? ( dev-libs/glib:2[static-libs(+)] ) numa? ( sys-process/numactl[static-libs(+)] ) rbd? ( sys-cluster/ceph[static-libs(+)] ) rdma? ( sys-fabric/libibverbs[static-libs(+)] sys-fabric/librdmacm[static-libs(+)] ) zlib? ( sys-libs/zlib[static-libs(+)] ) )
-DESCRIPTION=Jens Axboe's Flexible IO tester
-EAPI=6
-HOMEPAGE=http://brick.kernel.dk/snaps/
-IUSE=aio glusterfs gnuplot gtk numa rbd rdma static zlib python_targets_python2_7
-KEYWORDS=*
-LICENSE=GPL-2
-RDEPEND=!static? ( aio? ( dev-libs/libaio ) glusterfs? ( sys-cluster/glusterfs ) gtk? ( dev-libs/glib:2 ) numa? ( sys-process/numactl ) rbd? ( sys-cluster/ceph ) rdma? ( sys-fabric/libibverbs sys-fabric/librdmacm ) zlib? ( sys-libs/zlib ) ) gtk? ( x11-libs/gtk+:2 ) gnuplot? ( sci-visualization/gnuplot python_targets_python2_7? ( >=dev-lang/python-2.7.5-r2:2.7 ) >=dev-lang/python-exec-2:=[python_targets_python2_7(-)?,-python_single_target_python2_7(-)] )
-REQUIRED_USE=gnuplot? ( || ( python_targets_python2_7 ) )
-SLOT=0
-SRC_URI=http://brick.kernel.dk/snaps/fio-3.2.tar.bz2
-_eclasses_=eutils	06133990e861be0fe60c2b428fd025d9	multibuild	40fe59465edacd730c644ec2bc197809	multilib	b2f01ad412baf81650c23fcf0975fa33	python-r1	ce1cd23cfdc1848e8e32743efe34f299	python-utils-r1	1a4f6b5e7fa7b8da3f7d9753118d10c5	toolchain-funcs	209edad4a5c4812e7b2f8021650974f0
-_md5_=28b5531f778b2f9392ae6332283af336
diff --git a/sys-block/fio/Manifest b/sys-block/fio/Manifest
index 4b59d36..436d66f 100644
--- a/sys-block/fio/Manifest
+++ b/sys-block/fio/Manifest
@@ -1 +1 @@
-DIST fio-3.2.tar.bz2 613565 SHA256 1f608d1c68a5249cd1ad067671bc25f27af46c5fb021d5724bc9f695948dbbb8 SHA512 97ea5ed6587d1e7382a67ab7ad933b6e332ba84cb648d17dcebad3c95c9eb6b1c04a4537e3470f890607f2921da77fcd4e49079b8b78f2d15e9c199dab850d1e WHIRLPOOL f1653e5e9d0317b850246a496bd8cf26605fd7bba2ac6479b8d063b1d3566738e1384ffc38786a7cd061cca8a54172cc74b867ba25622407861b93e5f83de90f
+DIST fio-3.16.tar.bz2 881436 BLAKE2B fee99930d0245474eb67ceee2d1a6ec2f1a0eb4da6d52cf8616d7eda64699a8c2727715284134fd4931e91efad69b064f66a80a78f70ea03e66d4eab4e601120 SHA512 2d651b20cbc6c7babf3adc082dbe78e1f7de920764653cf5ffd99df7516cf6190ffefe2152d2739326d3102949d9bad7db978ff88866cfa54020f9ec3b0a2a23
diff --git a/sys-block/fio/files/fio-3.16-snprintf.patch b/sys-block/fio/files/fio-3.16-snprintf.patch
new file mode 100644
index 0000000..1470290
--- /dev/null
+++ b/sys-block/fio/files/fio-3.16-snprintf.patch
@@ -0,0 +1,44 @@
+From 5b215853ed4b438b5b2d4ac3e56d5f0d19e145d9 Mon Sep 17 00:00:00 2001
+From: Anatol Pomozov <anatol.pomozov@gmail.com>
+Date: Mon, 23 Sep 2019 14:12:12 -0700
+Subject: [PATCH] Fix compilation error with gfio
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Commit 36833fb04 replaced many usages of strncpy with snprintf.
+But there is one place where new arguments were added but the function
+name has not been changed. It leads to the following compilation error:
+
+gclient.c:333:2: error: too many arguments to function ‘strncpy’
+  333 |  strncpy(message, sizeof(message), "%s", status_message);
+      |  ^~~~~~~
+In file included from /usr/include/features.h:450,
+                 from /usr/include/bits/libc-header-start.h:33,
+                 from /usr/include/stdlib.h:25,
+                 from gclient.c:1:
+/usr/include/bits/string_fortified.h:103:1: note: declared here
+  103 | __NTH (strncpy (char *__restrict __dest, const char *__restrict __src,
+      | ^~~~~
+
+Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
+---
+ gclient.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gclient.c b/gclient.c
+index 64324177..d8dc62d2 100644
+--- a/gclient.c
++++ b/gclient.c
+@@ -330,7 +330,7 @@ static void gfio_update_thread_status_all(struct gui *ui, char *status_message,
+ 	static char message[100];
+ 	const char *m = message;
+ 
+-	strncpy(message, sizeof(message), "%s", status_message);
++	snprintf(message, sizeof(message), "%s", status_message);
+ 	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ui->thread_status_pb), m);
+ 	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ui->thread_status_pb), perc / 100.0);
+ 	gtk_widget_queue_draw(ui->window);
+-- 
+2.24.0
+
diff --git a/sys-block/fio/fio-3.2.ebuild b/sys-block/fio/fio-3.16.ebuild
similarity index 69%
rename from sys-block/fio/fio-3.2.ebuild
rename to sys-block/fio/fio-3.16.ebuild
index 698495a..9342f93 100644
--- a/sys-block/fio/fio-3.2.ebuild
+++ b/sys-block/fio/fio-3.16.ebuild
@@ -1,27 +1,35 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI="7"
 
-PYTHON_COMPAT=( python2_7 )
+PYTHON_COMPAT=( python2_7 python3_5 python3_6 )
 
-inherit eutils python-r1 toolchain-funcs
+inherit python-r1 toolchain-funcs
 
 MY_PV="${PV/_rc/-rc}"
 MY_P="${PN}-${MY_PV}"
 
 DESCRIPTION="Jens Axboe's Flexible IO tester"
-HOMEPAGE="http://brick.kernel.dk/snaps/"
-SRC_URI="http://brick.kernel.dk/snaps/${MY_P}.tar.bz2"
+HOMEPAGE="https://brick.kernel.dk/snaps/"
+SRC_URI="https://brick.kernel.dk/snaps/${MY_P}.tar.bz2"
 
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="*"
-IUSE="aio glusterfs gnuplot gtk numa rbd rdma static zlib"
-REQUIRED_USE="gnuplot? ( ${PYTHON_REQUIRED_USE} )"
+IUSE="aio curl glusterfs gnuplot gtk libressl numa rbd rdma static tcmalloc zlib"
+REQUIRED_USE="gnuplot? ( ${PYTHON_REQUIRED_USE} )
+	libressl? ( curl )"
+
+BDEPEND="virtual/pkgconfig"
 
 # GTK+:2 does not offer static libaries.
 LIB_DEPEND="aio? ( dev-libs/libaio[static-libs(+)] )
+	curl? (
+		net-misc/curl:=[static-libs(+)]
+		!libressl? ( dev-libs/openssl:0=[static-libs(+)] )
+		libressl? ( dev-libs/libressl:0=[static-libs(+)] )
+	)
 	glusterfs? ( sys-cluster/glusterfs[static-libs(+)] )
 	gtk? ( dev-libs/glib:2[static-libs(+)] )
 	numa? ( sys-process/numactl[static-libs(+)] )
@@ -30,6 +38,7 @@
 		sys-fabric/libibverbs[static-libs(+)]
 		sys-fabric/librdmacm[static-libs(+)]
 	)
+	tcmalloc? ( dev-util/google-perftools:=[static-libs(+)] )
 	zlib? ( sys-libs/zlib[static-libs(+)] )"
 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
 	gtk? ( x11-libs/gtk+:2 )"
@@ -38,6 +47,7 @@
 RDEPEND+="
 	gnuplot? (
 		sci-visualization/gnuplot
+		$(python_gen_any_dep 'dev-python/pandas[${PYTHON_USEDEP}]')
 		${PYTHON_DEPS}
 	)"
 
@@ -45,9 +55,16 @@
 
 PATCHES=(
 	"${FILESDIR}"/fio-2.2.13-libmtd.patch
+	"${FILESDIR}"/fio-3.16-snprintf.patch
 )
 
+python_check_deps() {
+	has_version "dev-python/pandas[${PYTHON_USEDEP}]"
+}
+
 src_prepare() {
+	default
+
 	sed -i '/^DEBUGFLAGS/s: -D_FORTIFY_SOURCE=2::g' Makefile || die
 
 	# Many checks don't have configure flags.
@@ -56,7 +73,6 @@
 		-e '/if compile_prog "" "-lz" "zlib" *; *then/  '"s::if $(usex zlib true false) ; then:" \
 		-e '/if compile_prog "" "-laio" "libaio" ; then/'"s::if $(usex aio true false) ; then:" \
 		configure || die
-	default
 }
 
 src_configure() {
@@ -69,12 +85,14 @@
 		--extra-cflags="${CFLAGS} ${CPPFLAGS}" \
 		--cc="$(tc-getCC)" \
 		--disable-pmem \
+		$(usex curl '' '--disable-http') \
 		$(usex glusterfs '' '--disable-gfapi') \
 		$(usex gtk '--enable-gfio' '') \
 		$(usex numa '' '--disable-numa') \
 		$(usex rbd '' '--disable-rbd') \
 		$(usex rdma '' '--disable-rdma') \
-		$(usex static '--build-static' '')
+		$(usex static '--build-static' '') \
+		$(usex tcmalloc '' '--disable-tcmalloc')
 	echo "$@"
 	"$@" || die 'configure failed'
 }
@@ -87,6 +105,10 @@
 	emake install DESTDIR="${D}" prefix="${EPREFIX}/usr" mandir="${EPREFIX}/usr/share/man"
 
 	if use gnuplot ; then
+		sed -i 's:python2.7:python:g' \
+			"${ED}/usr/bin/fio2gnuplot" \
+			"${ED}/usr/bin/fiologparser_hist.py" \
+			"${ED}/usr/bin/fiologparser.py"
 		python_replicate_script \
 			"${ED}/usr/bin/fio2gnuplot" \
 			"${ED}/usr/bin/fiologparser_hist.py" \
diff --git a/sys-block/fio/metadata.xml b/sys-block/fio/metadata.xml
index 008fec0..10bc8be 100644
--- a/sys-block/fio/metadata.xml
+++ b/sys-block/fio/metadata.xml
@@ -9,10 +9,12 @@
 	</maintainer>
 	<use>
 		<flag name="aio">Enable AIO ioengine</flag>
+		<flag name="curl">Enable HTTP engine for S3 and WebDav support support via <pkg>net-misc/curl</pkg></flag>
 		<flag name="glusterfs">Enable GlusterFS gfapi support via <pkg>sys-cluster/glusterfs</pkg></flag>
 		<flag name="gnuplot">Install tools for generating gnuplots</flag>
 		<flag name="numa">Enable numa support</flag>
 		<flag name="rbd">Enable Rados block device support via <pkg>sys-cluster/ceph</pkg></flag>
 		<flag name="rdma">Enable infiniband support via <pkg>sys-fabric/librdmacm</pkg></flag>
+		<flag name="tcmalloc">Link against <pkg>dev-util/google-perftools</pkg> by default which will speed up USE=rbd up to 20%</flag>
 	</use>
 </pkgmetadata>