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:04
Message-Id: 1589291828.09efbf4ed38ffb300545cb132cd313d4943c8010.juippis@gentoo
1 commit: 09efbf4ed38ffb300545cb132cd313d4943c8010
2 Author: Konstantin Podshumok <kpp.live+signed <AT> gmail <DOT> com>
3 AuthorDate: Sat Apr 25 01:35:05 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue May 12 13:57:08 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09efbf4e
7
8 dev-go/licenseclassifier: new ebuild
9
10 I find this tool very helpful for managing LICENSE in different
11 ebuilds. Just run identify_license on any file - just a source
12 code or COPYING/LICENSE file. It also can be built against
13 licenses in /var/db/repos/gentoo/licenses, but this is not yet
14 implemented in this commit.
15
16 Bug: https://bugs.gentoo.org/694792
17 Bug: https://bugs.gentoo.org/694790
18 Signed-off-by: Konstantin Podshumok <kpp.live+signed <AT> gmail.com>
19 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
20
21 dev-go/licenseclassifier/Manifest | 12 ++++
22 .../licenseclassifier-0_pre20200402.ebuild | 84 ++++++++++++++++++++++
23 dev-go/licenseclassifier/metadata.xml | 22 ++++++
24 3 files changed, 118 insertions(+)
25
26 diff --git a/dev-go/licenseclassifier/Manifest b/dev-go/licenseclassifier/Manifest
27 new file mode 100644
28 index 00000000000..1cb9002fe8e
29 --- /dev/null
30 +++ b/dev-go/licenseclassifier/Manifest
31 @@ -0,0 +1,12 @@
32 +DIST github.com%2Fdavecgh%2Fgo-spew%2F@v%2Fv1.1.0.mod 34 BLAKE2B 7e09c2779bf7a84a9271e31522ebbe600a1c11b107d651d91f58c8373e4336332a3a881f3e12b382543d75f20398af66085fcb3e780eed341e870e9c30f29267 SHA512 5e079462f7e0dff0efda71f580aa185700cfa936b718a19d0e2a8c63212e47a07022dca0c282832d48e5165aae8e82aeeeb2ac3664268f1148fc772010fb860e
33 +DIST github.com%2Fdavecgh%2Fgo-spew%2F@v%2Fv1.1.0.zip 60546 BLAKE2B e775860f49c6ee09a6c48902d38fdf5d2d77af4cd405d8d303902170e46493301d4aa873a48b4d12a16d92dafaa65290de1fd3a42545025fbfc82f15a3881e8d SHA512 53dc5484f488ae1f8d0eb672c3431bbf9fce33dfcee83dda7929103e3650559cf703f601716984a640422f01cc640860dba0b47e16aef04d0d2452a266fefbf9
34 +DIST github.com%2Fgoogle%2Fgo-cmp%2F@v%2Fv0.2.0.mod 32 BLAKE2B 7c7baa1e29b9806fb97e0d557200e8722f2d373e149127307efa285cdfedb36dd57355168554d1a1bada62144e6a6a00c4d3246aa9afc7d0ffae0f087459c552 SHA512 7229d917bb0c788b07297e1b09b8f7952f951998a56f17ea1f69ff7c2f565a5686b212f42f45c6b8351905d6740a2ec5a235e493daa531ae00cb709faf67ae45
35 +DIST github.com%2Fgoogle%2Fgo-cmp%2F@v%2Fv0.2.0.zip 74164 BLAKE2B 6a3c04c2986b35dcc32f14553534758c3270c294a5e2595487f884e32e76cac2ebbc34cf7e42232eb7d85e71fee7660b513de4e365981e625515b086c341d15c SHA512 7be2dd2b362f56ad7fb7be35b62a841ca051d4fe31ffe1ca784e393b0cfe44674a050cf1129a15094872bc16c8ed9bc62afe0e7017bcaf1a4eb9b2e39423f790
36 +DIST github.com%2Fpmezard%2Fgo-difflib%2F@v%2Fv1.0.0.mod 37 BLAKE2B 94636062c94f8ff68cdcab7593a3acae7b9ffff616cad7b1d5c9cd147a4a1042d33666cbeed6fd816d6793113abfb595183097dcc46de7a3dfadc1423ed43e79 SHA512 c3d5c48cdb8ba6af7071a07cfede06e0ab67e3726d9de592a952fad40167dcbdd9621dc2c4df1bd3c28eb99d70b1b6d8d812441237c35bf492e5b7f07bd33902
37 +DIST github.com%2Fpmezard%2Fgo-difflib%2F@v%2Fv1.0.0.zip 12433 BLAKE2B 0c911c9d173080abd8edbbab1f47222343801d8eeae36b4add24773e3282fc2a39283fdf519a3d4483e39cdb7d9509b8570d151f46841ac1a616f312dc4cb0ba SHA512 3b85697185ba85cdef6202444ab6cabeabfad8a03d66b3839a852586b1f91ddae7897a57c8c138d5647022aa44906c7ef3c5339d520f90eeea0742a935da8cf2
38 +DIST github.com%2Fsergi%2Fgo-diff%2F@v%2Fv1.0.0.mod 32 BLAKE2B 9c0be7f17fe7a9156f124f7f67c3e15e14719d0b271f36d5d41ccfa5ff6c1b7887e0051df6eb3b29f29b40357d8e438598088b3c4f4df28fb81f030c8efa7ff3 SHA512 8b8b8958405a188b93adcdda0634aaa2961b5b8e0d3b3e1f768fb9c49c02b73cf3bb39027431e0c1d209abea6cb72a651c5776bf26391e81f4dc18c7bafa692c
39 +DIST github.com%2Fsergi%2Fgo-diff%2F@v%2Fv1.0.0.zip 52931 BLAKE2B e511ef9edf7d968d848e021658001daefe7c8cc7169b1c6984ca5388fc4d6a5f54def9060483e57392711617892d21322d9de099234901bd1c251e57e6489f6b SHA512 e3d8a20d1cc351b8944579988feff39cb0aa3e1f2aacf2e2307180c25c153a0473f2a5a3ebda9d96868cb1f477ccccffdce06b117be7fa5409b2d1926b4c270a
40 +DIST github.com%2Fstretchr%2Fobjx%2F@v%2Fv0.1.0.mod 32 BLAKE2B d698910da1ef00a70a1673b8c74105de195020ccd95d1e70c5dd1e1615210886ff9acbc9cfd03f46e99f5223b60b04695b8d362b9e0edd4e485480f802bd229a SHA512 4e366e5a60559a8863cb2a50280deb307d8bf885ca5440cce1b49a084b4cc4583b3481240125f35f161226592a43f2c0a426152f117d79b68c92c72a93f751d5
41 +DIST github.com%2Fstretchr%2Ftestify%2F@v%2Fv1.3.0.mod 154 BLAKE2B 60cd7801e7cd33746305cd636b048b25a86270ec3b29a21c3c078c7e95b769bce7e80c2c7c5474113786bd788c7f88f3719e34f02141038e0d161b36e32f39b9 SHA512 bb808fad059f5abd0171e4bdc724411eff2c7e8d303a4ffb3608a00e21bb3cfafe9e83b4b4e9bccd42c9a4331f67ddc6043e3dd5eaa9a122c86626eed43a8383
42 +DIST github.com%2Fstretchr%2Ftestify%2F@v%2Fv1.3.0.zip 83537 BLAKE2B 6d6de57cc5e393aaef1cdc7e2140143eb7fa324bb2ea3b9f63bfe1e8652c02d24eb441fc3b435c6b287f165c5540a008a7c21ab4070d8bc77c77e6fb608f7e46 SHA512 c5cd06f825bbfdcf2ae58ea21edbeea03c110de3fc20fcf69db07aae26c9ae67a8ac57a9ffedec9b3b4f1f3b016089935049d75d92a9a03e45ce6345b4c9c611
43 +DIST licenseclassifier-0_pre20200402.tar.gz 6703094 BLAKE2B c68dc92e593aeb71b1a3ae0a938d659ecb72a870025ac900587e62b1f9923e6e6b9356efc3ff7bd7b085ce01fc0c65f51ee7d0aec683cc2605d56a5da075021e SHA512 e376be738bbbc9e6d3df495c9967ab198836c6ac80d1c658a4ff44a261e495b0bc0aca0b559477f80b6f433a6867c7ec6b1937d76133bd1fef0a3e9b15c8173b
44
45 diff --git a/dev-go/licenseclassifier/licenseclassifier-0_pre20200402.ebuild b/dev-go/licenseclassifier/licenseclassifier-0_pre20200402.ebuild
46 new file mode 100644
47 index 00000000000..ff257f9915b
48 --- /dev/null
49 +++ b/dev-go/licenseclassifier/licenseclassifier-0_pre20200402.ebuild
50 @@ -0,0 +1,84 @@
51 +# Copyright 1999-2020 Gentoo Authors
52 +# Distributed under the terms of the GNU General Public License v2
53 +
54 +EAPI=7
55 +
56 +DESCRIPTION="A library and set of tools that can analyze text to determine what type of license it contains"
57 +HOMEPAGE="https://github.com/google/licenseclassifier"
58 +LICENSE="Apache-2.0 MIT"
59 +SLOT="0"
60 +
61 +EGO_PN=github.com/google/${PN}
62 +EGIT_REPO_URI="https://${EGO_PN}.git"
63 +
64 +inherit go-module
65 +
66 +if [[ ${PV} == *9999* ]]; then
67 + inherit git-r3
68 +
69 + src_unpack() {
70 + git-r3_src_unpack
71 + go-module_live_vendor
72 + }
73 +else
74 + KEYWORDS="~amd64"
75 + EGIT_COMMIT="879cb1424de0ab6dbb3d7a0788a0e40c2515a1b7"
76 + SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
77 +
78 + EGO_SUM=(
79 + "github.com/davecgh/go-spew v1.1.0"
80 + "github.com/google/go-cmp v0.2.0"
81 + "github.com/pmezard/go-difflib v1.0.0"
82 + "github.com/sergi/go-diff v1.0.0"
83 + "github.com/stretchr/testify v1.3.0"
84 +
85 + "github.com/davecgh/go-spew v1.1.0/go.mod"
86 + "github.com/google/go-cmp v0.2.0/go.mod"
87 + "github.com/pmezard/go-difflib v1.0.0/go.mod"
88 + "github.com/sergi/go-diff v1.0.0/go.mod"
89 + "github.com/stretchr/objx v0.1.0/go.mod"
90 + "github.com/stretchr/testify v1.3.0/go.mod"
91 + )
92 +
93 + S="${WORKDIR}/${PN}-${EGIT_COMMIT}"
94 +fi
95 +
96 +go-module_set_globals
97 +SRC_URI+=" ${EGO_SUM_SRC_URI}"
98 +
99 +src_prepare() {
100 + eapply_user
101 + rm licenses/*db || die
102 +}
103 +
104 +src_compile() {
105 + mkdir -p build-int build || die
106 +
107 + # Make a binary that will be used to generate licenses
108 + go build -o build-int ./... || die
109 +
110 + # Make a binary that will use fixed path for the db
111 + cp -v file_system_resources.go{,.bak} || die
112 + local share="${EROOT}/usr/share/licenseclassifier"
113 + sed -i "s@= lcRoot()@= \"${share}\", error(nil)@" file_system_resources.go || die
114 + go build -o build ./... || die
115 +
116 + # undo that change for tests
117 + mv -v file_system_resources.go{.bak,} || die
118 +
119 + build-int/license_serializer -output licenses || die
120 + build-int/license_serializer -forbidden -output licenses || die
121 +}
122 +
123 +src_test() {
124 + go test ./... || die
125 +}
126 +
127 +src_install() {
128 + # Install package data (this isn't the package license)
129 + insinto usr/share/licenseclassifier
130 + doins licenses/*
131 +
132 + dobin build/*
133 + einstalldocs
134 +}
135
136 diff --git a/dev-go/licenseclassifier/metadata.xml b/dev-go/licenseclassifier/metadata.xml
137 new file mode 100644
138 index 00000000000..36c5ed7ae5e
139 --- /dev/null
140 +++ b/dev-go/licenseclassifier/metadata.xml
141 @@ -0,0 +1,22 @@
142 +<?xml version="1.0" encoding="UTF-8"?>
143 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
144 +<pkgmetadata>
145 + <maintainer type="person">
146 + <email>kpp+gentoo@××××××.net</email>
147 + <name>Konstantin Ignatov</name>
148 + </maintainer>
149 + <maintainer type="project">
150 + <email>proxy-maint@g.o</email>
151 + <name>Proxy Maintainers</name>
152 + </maintainer>
153 + <longdescription>
154 + The license classifier is a library and set of tools that can analyze text
155 + to determine what type of license it contains. It searches for license texts
156 + in a file and compares them to an archive of known licenses.
157 + These files could be, e.g., LICENSE files with a single or multiple licenses in it,
158 + or source code files with the license text in a comment.
159 + </longdescription>
160 + <upstream>
161 + <remote-id type="github">google/licenseclassifier</remote-id>
162 + </upstream>
163 +</pkgmetadata>