forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev-go/licenseclassifier: new ebuild
I find this tool very helpful for managing LICENSE in different ebuilds. Just run identify_license on any file - just a source code or COPYING/LICENSE file. It also can be built against licenses in /var/db/repos/gentoo/licenses, but this is not yet implemented in this commit. Bug: https://bugs.gentoo.org/694792 Bug: https://bugs.gentoo.org/694790 Signed-off-by: Konstantin Podshumok <[email protected]> Signed-off-by: Joonas Niilola <[email protected]>
- Loading branch information
1 parent
9b5e22f
commit 09efbf4
Showing
3 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DIST github.com%2Fdavecgh%2Fgo-spew%2F@v%2Fv1.1.0.mod 34 BLAKE2B 7e09c2779bf7a84a9271e31522ebbe600a1c11b107d651d91f58c8373e4336332a3a881f3e12b382543d75f20398af66085fcb3e780eed341e870e9c30f29267 SHA512 5e079462f7e0dff0efda71f580aa185700cfa936b718a19d0e2a8c63212e47a07022dca0c282832d48e5165aae8e82aeeeb2ac3664268f1148fc772010fb860e | ||
DIST github.com%2Fdavecgh%2Fgo-spew%2F@v%2Fv1.1.0.zip 60546 BLAKE2B e775860f49c6ee09a6c48902d38fdf5d2d77af4cd405d8d303902170e46493301d4aa873a48b4d12a16d92dafaa65290de1fd3a42545025fbfc82f15a3881e8d SHA512 53dc5484f488ae1f8d0eb672c3431bbf9fce33dfcee83dda7929103e3650559cf703f601716984a640422f01cc640860dba0b47e16aef04d0d2452a266fefbf9 | ||
DIST github.com%2Fgoogle%2Fgo-cmp%2F@v%2Fv0.2.0.mod 32 BLAKE2B 7c7baa1e29b9806fb97e0d557200e8722f2d373e149127307efa285cdfedb36dd57355168554d1a1bada62144e6a6a00c4d3246aa9afc7d0ffae0f087459c552 SHA512 7229d917bb0c788b07297e1b09b8f7952f951998a56f17ea1f69ff7c2f565a5686b212f42f45c6b8351905d6740a2ec5a235e493daa531ae00cb709faf67ae45 | ||
DIST github.com%2Fgoogle%2Fgo-cmp%2F@v%2Fv0.2.0.zip 74164 BLAKE2B 6a3c04c2986b35dcc32f14553534758c3270c294a5e2595487f884e32e76cac2ebbc34cf7e42232eb7d85e71fee7660b513de4e365981e625515b086c341d15c SHA512 7be2dd2b362f56ad7fb7be35b62a841ca051d4fe31ffe1ca784e393b0cfe44674a050cf1129a15094872bc16c8ed9bc62afe0e7017bcaf1a4eb9b2e39423f790 | ||
DIST github.com%2Fpmezard%2Fgo-difflib%2F@v%2Fv1.0.0.mod 37 BLAKE2B 94636062c94f8ff68cdcab7593a3acae7b9ffff616cad7b1d5c9cd147a4a1042d33666cbeed6fd816d6793113abfb595183097dcc46de7a3dfadc1423ed43e79 SHA512 c3d5c48cdb8ba6af7071a07cfede06e0ab67e3726d9de592a952fad40167dcbdd9621dc2c4df1bd3c28eb99d70b1b6d8d812441237c35bf492e5b7f07bd33902 | ||
DIST github.com%2Fpmezard%2Fgo-difflib%2F@v%2Fv1.0.0.zip 12433 BLAKE2B 0c911c9d173080abd8edbbab1f47222343801d8eeae36b4add24773e3282fc2a39283fdf519a3d4483e39cdb7d9509b8570d151f46841ac1a616f312dc4cb0ba SHA512 3b85697185ba85cdef6202444ab6cabeabfad8a03d66b3839a852586b1f91ddae7897a57c8c138d5647022aa44906c7ef3c5339d520f90eeea0742a935da8cf2 | ||
DIST github.com%2Fsergi%2Fgo-diff%2F@v%2Fv1.0.0.mod 32 BLAKE2B 9c0be7f17fe7a9156f124f7f67c3e15e14719d0b271f36d5d41ccfa5ff6c1b7887e0051df6eb3b29f29b40357d8e438598088b3c4f4df28fb81f030c8efa7ff3 SHA512 8b8b8958405a188b93adcdda0634aaa2961b5b8e0d3b3e1f768fb9c49c02b73cf3bb39027431e0c1d209abea6cb72a651c5776bf26391e81f4dc18c7bafa692c | ||
DIST github.com%2Fsergi%2Fgo-diff%2F@v%2Fv1.0.0.zip 52931 BLAKE2B e511ef9edf7d968d848e021658001daefe7c8cc7169b1c6984ca5388fc4d6a5f54def9060483e57392711617892d21322d9de099234901bd1c251e57e6489f6b SHA512 e3d8a20d1cc351b8944579988feff39cb0aa3e1f2aacf2e2307180c25c153a0473f2a5a3ebda9d96868cb1f477ccccffdce06b117be7fa5409b2d1926b4c270a | ||
DIST github.com%2Fstretchr%2Fobjx%2F@v%2Fv0.1.0.mod 32 BLAKE2B d698910da1ef00a70a1673b8c74105de195020ccd95d1e70c5dd1e1615210886ff9acbc9cfd03f46e99f5223b60b04695b8d362b9e0edd4e485480f802bd229a SHA512 4e366e5a60559a8863cb2a50280deb307d8bf885ca5440cce1b49a084b4cc4583b3481240125f35f161226592a43f2c0a426152f117d79b68c92c72a93f751d5 | ||
DIST github.com%2Fstretchr%2Ftestify%2F@v%2Fv1.3.0.mod 154 BLAKE2B 60cd7801e7cd33746305cd636b048b25a86270ec3b29a21c3c078c7e95b769bce7e80c2c7c5474113786bd788c7f88f3719e34f02141038e0d161b36e32f39b9 SHA512 bb808fad059f5abd0171e4bdc724411eff2c7e8d303a4ffb3608a00e21bb3cfafe9e83b4b4e9bccd42c9a4331f67ddc6043e3dd5eaa9a122c86626eed43a8383 | ||
DIST github.com%2Fstretchr%2Ftestify%2F@v%2Fv1.3.0.zip 83537 BLAKE2B 6d6de57cc5e393aaef1cdc7e2140143eb7fa324bb2ea3b9f63bfe1e8652c02d24eb441fc3b435c6b287f165c5540a008a7c21ab4070d8bc77c77e6fb608f7e46 SHA512 c5cd06f825bbfdcf2ae58ea21edbeea03c110de3fc20fcf69db07aae26c9ae67a8ac57a9ffedec9b3b4f1f3b016089935049d75d92a9a03e45ce6345b4c9c611 | ||
DIST licenseclassifier-0_pre20200402.tar.gz 6703094 BLAKE2B c68dc92e593aeb71b1a3ae0a938d659ecb72a870025ac900587e62b1f9923e6e6b9356efc3ff7bd7b085ce01fc0c65f51ee7d0aec683cc2605d56a5da075021e SHA512 e376be738bbbc9e6d3df495c9967ab198836c6ac80d1c658a4ff44a261e495b0bc0aca0b559477f80b6f433a6867c7ec6b1937d76133bd1fef0a3e9b15c8173b |
84 changes: 84 additions & 0 deletions
84
dev-go/licenseclassifier/licenseclassifier-0_pre20200402.ebuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Copyright 1999-2020 Gentoo Authors | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=7 | ||
|
||
DESCRIPTION="A library and set of tools that can analyze text to determine what type of license it contains" | ||
HOMEPAGE="https://github.com/google/licenseclassifier" | ||
LICENSE="Apache-2.0 MIT" | ||
SLOT="0" | ||
|
||
EGO_PN=github.com/google/${PN} | ||
EGIT_REPO_URI="https://${EGO_PN}.git" | ||
|
||
inherit go-module | ||
|
||
if [[ ${PV} == *9999* ]]; then | ||
inherit git-r3 | ||
|
||
src_unpack() { | ||
git-r3_src_unpack | ||
go-module_live_vendor | ||
} | ||
else | ||
KEYWORDS="~amd64" | ||
EGIT_COMMIT="879cb1424de0ab6dbb3d7a0788a0e40c2515a1b7" | ||
SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz" | ||
|
||
EGO_SUM=( | ||
"github.com/davecgh/go-spew v1.1.0" | ||
"github.com/google/go-cmp v0.2.0" | ||
"github.com/pmezard/go-difflib v1.0.0" | ||
"github.com/sergi/go-diff v1.0.0" | ||
"github.com/stretchr/testify v1.3.0" | ||
|
||
"github.com/davecgh/go-spew v1.1.0/go.mod" | ||
"github.com/google/go-cmp v0.2.0/go.mod" | ||
"github.com/pmezard/go-difflib v1.0.0/go.mod" | ||
"github.com/sergi/go-diff v1.0.0/go.mod" | ||
"github.com/stretchr/objx v0.1.0/go.mod" | ||
"github.com/stretchr/testify v1.3.0/go.mod" | ||
) | ||
|
||
S="${WORKDIR}/${PN}-${EGIT_COMMIT}" | ||
fi | ||
|
||
go-module_set_globals | ||
SRC_URI+=" ${EGO_SUM_SRC_URI}" | ||
|
||
src_prepare() { | ||
eapply_user | ||
rm licenses/*db || die | ||
} | ||
|
||
src_compile() { | ||
mkdir -p build-int build || die | ||
|
||
# Make a binary that will be used to generate licenses | ||
go build -o build-int ./... || die | ||
|
||
# Make a binary that will use fixed path for the db | ||
cp -v file_system_resources.go{,.bak} || die | ||
local share="${EROOT}/usr/share/licenseclassifier" | ||
sed -i "s@= lcRoot()@= \"${share}\", error(nil)@" file_system_resources.go || die | ||
go build -o build ./... || die | ||
|
||
# undo that change for tests | ||
mv -v file_system_resources.go{.bak,} || die | ||
|
||
build-int/license_serializer -output licenses || die | ||
build-int/license_serializer -forbidden -output licenses || die | ||
} | ||
|
||
src_test() { | ||
go test ./... || die | ||
} | ||
|
||
src_install() { | ||
# Install package data (this isn't the package license) | ||
insinto usr/share/licenseclassifier | ||
doins licenses/* | ||
|
||
dobin build/* | ||
einstalldocs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> | ||
<pkgmetadata> | ||
<maintainer type="person"> | ||
<email>[email protected]</email> | ||
<name>Konstantin Ignatov</name> | ||
</maintainer> | ||
<maintainer type="project"> | ||
<email>[email protected]</email> | ||
<name>Proxy Maintainers</name> | ||
</maintainer> | ||
<longdescription> | ||
The license classifier is a library and set of tools that can analyze text | ||
to determine what type of license it contains. It searches for license texts | ||
in a file and compares them to an archive of known licenses. | ||
These files could be, e.g., LICENSE files with a single or multiple licenses in it, | ||
or source code files with the license text in a comment. | ||
</longdescription> | ||
<upstream> | ||
<remote-id type="github">google/licenseclassifier</remote-id> | ||
</upstream> | ||
</pkgmetadata> |