diff options
-rw-r--r-- | config | 4 | ||||
-rw-r--r-- | config.local.svn-community | 2 | ||||
-rw-r--r-- | config.local.svn-packages | 2 | ||||
-rw-r--r-- | config.testing | 10 | ||||
-rw-r--r-- | db-functions | 38 | ||||
-rwxr-xr-x | db-update | 6 | ||||
-rw-r--r-- | test/lib/common.inc | 4 | ||||
-rwxr-xr-x | test/test.d/db-update.sh | 4 |
8 files changed, 53 insertions, 17 deletions
@@ -42,6 +42,10 @@ SRCEXT=".src.tar.gz" LIST="dev@lists.parabola.nu" FROM="dbscripts+${_name}@$(hostname -f)" +# Where to send error emails, and who they are from +LIST="maintenance@lists.parabola.nu" +FROM="repo@parabola.nu" + # Override default config with config.local [ -f "$(dirname "${BASH_SOURCE[0]}")/config.local" ] && . "$(dirname "${BASH_SOURCE[0]}")/config.local" [ -f "$(dirname "${BASH_SOURCE[0]}")/config.local.${_name}" ] && . "$(dirname "${BASH_SOURCE[0]}")/config.local.${_name}" diff --git a/config.local.svn-community b/config.local.svn-community index 105ea66..5d61b5e 100644 --- a/config.local.svn-community +++ b/config.local.svn-community @@ -1,3 +1,5 @@ +#!/hint/bash + PKGREPOS=('community' 'community-testing' 'community-staging' 'multilib' 'multilib-testing' 'multilib-staging') PKGPOOL='pool/community' SRCPOOL='sources/community' diff --git a/config.local.svn-packages b/config.local.svn-packages index 958a483..34aab35 100644 --- a/config.local.svn-packages +++ b/config.local.svn-packages @@ -1,3 +1,5 @@ +#!/hint/bash + PKGREPOS=('core' 'extra' 'testing' 'staging' 'kde-unstable' 'gnome-unstable') PKGPOOL='pool/packages' SRCPOOL='sources/packages' diff --git a/config.testing b/config.testing new file mode 100644 index 0000000..24c2283 --- /dev/null +++ b/config.testing @@ -0,0 +1,10 @@ +#!/hint/bash + +# The host architecture +ARCH_HOST=$(uname -m) +# Which architectures should we test building for? +ARCH_BUILD=("$ARCH_HOST"); if [[ $ARCH_HOST == x86_64 ]]; then ARCH_BUILD+=("i686"); fi + +# override the default TMPDIR +[[ -n $MASTER_TMPDIR ]] || export MASTER_TMPDIR="$(mktemp -dt "${0##*/}.XXXXXXXXXX")" +TMPDIR=$MASTER_TMPDIR 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 +} @@ -54,6 +54,12 @@ for repo in "${repos[@]}"; do if ! check_packager "${pkg}"; then die "Package ${repo}/${pkg##*/} does not have a valid packager" fi + if ! check_buildinfo "${pkg}"; then + die "Package ${repo}/${pkg##*/} does not have a .BUILDINFO file" + fi + if ! check_builddir "${pkg}"; then + die "Package ${repo}/${pkg##*/} was not built in a chroot" + fi done if ! check_splitpkgs "${repo}" "${pkgs[@]}"; then die "Missing split packages for %s" "${repo}" diff --git a/test/lib/common.inc b/test/lib/common.inc index eede414..1831602 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -5,10 +5,6 @@ set -E . "$(dirname "${BASH_SOURCE[0]}")/../../config.testing" . "$(dirname "${BASH_SOURCE[0]}")/../../db-functions" -arch_svn() { - /usr/bin/svn "$@" -} - signpkg() { if [[ -r '/etc/makepkg.conf' ]]; then source '/etc/makepkg.conf' diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh index 1581bee..5d3c833 100755 --- a/test/test.d/db-update.sh +++ b/test/test.d/db-update.sh @@ -132,7 +132,7 @@ testUpdateSameAnyPackageToDifferentRepositories() { local arch for arch in "${ARCH_BUILD[@]}"; do ( [ -r "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \ - && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep ${pkgbase} &>/dev/null) \ + && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep "${pkgbase}" &>/dev/null) \ && fail "${pkgbase} should not be in testing/os/${arch}/testing${DBEXT%.tar.*}" done } @@ -154,7 +154,7 @@ testAddIncompleteSplitPackage() { for arch in "${ARCH_BUILD[@]}"; do ( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" ] \ - && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep ${pkgbase} &>/dev/null) \ + && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep "${pkgbase}" &>/dev/null) \ && fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" done } |