summaryrefslogtreecommitdiff
path: root/dev-util/web_page_replay_go/web_page_replay_go-20220314.ebuild
blob: 0a45a851bcaa7d3d072a3207c1912e4353c9d911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module

DESCRIPTION="A performance testing tool for recording and replaying web pages"
HOMEPAGE="https://chromium.googlesource.com/catapult/+/refs/heads/main/web_page_replay_go/"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"

SRC_URI="https://github.com/elkablo/web_page_replay_go/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://github.com/elkablo/web_page_replay_go/releases/download/v${PV}/web_page_replay_go-${PV}-deps.tar.xz"
S="${WORKDIR}/${P}/src"

src_prepare() {
	local PATCHES=(
		"${FILESDIR}/wpr-usage.patch"
	)

	default

	# default certificate, key and inject script in /usr/share/web_page_replay_go
	local f
	for f in wpr.go webpagereplay/legacyformatconvertor.go; do
		sed -i -e 's^"\(wpr_cert\.pem\|wpr_key\.pem\|deterministic\.js\)"^"/usr/share/web_page_replay_go/\1"^' "${f}" || die "sed-editing ${f} failed"
	done
}

src_compile() {
	local t

	for t in wpr.go httparchive.go; do
		go build ${GOFLAGS} -mod=mod "${t}" || die "compiling ${t} failed"
	done
}

src_install() {
	dobin wpr
	dobin httparchive

	insinto /usr/share/${PN}
	doins ../deterministic.js
	doins ../wpr_cert.pem
	doins ../wpr_key.pem
	doins ../wpr_public_hash.txt
}