From 7e1d37bc765c24ebe0ab4238f8192c8c377dddce Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 16 Nov 2022 16:18:31 +0100
Subject: [PATCH] swh-loader-svn: Build rsvndump dependency

This creates a new utility image holding the rsvndump pushed in the gitlab registry.

And then adapts the svn loader image to expose that new dependency tool [1]. That will
allow development to use rsvndump instead of svnrdump.

[1]
```
$ docker build -t swh-loader-svn .
$ docker run -ti --rm --user root --entrypoint rsvndump swh-loader-svn --version
rsvndump 0.6.1
Copyright (C) 2008-present Jonas Gehring <jonas@jgehring.net>
Released under the GNU General Public License.
```
---
 apps/swh-loader-svn/Dockerfile |  7 ++++++-
 utilities/rsvndump/Dockerfile  | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 utilities/rsvndump/Dockerfile

diff --git a/apps/swh-loader-svn/Dockerfile b/apps/swh-loader-svn/Dockerfile
index 1c828d1a8..80b1e520f 100644
--- a/apps/swh-loader-svn/Dockerfile
+++ b/apps/swh-loader-svn/Dockerfile
@@ -1,5 +1,10 @@
-# Deeply inspired from the Dockerfile of the swh-graph project
+# ARG REGISTRY=container-registry.softwareheritage.org/infra/swh-apps/
+ARG REGISTRY=container-registry.softwareheritage.org/infra/swh-apps/
+ARG RSVNDUMP=/usr/local/bin/rsvndump
+
+FROM ${REGISTRY}rsvndump-base:latest AS rsvndump_image
 FROM python:3.10-bullseye
+COPY --from=rsvndump_image ${RSVNDUMP} ${RSVNDUMP}
 
 RUN apt-get -y update && \
     apt-get -y upgrade && \
diff --git a/utilities/rsvndump/Dockerfile b/utilities/rsvndump/Dockerfile
new file mode 100644
index 000000000..7ed967953
--- /dev/null
+++ b/utilities/rsvndump/Dockerfile
@@ -0,0 +1,17 @@
+# Build svnrdump
+FROM debian:bullseye AS rsvndump
+ARG VERSION=0.6.1
+ARG TARBALL_NAME=rsvndump-${VERSION}
+ARG TARBALL=${TARBALL_NAME}.tar.gz
+ARG SHA512SUM=36167a9e56c4be543ef223dee475a686207b0595cd587f8c8e1ad4fb6144b6c4a734d17ff0024040b8691a2c84a3dc66cba32e91942d196fd1137943acb81879
+ARG CHECKSUMS=${TARBALL}.sha512
+RUN apt-get -y update && \
+    apt-get -y upgrade && \
+    apt-get install -y build-essential wget coreutils
+RUN wget https://sourceforge.net/projects/rsvndump/files/rsvndump/${TARBALL_NAME}/${TARBALL}/download -O ${TARBALL}
+RUN echo "${SHA512SUM}  ${TARBALL}" > ${CHECKSUMS}
+RUN sha512sum -c ${CHECKSUMS}
+RUN tar xvf $TARBALL -C /tmp/
+RUN apt-get -y install libapr1-dev libaprutil1-dev libsvn-dev
+WORKDIR /tmp/${TARBALL_NAME}
+RUN ./configure && make && make install
-- 
GitLab