From 1122e3a74f43aba87e55a6a3bc6af027ff602015 Mon Sep 17 00:00:00 2001 From: lenny Date: Sun, 3 Nov 2024 14:29:45 +0100 Subject: [PATCH 1/2] ghbackup: init at 1.13.0 Applied patch from https://github.com/voiapp/ghbackup/pull/1 to fix pagination. --- pkgs/by-name/gh/ghbackup/package.nix | 44 +++++++++++++ .../patches/fix-next-page-logic.patch | 66 +++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 pkgs/by-name/gh/ghbackup/package.nix create mode 100644 pkgs/by-name/gh/ghbackup/patches/fix-next-page-logic.patch diff --git a/pkgs/by-name/gh/ghbackup/package.nix b/pkgs/by-name/gh/ghbackup/package.nix new file mode 100644 index 0000000000000..4bdacd3044eb5 --- /dev/null +++ b/pkgs/by-name/gh/ghbackup/package.nix @@ -0,0 +1,44 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + git, + makeWrapper, +}: + +buildGoModule rec { + pname = "ghbackup"; + version = "1.13.0"; + + src = fetchFromGitHub { + owner = "qvl"; + repo = "ghbackup"; + rev = "v${version}"; + hash = "sha256-3LSe805VrbUGjqjnhTJD2KBVZ4rq+4Z3l4d0I1MrBMA="; + }; + + patches = [ ./patches/fix-next-page-logic.patch ]; + + postPatch = '' + go mod init qvl.io/ghbackup + ''; + + nativeBuildInputs = [ makeWrapper ]; + + vendorHash = null; + + postFixup = '' + wrapProgram $out/bin/${meta.mainProgram} \ + --prefix PATH : "${lib.makeBinPath [ git ]}" + ''; + + doCheck = false; # tests want to actually download from github + + meta = with lib; { + description = "Backup your GitHub repositories with a simple command-line application written in Go."; + homepage = "https://github.com/qvl/ghbackup"; + license = licenses.mit; + mainProgram = "ghbackup"; + maintainers = with maintainers; [ lenny ]; + }; +} diff --git a/pkgs/by-name/gh/ghbackup/patches/fix-next-page-logic.patch b/pkgs/by-name/gh/ghbackup/patches/fix-next-page-logic.patch new file mode 100644 index 0000000000000..346807a3a6d0d --- /dev/null +++ b/pkgs/by-name/gh/ghbackup/patches/fix-next-page-logic.patch @@ -0,0 +1,66 @@ +From 9825efc51387fef14fdb184e7061b313a54fcb86 Mon Sep 17 00:00:00 2001 +From: Ronan Barrett +Date: Mon, 8 May 2023 15:54:39 +0200 +Subject: [PATCH 1/2] fix next page logic + +--- + ghbackup/fetch.go | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/ghbackup/fetch.go b/ghbackup/fetch.go +index 93cce1c..bcef8ad 100644 +--- a/ghbackup/fetch.go ++++ b/ghbackup/fetch.go +@@ -126,11 +126,17 @@ func getNextURL(header http.Header) string { + if len(parts) == 0 { + return "" + } +- firstLink := parts[0] +- if !strings.Contains(firstLink, "rel=\"next\"") { ++ var nextLink string ++ for _, v := range parts { ++ if strings.Contains(v, "rel=\"next\"") { ++ nextLink = strings.TrimSpace(v) ++ } ++ } ++ if nextLink == "" { + return "" + } +- parts = strings.Split(firstLink, ";") ++ ++ parts = strings.Split(nextLink, ";") + if len(parts) == 0 { + return "" + } +@@ -140,3 +146,4 @@ func getNextURL(header http.Header) string { + } + return urlInBrackets[1 : len(urlInBrackets)-1] + } ++ + +From 5f696939f668cd88c59c05fd8e0d6ad9f236dea5 Mon Sep 17 00:00:00 2001 +From: Ronan Barrett +Date: Mon, 8 May 2023 16:44:47 +0200 +Subject: [PATCH 2/2] add break + +--- + ghbackup/fetch.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ghbackup/fetch.go b/ghbackup/fetch.go +index bcef8ad..b045c38 100644 +--- a/ghbackup/fetch.go ++++ b/ghbackup/fetch.go +@@ -130,6 +130,7 @@ func getNextURL(header http.Header) string { + for _, v := range parts { + if strings.Contains(v, "rel=\"next\"") { + nextLink = strings.TrimSpace(v) ++ break + } + } + if nextLink == "" { +@@ -146,4 +147,3 @@ func getNextURL(header http.Header) string { + } + return urlInBrackets[1 : len(urlInBrackets)-1] + } +- From f3c7acc49f9e8d8a3cf3aa9be92b2ef47a5b9830 Mon Sep 17 00:00:00 2001 From: lenny Date: Sun, 3 Nov 2024 14:30:42 +0100 Subject: [PATCH 2/2] maintainers: add lenny --- maintainers/maintainer-list.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 638ef6ea71259..8c1b474b231b1 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -12193,6 +12193,11 @@ github = "lenivaya"; githubId = 49302467; }; + lenny = { + name = "Lenny."; + matrix = "lenny@flipdot.org"; + keys = [ { fingerprint = "6D63 2D4D 0CFE 8D53 F5FD C7ED 738F C800 6E9E A634"; } ]; + }; leo248 = { github = "leo248"; githubId = 95365184;