Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-go/licenseclassifier/
Date: Tue, 12 May 2020 13:58:06
Message-Id: 1589291829.80bc9b80f514c8b807501be87dfdf78d3d4f009f.juippis@gentoo
1 commit: 80bc9b80f514c8b807501be87dfdf78d3d4f009f
2 Author: Konstantin Podshumok <kpp.live+signed <AT> gmail <DOT> com>
3 AuthorDate: Mon May 4 11:57:28 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue May 12 13:57:09 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80bc9b80
7
8 dev-go/licenseclassifier: live ebuild
9
10 Signed-off-by: Konstantin Podshumok <kpp.live+signed <AT> gmail.com>
11 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
12
13 .../licenseclassifier-9999.ebuild | 84 ++++++++++++++++++++++
14 1 file changed, 84 insertions(+)
15
16 diff --git a/dev-go/licenseclassifier/licenseclassifier-9999.ebuild b/dev-go/licenseclassifier/licenseclassifier-9999.ebuild
17 new file mode 100644
18 index 00000000000..4612f6e8382
19 --- /dev/null
20 +++ b/dev-go/licenseclassifier/licenseclassifier-9999.ebuild
21 @@ -0,0 +1,84 @@
22 +# Copyright 1999-2020 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +
27 +DESCRIPTION="A library and set of tools that can analyze text to determine what type of license it contains"
28 +HOMEPAGE="https://github.com/google/licenseclassifier"
29 +LICENSE="Apache-2.0 MIT"
30 +SLOT="0"
31 +
32 +EGO_PN=github.com/google/${PN}
33 +EGIT_REPO_URI="https://${EGO_PN}.git"
34 +
35 +inherit go-module
36 +
37 +if [[ ${PV} == *9999* ]]; then
38 + inherit git-r3
39 +
40 + src_unpack() {
41 + git-r3_src_unpack
42 + go-module_live_vendor
43 + }
44 +else
45 + KEYWORDS="~amd64"
46 + EGIT_COMMIT="879cb1424de0ab6dbb3d7a0788a0e40c2515a1b7"
47 + SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
48 +
49 + EGO_SUM=(
50 + "github.com/davecgh/go-spew v1.1.0"
51 + "github.com/google/go-cmp v0.2.0"
52 + "github.com/pmezard/go-difflib v1.0.0"
53 + "github.com/sergi/go-diff v1.0.0"
54 + "github.com/stretchr/testify v1.3.0"
55 +
56 + "github.com/davecgh/go-spew v1.1.0/go.mod"
57 + "github.com/google/go-cmp v0.2.0/go.mod"
58 + "github.com/pmezard/go-difflib v1.0.0/go.mod"
59 + "github.com/sergi/go-diff v1.0.0/go.mod"
60 + "github.com/stretchr/objx v0.1.0/go.mod"
61 + "github.com/stretchr/testify v1.3.0/go.mod"
62 + )
63 +
64 + S="${WORKDIR}/${PN}-${EGIT_COMMIT}"
65 +fi
66 +
67 +go-module_set_globals
68 +SRC_URI+=" ${EGO_SUM_SRC_URI}"
69 +
70 +src_prepare() {
71 + eapply_user
72 + rm -v licenses/*db || :
73 +}
74 +
75 +src_compile() {
76 + mkdir -p build-int build || die
77 +
78 + # Make a binary that will be used to generate licenses
79 + go build -o build-int ./... || die
80 +
81 + # Make a binary that will use fixed path for the db
82 + cp -v file_system_resources.go{,.bak} || die
83 + local share="${EROOT}/usr/share/licenseclassifier"
84 + sed -i "s@= lcRoot()@= \"${share}\", error(nil)@" file_system_resources.go || die
85 + go build -o build ./... || die
86 +
87 + # undo that change for tests
88 + mv -v file_system_resources.go{.bak,} || die
89 +
90 + build-int/license_serializer -output licenses || die
91 + build-int/license_serializer -forbidden -output licenses || die
92 +}
93 +
94 +src_test() {
95 + go test ./... || die
96 +}
97 +
98 +src_install() {
99 + # Install package data (this isn't the package license)
100 + insinto usr/share/licenseclassifier
101 + doins licenses/*
102 +
103 + dobin build/*
104 + einstalldocs
105 +}