pacotes.eletrotupi.com

commit 735f461dfea73a9674d245c3080434b9fe1491dd

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

smithy: patch to make modules go gettable

 pkgs/smithy/APKBUILD | 10 
 pkgs/smithy/global-make-repositories-go-gettable.patch | 99 ++++++++++++


diff --git a/pkgs/smithy/APKBUILD b/pkgs/smithy/APKBUILD
index 67f823de9c9d1369f29b105ddfbcab21d622a7f1..f5f868447fa0711c4260f0fad0e23e6ade3f2845 100644
--- a/pkgs/smithy/APKBUILD
+++ b/pkgs/smithy/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
 pkgname=smithy
 pkgver=0.2.1
-pkgrel=2
+pkgrel=4
 pkgdesc="A tiny git forge written in Go"
 options="!check" # No testsuite
 url="https://github.com/honza/smithy"
@@ -16,6 +16,7 @@ 	$pkgname-$pkgver.tar.gz::https://github.com/honza/smithy/archive/v$pkgver.tar.gz
 	$pkgname.initd
 	$pkgname.confd
 	fallback-to-user-default-monospace-font.patch
+	global-make-repositories-go-gettable.patch
 "
 pkggroups="smithy"
 builddir="$srcdir/$pkgname-$pkgver"
@@ -31,7 +32,10 @@
 	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
 	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
 }
-sha512sums="89c4242ea3bbdbcd8ee9f035bbb0665d2197f11282cd2b8c963759edad5c7c703d772ea1f6f10283040a3b7dd8495aa78b862b7e8409dd1f7d5dfa0eec09ef68  smithy-0.2.1.tar.gz
+sha512sums="
+89c4242ea3bbdbcd8ee9f035bbb0665d2197f11282cd2b8c963759edad5c7c703d772ea1f6f10283040a3b7dd8495aa78b862b7e8409dd1f7d5dfa0eec09ef68  smithy-0.2.1.tar.gz
 a7c415023ad45be5c7badb50f97275f46b38a19399f229b3408875ebd5811293b4efec5766716fa8dc0447be0995a3f6964b1b851c6d71960a3ab3e3d0b2f588  smithy.initd
 f78e8fd5e8de95313df23ee2b292dabd7645d9bfbbbce5fcecdd3961bd8cf5e06c3a6e7294a04061b3c46ece29465a911fb313810e55acaf5fa67adda04020e3  smithy.confd
-3788e8e24be104549ada666d6df2bff0142d91bc40d4f082ddade1add0ee6d4e97283891a0c9542091a28f6fbcb0d155ba81784f73138932ba4484febd2df887  fallback-to-user-default-monospace-font.patch"
+3788e8e24be104549ada666d6df2bff0142d91bc40d4f082ddade1add0ee6d4e97283891a0c9542091a28f6fbcb0d155ba81784f73138932ba4484febd2df887  fallback-to-user-default-monospace-font.patch
+83a341b620e6a20b1172c9f03dbb4f250c1bed1572d730038a6562eb4f536c3507e75058e9a1d1bdcfdaf7acf37c682f39bbebff235b6e9253e329b2a9200166  global-make-repositories-go-gettable.patch
+"




diff --git a/pkgs/smithy/global-make-repositories-go-gettable.patch b/pkgs/smithy/global-make-repositories-go-gettable.patch
new file mode 100644
index 0000000000000000000000000000000000000000..bd728db341c85b3328a42b913b2924127268ab41
--- /dev/null
+++ b/pkgs/smithy/global-make-repositories-go-gettable.patch
@@ -0,0 +1,99 @@
+From c7fadc9d68baf64c0ef1e4b548e17b43803271f7 Mon Sep 17 00:00:00 2001
+From: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
+Date: Fri, 24 Sep 2021 22:51:29 -0300
+Subject: [PATCH smithy] global: make repositories go-gettable
+
+---
+ pkg/smithy/smithy.go             | 33 +++++++++++++++++++++++++++++++-
+ pkg/smithy/templates/header.html |  9 +++++----
+ 2 files changed, 37 insertions(+), 5 deletions(-)
+
+diff --git a/pkg/smithy/smithy.go b/pkg/smithy/smithy.go
+index 7dff62d..4db6bc2 100644
+--- a/pkg/smithy/smithy.go
++++ b/pkg/smithy/smithy.go
+@@ -569,6 +569,35 @@ func LogView(ctx *gin.Context, urlParts []string) {
+ 	}))
+ }
+
++func GoGetView(ctx *gin.Context, urlParts []string) {
++	repoName := urlParts[0]
++	smithyConfig := ctx.MustGet("config").(SmithyConfig)
++	repoPath := filepath.Join(smithyConfig.Git.Root, repoName)
++
++	repoPathExists, err := PathExists(repoPath)
++
++	if err != nil {
++		Http404(ctx)
++		return
++	}
++
++	if !repoPathExists {
++		Http404(ctx)
++		return
++	}
++
++	moduleName := smithyConfig.Host + "/" + repoName
++	gitModuleName := smithyConfig.Host + "/git/" + repoName
++
++	ctx.Data(200, "text/html; charset=utf-8", []byte(fmt.Sprintf(`<!doctype html>
++		<html>
++		<head>
++			<title>Placeholder page for Go module resolution </title>
++			<meta name="go-import" content="%s git https://%s" />
++		</head>
++	`, moduleName, gitModuleName)))
++}
++
+ func LogViewDefault(ctx *gin.Context, urlParts []string) {
+ 	repoName := urlParts[0]
+ 	smithyConfig := ctx.MustGet("config").(SmithyConfig)
+@@ -825,7 +854,7 @@ func CompileRoutes() []Route {
+
+ 	indexUrl := regexp.MustCompile(`^/$`)
+ 	repoGitUrl := regexp.MustCompile(`^/git/(?P<repo>` + label + `)`)
+-	repoIndexUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)$`)
++	repoIndexUrl := regexp.MustCompile(`^/(?P<repo>` + label + `).*$`)
+ 	refsUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/refs$`)
+ 	logDefaultUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/log$`)
+ 	logUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/log/(?P<ref>` + label + `)$`)
+@@ -835,6 +864,7 @@ func CompileRoutes() []Route {
+ 	treeRootUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/tree$`)
+ 	treeRootRefUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/tree/(?P<ref>` + label + `)$`)
+ 	treeRootRefPathUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/tree/(?P<ref>` + label + `)/(?P<path>.*)$`)
++	goGetUrl := regexp.MustCompile(`^/(?P<repo>` + label + `)/(?P<path>` + label + `)(\?go-get=([0-9]))$`)
+
+ 	return []Route{
+ 		{Pattern: indexUrl, View: IndexView},
+@@ -848,6 +878,7 @@ func CompileRoutes() []Route {
+ 		{Pattern: treeRootUrl, View: TreeView},
+ 		{Pattern: treeRootRefUrl, View: TreeView},
+ 		{Pattern: treeRootRefPathUrl, View: TreeView},
++		{Pattern: goGetUrl, View: GoGetView},
+ 	}
+ }
+
+diff --git a/include/header.html b/include/header.html
+index dcf0bb3..f2734d1 100644
+--- a/include/header.html
++++ b/include/header.html
+@@ -2,11 +2,12 @@
+ <!doctype html>
+ <html>
+     <head>
+-        <meta charset="utf-8">
+-        <meta http-equiv="x-ua-compatible" content="ie=edge">
++        <meta charset="utf-8" />
++        <meta http-equiv="x-ua-compatible" content="ie=edge" />
+         <title>{{ .Site.Title }}</title>
+-        <meta name="description" content="">
+-        <meta name="viewport" content="width=device-width, initial-scale=1">
++        <meta name="go-import" content="{{ .Site.Host }}/{{ .Repo.Name }} git https://{{ .Site.Host }}/git/{{ .Repo.Name }}" />
++        <meta name="description" content="" />
++        <meta name="viewport" content="width=device-width, initial-scale=1" />
+         <link rel="stylesheet" href="{{ css }}" />
+     </head>
+     <body>
+--
+2.33.0
+