summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Swanson2021-06-27 08:20:18 -0700
committerMike Swanson2021-06-27 08:20:18 -0700
commit32799edc7a1089f4848bfa6b2af5e24ee0a5aa3f (patch)
treea17b11ad143632ed29738399781ec21691ce604b
parentcef5704934ccde406eab9159cf80b953f3e9d5ed (diff)
downloadaur-32799edc7a1089f4848bfa6b2af5e24ee0a5aa3f.tar.gz
Backport a couple critical repotool fixes
-rw-r--r--.SRCINFO6
-rw-r--r--0001-Attempt-at-fixing-GitLab-issue-362-incremental-mirro.patch31
-rw-r--r--0002-Correct-erroneous-computation-of-remote-size-on-incr.patch81
-rw-r--r--PKGBUILD10
4 files changed, 124 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a7a7c37c1b13..0ebe4c6d8bf6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = reposurgeon
pkgdesc = Performs surgery on version control repositories.
pkgver = 4.27
- pkgrel = 1
+ pkgrel = 2
url = http://www.catb.org/esr/reposurgeon/
arch = x86_64
license = BSD
@@ -19,6 +19,10 @@ pkgbase = reposurgeon
optdepends = src
optdepends = subversion
source = https://gitlab.com/esr/reposurgeon/-/archive/4.27/reposurgeon-4.27.tar.gz
+ source = 0001-Attempt-at-fixing-GitLab-issue-362-incremental-mirro.patch
+ source = 0002-Correct-erroneous-computation-of-remote-size-on-incr.patch
b2sums = fa66c68e75595d074c24cd3dfd1c2d4288663e2dacedc6b45259fb006d4d87942b64b24dddeb507ff800c0c0637963238a9605e2c4971cfdcff4a7fe1f4e6e68
+ b2sums = 077bcbbf94385b47f855d449c47c7aac5e5fa9a5de9fcbbaf4ff8050f143af62be63a4a319f356af311fdeaa7a2e22f6863821c434b6fc31db7b0ae67f25b3ca
+ b2sums = a4a593f48624a835e1e18bbeac41d6c961ca87ca52769f3aae2bb5a3de096a31058f4531a2159d42a39940f4eb8174dbb4f1f8f9f7034fd40695462f026a850d
pkgname = reposurgeon
diff --git a/0001-Attempt-at-fixing-GitLab-issue-362-incremental-mirro.patch b/0001-Attempt-at-fixing-GitLab-issue-362-incremental-mirro.patch
new file mode 100644
index 000000000000..03b977001167
--- /dev/null
+++ b/0001-Attempt-at-fixing-GitLab-issue-362-incremental-mirro.patch
@@ -0,0 +1,31 @@
+From 6ab3a40666106c77e0685bf6053f53a2878cc85b Mon Sep 17 00:00:00 2001
+From: "Eric S. Raymond" <esr@thyrsus.com>
+Date: Thu, 10 Jun 2021 05:47:05 -0400
+Subject: [PATCH 1/2] Attempt at fixing GitLab issue #362: incremental
+ mirror...
+
+...fails because of SVN error.
+---
+ tool/repotool.go | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/tool/repotool.go b/tool/repotool.go
+index 376696e3..9145f9d4 100644
+--- a/tool/repotool.go
++++ b/tool/repotool.go
+@@ -479,6 +479,12 @@ func mirror(args []string) {
+ password := os.Getenv("RPASSWORD")
+ // Gets commit length of a repo from its URL
+ reposize := func(operand string) int {
++ if !strings.HasPrefix(operand, "svn://") && !strings.HasPrefix(operand, "file://") {
++ if operand[0] != '/' {
++ operand = "/" + operand
++ }
++ operand = "file://"
++ }
+ infoCredentials := ""
+ if username != "" {
+ infoCredentials = fmt.Sprintf("--username %q", username)
+--
+2.32.0
+
diff --git a/0002-Correct-erroneous-computation-of-remote-size-on-incr.patch b/0002-Correct-erroneous-computation-of-remote-size-on-incr.patch
new file mode 100644
index 000000000000..e2be3fb45041
--- /dev/null
+++ b/0002-Correct-erroneous-computation-of-remote-size-on-incr.patch
@@ -0,0 +1,81 @@
+From deee4526fe95277436fa14ee69d04712a2e5a082 Mon Sep 17 00:00:00 2001
+From: "Eric S. Raymond" <esr@thyrsus.com>
+Date: Thu, 10 Jun 2021 07:02:25 -0400
+Subject: [PATCH 2/2] Correct erroneous computation of remote size on
+ incremental mirroring.
+
+---
+ tool/repotool.go | 41 +++++++++++++++++++++++++++--------------
+ 1 file changed, 27 insertions(+), 14 deletions(-)
+
+diff --git a/tool/repotool.go b/tool/repotool.go
+index 9145f9d4..fb40eef4 100644
+--- a/tool/repotool.go
++++ b/tool/repotool.go
+@@ -477,7 +477,8 @@ func mirror(args []string) {
+ }
+ username := os.Getenv("RUSERNAME")
+ password := os.Getenv("RPASSWORD")
+- // Gets commit length of a repo from its URL
++ // Gets commit length of a Subversion repo from its URL. Can be run
++ // on a local mirror directory.
+ reposize := func(operand string) int {
+ if !strings.HasPrefix(operand, "svn://") && !strings.HasPrefix(operand, "file://") {
+ if operand[0] != '/' {
+@@ -539,28 +540,40 @@ func mirror(args []string) {
+ baton.Write([]byte{'\n'}) // Kludge, FIXME
+ }
+ baton.endProgress()
++ // Stash the remote URL in the mirror directory
++ // so that when mirroring incrementally we can query its size.
++ if ioutil.WriteFile(filepath.Join(locald, "REMOTE-URL"), []byte(operand), 0644) != nil {
++ log.Fatal("couldn't stash remote repository URL in REMOTE-URL")
++ }
+ } else if isdir(filepath.Join(operand, "locks")) {
+ if operand[0] == os.PathSeparator {
+ locald = operand
+ } else {
+ locald = filepath.Join(pwd, operand)
+ }
+- baton := newBaton(!quiet, func(s string) {})
+- remotesize := reposize(operand)
+- localsize := reposize(fmt.Sprintf("file://%s", locald))
+- baton.startProgress("Mirroring", uint64(remotesize-localsize))
+ cmd := fmt.Sprintf("svnsync synchronize -q --steal-lock file://%s", locald)
+- ind := 0
+- runMonitoredProcessOrDie(cmd, "mirroring", func(line string) {
+- if strings.Contains(line, "Committed revision") {
+- ind++
+- baton.percentProgress(uint64(ind))
++ if remote, err := ioutil.ReadFile(filepath.Join(locald, "REMOTE-URL")); err != nil {
++ // Without the stashed remote size we can't progress-meter
++ runShellProcessOrDie(cmd, "mirroring")
++ } else {
++ // Have remote size, we can progress-meter,
++ // this makes long resyncs more bearable.
++ baton := newBaton(!quiet, func(s string) {})
++ remotesize := reposize(string(remote))
++ localsize := reposize(locald)
++ baton.startProgress("Mirroring", uint64(remotesize-localsize))
++ ind := 0
++ runMonitoredProcessOrDie(cmd, "mirroring", func(line string) {
++ if strings.Contains(line, "Committed revision") {
++ ind++
++ baton.percentProgress(uint64(ind))
++ }
++ })
++ if !quiet {
++ baton.Write([]byte{'\n'}) // Kludge, FIXME
+ }
+- })
+- if !quiet {
+- baton.Write([]byte{'\n'}) // Kludge, FIXME
++ baton.endProgress()
+ }
+- baton.endProgress()
+ } else if strings.HasPrefix(operand, "rsync://") {
+ if mirrordir == "" {
+ locald = filepath.Join(pwd, filepath.Base(operand)+"-mirror")
+--
+2.32.0
+
diff --git a/PKGBUILD b/PKGBUILD
index a59f669b4356..d32f980e57e9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
pkgname=reposurgeon
pkgver=4.27
-pkgrel=1
+pkgrel=2
pkgdesc="Performs surgery on version control repositories."
arch=('x86_64')
url="http://www.catb.org/esr/$pkgname/"
@@ -17,8 +17,12 @@ optdepends=('bitkeeper'
'mercurial'
'src'
'subversion')
-source=("https://gitlab.com/esr/$pkgname/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
-b2sums=('fa66c68e75595d074c24cd3dfd1c2d4288663e2dacedc6b45259fb006d4d87942b64b24dddeb507ff800c0c0637963238a9605e2c4971cfdcff4a7fe1f4e6e68')
+source=("https://gitlab.com/esr/$pkgname/-/archive/$pkgver/$pkgname-$pkgver.tar.gz"
+ 0001-Attempt-at-fixing-GitLab-issue-362-incremental-mirro.patch
+ 0002-Correct-erroneous-computation-of-remote-size-on-incr.patch)
+b2sums=('fa66c68e75595d074c24cd3dfd1c2d4288663e2dacedc6b45259fb006d4d87942b64b24dddeb507ff800c0c0637963238a9605e2c4971cfdcff4a7fe1f4e6e68'
+ '077bcbbf94385b47f855d449c47c7aac5e5fa9a5de9fcbbaf4ff8050f143af62be63a4a319f356af311fdeaa7a2e22f6863821c434b6fc31db7b0ae67f25b3ca'
+ 'a4a593f48624a835e1e18bbeac41d6c961ca87ca52769f3aae2bb5a3de096a31058f4531a2159d42a39940f4eb8174dbb4f1f8f9f7034fd40695462f026a850d')
prepare() {
cd "$pkgbase-$pkgver"