From 4fbebfd39169c5ba02bc96961a55af8e1e558f4b Mon Sep 17 00:00:00 2001
From: Levente Polyak <anthraxx@archlinux.org>
Date: Sat, 2 Dec 2023 02:40:27 +0100
Subject: [PATCH] chore(cleanup): remove all functionality for SVN

Fixes #48

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
---
 config                     |   5 -
 config.local.git           |   3 -
 config.local.svn-community |  16 ---
 config.local.svn-packages  |  16 ---
 db-functions               | 274 ++++++++++++++++++++++++++++++++++++-
 db-functions-git           | 273 ------------------------------------
 db-functions-svn           | 106 --------------
 db-update                  |   2 +-
 test/lib/common.bash       |   1 -
 9 files changed, 273 insertions(+), 423 deletions(-)
 delete mode 100644 config.local.svn-community
 delete mode 100644 config.local.svn-packages
 delete mode 100644 db-functions-git
 delete mode 100644 db-functions-svn

diff --git a/config b/config
index ae2fb6a..842d684 100644
--- a/config
+++ b/config
@@ -15,11 +15,6 @@ STABLE_REPOS=()
 STABILITY_LAYERS=(stable testing staging unstable)
 declare -A ACL=()
 
-# VCS backend
-VCS=svn
-SVNREPO=''
-SVNUSER=''
-
 CLEANUP_DESTDIR="/var/tmp"
 CLEANUP_DRYRUN=false
 # Time in days to keep moved packages
diff --git a/config.local.git b/config.local.git
index a17a8ee..8ea89ab 100644
--- a/config.local.git
+++ b/config.local.git
@@ -1,7 +1,5 @@
 #!/hint/bash
 
-VCS=git
-
 PKGREPOS=(
 	core core-staging core-testing
 	extra extra-staging extra-testing
@@ -65,7 +63,6 @@ TMPDIR="/srv/repos/git-packages/tmp"
 KEYRING="/etc/pacman.d/gnupg"
 GIT_PACKAGING_REPOS_URL="https://gitlab.archlinux.org/archlinux/packaging/packages"
 GIT_STATE_REPO="/srv/repos/state"
-GITUSER=""
 
 GIT_PACKAGES_CACHE="/srv/repos/pkg-cache"
 LOCK_DIR="/srv/repos/lock"
diff --git a/config.local.svn-community b/config.local.svn-community
deleted file mode 100644
index 06c9f89..0000000
--- a/config.local.svn-community
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/hint/bash
-
-PKGREPOS=('community' 'community-testing' 'community-staging' 'multilib' 'multilib-testing' 'multilib-staging')
-DEBUGREPOS=('community-debug' 'community-testing-debug' 'community-staging-debug' 'multilib-debug' 'multilib-testing-debug' 'multilib-staging-debug')
-PKGPOOL='pool/community'
-DEBUGPKGPOOL='pool/community-debug'
-SRCPOOL='sources/community'
-SVNREPO='file:///srv/repos/svn-community/svn'
-SVNUSER='svn-community'
-STAGING_REPOS=('community-staging' 'multilib-staging')
-TESTING_REPOS=('community-testing' 'multilib-testing')
-STABLE_REPOS=('community')
-
-CLEANUP_DESTDIR="/srv/repos/svn-community/package-cleanup"
-SOURCE_CLEANUP_DESTDIR="/srv/repos/svn-community/source-cleanup"
-TMPDIR="/srv/repos/svn-community/tmp"
diff --git a/config.local.svn-packages b/config.local.svn-packages
deleted file mode 100644
index 250522a..0000000
--- a/config.local.svn-packages
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/hint/bash
-
-PKGREPOS=('core' 'extra' 'testing' 'staging' 'kde-unstable' 'gnome-unstable')
-DEBUGREPOS=('core-debug' 'extra-debug' 'testing-debug' 'staging-debug' 'kde-unstable-debug' 'gnome-unstable-debug')
-PKGPOOL='pool/packages'
-DEBUGPKGPOOL='pool/packages-debug'
-SRCPOOL='sources/packages'
-SVNREPO='file:///srv/repos/svn-packages/svn'
-SVNUSER='svn-packages'
-STAGING_REPOS=('staging')
-TESTING_REPOS=('testing')
-STABLE_REPOS=('core' 'extra')
-
-CLEANUP_DESTDIR="/srv/repos/svn-packages/package-cleanup"
-SOURCE_CLEANUP_DESTDIR="/srv/repos/svn-packages/source-cleanup"
-TMPDIR="/srv/repos/svn-packages/tmp"
diff --git a/db-functions b/db-functions
index c0f3cc0..0aad4d7 100644
--- a/db-functions
+++ b/db-functions
@@ -499,7 +499,7 @@ check_pkgvcs() {
 
 	# check if the VCS pkgver equals the package file pkgver
 	if [[ "${vcsver}" != "${_pkgver}" ]]; then
-		error "VCS pkgver %s does not equal package pkgver %s" "${vcsver}" "${_pkgver}"
+		error "PKGBUILD pkgver %s does not equal package pkgver %s" "${vcsver}" "${_pkgver}"
 		return 1
 	fi
 
@@ -1003,4 +1003,274 @@ function array_append() {
 }
 
 
-. "$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")/db-functions-${VCS}"
+if [[ -n ${GITUSER} ]]; then
+	setfacl -m u:"${GITUSER}":rwx "${WORKDIR}"
+	setfacl -m d:u:"${USER}":rwx "${WORKDIR}"
+	setfacl -m d:u:"${GITUSER}":rwx "${WORKDIR}"
+fi
+
+# unset any behavior influencing environment variables
+# https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables
+while read -r var; do
+	unset "${var}";
+done < <(env | grep -E '^GIT' | awk -F= '{print $1}')
+unset PREFIX
+unset EMAIL
+
+
+# Converts from the PKGBUILD tag to the git repository tag
+# Input     1:1.0~0-1
+# Output    1-1.0.0-1
+gittag_from_pkgver() {
+	local pkgver="$1"
+	local gittag
+	gittag="${pkgver/:/-}"
+	gittag="${gittag//\~/.}"
+	printf "%s" "${gittag}"
+}
+
+arch_git() {
+	if [[ -z ${GITUSER} ]]; then
+		/usr/bin/git "${@}"
+	else
+		sudo -u "${GITUSER}" -- /usr/bin/git "${@}"
+	fi
+}
+
+# Convert arbitrary project names to GitLab valid path names.
+#
+# GitLab has several limitations on project and group names and also maintains
+# a list of reserved keywords as documented on their docs.
+# https://docs.gitlab.com/ee/user/reserved_names.html
+#
+# 1. replace single '+' between word boundaries with '-'
+# 2. replace any other '+' with literal 'plus'
+# 3. replace any special chars other than '_', '-' and '.' with '-'
+# 4. replace consecutive '_-' chars with a single '-'
+# 5. replace 'tree' with 'unix-tree' due to GitLab reserved keyword
+gitlab_project_name_to_path() {
+	local name=$1
+	printf "%s" "${name}" \
+		| sed -E 's/([a-zA-Z0-9]+)\+([a-zA-Z]+)/\1-\2/g' \
+		| sed -E 's/\+/plus/g' \
+		| sed -E 's/[^a-zA-Z0-9_\-\.]/-/g' \
+		| sed -E 's/[_\-]{2,}/-/g' \
+		| sed -E 's/^tree$/unix-tree/g'
+}
+
+# Fetch the package sources into a global cache
+fetch_pkgbuild() {
+	local pkgbase="${1}"
+	local project_path src target lock_file
+
+	project_path=$(gitlab_project_name_to_path "${pkgbase}")
+	src="${GIT_PACKAGING_REPOS_URL}/${project_path}.git"
+	target="${GIT_PACKAGES_CACHE}/${pkgbase}"
+
+	# avoid git operations asking for terminal input
+	export GIT_TERMINAL_PROMPT=0
+
+	# double checked locking for fresh clones
+	if [[ ! -d $target ]]; then
+		lock_file="${LOCK_DIR}/clone-${pkgbase}.lock"
+		lock "${lock_file}" "Locking git clone for ${pkgbase}"
+		if [[ ! -d $target ]]; then
+			if ! arch_git -c core.sharedRepository=group clone --origin origin --bare --mirror "${src}" "${target}"; then
+				unlock "${lock_file}"
+				return 1
+			fi
+			unlock "${lock_file}"
+			return 0
+		fi
+		unlock "${lock_file}"
+	fi
+
+	lock_file="${target}/.git/dbscripts.lock"
+	lock "${lock_file}" "Locking git repo ${pkgbase}"
+	if ! arch_git -C "${target}" fetch --prune --prune-tags; then
+		unlock "${lock_file}"
+		return 1
+	fi
+	unlock "${lock_file}"
+
+	return 0
+}
+
+git_tag_exists() {
+	local pkgbase="$1"
+	local tag="$2"
+	local path="${GIT_PACKAGES_CACHE}/${pkgbase}"
+
+	tag=$(gittag_from_pkgver "${tag}")
+
+	if [[ ! -d "${path}" ]]; then
+		return 1
+	fi
+
+	if ! git -C "${path}" rev-parse --quiet --verify --end-of-options "${tag}^{tag}" -- &>/dev/null; then
+		return 1
+	fi
+
+	return 0
+}
+
+
+# Source the PKGBUILD from the package's git/svn/whatever repo.
+source_pkgbuild() {
+	local pkgbase="$1"
+	local tag=$(gittag_from_pkgver "${2}")
+
+	. <(arch_git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" show "${tag}":PKGBUILD 2>/dev/null || echo false)
+}
+
+# Export PKGBUILD resource following the same rules as source_pkgbuild()
+export_from_vcs() {
+	local pkgbase="$1"
+	local tag=$(gittag_from_pkgver "${2}")
+	local dest="$3"
+
+	if [[ ! -e ${dest} ]]; then
+		mkdir -p "${dest}"
+		arch_git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" archive "$tag" | bsdtar -xf - -C "${dest}"
+	fi
+}
+
+# Which repo is this package in?
+find_repo_for_package() {
+	local pkgbase=${1}
+	local pkgarch=${2}
+	local candidates=("${@:3}")
+
+	local repos=($(arch_git -C "${GIT_STATE_REPO}" ls-files "*/$pkgbase" | \
+		awk -F/ '{print $1}' | \
+		grep --line-regexp --fixed-strings --file \
+			<(printf "%s\n" "${candidates[@]/%/-${pkgarch}}" "${candidates[@]/%/-any}")))
+
+	if (( ${#repos[@]} > 1 )); then
+		die "%s is present in multiple repos (%s)" "${pkgbase}" "${repos[*]}"
+	fi
+	(( ${#repos[@]} == 1 )) || return $?
+
+	printf '%s\n' "${repos[@]%/}"
+}
+
+# Get the current pkgver from a given repo
+pkgver_from_state_repo() {
+	local pkgbase=${1}
+	local repo=${2}
+	property_from_state_repo "${pkgbase}" "${repo}" 2
+}
+
+# Get the current git tag name from a given repo
+gittag_from_state_repo() {
+	local pkgbase=${1}
+	local repo=${2}
+	property_from_state_repo "${pkgbase}" "${repo}" 3
+}
+
+# Get the given property position from a given repo
+property_from_state_repo() {
+	local pkgbase=${1}
+	local repo=${2}
+	local prop=${3}
+	awk '{print $'"${prop}"'}' "${GIT_STATE_REPO}/${repo}/${pkgbase}" 2>/dev/null || return 1
+}
+
+# Commit changes staged by (successive?) vcs_(re)?move_package runs.
+#
+# Caller contract:
+# - Requires the caller to hold a lock for the transaction on fd 8 "${GIT_STATE_REPO}/.git/dbscripts.lock"
+vcs_commit() {
+	local commit_message=$1
+	local username author name email
+
+	if ! username=$(/usr/bin/id -un); then
+		die "Failed to get username from 'id'"
+	fi
+	if ! author=$(grep -E " ${username}\$" "${AUTHORS}"); then
+		die "Missing author information for %s in '%s'" "${username}" "${AUTHORS}"
+	fi
+	if ! name=$(echo "${author}"|sed -E 's/(.+) (<.+>) .+/\1/'); then
+		die "Failed to extract name from author line"
+	fi
+	if ! email=$(echo "${author}"|sed -E 's/(.+) (<.+>) .+/\2/'); then
+		die "Failed to extract email from author line"
+	fi
+
+	export GIT_AUTHOR_NAME="${name}"
+	export GIT_AUTHOR_EMAIL="${email}"
+	export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
+	export GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL}
+
+	unset GIT_AUTHOR_DATE
+	unset GIT_COMMITTER_DATE
+
+	arch_git \
+		-c user.name="${name}" \
+		-c user.email="${email}" \
+		-C "${GIT_STATE_REPO}" \
+		commit \
+		--no-gpg-sign \
+		--message="${commit_message}"
+}
+
+
+vcs_update_package() {
+	local pkgbase="$1"
+	local pkgver="$2"
+	local dest="$3"
+	local gittag
+	local lock_file
+
+	gittag="$(gittag_from_pkgver "${pkgver}")"
+
+	lock_file="${GIT_STATE_REPO}/.git/dbscripts.lock"
+	lock "${lock_file}" "Locking state repo"
+
+	mkdir -p "${GIT_STATE_REPO}/${dest}"
+	printf '%s %s %s %s\n' \
+		"${pkgbase}" \
+		"${pkgver}" \
+		"${gittag}" \
+		"$(git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" rev-parse "${gittag}")" \
+		> "${GIT_STATE_REPO}/${dest}/${pkgbase}"
+
+	arch_git -C "${GIT_STATE_REPO}" add "${GIT_STATE_REPO}/${dest}/${pkgbase}"
+	vcs_commit "update ${pkgbase} to ${pkgver} in ${dest}"
+
+	unlock "${lock_file}"
+}
+
+# Write to the VCS in order to track a package moving between different pacman
+# repositories.
+vcs_move_package() {
+	local pkgbase=${1}
+	local vcsrepo_from=${2}
+	local vcsrepo_to=${3}
+	local lock_file
+
+	lock_file="${GIT_STATE_REPO}/.git/dbscripts.lock"
+	lock "${lock_file}" "Locking state repo"
+
+	mkdir -p "${GIT_STATE_REPO}/${vcsrepo_to}"
+	arch_git -C "${GIT_STATE_REPO}" mv --force "${vcsrepo_from}/${pkgbase}" "${vcsrepo_to}/${pkgbase}"
+	vcs_commit "move ${pkgbase} from ${vcsrepo_from} to ${vcsrepo_to}"
+
+	unlock "${lock_file}"
+}
+
+# Write to the VCS in order to track a package being deleted from a pacman
+# repository.
+vcs_remove_package() {
+	local pkgbase=${1}
+	local vcsrepo=${2}
+	local lock_file
+
+	lock_file="${GIT_STATE_REPO}/.git/dbscripts.lock"
+	lock "${lock_file}" "Locking state repo"
+
+	arch_git -C "${GIT_STATE_REPO}" rm "${vcsrepo}/${pkgbase}"
+	vcs_commit "remove ${pkgbase} from ${vcsrepo}"
+
+	unlock "${lock_file}"
+}
diff --git a/db-functions-git b/db-functions-git
deleted file mode 100644
index 6dd7b36..0000000
--- a/db-functions-git
+++ /dev/null
@@ -1,273 +0,0 @@
-#!/hint/bash
-
-if [[ -n ${GITUSER} ]]; then
-	setfacl -m u:"${GITUSER}":rwx "${WORKDIR}"
-	setfacl -m d:u:"${USER}":rwx "${WORKDIR}"
-	setfacl -m d:u:"${GITUSER}":rwx "${WORKDIR}"
-fi
-
-# unset any behavior influencing environment variables
-# https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables
-while read -r var; do
-	unset "${var}";
-done < <(env | grep -E '^GIT' | awk -F= '{print $1}')
-unset PREFIX
-unset EMAIL
-
-
-# Converts from the PKGBUILD tag to the git repository tag
-# Input     1:1.0~0-1
-# Output    1-1.0.0-1
-gittag_from_pkgver() {
-	local pkgver="$1"
-	local gittag
-	gittag="${pkgver/:/-}"
-	gittag="${gittag//\~/.}"
-	printf "%s" "${gittag}"
-}
-
-arch_git() {
-	if [[ -z ${GITUSER} ]]; then
-		/usr/bin/git "${@}"
-	else
-		sudo -u "${GITUSER}" -- /usr/bin/git "${@}"
-	fi
-}
-
-# Convert arbitrary project names to GitLab valid path names.
-#
-# GitLab has several limitations on project and group names and also maintains
-# a list of reserved keywords as documented on their docs.
-# https://docs.gitlab.com/ee/user/reserved_names.html
-#
-# 1. replace single '+' between word boundaries with '-'
-# 2. replace any other '+' with literal 'plus'
-# 3. replace any special chars other than '_', '-' and '.' with '-'
-# 4. replace consecutive '_-' chars with a single '-'
-# 5. replace 'tree' with 'unix-tree' due to GitLab reserved keyword
-gitlab_project_name_to_path() {
-	local name=$1
-	printf "%s" "${name}" \
-		| sed -E 's/([a-zA-Z0-9]+)\+([a-zA-Z]+)/\1-\2/g' \
-		| sed -E 's/\+/plus/g' \
-		| sed -E 's/[^a-zA-Z0-9_\-\.]/-/g' \
-		| sed -E 's/[_\-]{2,}/-/g' \
-		| sed -E 's/^tree$/unix-tree/g'
-}
-
-# Fetch the package sources into a global cache
-fetch_pkgbuild() {
-	local pkgbase="${1}"
-	local project_path src target lock_file
-
-	project_path=$(gitlab_project_name_to_path "${pkgbase}")
-	src="${GIT_PACKAGING_REPOS_URL}/${project_path}.git"
-	target="${GIT_PACKAGES_CACHE}/${pkgbase}"
-
-	# avoid git operations asking for terminal input
-	export GIT_TERMINAL_PROMPT=0
-
-	# double checked locking for fresh clones
-	if [[ ! -d $target ]]; then
-		lock_file="${LOCK_DIR}/clone-${pkgbase}.lock"
-		lock "${lock_file}" "Locking git clone for ${pkgbase}"
-		if [[ ! -d $target ]]; then
-			if ! arch_git -c core.sharedRepository=group clone --origin origin --bare --mirror "${src}" "${target}"; then
-				unlock "${lock_file}"
-				return 1
-			fi
-			unlock "${lock_file}"
-			return 0
-		fi
-		unlock "${lock_file}"
-	fi
-
-	lock_file="${target}/.git/dbscripts.lock"
-	lock "${lock_file}" "Locking git repo ${pkgbase}"
-	if ! arch_git -C "${target}" fetch --prune --prune-tags; then
-		unlock "${lock_file}"
-		return 1
-	fi
-	unlock "${lock_file}"
-
-	return 0
-}
-
-git_tag_exists() {
-	local pkgbase="$1"
-	local tag="$2"
-	local path="${GIT_PACKAGES_CACHE}/${pkgbase}"
-
-	tag=$(gittag_from_pkgver "${tag}")
-
-	if [[ ! -d "${path}" ]]; then
-		return 1
-	fi
-
-	if ! git -C "${path}" rev-parse --quiet --verify --end-of-options "${tag}^{tag}" -- &>/dev/null; then
-		return 1
-	fi
-
-	return 0
-}
-
-
-# Source the PKGBUILD from the package's git/svn/whatever repo.
-source_pkgbuild() {
-	local pkgbase="$1"
-	local tag=$(gittag_from_pkgver "${2}")
-
-	. <(arch_git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" show "${tag}":PKGBUILD 2>/dev/null || echo false)
-}
-
-# Export PKGBUILD resource following the same rules as source_pkgbuild()
-export_from_vcs() {
-	local pkgbase="$1"
-	local tag=$(gittag_from_pkgver "${2}")
-	local dest="$3"
-	
-	if [[ ! -e ${dest} ]]; then
-		mkdir -p "${dest}"
-		arch_git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" archive "$tag" | bsdtar -xf - -C "${dest}"
-	fi
-}
-
-# Which repo is this package in?
-find_repo_for_package() {
-	local pkgbase=${1}
-	local pkgarch=${2}
-	local candidates=("${@:3}")
-
-	local repos=($(arch_git -C "${GIT_STATE_REPO}" ls-files "*/$pkgbase" | \
-		awk -F/ '{print $1}' | \
-		grep --line-regexp --fixed-strings --file \
-			<(printf "%s\n" "${candidates[@]/%/-${pkgarch}}" "${candidates[@]/%/-any}")))
-
-	if (( ${#repos[@]} > 1 )); then
-		die "%s is present in multiple repos (%s)" "${pkgbase}" "${repos[*]}"
-	fi
-	(( ${#repos[@]} == 1 )) || return $?
-
-	printf '%s\n' "${repos[@]%/}"
-}
-
-# Get the current pkgver from a given repo
-pkgver_from_state_repo() {
-	local pkgbase=${1}
-	local repo=${2}
-	property_from_state_repo "${pkgbase}" "${repo}" 2
-}
-
-# Get the current git tag name from a given repo
-gittag_from_state_repo() {
-	local pkgbase=${1}
-	local repo=${2}
-	property_from_state_repo "${pkgbase}" "${repo}" 3
-}
-
-# Get the given property position from a given repo
-property_from_state_repo() {
-	local pkgbase=${1}
-	local repo=${2}
-	local prop=${3}
-	awk '{print $'"${prop}"'}' "${GIT_STATE_REPO}/${repo}/${pkgbase}" 2>/dev/null || return 1
-}
-
-# Commit changes staged by (successive?) vcs_(re)?move_package runs.
-#
-# Caller contract:
-# - Requires the caller to hold a lock for the transaction on fd 8 "${GIT_STATE_REPO}/.git/dbscripts.lock"
-vcs_commit() {
-	local commit_message=$1
-	local username author name email
-
-	if ! username=$(/usr/bin/id -un); then
-		die "Failed to get username from 'id'"
-	fi
-	if ! author=$(grep -E " ${username}\$" "${AUTHORS}"); then
-		die "Missing author information for %s in '%s'" "${username}" "${AUTHORS}"
-	fi
-	if ! name=$(echo "${author}"|sed -E 's/(.+) (<.+>) .+/\1/'); then
-		die "Failed to extract name from author line"
-	fi
-	if ! email=$(echo "${author}"|sed -E 's/(.+) (<.+>) .+/\2/'); then
-		die "Failed to extract email from author line"
-	fi
-
-	export GIT_AUTHOR_NAME="${name}"
-	export GIT_AUTHOR_EMAIL="${email}"
-	export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
-	export GIT_COMMITTER_EMAIL=${GIT_AUTHOR_EMAIL}
-
-	unset GIT_AUTHOR_DATE
-	unset GIT_COMMITTER_DATE
-
-	arch_git \
-		-c user.name="${name}" \
-		-c user.email="${email}" \
-		-C "${GIT_STATE_REPO}" \
-		commit \
-		--no-gpg-sign \
-		--message="${commit_message}"
-}
-
-
-vcs_update_package() {
-	local pkgbase="$1"
-	local pkgver="$2"
-	local dest="$3"
-	local gittag
-	local lock_file
-
-	gittag="$(gittag_from_pkgver "${pkgver}")"
-
-	lock_file="${GIT_STATE_REPO}/.git/dbscripts.lock"
-	lock "${lock_file}" "Locking state repo"
-
-	mkdir -p "${GIT_STATE_REPO}/${dest}"
-	printf '%s %s %s %s\n' \
-		"${pkgbase}" \
-		"${pkgver}" \
-		"${gittag}" \
-		"$(git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" rev-parse "${gittag}")" \
-		> "${GIT_STATE_REPO}/${dest}/${pkgbase}"
-
-	arch_git -C "${GIT_STATE_REPO}" add "${GIT_STATE_REPO}/${dest}/${pkgbase}"
-	vcs_commit "update ${pkgbase} to ${pkgver} in ${dest}"
-
-	unlock "${lock_file}"
-}
-
-# Write to the VCS in order to track a package moving between different pacman
-# repositories.
-vcs_move_package() {
-	local pkgbase=${1}
-	local vcsrepo_from=${2}
-	local vcsrepo_to=${3}
-	local lock_file
-
-	lock_file="${GIT_STATE_REPO}/.git/dbscripts.lock"
-	lock "${lock_file}" "Locking state repo"
-
-	mkdir -p "${GIT_STATE_REPO}/${vcsrepo_to}"
-	arch_git -C "${GIT_STATE_REPO}" mv --force "${vcsrepo_from}/${pkgbase}" "${vcsrepo_to}/${pkgbase}"
-	vcs_commit "move ${pkgbase} from ${vcsrepo_from} to ${vcsrepo_to}"
-
-	unlock "${lock_file}"
-}
-
-# Write to the VCS in order to track a package being deleted from a pacman
-# repository.
-vcs_remove_package() {
-	local pkgbase=${1}
-	local vcsrepo=${2}
-	local lock_file
-
-	lock_file="${GIT_STATE_REPO}/.git/dbscripts.lock"
-	lock "${lock_file}" "Locking state repo"
-
-	arch_git -C "${GIT_STATE_REPO}" rm "${vcsrepo}/${pkgbase}"
-	vcs_commit "remove ${pkgbase} from ${vcsrepo}"
-
-	unlock "${lock_file}"
-}
diff --git a/db-functions-svn b/db-functions-svn
deleted file mode 100644
index f971cd2..0000000
--- a/db-functions-svn
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/hint/bash
-
-if [[ -n ${SVNUSER} ]]; then
-	setfacl -m u:"${SVNUSER}":rwx "${WORKDIR}"
-	setfacl -m d:u:"${USER}":rwx "${WORKDIR}"
-	setfacl -m d:u:"${SVNUSER}":rwx "${WORKDIR}"
-fi
-
-arch_svn() {
-	if [[ -z ${SVNUSER} ]]; then
-		/usr/bin/svn "${@}"
-	else
-		sudo -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}"
-	fi
-}
-
-# source_pkgbuild pkgbase tag
-#
-# Source the PKGBUILD from the package's git/svn/whatever repo.
-# Depending on how the VCS is used the tag might be "trunk" or "repos/$repo-$arch"
-# or the full package version (epoch:pkgver-pkgrel) or any other recognized tag.
-source_pkgbuild() {
-	local pkgbase=${1}
-	local tag=${2}
-
-	. <(arch_svn cat "${SVNREPO}/${pkgbase}/${tag}/PKGBUILD" 2>/dev/null || echo "false")
-}
-
-# Export PKGBUILD resource(s) from the package's git/svn/whatever repo.
-# Depending on how the VCS is used the tag might be "trunk" or "repos/$repo-$arch"
-# or the full package version (epoch:pkgver-pkgrel) or any other recognized tag.
-export_from_vcs() {
-	local pkgbase=${1}
-	local tag=${2}
-	local src=${3}
-	local dest=${4}
-
-	if [[ ! -e ${dest} ]]; then
-		mkdir -p "${dest%/?*}"
-		arch_svn export -q "${SVNREPO}/${pkgbase}/${tag}/${src}" "${dest}" 2>/dev/null
-	fi
-}
-
-# Which repo is this package in?
-find_repo_for_package() {
-	local pkgbase=${1}
-	local pkgarch=${2}
-	local candidates=("${@:3}")
-
-	local repos=($(arch_svn ls "${SVNREPO}/${pkgbase}/repos/" | grep -xFf \
-		<(printf '%s\n' "${candidates[@]/%/-${pkgarch}/}" "${candidates[@]/%/-any/}")))
-	#TODO: check the PKGBUILD exists?
-
-	if (( ${#repos[@]} > 1 )); then
-		die "%s is present in multiple repos (%s)" "${pkgbase}" "${repos[*]}"
-	fi
-	(( ${#repos[@]} == 1 )) || return $?
-
-	printf '%s\n' "${repos[@]%/}"
-}
-
-# Commit changes staged by (successive?) vcs_(re)?move_package runs.
-vcs_commit() {
-	arch_svn commit -q "${WORKDIR}/svn/${pkgbase}" -m "${1}"
-}
-
-# Write to the VCS in order to track a package moving between different pacman
-# repositories.
-vcs_move_package() {
-	local pkgbase=${1}
-	local vcsrepo_from=${WORKDIR}/svn/${pkgbase}/repos/${2}
-	local vcsrepo_to=${WORKDIR}/svn/${pkgbase}/repos/${3}
-
-	if [[ ! -d ${WORKDIR}/svn ]]; then
-		arch_svn checkout -q -N "${SVNREPO}" "${WORKDIR}/svn" >/dev/null
-	fi
-	arch_svn up -q "${WORKDIR}/svn/${pkgbase}" >/dev/null
-
-	if [[ -d ${vcsrepo_to} ]]; then
-		while read -r file; do
-			arch_svn rm -q "${vcsrepo_to}/${file}@"
-		done < <(arch_svn ls "${vcsrepo_to}")
-	else
-		mkdir "${vcsrepo_to}"
-		arch_svn add -q "${vcsrepo_to}"
-	fi
-
-	while read -r file; do
-		arch_svn mv -q -r HEAD "${vcsrepo_from}/${file}@" "${vcsrepo_to}/"
-	done < <(arch_svn ls "${vcsrepo_from}")
-	arch_svn rm --force -q "${vcsrepo_from}"
-}
-
-# Write to the VCS in order to track a package being deleted from a pacman
-# repository.
-vcs_remove_package() {
-	local pkgbase=${1}
-	local vcsrepo=${WORKDIR}/svn/${pkgbase}/repos/${2}
-
-	if [[ ! -d ${WORKDIR}/svn ]]; then
-		arch_svn checkout -q -N "${SVNREPO}" "${WORKDIR}/svn" >/dev/null
-	fi
-
-	arch_svn up -q "${WORKDIR}/svn/${pkgbase}" > /dev/null
-	arch_svn rm --force -q "${vcsrepo}"
-}
diff --git a/db-update b/db-update
index d6e08b8..de63674 100755
--- a/db-update
+++ b/db-update
@@ -98,7 +98,7 @@ for repo in "${!staging[@]}"; do
 			die "Package %s was not built with the checked in PKGBUILD" "$repo/${pkg##*/}"
 		fi
 		if ! check_pkgvcs "${pkg}" "${repo}"; then
-			die "Package %s is not consistent with %s repository" "$repo/${pkg##*/}" "${VCS}"
+			die "Package %s is not consistent with data in git repository" "$repo/${pkg##*/}"
 		fi
 	done
 done
diff --git a/test/lib/common.bash b/test/lib/common.bash
index d26ae82..b42a706 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -200,7 +200,6 @@ setup() {
 	ARCHES=(x86_64 i686)
 	CLEANUP_DRYRUN=false
 	SOURCE_CLEANUP_DRYRUN=false
-	VCS=git
 	KEYRING="/etc/pacman.d/gnupg"
 	GIT_PACKAGING_REPOS_URL="${TMP}/git-packages"
 	GIT_STATE_REPO="${TMP}/repository"
-- 
GitLab