summaryrefslogtreecommitdiff
path: root/src/xbs-abs/helper-abs
diff options
context:
space:
mode:
Diffstat (limited to 'src/xbs-abs/helper-abs')
-rwxr-xr-xsrc/xbs-abs/helper-abs86
1 files changed, 64 insertions, 22 deletions
diff --git a/src/xbs-abs/helper-abs b/src/xbs-abs/helper-abs
index 0471c81..f1f4937 100755
--- a/src/xbs-abs/helper-abs
+++ b/src/xbs-abs/helper-abs
@@ -31,7 +31,8 @@
load_config() {
. $(librelib conf.sh)
load_files xbs-abs
- check_vars SVNURL SVNREPO ARCHES || exit 1
+ # SVNUSER is optional
+ check_vars SVNDIR SVNREPOS ARCHES || exit 1
}
# This is taken from dbscripts:db-fuctions
@@ -43,6 +44,25 @@ arch_svn() {
fi
}
+pac2svn() {
+ local pacrepo=$1
+
+ # Figure out which svn repo we need
+ local svnrepoStr
+ for svnrepoStr in "${SVNREPOS[@]}"; do
+ local svnrepoAry=($svnrepoStr)
+ local svnrepo=${svnrepoAry[0]}
+ local svnurl=${svnrepoAry[1]}
+ local pacrepos=("${svnrepoAry[@]:2}")
+
+ if in_array "$pacrepo" "${pacrepos[@]}"; then
+ echo "$svnrepo"
+ return 0
+ fi
+ done
+ return 1
+}
+
status() {
load_config
[[ -z $(arch_svn status -q) ]]
@@ -50,21 +70,41 @@ status() {
download() {
load_config
- if [[ -d "$SVNREPO/.svn" ]]; then
- arch_svn -q up "$SVNREPO"/*
- else
- # checkout non-recursive, then lazy load
- # nescessary because:
- # > DO NOT CHECK OUT THE ENTIRE SVN REPO. Your address may be blocked.
- arch_svn -q checkout -N "$SVNURL" "$SVNREPO"
- fi
+
+ local svnrepoStr
+ for svnrepoStr in "${SVNREPOS[@]}"; do
+ local svnrepoAry=($svnrepoStr)
+ local svnrepo=${svnrepoAry[0]}
+ local svnurl=${svnrepoAry[1]}
+ local pacrepos=("${svnrepoAry[@]:2}")
+
+ if [[ -d "$SVNDIR/$svnrepo/.svn" ]]; then
+ arch_svn -q up "$SVNDIR/$svnrepo"/*
+ else
+ # checkout non-recursive, then lazy load
+ # nescessary because:
+ # > DO NOT CHECK OUT THE ENTIRE SVN REPO. Your address
+ # > may be blocked.
+ arch_svn -q checkout -N "$svnurl" "$SVNDIR/$svnrepo"
+ fi
+ done
}
release() {
local repo=$1
local arch=$2
- "${0}.d/archrelease" -f "${repo}-${arch}"
+ local tmpdir="$(mktemp -dt "xbs-abs-release.XXXXXXXXXX")"
+ trap "$(printf 'rm -rf -- %q' "$tmpdir")" EXIT
+
+ printf '%s\n' \
+ '#!/bin/bash' \
+ "$(declare -f arch_svn)" \
+ 'arch_svn "$@"' \
+ > "$tmpdir/svn"
+ chmod 755 "$tmpdir/svn"
+
+ PATH="$tmpdir:$PATH" "${0}.d/archrelease" -f "${repo}-${arch}"
}
unrelease() {
@@ -72,15 +112,15 @@ unrelease() {
local repo=$2
local arch=$3
- local svnrepo="$repo-$arch"
- load_config
+ local tag="$repo-$arch"
- arch_svn up -q "${SVNREPO}/${pkgbase}"
+ load_config
+ local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}"
+ arch_svn up -q "$svndir"
# This is based off code from dbscripts:db-remove
- remove_pkgs=$(. "${SVNREPO}/$pkgbase/repos/$svnrepo/PKGBUILD"; echo ${pkgname[@]})
- arch_svn rm --force -q "${SVNREPO}/$pkgbase/repos/$svnrepo"
- arch_svn commit -q "${SVNREPO}/$pkgbase" -m "${0##*/}: $pkgbase removed by $(id -un)"
+ arch_svn rm --force -q "${svndir}/repos/${tag}"
+ arch_svn commit -q "${svndir}" -m "${0##*/}: $pkgbase removed by $(id -un)"
}
move() {
@@ -89,15 +129,16 @@ move() {
local pkgbase=$3
load_config
- arch_svn up -q "${SVNREPO}/${pkgbase}"
+ local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}"
+ arch_svn up -q "$svndir"
local tag_list=""
local pkgarch
local arches=()
# this is based off code from dbscripts:db-move
for pkgarch in "${ARCHES[@]}" 'any'; do
- dir_from="${SVNREPO}/${pkgbase}/repos/${repo_from}-${pkgarch}"
- dir_to="${SVNREPO}/${pkgbase}/repos/${repo_to}-${pkgarch}"
+ dir_from="${svndir}/repos/${repo_from}-${pkgarch}"
+ dir_to="${svndir}/repos/${repo_to}-${pkgarch}"
if [ -f "${dir_from}/PKGBUILD" ]; then
if [ -d "${dir_to}" ]; then
@@ -118,7 +159,7 @@ move() {
fi
done
tag_list="${tag_list#, }"
- arch_svn commit -q "${SVNREPO}/${pkgbase}" -m "${0##*/}: moved ${pkgbase} from [${repo_from}] to [${repo_to}] (${tag_list})"
+ arch_svn commit -q "${svndir}" -m "${0##*/}: moved ${pkgbase} from [${repo_from}] to [${repo_to}] (${tag_list})"
echo "${arches[*]}"
}
@@ -128,8 +169,9 @@ releasepath() {
local arch=$3
load_config
- arch_svn up -q "${SVNREPO}/${pkgbase}"
- echo "${SVNREPO}/${pkgbase}/repos/${repo}-${arch}"
+ local svndir="${SVNDIR}/$(pac2svn "$repo")/${pkgbase}"
+ arch_svn up -q "${svndir}"
+ echo "${svndir}/repos/${repo}-${arch}"
}
case "$1" in