From 3bf957c3136b539834946cda37abf596f47bf9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Tue, 15 Oct 2024 11:32:54 +0200 Subject: [PATCH] d/patches: remove old patch, and disable swagger support --- debian/patches/0001-disable-swagger.patch | 60 +++++++++++++++++++ ...gpack-decoding-backwards-compatibili.patch | 40 ------------- debian/patches/series | 3 +- 3 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 debian/patches/0001-disable-swagger.patch delete mode 100644 debian/patches/Fix-time.Time-msgpack-decoding-backwards-compatibili.patch diff --git a/debian/patches/0001-disable-swagger.patch b/debian/patches/0001-disable-swagger.patch new file mode 100644 index 00000000..e26cc545 --- /dev/null +++ b/debian/patches/0001-disable-swagger.patch @@ -0,0 +1,60 @@ +From: =?utf-8?q?Andr=C3=A9_Roth?= +Date: Tue, 15 Oct 2024 12:09:33 +0200 +Subject: disable swagger + +--- + api/router.go | 16 ++++++++-------- + docs/index.go | 1 - + docs/index.go.disabled | 1 + + 3 files changed, 9 insertions(+), 9 deletions(-) + delete mode 100644 docs/index.go + create mode 100644 docs/index.go.disabled + +diff --git a/api/router.go b/api/router.go +index d5b6e61..708b892 100644 +--- a/api/router.go ++++ b/api/router.go +@@ -12,9 +12,9 @@ import ( + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/rs/zerolog/log" + +- _ "github.com/aptly-dev/aptly/docs" // import docs +- swaggerFiles "github.com/swaggo/files" +- ginSwagger "github.com/swaggo/gin-swagger" ++ // _ "github.com/aptly-dev/aptly/docs" // import docs ++ // swaggerFiles "github.com/swaggo/files" ++ // ginSwagger "github.com/swaggo/gin-swagger" + ) + + var context *ctx.AptlyContext +@@ -72,11 +72,11 @@ func Router(c *ctx.AptlyContext) http.Handler { + + router.Use(gin.Recovery(), gin.ErrorLogger()) + +- if c.Config().EnableSwaggerEndpoint { +- router.Use(redirectSwagger) +- url := ginSwagger.URL("/docs/doc.json") +- router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url)) +- } ++ // if c.Config().EnableSwaggerEndpoint { ++ // router.Use(redirectSwagger) ++ // url := ginSwagger.URL("/docs/doc.json") ++ // router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url)) ++ // } + + if c.Config().EnableMetricsEndpoint { + MetricsCollectorRegistrar.Register(router) +diff --git a/docs/index.go b/docs/index.go +deleted file mode 100644 +index 5604656..0000000 +--- a/docs/index.go ++++ /dev/null +@@ -1 +0,0 @@ +-package docs +diff --git a/docs/index.go.disabled b/docs/index.go.disabled +new file mode 100644 +index 0000000..5604656 +--- /dev/null ++++ b/docs/index.go.disabled +@@ -0,0 +1 @@ ++package docs diff --git a/debian/patches/Fix-time.Time-msgpack-decoding-backwards-compatibili.patch b/debian/patches/Fix-time.Time-msgpack-decoding-backwards-compatibili.patch deleted file mode 100644 index 082ebcf3..00000000 --- a/debian/patches/Fix-time.Time-msgpack-decoding-backwards-compatibili.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Shengjing Zhu -Date: Sat, 13 Apr 2019 22:57:46 +0800 -Subject: Fix time.Time msgpack decoding backwards compatibility - -This allows aptly to decode DB created by old codec library. - -Forwarded: https://github.com/aptly-dev/aptly/pull/830 ---- - deb/remote.go | 3 ++- - deb/snapshot.go | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -Index: aptly/deb/remote.go -=================================================================== ---- aptly.orig/deb/remote.go -+++ aptly/deb/remote.go -@@ -688,7 +688,8 @@ func (repo *RemoteRepo) Decode(input []b - decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{}) - err := decoder.Decode(repo) - if err != nil { -- if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") { -+ if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") || -+ strings.Contains(err.Error(), "invalid length of bytes for decoding time") { - // probably it is broken DB from go < 1.2, try decoding w/o time.Time - var repo11 struct { // nolint: maligned - UUID string -Index: aptly/deb/snapshot.go -=================================================================== ---- aptly.orig/deb/snapshot.go -+++ aptly/deb/snapshot.go -@@ -152,7 +152,8 @@ func (s *Snapshot) Decode(input []byte) - decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{}) - err := decoder.Decode(s) - if err != nil { -- if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") { -+ if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") || -+ strings.Contains(err.Error(), "invalid length of bytes for decoding time") { - // probably it is broken DB from go < 1.2, try decoding w/o time.Time - var snapshot11 struct { - UUID string diff --git a/debian/patches/series b/debian/patches/series index 7c73829d..2b7c0d33 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1 @@ -Fix-time.Time-msgpack-decoding-backwards-compatibili.patch - +0001-disable-swagger.patch