From 331494d4625464b61d81898c34b50a045d2a74d0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 26 Jun 2018 15:11:15 -0400 Subject: Preliminary work to break out svn-specific code. Introduce "db-functions-$VCS" which will eventually contain all VCS-specific code, and make this configurable in config. Move private arch_svn function and svn acl handling here. (Luke Shumaker: this is a partial cherry pick of commit 3bb6775dea3e6dda58d94e8ef9a19026cb9248a4) --- config | 7 +++++-- db-functions | 13 +------------ db-functions-svn | 15 +++++++++++++++ db-update | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 db-functions-svn diff --git a/config b/config index fd79b6e..1cfe11f 100644 --- a/config +++ b/config @@ -1,14 +1,17 @@ #!/hint/bash FTP_BASE="/srv/ftp" -SVNREPO='' -SVNUSER='' PKGREPOS=() PKGPOOL='' SRCPOOL='' TESTING_REPO='' STABLE_REPOS=() +# VCS backend +VCS=svn +SVNREPO='' +SVNUSER='' + CLEANUP_DESTDIR="/var/tmp" CLEANUP_DRYRUN=false # Time in days to keep moved packages diff --git a/db-functions b/db-functions index 260cc67..f7fffeb 100644 --- a/db-functions +++ b/db-functions @@ -36,11 +36,6 @@ mv_acl() { # set up general environment WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX") -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 LOCKS=() REPO_MODIFIED=0 @@ -494,10 +489,4 @@ arch_repo_modify() { REPO_MODIFIED=1 } -arch_svn() { - if [[ -z ${SVNUSER} ]]; then - /usr/bin/svn "${@}" - else - sudo -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}" - fi -} +. "$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")/db-functions-${VCS}" diff --git a/db-functions-svn b/db-functions-svn new file mode 100644 index 0000000..fe043a0 --- /dev/null +++ b/db-functions-svn @@ -0,0 +1,15 @@ +#!/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 +} diff --git a/db-update b/db-update index 8eb27df..c9b727a 100755 --- a/db-update +++ b/db-update @@ -47,7 +47,7 @@ for repo in "${repos[@]}"; do die "Package %s does not have a valid signature" "$repo/${pkg##*/}" fi if ! check_pkgsvn "${pkg}" "${repo}"; then - die "Package %s is not consistent with svn repository" "$repo/${pkg##*/}" + die "Package %s is not consistent with %s repository" "$repo/${pkg##*/}" "$VCS" fi if ! check_pkgrepos "${pkg}"; then die "Package %s already exists in another repository" "$repo/${pkg##*/}" -- cgit v1.2.2