summaryrefslogtreecommitdiff
path: root/db-functions
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 15:41:37 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 15:41:37 -0400
commitda0737360ab185844e4461d7580cf81c639e9ded (patch)
treeafdc2387e43645a62410852d96fa0cf549363597 /db-functions
parent0b96686ab36ddc29e07281d52dd7790c5c5ca89d (diff)
parent9705ba8a148d03dfd4c2184f3a1f13ee373eb826 (diff)
Merge branch 'lukeshu/archlinux+cleanup+librelib' into lukeshu/xbs
# Conflicts: # config # cron-jobs/makepkg.conf # cron-jobs/update-web-db # db-functions # db-move # db-remove # db-update # test/lib/common.inc # test/test.d/create-filelists.sh # test/test.d/db-update.sh # testing2x
Diffstat (limited to 'db-functions')
-rw-r--r--db-functions38
1 files changed, 27 insertions, 11 deletions
diff --git a/db-functions b/db-functions
index 62260bb..1d37123 100644
--- a/db-functions
+++ b/db-functions
@@ -102,7 +102,6 @@ trap cleanup EXIT
repo_lock () {
local LOCKDIR="$TMPDIR/.repolock.$1.$2"
local DBLOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${DBEXT}.lck"
- local FILESLOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${FILESEXT}.lck"
local _count
local _trial
local _timeout
@@ -114,10 +113,6 @@ repo_lock () {
error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(<"$DBLOCKFILE")"
return 1
fi
- if [ -f "${FILESLOCKFILE}" ]; then
- error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(<"$FILESLOCKFILE")"
- return 1
- fi
if [ $# -eq 2 ]; then
_lockblock=true
@@ -168,6 +163,13 @@ _grep_pkginfo() {
echo "${_ret#${2} = }"
}
+# usage: _grep_buildinfo pkgfile pattern
+_grep_buildinfo() {
+ local _ret
+
+ _ret="$(/usr/bin/bsdtar -xOqf "$1" .BUILDINFO | grep -m 1 "^${2} = ")"
+ echo "${_ret#${2} = }"
+}
# Get the package base or name as fallback
getpkgbase() {
@@ -237,6 +239,17 @@ check_packager() {
[[ $_packager && $_packager != 'Unknown Packager' ]]
}
+check_buildinfo() {
+ /usr/bin/bsdtar -tf "$1" .BUILDINFO >/dev/null 2>&1
+}
+
+check_builddir() {
+ local _builddir
+
+ _builddir=$(_grep_buildinfo "$1" "builddir")
+ [[ $_builddir && $_builddir = '/build' ]]
+}
+
getpkgfile() {
if [[ ${#} -ne 1 ]]; then
error 'No canonical package found!'
@@ -284,7 +297,7 @@ check_pkgfile() {
in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1
- if echo "${pkgfile##*/}" | grep -q "${pkgname}-${pkgver}-${pkgarch}"; then
+ if echo "${pkgfile##*/}" | grep "${pkgname}-${pkgver}-${pkgarch}" &>/dev/null; then
return 0
else
return 1
@@ -426,8 +439,6 @@ arch_repo_add() {
pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null
/usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" \
|| error 'repo-add %q %s' "${repo}${DBEXT}" "${pkgs_str% }"
- /usr/bin/repo-add -f -q "${repo}${FILESEXT}" "${pkgs[@]}" \
- || error 'repo-add -f %q %s' "${repo}${FILESEXT}" "${pkgs_str% }"
popd >/dev/null
set_repo_permission "${repo}" "${arch}"
@@ -439,7 +450,6 @@ arch_repo_remove() {
local arch=$2
local pkgs=("${@:3}")
local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}"
- local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
if [ ! -f "${dbfile}" ]; then
error "No database found at '%s'" "${dbfile}"
@@ -448,9 +458,15 @@ arch_repo_remove() {
printf -v pkgs_str -- '%q ' "${pkgs[@]}"
/usr/bin/repo-remove -q "${dbfile}" "${pkgs[@]}" \
|| error 'repo-remove %q %s' "${dbfile}" "${pkgs_str% }"
- /usr/bin/repo-remove -q "${filesfile}" "${pkgs[@]}" \
- || error 'repo-remove %q %s' "${filesfile}" "${pkgs_str% }"
set_repo_permission "${repo}" "${arch}"
REPO_MODIFIED=1
}
+
+arch_svn() {
+ if [ -z "${SVNUSER}" ]; then
+ /usr/bin/svn "${@}"
+ else
+ sudo -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}"
+ fi
+}