ghbackup: init at 1.13.0 Applied patch from https://github.com/voiapp/ghbackup/pull/1 to fix pagination.

lenny 1122e3a7 aa9dd15d

+110
+44
pkgs/by-name/gh/ghbackup/package.nix
···
··· 1 + { 2 + lib, 3 + buildGoModule, 4 + fetchFromGitHub, 5 + git, 6 + makeWrapper, 7 + }: 8 + 9 + buildGoModule rec { 10 + pname = "ghbackup"; 11 + version = "1.13.0"; 12 + 13 + src = fetchFromGitHub { 14 + owner = "qvl"; 15 + repo = "ghbackup"; 16 + rev = "v${version}"; 17 + hash = "sha256-3LSe805VrbUGjqjnhTJD2KBVZ4rq+4Z3l4d0I1MrBMA="; 18 + }; 19 + 20 + patches = [ ./patches/fix-next-page-logic.patch ]; 21 + 22 + postPatch = '' 23 + go mod init qvl.io/ghbackup 24 + ''; 25 + 26 + nativeBuildInputs = [ makeWrapper ]; 27 + 28 + vendorHash = null; 29 + 30 + postFixup = '' 31 + wrapProgram $out/bin/${meta.mainProgram} \ 32 + --prefix PATH : "${lib.makeBinPath [ git ]}" 33 + ''; 34 + 35 + doCheck = false; # tests want to actually download from github 36 + 37 + meta = with lib; { 38 + description = "Backup your GitHub repositories with a simple command-line application written in Go."; 39 + homepage = "https://github.com/qvl/ghbackup"; 40 + license = licenses.mit; 41 + mainProgram = "ghbackup"; 42 + maintainers = with maintainers; [ lenny ]; 43 + }; 44 + }
+66
pkgs/by-name/gh/ghbackup/patches/fix-next-page-logic.patch
···
··· 1 + From 9825efc51387fef14fdb184e7061b313a54fcb86 Mon Sep 17 00:00:00 2001 2 + From: Ronan Barrett <ronan.barrett@voiapp.io> 3 + Date: Mon, 8 May 2023 15:54:39 +0200 4 + Subject: [PATCH 1/2] fix next page logic 5 + 6 + --- 7 + ghbackup/fetch.go | 13 ++++++++++--- 8 + 1 file changed, 10 insertions(+), 3 deletions(-) 9 + 10 + diff --git a/ghbackup/fetch.go b/ghbackup/fetch.go 11 + index 93cce1c..bcef8ad 100644 12 + --- a/ghbackup/fetch.go 13 + +++ b/ghbackup/fetch.go 14 + @@ -126,11 +126,17 @@ func getNextURL(header http.Header) string { 15 + if len(parts) == 0 { 16 + return "" 17 + } 18 + - firstLink := parts[0] 19 + - if !strings.Contains(firstLink, "rel=\"next\"") { 20 + + var nextLink string 21 + + for _, v := range parts { 22 + + if strings.Contains(v, "rel=\"next\"") { 23 + + nextLink = strings.TrimSpace(v) 24 + + } 25 + + } 26 + + if nextLink == "" { 27 + return "" 28 + } 29 + - parts = strings.Split(firstLink, ";") 30 + + 31 + + parts = strings.Split(nextLink, ";") 32 + if len(parts) == 0 { 33 + return "" 34 + } 35 + @@ -140,3 +146,4 @@ func getNextURL(header http.Header) string { 36 + } 37 + return urlInBrackets[1 : len(urlInBrackets)-1] 38 + } 39 + + 40 + 41 + From 5f696939f668cd88c59c05fd8e0d6ad9f236dea5 Mon Sep 17 00:00:00 2001 42 + From: Ronan Barrett <ronan.barrett@voiapp.io> 43 + Date: Mon, 8 May 2023 16:44:47 +0200 44 + Subject: [PATCH 2/2] add break 45 + 46 + --- 47 + ghbackup/fetch.go | 2 +- 48 + 1 file changed, 1 insertion(+), 1 deletion(-) 49 + 50 + diff --git a/ghbackup/fetch.go b/ghbackup/fetch.go 51 + index bcef8ad..b045c38 100644 52 + --- a/ghbackup/fetch.go 53 + +++ b/ghbackup/fetch.go 54 + @@ -130,6 +130,7 @@ func getNextURL(header http.Header) string { 55 + for _, v := range parts { 56 + if strings.Contains(v, "rel=\"next\"") { 57 + nextLink = strings.TrimSpace(v) 58 + + break 59 + } 60 + } 61 + if nextLink == "" { 62 + @@ -146,4 +147,3 @@ func getNextURL(header http.Header) string { 63 + } 64 + return urlInBrackets[1 : len(urlInBrackets)-1] 65 + } 66 + -