Skip to content

Commit aee9166

Browse files
authored
ghbackup: init at 1.13.0 (#346918)
2 parents 59f20fb + f3c7acc commit aee9166

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

maintainers/maintainer-list.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12193,6 +12193,11 @@
1219312193
github = "lenivaya";
1219412194
githubId = 49302467;
1219512195
};
12196+
lenny = {
12197+
name = "Lenny.";
12198+
matrix = "[email protected]";
12199+
keys = [ { fingerprint = "6D63 2D4D 0CFE 8D53 F5FD C7ED 738F C800 6E9E A634"; } ];
12200+
};
1219612201
leo248 = {
1219712202
github = "leo248";
1219812203
githubId = 95365184;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 9825efc51387fef14fdb184e7061b313a54fcb86 Mon Sep 17 00:00:00 2001
2+
From: Ronan Barrett <[email protected]>
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 <[email protected]>
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+
-

0 commit comments

Comments
 (0)