diff options
author | Ryan Qian <i@bitbili.net> | 2024-06-07 01:57:01 +0800 |
---|---|---|
committer | Yixun Lan <dlan@gentoo.org> | 2024-06-06 22:07:33 +0000 |
commit | 8f30ea59cf0c6f20feaa59d87687a76058e18d13 (patch) | |
tree | fb12ac8032d2e83c93d6b6a612a33c9225242a3c /www-apps/gitea/files | |
parent | meson.eclass: stop using the incomparably broken "meson compile" (diff) | |
download | gentoo-8f30ea59cf0c6f20feaa59d87687a76058e18d13.tar.gz gentoo-8f30ea59cf0c6f20feaa59d87687a76058e18d13.tar.bz2 gentoo-8f30ea59cf0c6f20feaa59d87687a76058e18d13.zip |
www-apps/gitea: add 1.22.0
also adds an experimental USE flag 'gogit', which is used as
an alternative of the 'git' command
Closes: https://bugs.gentoo.org/933692
Closes: https://github.com/gentoo/gentoo/pull/37058
Signed-off-by: Ryan Qian <i@bitbili.net>
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Diffstat (limited to 'www-apps/gitea/files')
3 files changed, 159 insertions, 0 deletions
diff --git a/www-apps/gitea/files/gitea-1.22.0-fix-missing-memcache-import.diff b/www-apps/gitea/files/gitea-1.22.0-fix-missing-memcache-import.diff new file mode 100644 index 000000000000..1ad5d50bf047 --- /dev/null +++ b/www-apps/gitea/files/gitea-1.22.0-fix-missing-memcache-import.diff @@ -0,0 +1,18 @@ +https://github.com/go-gitea/gitea/issues/31102 +https://github.com/go-gitea/gitea/pull/31105 + +Fix missing memcache import + +diff --git a/modules/cache/cache.go b/modules/cache/cache.go +index 2ca77bdb29f3..075367115803 100644 +--- a/modules/cache/cache.go ++++ b/modules/cache/cache.go +@@ -8,6 +8,8 @@ import ( + "time" + + "code.gitea.io/gitea/modules/setting" ++ ++ _ "gitea.com/go-chi/cache/memcache" //nolint:depguard // memcache plugin for cache, it is required for config "ADAPTER=memcache" + ) + + var defaultCache StringCache diff --git a/www-apps/gitea/files/gitea-1.22.0-go-chi-memcache-package.diff b/www-apps/gitea/files/gitea-1.22.0-go-chi-memcache-package.diff new file mode 100644 index 000000000000..f3ebbe6fc73f --- /dev/null +++ b/www-apps/gitea/files/gitea-1.22.0-go-chi-memcache-package.diff @@ -0,0 +1,121 @@ +https://github.com/go-gitea/gitea/issues/31102 +https://github.com/go-gitea/gitea/pull/31105 + +add the missing memcache package in the vendor dir, +binding to patch ./gitea-1.22.0-fix-missing-memcache-import.diff + +diff --git a/vendor/gitea.com/go-chi/cache/memcache/memcache.go b/vendor/gitea.com/go-chi/cache/memcache/memcache.go +new file mode 100644 +index 00000000..7c7cd225 +--- /dev/null ++++ b/vendor/gitea.com/go-chi/cache/memcache/memcache.go +@@ -0,0 +1,97 @@ ++// Copyright 2013 Beego Authors ++// Copyright 2014 The Macaron Authors ++// ++// Licensed under the Apache License, Version 2.0 (the "License"): you may ++// not use this file except in compliance with the License. You may obtain ++// a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ++// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ++// License for the specific language governing permissions and limitations ++// under the License. ++ ++package cache ++ ++import ( ++ "strings" ++ ++ "github.com/bradfitz/gomemcache/memcache" ++ "github.com/unknwon/com" ++ ++ "gitea.com/go-chi/cache" ++) ++ ++// MemcacheCacher represents a memcache cache adapter implementation. ++type MemcacheCacher struct { ++ c *memcache.Client ++} ++ ++func NewItem(key string, data []byte, expire int32) *memcache.Item { ++ return &memcache.Item{ ++ Key: key, ++ Value: data, ++ Expiration: expire, ++ } ++} ++ ++// Put puts value into cache with key and expire time. ++// If expired is 0, it lives forever. ++func (c *MemcacheCacher) Put(key string, val interface{}, expire int64) error { ++ return c.c.Set(NewItem(key, []byte(com.ToStr(val)), int32(expire))) ++} ++ ++// Get gets cached value by given key. ++func (c *MemcacheCacher) Get(key string) interface{} { ++ item, err := c.c.Get(key) ++ if err != nil { ++ return nil ++ } ++ return string(item.Value) ++} ++ ++// Delete deletes cached value by given key. ++func (c *MemcacheCacher) Delete(key string) error { ++ return c.c.Delete(key) ++} ++ ++// Incr increases cached int-type value by given key as a counter. ++func (c *MemcacheCacher) Incr(key string) error { ++ _, err := c.c.Increment(key, 1) ++ return err ++} ++ ++// Decr decreases cached int-type value by given key as a counter. ++func (c *MemcacheCacher) Decr(key string) error { ++ _, err := c.c.Decrement(key, 1) ++ return err ++} ++ ++// IsExist returns true if cached value exists. ++func (c *MemcacheCacher) IsExist(key string) bool { ++ _, err := c.c.Get(key) ++ return err == nil ++} ++ ++// Flush deletes all cached data. ++func (c *MemcacheCacher) Flush() error { ++ return c.c.FlushAll() ++} ++ ++// StartAndGC starts GC routine based on config string settings. ++// AdapterConfig: 127.0.0.1:9090;127.0.0.1:9091 ++func (c *MemcacheCacher) StartAndGC(opt cache.Options) error { ++ c.c = memcache.New(strings.Split(opt.AdapterConfig, ";")...) ++ return nil ++} ++ ++// Ping tests if the cache is alive. ++func (c *MemcacheCacher) Ping() error { ++ return cache.GenericPing(c) ++} ++ ++func init() { ++ cache.Register("memcache", &MemcacheCacher{}) ++} +diff --git a/vendor/modules.txt b/vendor/modules.txt +index 144a505d..6cb3f48b 100644 +--- a/vendor/modules.txt ++++ b/vendor/modules.txt +@@ -40,6 +40,7 @@ gitea.com/go-chi/binding + # gitea.com/go-chi/cache v0.2.0 + ## explicit; go 1.11 + gitea.com/go-chi/cache ++gitea.com/go-chi/cache/memcache + # gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098 + ## explicit; go 1.21 + gitea.com/go-chi/captcha diff --git a/www-apps/gitea/files/gitea-1.22.0-ignore-findrecentlypushednewbranches-err.diff b/www-apps/gitea/files/gitea-1.22.0-ignore-findrecentlypushednewbranches-err.diff new file mode 100644 index 000000000000..78459f6e3359 --- /dev/null +++ b/www-apps/gitea/files/gitea-1.22.0-ignore-findrecentlypushednewbranches-err.diff @@ -0,0 +1,20 @@ +https://github.com/go-gitea/gitea/issues/31163 +https://github.com/go-gitea/gitea/pull/31164 + +A quick fix to workaround 500 error: +FindRecentlyPushedNewBranches, branch does not exist [repo_id: 64 name: main] + +diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go +index e1498c0d581e..386ef7be5ce8 100644 +--- a/routers/web/repo/view.go ++++ b/routers/web/repo/view.go +@@ -1047,8 +1047,7 @@ func renderHomeCode(ctx *context.Context) { + baseRepoPerm.CanRead(unit_model.TypePullRequests) { + ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Doer, opts) + if err != nil { +- ctx.ServerError("FindRecentlyPushedNewBranches", err) +- return ++ log.Error("FindRecentlyPushedNewBranches failed: %v", err) + } + } + } |