commit:     70474a40cc82af756e37d4876271bd0df07292eb
Author:     Rahil Bhimjiani <me <AT> rahil <DOT> rocks>
AuthorDate: Mon Jan  1 04:54:52 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Mon Jan  1 04:54:52 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=70474a40

app-crypt/lego: ACME client alternative to certbot/acme.sh

written in Go which offers many built-in DNS plugins

Signed-off-by: Rahil Bhimjiani <me <AT> rahil.rocks>

 app-crypt/lego/Manifest           |  3 ++
 app-crypt/lego/lego-4.14.2.ebuild | 82 +++++++++++++++++++++++++++++++++++++++
 app-crypt/lego/lego-9999.ebuild   | 82 +++++++++++++++++++++++++++++++++++++++
 app-crypt/lego/metadata.xml       | 13 +++++++
 4 files changed, 180 insertions(+)

diff --git a/app-crypt/lego/Manifest b/app-crypt/lego/Manifest
new file mode 100644
index 0000000000..6a66b1065e
--- /dev/null
+++ b/app-crypt/lego/Manifest
@@ -0,0 +1,3 @@
+DIST lego-4.14.2-deps.tar.xz 204384528 BLAKE2B 
5db3b7b6c194b4042b4c81a490c99f79339c9c0c4571bf31061a352626f08afcf8508edaf104af784243476264edd03c3e992aef711d05f26f5270f27b98e7bd
 SHA512 
a07c5bf3fa0b99e3b2af06141b1049ff030b7d74c2a38fbe7c15fc46a622d4cc02c2e563e03eb5aede1ef8dc0ea3d16b775f2381a41caafbe3c6e45831d56544
+DIST lego-4.14.2-docs.tar.gz 3639965 BLAKE2B 
deb991244c93cd317a8e3acb90acc5f6712d5f5a1cf65ce615a13830e5a91fb35070b1eb9ce808322fa1e6e3cc9a6ee4253b488c1c8cbef0d7899b000a00d45f
 SHA512 
13ea06e72581aee038d8cc4906b357d506b1dd20f1c8bd32a1c3fcfa364bdac2ccb76416bf6328f07e8feabc934329358ab75b0a440ede859caf350febac69fd
+DIST lego-4.14.2.tar.gz 672197 BLAKE2B 
b633d6ed12fd7d38c35db392a58785fd32c3475961a49c5dbb3fe4986ca17c322a39ff604e73688928db1fa26eee70c8d9774fb560f96c5e017b680e2f89dbf2
 SHA512 
089788d1df077bdf8731250664628c9dbf44c8db7f2755242029c69b450eb892845b4c0b549a7affe80e351a29a6cc9d07514df3d0b7d1d17b42e20d1c85eca1

diff --git a/app-crypt/lego/lego-4.14.2.ebuild 
b/app-crypt/lego/lego-4.14.2.ebuild
new file mode 100644
index 0000000000..2e16460056
--- /dev/null
+++ b/app-crypt/lego/lego-4.14.2.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit go-module
+
+DESCRIPTION="Let's Encrypt/ACME client (like certbot or acme.sh) and library 
written in Go"
+HOMEPAGE="https://github.com/go-acme/lego/";
+
+DOCUMENTATION_COMMIT=e28a6ff22f2b7f75b8aaae5012672cfcca2be690
+
+if [[ ${PV} == 9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/go-acme/lego.git";
+else
+       SRC_URI="
+       https://github.com/go-acme/lego/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       
https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.xz
 -> ${P}-deps.tar.xz
+       doc? ( 
https://github.com/go-acme/lego/archive/${DOCUMENTATION_COMMIT}.tar.gz -> 
${P}-docs.tar.gz )
+"
+       KEYWORDS="~amd64"
+fi
+
+# main
+LICENSE="MIT"
+# deps
+LICENSE+=" Apache-2.0 BSD-2 BSD ISC MPL-2.0"
+SLOT="0"
+IUSE="doc"
+
+# some tests require network access otherwise get following error
+# expected: "zoneee: unexpected status code: [status code: 401] body: 
Unauthorized"
+# actual  : "zoneee: could not find zone for domain \"prefix.example.com\" 
(_acme-challenge.prefix.example.com.): could not find the start of authority 
for _acme-challenge.prefix.example.com.: read udp 10.0.0.1:54729->10.0.0.1:53: 
read: connection refused"
+PROPERTIES="test_network"
+RESTRICT="test"
+
+src_unpack() {
+       if [[ ${PV} == 9999* ]]; then
+               git-r3_src_unpack
+               go-module_live_vendor
+               if use doc; then
+                       EGIT_BRANCH="gh-pages"
+                       EGIT_CHECKOUT_DIR="${WORKDIR}/${P}-doc"
+                       git-r3_src_unpack
+               fi
+       else
+               go-module_src_unpack
+       fi
+}
+
+src_compile() {
+       export CGO_ENABLED=0
+
+       local VERSION
+       if [[ ${PV} == 9999* ]]; then
+               VERSION="$(git rev-parse HEAD)" || die
+       else
+               VERSION="${PV}"
+       fi
+
+       ego build -trimpath -ldflags "-X main.version=${VERSION}" -o 
dist/"${PN}" ./cmd/lego/
+}
+
+src_test() {
+       ego test -v -cover ./...
+}
+
+src_install() {
+       # primary program
+       dobin dist/"${PN}"
+
+       # docs
+       einstalldocs
+       if use doc; then
+               if [[ ${PV} == 9999* ]]; then
+                       dodoc -r ../"${P}"-doc/*
+               else
+                       dodoc -r ../"${PN}"-"${DOCUMENTATION_COMMIT}"/*
+               fi
+       fi
+}

diff --git a/app-crypt/lego/lego-9999.ebuild b/app-crypt/lego/lego-9999.ebuild
new file mode 100644
index 0000000000..2e16460056
--- /dev/null
+++ b/app-crypt/lego/lego-9999.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit go-module
+
+DESCRIPTION="Let's Encrypt/ACME client (like certbot or acme.sh) and library 
written in Go"
+HOMEPAGE="https://github.com/go-acme/lego/";
+
+DOCUMENTATION_COMMIT=e28a6ff22f2b7f75b8aaae5012672cfcca2be690
+
+if [[ ${PV} == 9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/go-acme/lego.git";
+else
+       SRC_URI="
+       https://github.com/go-acme/lego/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       
https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.xz
 -> ${P}-deps.tar.xz
+       doc? ( 
https://github.com/go-acme/lego/archive/${DOCUMENTATION_COMMIT}.tar.gz -> 
${P}-docs.tar.gz )
+"
+       KEYWORDS="~amd64"
+fi
+
+# main
+LICENSE="MIT"
+# deps
+LICENSE+=" Apache-2.0 BSD-2 BSD ISC MPL-2.0"
+SLOT="0"
+IUSE="doc"
+
+# some tests require network access otherwise get following error
+# expected: "zoneee: unexpected status code: [status code: 401] body: 
Unauthorized"
+# actual  : "zoneee: could not find zone for domain \"prefix.example.com\" 
(_acme-challenge.prefix.example.com.): could not find the start of authority 
for _acme-challenge.prefix.example.com.: read udp 10.0.0.1:54729->10.0.0.1:53: 
read: connection refused"
+PROPERTIES="test_network"
+RESTRICT="test"
+
+src_unpack() {
+       if [[ ${PV} == 9999* ]]; then
+               git-r3_src_unpack
+               go-module_live_vendor
+               if use doc; then
+                       EGIT_BRANCH="gh-pages"
+                       EGIT_CHECKOUT_DIR="${WORKDIR}/${P}-doc"
+                       git-r3_src_unpack
+               fi
+       else
+               go-module_src_unpack
+       fi
+}
+
+src_compile() {
+       export CGO_ENABLED=0
+
+       local VERSION
+       if [[ ${PV} == 9999* ]]; then
+               VERSION="$(git rev-parse HEAD)" || die
+       else
+               VERSION="${PV}"
+       fi
+
+       ego build -trimpath -ldflags "-X main.version=${VERSION}" -o 
dist/"${PN}" ./cmd/lego/
+}
+
+src_test() {
+       ego test -v -cover ./...
+}
+
+src_install() {
+       # primary program
+       dobin dist/"${PN}"
+
+       # docs
+       einstalldocs
+       if use doc; then
+               if [[ ${PV} == 9999* ]]; then
+                       dodoc -r ../"${P}"-doc/*
+               else
+                       dodoc -r ../"${PN}"-"${DOCUMENTATION_COMMIT}"/*
+               fi
+       fi
+}

diff --git a/app-crypt/lego/metadata.xml b/app-crypt/lego/metadata.xml
new file mode 100644
index 0000000000..9fbd01cd7f
--- /dev/null
+++ b/app-crypt/lego/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Rahil Bhimjiani</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">go-acme/lego</remote-id>
+               <bugs-to>https://github.com/go-acme/lego/issues</bugs-to>
+               <doc>https://go-acme.github.io/lego/</doc>
+       </upstream>
+</pkgmetadata>

Reply via email to