From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BF1311382C5 for ; Tue, 12 May 2020 13:58:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 74218E097D; Tue, 12 May 2020 13:58:05 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4F51DE097D for ; Tue, 12 May 2020 13:58:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8CEFD35017A for ; Tue, 12 May 2020 13:58:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E3C8A240 for ; Tue, 12 May 2020 13:57:59 +0000 (UTC) From: "Joonas Niilola" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Joonas Niilola" Message-ID: <1589291829.80bc9b80f514c8b807501be87dfdf78d3d4f009f.juippis@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-go/licenseclassifier/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-go/licenseclassifier/licenseclassifier-9999.ebuild X-VCS-Directories: dev-go/licenseclassifier/ X-VCS-Committer: juippis X-VCS-Committer-Name: Joonas Niilola X-VCS-Revision: 80bc9b80f514c8b807501be87dfdf78d3d4f009f X-VCS-Branch: master Date: Tue, 12 May 2020 13:57:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b84a59e7-a429-4b36-9145-382a9fcd4607 X-Archives-Hash: 381a5ddd9a87961828359cd7b1bc9770 commit: 80bc9b80f514c8b807501be87dfdf78d3d4f009f Author: Konstantin Podshumok gmail com> AuthorDate: Mon May 4 11:57:28 2020 +0000 Commit: Joonas Niilola gentoo org> CommitDate: Tue May 12 13:57:09 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80bc9b80 dev-go/licenseclassifier: live ebuild Signed-off-by: Konstantin Podshumok gmail.com> Signed-off-by: Joonas Niilola gentoo.org> .../licenseclassifier-9999.ebuild | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/dev-go/licenseclassifier/licenseclassifier-9999.ebuild b/dev-go/licenseclassifier/licenseclassifier-9999.ebuild new file mode 100644 index 00000000000..4612f6e8382 --- /dev/null +++ b/dev-go/licenseclassifier/licenseclassifier-9999.ebuild @@ -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 -v licenses/*db || : +} + +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 +}