[arch-projects] [dbscripts] [PATCH 2/2] Factor out the exporting of files/folders from svn.

Eli Schwartz eschwartz at archlinux.org
Wed Jul 4 02:15:32 UTC 2018


As of the source_pkgbuild rewrite, this is only ever done once.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---
 cron-jobs/sourceballs |  3 +--
 db-functions-svn      | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 6be28abc..115c5bc0 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -79,8 +79,7 @@ for repo in "${PKGREPOS[@]}"; do
 
 			# Get the sources from svn
 			mkdir -p -m0770 "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}"
-			arch_svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \
-				"${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
+			export_from_vcs "${pkgbase}" "repos/${repo}-${pkgarch}" "" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}"
 			if (( $? >= 1 )); then
 				failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
 				continue
diff --git a/db-functions-svn b/db-functions-svn
index aa7952d8..f9e9b6f7 100644
--- a/db-functions-svn
+++ b/db-functions-svn
@@ -25,3 +25,18 @@ source_pkgbuild() {
 
 	. <(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
+}
-- 
2.18.0


More information about the arch-projects mailing list