summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-12-31 14:35:11 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-12-31 14:35:11 -0500
commit99d6b1d0f1f88bf30b75243225cd461afb565f6b (patch)
tree82a5239fce117f50bd4d80365cb21bd6e5efe409
parentffe9ada1c43d5fd779863c4be2782f7b690a5fbc (diff)
parente6294556d3197b7d87f7659355d0e189fad613d6 (diff)
Merge branch 'cleanup' into master-merge
Conflicts: config cron-jobs/sourceballs db-functions db-move db-remove db-update
-rw-r--r--config6
-rw-r--r--config.local.svn-community11
-rw-r--r--config.local.svn-packages11
-rwxr-xr-xcron-jobs/ftpdir-cleanup33
-rwxr-xr-xcron-jobs/integrity-check4
-rwxr-xr-xcron-jobs/sourceballs33
-rw-r--r--cron-jobs/sourceballs.skip24
-rwxr-xr-xcron-jobs/update-web-db6
-rw-r--r--db-functions174
-rwxr-xr-xdb-move46
-rwxr-xr-xdb-remove25
-rwxr-xr-xdb-repo-add6
-rwxr-xr-xdb-repo-remove6
-rwxr-xr-xdb-update29
-rw-r--r--test/lib/common.inc143
-rwxr-xr-xtest/test.d/create-filelists.sh18
-rwxr-xr-xtest/test.d/db-move.sh12
-rwxr-xr-xtest/test.d/db-remove.sh4
-rwxr-xr-xtest/test.d/db-repo-add.sh4
-rwxr-xr-xtest/test.d/db-repo-remove.sh4
-rwxr-xr-xtest/test.d/db-update.sh32
-rwxr-xr-xtest/test.d/ftpdir-cleanup.sh8
-rwxr-xr-xtest/test.d/pool-transition.sh152
-rwxr-xr-xtest/test.d/signed-packages.sh25
-rwxr-xr-xtest/test.d/sourceballs.sh6
-rwxr-xr-xtest/test.d/testing2x.sh4
-rwxr-xr-xtesting2x32
27 files changed, 373 insertions, 485 deletions
diff --git a/config b/config
index 8b8117f..496b3ef 100644
--- a/config
+++ b/config
@@ -1,4 +1,4 @@
-#!/bin/bash
+#/bin/bash # as a hint to text editors
FTP_BASE="/srv/http/repo/public"
ARCH_BASE="/srv/http/repo/public"
SVNREPO="/var/abs"
@@ -12,7 +12,7 @@ USERREPOS=('~smv' '~xihh' '~brendan' '~lukeshu' '~emulatorman' '~aurelien' '~jor
# Community project repos
PROJREPOS=('pcr' 'kernels' 'cross' 'java' 'java-ugly' 'nonprism')
# Remote repos
-PKGREPOS=(${ARCHREPOS[@]} ${OURREPOS[@]} ${USERREPOS[@]} ${PROJREPOS[@]})
+PKGREPOS=("${ARCHREPOS[@]}" "${OURREPOS[@]}" "${USERREPOS[@]}" "${PROJREPOS[@]}")
PKGPOOL='pool/packages'
SRCPOOL='sources/packages'
@@ -37,7 +37,7 @@ REQUIRE_SIGNATURE=true
LOCK_DELAY=10
LOCK_TIMEOUT=300
-[ -n "${STAGING:-}" ] || STAGING="$FTP_BASE/staging"
+[ -n "${STAGING:-}" ] || STAGING="$HOME/staging"
TMPDIR="/tmp"
ARCHARCHES=(i686 x86_64)
OURARCHES=(mips64el)
diff --git a/config.local.svn-community b/config.local.svn-community
new file mode 100644
index 0000000..105ea66
--- /dev/null
+++ b/config.local.svn-community
@@ -0,0 +1,11 @@
+PKGREPOS=('community' 'community-testing' 'community-staging' 'multilib' 'multilib-testing' 'multilib-staging')
+PKGPOOL='pool/community'
+SRCPOOL='sources/community'
+SVNREPO='file:///srv/repos/svn-community/svn'
+SVNUSER='svn-community'
+TESTING_REPO='community-testing'
+STABLE_REPOS=('community')
+
+CLEANUP_DESTDIR="/srv/repos/svn-community/package-cleanup"
+SOURCE_CLEANUP_DESTDIR="/srv/repos/svn-community/source-cleanup"
+TMPDIR="/srv/repos/svn-community/tmp"
diff --git a/config.local.svn-packages b/config.local.svn-packages
new file mode 100644
index 0000000..958a483
--- /dev/null
+++ b/config.local.svn-packages
@@ -0,0 +1,11 @@
+PKGREPOS=('core' 'extra' 'testing' 'staging' 'kde-unstable' 'gnome-unstable')
+PKGPOOL='pool/packages'
+SRCPOOL='sources/packages'
+SVNREPO='file:///srv/repos/svn-packages/svn'
+SVNUSER='svn-packages'
+TESTING_REPO='testing'
+STABLE_REPOS=('core' 'extra')
+
+CLEANUP_DESTDIR="/srv/repos/svn-packages/package-cleanup"
+SOURCE_CLEANUP_DESTDIR="/srv/repos/svn-packages/source-cleanup"
+TMPDIR="/srv/repos/svn-packages/tmp"
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 83e6e17..a2823d4 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/../db-functions"
-. "$(dirname $0)/../config"
+. "$(dirname "$(readlink -e "$0")")/../config"
+. "$(dirname "$(readlink -e "$0")")/../db-functions"
clean_pkg() {
local pkg
@@ -12,11 +12,11 @@ clean_pkg() {
if [ -h "$pkg" ]; then
rm -f "$pkg" "$pkg.sig"
else
- mv -f "$pkg" "$CLEANUP_DESTDIR"
+ mv_acl "$pkg" "$CLEANUP_DESTDIR/${pkg##*/}"
if [ -e "$pkg.sig" ]; then
- mv -f "$pkg.sig" "$CLEANUP_DESTDIR"
+ mv_acl "$pkg.sig" "$CLEANUP_DESTDIR/${pkg##*/}.sig"
fi
- touch "${CLEANUP_DESTDIR}/$(basename ${pkg})"
+ touch "${CLEANUP_DESTDIR}/${pkg##*/}"
fi
done
fi
@@ -68,29 +68,6 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
done
fi
-# cleanup of legacy $repo/os/any directories
-for repo in ${PKGREPOS[@]}; do
- if [ ! -d "${FTP_BASE}/${repo}/os/any" ]; then
- continue
- fi
- if [ -n "$(find "${FTP_BASE}/${repo}/os/any" -type d -empty)" ]; then
- msg "Removing empty legacy directory ${repo}/os/any"
- ${CLEANUP_DRYRUN} || rmdir "${FTP_BASE}/${repo}/os/any"
- continue
- fi
- find "${FTP_BASE}/${repo}/os/any" -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/any-${repo}"
- cat "${WORKDIR}/db-${repo}-"* | sort -u > "${WORKDIR}/all-${repo}"
-
- old_pkgs=($(comm -23 "${WORKDIR}/any-${repo}" "${WORKDIR}/all-${repo}"))
- if [ ${#old_pkgs[@]} -ge 1 ]; then
- msg "Removing old packages from [${repo}] (any)..."
- for old_pkg in ${old_pkgs[@]}; do
- msg2 "${old_pkg}"
- clean_pkg "${FTP_BASE}/${repo}/os/any/${old_pkg}"
- done
- fi
-done
-
old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n'))
if [ ${#old_pkgs[@]} -ge 1 ]; then
msg "Removing old packages from the cleanup directory..."
diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check
index d4f9694..f6c26cf 100755
--- a/cron-jobs/integrity-check
+++ b/cron-jobs/integrity-check
@@ -2,13 +2,13 @@
dirname="$(dirname $0)"
-. "${dirname}/../db-functions"
. "${dirname}/../config"
+. "${dirname}/../db-functions"
script_lock
if [ $# -ne 1 ]; then
- die "usage: $(basename $0) <mailto>"
+ die "usage: ${0##*/} <mailto>"
fi
mailto=$1
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index ee074bd..91bc3d6 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -1,8 +1,8 @@
#!/bin/bash
-dirname="$(dirname $(readlink -e $0))"
-. "${dirname}/../db-functions"
+dirname="$(dirname "$(readlink -e "$0")")"
. "${dirname}/../config"
+. "${dirname}/../db-functions"
pushd "${WORKDIR}" >/dev/null
script_lock
@@ -63,7 +63,7 @@ for repo in ${PKGREPOS[@]}; do
if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then
continue
fi
- # Commenting out, we'll sourceball everything
+ # Commenting out, we'll sourceball everything
# Check if the license or .force file does not enforce creating a source package
# if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then
# continue
@@ -78,15 +78,10 @@ for repo in ${PKGREPOS[@]}; do
continue
fi
- # Get the sources from svn
- mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}"
- #svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \
- # "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
-
- # If it's on official repos, nor [libre], nor [libre-testing]
- cp -r "${SVNREPO}/$repo/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \
- cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \
- cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1
+ # Get the sources from xbs
+ mkdir -p -m0770 "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}"
+ cp -a "$(xbs releasepath "${pkgbase}" "${repo}" "${pkgarch}")" \
+ "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
if [ $? -ge 1 ]; then
failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
continue
@@ -94,14 +89,15 @@ for repo in ${PKGREPOS[@]}; do
# Build the actual source package
pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null
- makepkg --nocolor --allsource --ignorearch # >/dev/null 2>&1
+ SRCPKGDEST=. makepkg --nocolor --allsource --ignorearch --skippgpcheck >"${WORKDIR}/${pkgbase}.log" 2>&1
if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then
- mv "${pkgbase}-${pkgver}${SRCEXT}" "${ARCH_BASE}/${SRCPOOL}"
+ mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}"
# Avoid creating the same source package for every arch
echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs"
newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
else
- failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
+ failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
+ cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log"
fi
popd >/dev/null
fi
@@ -132,7 +128,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
for old_pkg in ${old_pkgs[@]}; do
msg2 "${old_pkg}"
if ! ${SOURCE_CLEANUP_DRYRUN}; then
- mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}"
+ mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
fi
done
@@ -147,4 +143,9 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
done
fi
+if [ -f "${WORKDIR}/makepkg-fail.log" ]; then
+ msg "Log of failed packages"
+ cat "${WORKDIR}/makepkg-fail.log"
+fi
+
script_unlock
diff --git a/cron-jobs/sourceballs.skip b/cron-jobs/sourceballs.skip
index 14d6f4b..0e1731c 100644
--- a/cron-jobs/sourceballs.skip
+++ b/cron-jobs/sourceballs.skip
@@ -1,14 +1,28 @@
-nexuiz-data
+0ad-data
+alienarena-data
+blobwars-data
+btanks-data
+dangerdeep-data
+egoboo-data
+fillets-ng-data
+flightgear-data
+frogatto-data
+gcompris-data
+naev-data
+openarena-data
+rocksndiamonds-data
+smc-data
+speed-dreams-data
torcs-data
tremulous-data
ufoai-data
-frogatto-data
vdrift-data
-naev-data
-btanks-data
+warmux-data
wesnoth-data
-texlive-bin
+widelands-data
+xonotic-data
texlive-bibtexextra
+texlive-bin
texlive-core
texlive-fontsextra
texlive-formatsextra
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
index 6ced4c1..713e75e 100755
--- a/cron-jobs/update-web-db
+++ b/cron-jobs/update-web-db
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname $0)/../db-functions"
-. "$(dirname $0)/../config"
+. "$(dirname "$(readlink -e "$0")")/../config"
+. "$(dirname "$(readlink -e "$0")")/../db-functions"
# setup paths
SPATH="/srv/http/archweb"
@@ -14,7 +14,7 @@ REPOS=('community-testing' 'multilib-testing' 'multilib' 'community' 'extra' 'te
LOGOUT="/tmp/archweb_update.log"
# figure out what operation to perform
-cmd="$(basename $0)"
+cmd="${0##*/}"
if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then
die "Invalid command name '$cmd' specified!"
fi
diff --git a/db-functions b/db-functions
index 4c247a7..072f43d 100644
--- a/db-functions
+++ b/db-functions
@@ -1,7 +1,7 @@
#!/bin/bash
# Some PKGBUILDs need CARCH to be set
-CARCH="x86_64"
+CARCH=$(. $(librelib conf.sh); load_files makepkg; echo $CARCH)
# Useful functions
UMASK=""
@@ -15,80 +15,32 @@ restore_umask () {
umask $UMASK >/dev/null
}
-# set up general environment
-WORKDIR=$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX)
-LOCKS=()
-
-# check if messages are to be printed using color
-unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-if [[ -t 2 ]]; then
- ALL_OFF="$(tput sgr0)"
- BOLD="$(tput bold)"
- BLUE="${BOLD}$(tput setaf 4)"
- GREEN="${BOLD}$(tput setaf 2)"
- RED="${BOLD}$(tput setaf 1)"
- YELLOW="${BOLD}$(tput setaf 3)"
-fi
-readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
-
-plain() {
- local mesg=$1; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
-}
-
-msg() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
-}
-
-msg2() {
- local mesg=$1; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
-}
-
-warning() {
- local mesg=$1; shift
- printf "${YELLOW}==> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+# just like mv -f, but we touch the file and then copy the content so
+# default ACLs in the target dir will be applied
+mv_acl() {
+ rm -f "$2"
+ touch "$2"
+ cat "$1" >"$2" || return 1
+ rm -f "$1"
}
-error() {
- local mesg=$1; shift
- printf "${RED}==> ERROR${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-##
-# usage : in_array( $needle, $haystack )
-# return : 0 - found
-# 1 - not found
-##
-in_array() {
- local needle=$1; shift
- [[ -z $1 ]] && return 1 # Not Found
- local item
- for item in "$@"; do
- [[ $item = $needle ]] && return 0 # Found
- done
- return 1 # Not Found
-}
+# set up general environment
+WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
+LOCKS=()
+REPO_MODIFIED=0
-##
-# usage : get_full_version( $epoch, $pkgver, $pkgrel )
-# return : full version spec, including epoch (if necessary), pkgver, pkgrel
-##
-get_full_version() {
- if [[ $1 -eq 0 ]]; then
- # zero epoch case, don't include it in version
- echo $2-$3
- else
- echo $1:$2-$3
- fi
-}
+# Used: plain, msg, msg2, warning, error, in_array, get_full_version
+# Overwritten: cleanup, abort, die
+# Ignored: stat_busy, stat_done,
+# setup_workdir, trab_abort, trap_exit,
+# lock, slock, lock_close
+. $(librelib common)
script_lock() {
- local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
+ local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
- local _owner="$(stat -c %U $LOCKDIR)"
- error "Script $(basename $0) is already locked by $_owner."
+ local _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
+ error "Script ${0##*/} is already locked by $_owner."
exit 1
else
set_umask
@@ -97,9 +49,9 @@ script_lock() {
}
script_unlock() {
- local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
+ local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
if [ ! -d "$LOCKDIR" ]; then
- warning "Script $(basename $0) was not locked!"
+ warning "Script ${0##*/} was not locked!"
restore_umask
return 1
else
@@ -123,11 +75,16 @@ cleanup() {
repo_unlock $repo $arch
fi
done
- if [ -d "$TMPDIR/.scriptlock.$(basename $0)" ]; then
- msg "Removing left over lock from $(basename $0)"
+ if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then
+ msg "Removing left over lock from ${0##*/}"
script_unlock
fi
rm -rf "$WORKDIR"
+
+ if (( REPO_MODIFIED )); then
+ date +%s > "${FTP_BASE}/lastupdate"
+ fi
+
[ "$1" ] && exit $1
}
@@ -211,7 +168,7 @@ repo_unlock () { #repo_unlock <repo-name> <arch>
_grep_pkginfo() {
local _ret
- _ret="$(bsdtar -xOqf "$1" .PKGINFO | grep -m 1 "^${2} = ")"
+ _ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | grep -m 1 "^${2} = ")"
echo "${_ret#${2} = }"
}
@@ -329,14 +286,14 @@ check_pkgfile() {
in_array "${pkgarch}" ${ARCHES[@]} 'any' || return 1
- if echo "$(basename ${pkgfile})" | grep -q "${pkgname}-${pkgver}-${pkgarch}"; then
+ if echo "${pkgfile##*/}" | grep -q "${pkgname}-${pkgver}-${pkgarch}"; then
return 0
else
return 1
fi
}
-check_pkgsvn() {
+check_pkgxbs() {
local pkgfile="${1}"
local _pkgbase="$(getpkgbase ${pkgfile})"
[ $? -ge 1 ] && return 1
@@ -350,18 +307,11 @@ check_pkgsvn() {
in_array "${repo}" ${PKGREPOS[@]} || return 1
- if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then
- mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}"
- svn export -q "${SVNREPO}/${_pkgbase}/repos/${repo}-${_pkgarch}/PKGBUILD" \
- "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null
- [ $? -ge 1 ] && return 1
- fi
-
- local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) )"
- [ "${svnver}" == "${_pkgver}" ] || return 1
+ local xbsver="$(. "`xbs releasepath ${_pkgbase} ${repo} ${_pkgarch}`/PKGBUILD"; get_full_version "${_pkgname}")"
+ [ "${xbsver}" == "${_pkgver}" ] || return 1
- local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
- in_array "${_pkgname}" ${svnnames[@]} || return 1
+ local xbsnames=($(. "`xbs releasepath ${_pkgbase} ${repo} ${_pkgarch}`/PKGBUILD"; echo ${pkgname[@]}))
+ in_array "${_pkgname}" ${xbsnames[@]} || return 1
return 0
}
@@ -372,7 +322,7 @@ check_splitpkgs() {
local pkgfiles=(${@})
local pkgfile
local pkgdir
- local svnname
+ local xbsname
mkdir -p "${WORKDIR}/check_splitpkgs/"
pushd "${WORKDIR}/check_splitpkgs" >/dev/null
@@ -386,22 +336,9 @@ check_splitpkgs() {
mkdir -p "${repo}/${_pkgarch}/${_pkgbase}"
echo "${_pkgname}" >> "${repo}/${_pkgarch}/${_pkgbase}/staging"
- if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then
- mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}"
-
- cp -r ${SVNREPO}/$repo/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \
- cp -r ${SVNREPO}/libre/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \
- cp -r ${SVNREPO}/libre-testing/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/$_pkgbase">/dev/null 2>&1
-
- [[ $? -ge 1 ]] && {
- echo "Failed $_pkgbase-$_pkgver-$_pkgarch"
- return 1
- }
- fi
-
- local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
- for svnname in ${svnnames[@]}; do
- echo "${svnname}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn"
+ local xbsnames=($(. "`xbs releasepath ${_pkgbase} ${repo} ${_pkgarch}`/PKGBUILD"; echo ${pkgname[@]}))
+ for xbsname in ${xbsnames[@]}; do
+ echo "${xbsname}" >> "${repo}/${_pkgarch}/${_pkgbase}/xbs"
done
done
popd >/dev/null
@@ -409,8 +346,8 @@ check_splitpkgs() {
for pkgdir in "${WORKDIR}/check_splitpkgs/${repo}"/*/*; do
[ ! -d "${pkgdir}" ] && continue
sort -u "${pkgdir}/staging" -o "${pkgdir}/staging"
- sort -u "${pkgdir}/svn" -o "${pkgdir}/svn"
- if [ ! -z "$(comm -13 "${pkgdir}/staging" "${pkgdir}/svn")" ]; then
+ sort -u "${pkgdir}/xbs" -o "${pkgdir}/xbs"
+ if [ ! -z "$(comm -13 "${pkgdir}/staging" "${pkgdir}/xbs")" ]; then
return 1
fi
done
@@ -430,19 +367,8 @@ check_pkgrepos() {
[ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1
[ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/$(basename ${pkgfile})" ] && return 1
- [ -f "${FTP_BASE}/${PKGPOOL}/$(basename ${pkgfile}).sig" ] && return 1
-
- local repo
- local arch
- for repo in ${PKGREPOS[@]}; do
- for arch in ${ARCHES[@]}; do
- [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1
- [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1
- [ -f "${FTP_BASE}/${repo}/os/${arch}/$(basename ${pkgfile})" ] && return 1
- [ -f "${FTP_BASE}/${repo}/os/${arch}/$(basename ${pkgfile}).sig" ] && return 1
- done
- done
+ [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}" ] && return 1
+ [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig" ] && return 1
return 0
}
@@ -450,8 +376,8 @@ check_pkgrepos() {
#usage: chk_license ${license[@]}"
chk_license() {
local l
- for l in ${@}; do
- in_array ${l} ${ALLOWED_LICENSES[@]} && return 0
+ for l in "${@}"; do
+ in_array "${l}" "${ALLOWED_LICENSES[@]}" && return 0
done
return 1
@@ -463,7 +389,7 @@ check_repo_permission() {
[ ${#PKGREPOS[@]} -eq 0 ] && return 1
[ -z "${PKGPOOL}" ] && return 1
- in_array "${repo}" ${PKGREPOS[@]} || return 1
+ in_array "${repo}" "${PKGREPOS[@]}" || return 1
[ -w "$FTP_BASE/${PKGPOOL}" ] || return 1
@@ -508,6 +434,8 @@ arch_repo_add() {
|| error "repo-add -f ${repo}${FILESEXT} ${pkgs[@]}"
popd >/dev/null
set_repo_permission "${repo}" "${arch}"
+
+ REPO_MODIFIED=1
}
arch_repo_remove() {
@@ -526,4 +454,6 @@ arch_repo_remove() {
repo-remove -q "${filesfile}" ${pkgs[@]} \
|| error "repo-remove ${filesfile} ${pkgs[@]}"
set_repo_permission "${repo}" "${arch}"
+
+ REPO_MODIFIED=1
}
diff --git a/db-move b/db-move
index 010d941..1b34404 100755
--- a/db-move
+++ b/db-move
@@ -1,10 +1,10 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
- msg "usage: $(basename $0) <repo-from> <repo-to> <pkgname|pkgbase> ..."
+ msg "usage: ${0##*/} <repo-from> <repo-to> <pkgname|pkgbase> ..."
exit 1
fi
@@ -24,20 +24,16 @@ for pkgarch in ${ARCHES[@]}; do
repo_lock ${repo_from} ${pkgarch} || exit 1
done
-# No idea why we loop twice... -- fauno
+# check if packages to be moved exist in xbs and ftp dir
for pkgbase in ${args[@]:2}; do
for pkgarch in ${ARCHES[@]} 'any'; do
- svnrepo_from="${SVNREPO}/${repo_from}/${pkgbase}"
- if [ -r "${svnrepo_from}/PKGBUILD" ]; then
- pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
+ xbsrepo_from="$(xbs releasepath ${pkgbase} ${repo_from} ${pkgarch})"
+ if [ -r "${xbsrepo_from}/PKGBUILD" ]; then
+ pkgnames=($(. "${xbsrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
if [ ${#pkgnames[@]} -lt 1 ]; then
die "Could not read pkgname"
fi
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
- if [ -z "${pkgver}" ]; then
- die "Could not read pkgver"
- fi
if [ "${pkgarch}" == 'any' ]; then
tarches=(${ARCHES[@]})
@@ -46,6 +42,10 @@ for pkgbase in ${args[@]:2}; do
fi
for pkgname in ${pkgnames[@]}; do
+ pkgver=$(. "${xbsrepo_from}/PKGBUILD"; get_full_version ${pkgname})
+ if [ -z "${pkgver}" ]; then
+ die "Could not read pkgver"
+ fi
for tarch in ${tarches[@]}; do
getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT} >/dev/null
done
@@ -61,29 +61,25 @@ msg "Moving packages from [${repo_from}] to [${repo_to}]..."
declare -A add_pkgs
declare -A remove_pkgs
for pkgbase in ${args[@]:2}; do
- for pkgarch in ${ARCHES[@]} 'any'; do
- svnrepo_from="${SVNREPO}/${repo_from}/${pkgbase}"
-
- if [ -f "${svnrepo_from}/PKGBUILD" ]; then
+ # move the package in xbs
+ arches=($(xbs move ${repo_from} ${repo_to} ${pkgbase}))
+ # move the package in ftp
+ for pkgarch in ${arches[@]}; do
+ dir_to="$(xbs releasepath $pkgbase $repo_to $pkgarch)"
+ if true; then # to add in indent level to make merging easier
if [ "${pkgarch}" == 'any' ]; then
- tarches=(${ARCHES[@]})
+ tarches=("${ARCHES[@]}")
else
tarches=("${pkgarch}")
fi
- msg2 "${pkgbase} ($(echo ${tarches[@]}))"
- pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
+ pkgnames=($(. "${dir_to}/PKGBUILD"; echo ${pkgname[@]}))
for pkgname in ${pkgnames[@]}; do
+ pkgver=$(. "${dir_to}/PKGBUILD"; get_full_version ${pkgname})
for tarch in ${tarches[@]}; do
pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT})
- pkgfile=$(basename "${pkgpath}")
+ pkgfile="${pkgpath##*/}"
- # copy package to pool if needed
- # TODO: can be removed once every package has been moved to the package pool
- if [ ! -f ${FTP_BASE}/${PKGPOOL}/${pkgfile} ]; then
- cp ${pkgpath} ${FTP_BASE}/${PKGPOOL}
- fi
ln -s "../../../${PKGPOOL}/${pkgfile}" ${ftppath_to}/${tarch}/
if [ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]; then
ln -s "../../../${PKGPOOL}/${pkgfile}.sig" ${ftppath_to}/${tarch}/
diff --git a/db-remove b/db-remove
index a71bbab..993574f 100755
--- a/db-remove
+++ b/db-remove
@@ -1,10 +1,10 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
- msg "usage: $(basename $0) <repo> <arch> <pkgname|pkgbase> ..."
+ msg "usage: ${0##*/} <repo> <arch> <pkgname|pkgbase> ..."
exit 1
fi
@@ -17,30 +17,31 @@ if ! check_repo_permission $repo; then
fi
if [ "$arch" == "any" ]; then
- tarches=(${ARCHES[@]})
+ tarches=("${ARCHES[@]}")
else
tarches=("$arch")
fi
-for tarch in ${tarches[@]}; do
+for tarch in "${tarches[@]}"; do
repo_lock $repo $tarch || exit 1
done
remove_pkgs=()
for pkgbase in ${pkgbases[@]}; do
msg "Removing $pkgbase from [$repo]..."
-
- if [ -d "${SVNREPO}/$repo/$pkgbase" ]; then
- remove_pkgs=($(. "${SVNREPO}/$repo/$pkgbase/PKGBUILD"; echo ${pkgname[@]}))
+ path="$(xbs releasepath "$pkgbase" "$repo" "$arch")"
+ if [ -d "$path" ]; then
+ remove_pkgs+=($(. "$path/PKGBUILD"; echo ${pkgname[@]}))
+ xbs unrelease "$pkgbase" "$repo" "$arch"
else
- warning "$pkgbase not found in $svnrepo"
+ warning "$pkgbase not found in $repo-$arch"
warning "Removing only $pkgbase from the repo"
warning "If it was a split package you have to remove the others yourself!"
- remove_pkgs[${#remove_pkgs[*]}]=$pkgbase
+ remove_pkgs+=($pkgbase)
fi
done
-for tarch in ${tarches[@]}; do
- arch_repo_remove "${repo}" "${tarch}" ${remove_pkgs[@]}
+for tarch in "${tarches[@]}"; do
+ arch_repo_remove "${repo}" "${tarch}" "${remove_pkgs[@]}"
repo_unlock $repo $tarch
done
diff --git a/db-repo-add b/db-repo-add
index b83fb77..a6355a1 100755
--- a/db-repo-add
+++ b/db-repo-add
@@ -1,10 +1,10 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
- msg "usage: $(basename $0) <repo> <arch> <pkgfile> ..."
+ msg "usage: ${0##*/} <repo> <arch> <pkgfile> ..."
exit 1
fi
diff --git a/db-repo-remove b/db-repo-remove
index 4f04ed1..7077d62 100755
--- a/db-repo-remove
+++ b/db-repo-remove
@@ -1,10 +1,10 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
- msg "usage: $(basename $0) <repo> <arch> <pkgname> ..."
+ msg "usage: ${0##*/} <repo> <arch> <pkgname> ..."
exit 1
fi
diff --git a/db-update b/db-update
index 0359697..74d3f45 100755
--- a/db-update
+++ b/db-update
@@ -1,19 +1,26 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -ge 1 ]; then
- warning "Calling $(basename $0) with a specific repository is no longer supported"
+ warning "Calling ${0##*/} with a specific repository is no longer supported"
exit 1
fi
# Find repos with packages to release
-repos=($(find "${STAGING}" -mindepth 1 -maxdepth 1 -type d ! -empty -printf '%f ' 2>/dev/null))
+staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u))
if [ $? -ge 1 ]; then
die "Could not read ${STAGING}"
fi
+repos=()
+for staging_repo in ${staging_repos[@]##*/}; do
+ if in_array ${staging_repo} ${PKGREPOS[@]}; then
+ repos+=(${staging_repo})
+ fi
+done
+
# TODO: this might lock too much (architectures)
for repo in ${repos[@]}; do
for pkgarch in ${ARCHES[@]}; do
@@ -30,13 +37,19 @@ for repo in ${repos[@]}; do
if [ $? -eq 0 ]; then
for pkg in ${pkgs[@]}; do
if [ -h "${pkg}" ]; then
- die "Package ${repo}/$(basename ${pkg}) is a symbolic link"
+ die "Package ${repo}/${pkg##*/} is a symbolic link"
fi
if ! check_pkgfile "${pkg}"; then
- die "Package ${repo}/$(basename ${pkg}) is not consistent with its meta data"
+ die "Package ${repo}/${pkg##*/} is not consistent with its meta data"
+ fi
+ if ${REQUIRE_SIGNATURE} && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then
+ die "Package ${repo}/${pkg##*/} does not have a valid signature"
+ fi
+ if ! check_pkgxbs "${pkg}" "${repo}"; then
+ die "Package ${repo}/${pkg##*/} is not consistent with xbs"
fi
if ! check_pkgrepos "${pkg}"; then
- die "Package ${repo}/$(basename ${pkg}) already exists in another repository"
+ die "Package ${repo}/${pkg##*/} already exists in another repository"
fi
done
# This is fucking obnoxious
@@ -55,7 +68,7 @@ for repo in ${repos[@]}; do
add_pkgs=()
arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null))
for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do
- pkgfile="$(basename ${pkg})"
+ pkgfile="${pkg##*/}"
msg2 "${pkgfile} (${pkgarch})"
# any packages might have been moved by the previous run
if [ -f "${pkg}" ]; then
diff --git a/test/lib/common.inc b/test/lib/common.inc
index a2dee10..2f308dd 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -1,24 +1,60 @@
set -E
+# override the default TMPDIR
+init_tmpdir() {
+ [[ -n $MASTER_TMPDIR ]] || export MASTER_TMPDIR="$(mktemp -dqt ${0##*/}.XXXXXXXXXX)"
+ export TMPDIR=$MASTER_TMPDIR
+}
+
+_TMPDIR=$TMPDIR
. "$(dirname ${BASH_SOURCE[0]})/../../config"
+TMPDIR=$_TMPDIR
+init_tmpdir
+
. "$(dirname ${BASH_SOURCE[0]})/../../db-functions"
+arches() (
+ . $(librelib conf.sh)
+ load_files libretools
+ printf '%s\n' "${ARCHES[*]}"
+)
+
+arch_svn() {
+ /usr/bin/svn "$@"
+}
+
+signpkg() {
+ if [[ -r '/etc/makepkg.conf' ]]; then
+ source '/etc/makepkg.conf'
+ else
+ die '/etc/makepkg.conf not found!'
+ fi
+ if [[ -r ~/.makepkg.conf ]]; then
+ . ~/.makepkg.conf
+ fi
+ if [[ -n $GPGKEY ]]; then
+ SIGNWITHKEY="-u ${GPGKEY}"
+ fi
+ gpg --detach-sign --use-agent ${SIGNWITHKEY} ${@} || die
+}
+
oneTimeSetUp() {
local p
local d
local a
+ local arches=($(arches))
local pkgname
local pkgarch
local pkgversion
local build
- pkgdir="$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX)"
+ pkgdir="$(mktemp -dqt ${0##*/}.XXXXXXXXXX)"
cp -Lr $(dirname ${BASH_SOURCE[0]})/../packages/* "${pkgdir}"
msg 'Building packages...'
for d in "${pkgdir}"/*; do
pushd $d >/dev/null
pkgname=($(. PKGBUILD; echo ${pkgname[@]}))
pkgarch=($(. PKGBUILD; echo ${arch[@]}))
- pkgversion=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
+ pkgversion=$(. PKGBUILD; get_full_version)
build=true
for a in ${pkgarch[@]}; do
@@ -29,17 +65,19 @@ oneTimeSetUp() {
if ! ${build}; then
if [ "${pkgarch[0]}" == 'any' ]; then
- sudo extra-x86_64-build || die 'extra-x86_64-build failed'
+ sudo libremakepkg || die 'libremakepkg failed'
else
for a in ${pkgarch[@]}; do
- sudo extra-${a}-build || die "extra-${a}-build failed"
+ if in_array $a ${arches[@]}; then
+ sudo setarch $a libremakepkg -n $a || die "setarch ${a} libremakepkg -n ${a} failed"
+ for p in ${pkgname[@]}; do
+ cp ${p}-${pkgversion}-${a}${PKGEXT} $(dirname ${BASH_SOURCE[0]})/../packages/${d##*/}
+ done
+ else
+ warning "skipping arch %s" "$a"
+ fi
done
fi
- for a in ${pkgarch[@]}; do
- for p in ${pkgname[@]}; do
- cp ${p}-${pkgversion}-${a}${PKGEXT} $(dirname ${BASH_SOURCE[0]})/../packages/$(basename ${d})
- done
- done
fi
popd >/dev/null
done
@@ -56,16 +94,18 @@ setUp() {
local a
[ -f "$(dirname ${BASH_SOURCE[0]})/../../config.local" ] && die "$(dirname ${BASH_SOURCE[0]})/../../config.local exists"
- TMP="$(mktemp -d /dev/shm/$(basename $0).XXXXXXXXXX)"
+ init_tmpdir
+ TMP="$(mktemp -dqt ${0##*/}.XXXXXXXXXX)"
#msg "Using ${TMP}"
PKGREPOS=('core' 'extra' 'testing')
PKGPOOL='pool/packages'
+ SRCPOOL='pool/sources'
mkdir -p "${TMP}/"{ftp,tmp,staging,{package,source}-cleanup,svn-packages-{copy,repo}}
for r in ${PKGREPOS[@]}; do
mkdir -p "${TMP}/staging/${r}"
- for a in ${ARCHES[@]} any; do
+ for a in ${ARCHES[@]}; do
mkdir -p "${TMP}/ftp/${r}/os/${a}"
done
done
@@ -74,21 +114,33 @@ setUp() {
msg 'Creating svn repository...'
svnadmin create "${TMP}/svn-packages-repo"
- svn checkout -q "file://${TMP}/svn-packages-repo" "${TMP}/svn-packages-copy"
+ arch_svn checkout -q "file://${TMP}/svn-packages-repo" "${TMP}/svn-packages-copy"
for p in "${pkgdir}"/*; do
- pkg=$(basename $p)
+ pkg=${p##*/}
mkdir -p "${TMP}/svn-packages-copy/${pkg}"/{trunk,repos}
cp "${p}"/* "${TMP}/svn-packages-copy"/${pkg}/trunk/
- svn add -q "${TMP}/svn-packages-copy"/${pkg}
- svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy"
+ arch_svn add -q "${TMP}/svn-packages-copy"/${pkg}
+ arch_svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy"
done
+ mkdir -p "${TMP}/home/.config/libretools"
+ export XDG_CONFIG_HOME="${TMP}/home/.config"
+ printf '%s\n' \
+ 'SVNURL=foo' \
+ "SVNREPO=\"${TMP}/svn-packages-copy\"" \
+ "ARCHES=($(arches))" \
+ > $XDG_CONFIG_HOME/libretools/xbs-abs.conf
+ printf '%s\n' 'BUILDSYSTEM=abs' > $XDG_CONFIG_HOME/xbs.conf
+
cat <<eot > "$(dirname ${BASH_SOURCE[0]})/../../config.local"
FTP_BASE="${TMP}/ftp"
- SVNREPO="file://${TMP}/svn-packages-repo"
+ SVNREPO="${TMP}/svn-packages-copy"
PKGREPOS=(${PKGREPOS[@]})
PKGPOOL="${PKGPOOL}"
+ SRCPOOL="${SRCPOOL}"
+ TESTING_REPO='testing'
+ STABLE_REPOS=('core' 'extra')
CLEANUP_DESTDIR="${TMP}/package-cleanup"
SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup"
STAGING="${TMP}/staging"
@@ -110,18 +162,24 @@ releasePackage() {
local repo=$1
local pkgbase=$2
local arch=$3
+ local a
+ local p
+ local pkgver
+ local pkgname
pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null
- archrelease ${repo}-${arch} >/dev/null 2&>1
- pkgver=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
+ xbs release ${repo} ${arch} >/dev/null 2>&1
+ pkgver=$(. PKGBUILD; get_full_version)
+ pkgname=($(. PKGBUILD; echo ${pkgname[@]}))
popd >/dev/null
cp "${pkgdir}/${pkgbase}"/*-${pkgver}-${arch}${PKGEXT} "${STAGING}"/${repo}/
if ${REQUIRE_SIGNATURE}; then
- # TODO: really sign the packages with a valid key
- find "${STAGING}"/${repo}/ -type f \
- -name "*-${pkgver}-${arch}${PKGEXT}" \
- -exec touch {}.sig \;
+ for a in ${arch[@]}; do
+ for p in ${pkgname[@]}; do
+ signpkg "${STAGING}"/${repo}/${p}-${pkgver}-${a}${PKGEXT}
+ done
+ done
fi
}
@@ -136,28 +194,25 @@ checkAnyPackageDB() {
[ -r "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found"
fi
- for arch in i686 x86_64; do
+ for arch in $(arches); do
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} is not a symlink"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/${PKGPOOL}/${pkg}" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}")" ] \
|| fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}"
if ${REQUIRE_SIGNATURE}; then
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}.sig")" ] \
|| fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig"
fi
+
+ for db in ${DBEXT} ${FILESEXT}; do
+ ( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
+ && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep ${pkg} &>/dev/null) \
+ || fail "${pkg} not in ${repo}/os/${arch}/${repo}${db%.tar.*}"
+ done
done
[ -r "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir"
[ -r "${STAGING}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging dir"
-
- for db in ${DBEXT} ${FILESEXT}; do
- ( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkg}) \
- || fail "${pkg} not in ${repo}/os/${arch}/${repo}${db%.tar.*}"
- done
-
- [ -r "${FTP_BASE}/${repo}/os/any/${pkg}" ] && fail "${repo}/os/any/${pkg} should not exist"
- [ -r "${FTP_BASE}/${repo}/os/any/${pkg}.sig" ] && fail "${repo}/os/any/${pkg}.sig should not exist"
}
checkAnyPackage() {
@@ -167,7 +222,7 @@ checkAnyPackage() {
checkAnyPackageDB $repo $pkg
local pkgbase=$(getpkgbase "${FTP_BASE}/${PKGPOOL}/${pkg}")
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
+ arch_svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
[ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
|| fail "svn-packages-copy/${pkgbase}/repos/${repo}-any does not exist"
}
@@ -182,7 +237,7 @@ checkPackageDB() {
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} not a symlink"
[ -r "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/${PKGPOOL}/${pkg}" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}")" ] \
|| fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}"
if ${REQUIRE_SIGNATURE}; then
@@ -190,13 +245,13 @@ checkPackageDB() {
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink"
[ -r "${STAGING}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging dir"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] \
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig")" == "$(readlink -e "${FTP_BASE}/${PKGPOOL}/${pkg}.sig")" ] \
|| fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig"
fi
for db in ${DBEXT} ${FILESEXT}; do
( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkg}) \
+ && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep ${pkg} &>/dev/null) \
|| fail "${pkg} not in ${repo}/os/${arch}/${repo}${db%.tar.*}"
done
}
@@ -209,7 +264,7 @@ checkPackage() {
checkPackageDB $repo $pkg $arch
local pkgbase=$(getpkgbase "${FTP_BASE}/${PKGPOOL}/${pkg}")
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
+ arch_svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
[ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \
|| fail "svn-packages-copy/${pkgbase}/repos/${repo}-${arch} does not exist"
}
@@ -222,7 +277,7 @@ checkRemovedPackageDB() {
for db in ${DBEXT} ${FILESEXT}; do
( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \
+ && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep ${pkgbase} &>/dev/null) \
&& fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${db%.tar.*}"
done
}
@@ -234,7 +289,7 @@ checkRemovedPackage() {
checkRemovedPackageDB $repo $pkgbase $arch
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
+ arch_svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
[ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \
&& fail "svn-packages-copy/${pkgbase}/repos/${repo}-${arch} should not exist"
}
@@ -246,9 +301,9 @@ checkRemovedAnyPackageDB() {
local db
for db in ${DBEXT} ${FILESEXT}; do
- for arch in i686 x86_64; do
+ for arch in $(arches); do
( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \
+ && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep ${pkgbase} &>/dev/null) \
&& fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${db%.tar.*}"
done
done
@@ -260,7 +315,7 @@ checkRemovedAnyPackage() {
checkRemovedAnyPackageDB $repo $pkgbase
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
+ arch_svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
[ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
&& fail "svn-packages-copy/${pkgbase}/repos/${repo}-any should not exist"
}
diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh
index 49734c4..e78bde8 100755
--- a/test/test.d/create-filelists.sh
+++ b/test/test.d/create-filelists.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testCreateSimpleFileLists() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
local pkgbase
local arch
@@ -18,7 +18,7 @@ testCreateSimpleFileLists() {
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
- if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/${pkgbase}"; then
+ if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep "usr/bin/${pkgbase}" &>/dev/null; then
fail "usr/bin/${pkgbase} not found in ${arch}/extra${FILESEXT}"
fi
done
@@ -26,7 +26,7 @@ testCreateSimpleFileLists() {
}
testCreateAnyFileLists() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase
local arch
@@ -38,7 +38,7 @@ testCreateAnyFileLists() {
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
- if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/share/${pkgbase}/test"; then
+ if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep "usr/share/${pkgbase}/test" &>/dev/null; then
fail "usr/share/${pkgbase}/test not found in ${arch}/extra${FILESEXT}"
fi
done
@@ -46,7 +46,7 @@ testCreateAnyFileLists() {
}
testCreateSplitFileLists() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
@@ -65,7 +65,7 @@ testCreateSplitFileLists() {
pkgnames=($(source "${TMP}/svn-packages-copy/${pkgbase}/trunk/PKGBUILD"; echo ${pkgname[@]}))
for pkgname in ${pkgnames[@]}; do
for arch in ${arches[@]}; do
- if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/${pkgname}"; then
+ if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep "usr/bin/${pkgname}" &>/dev/null; then
fail "usr/bin/${pkgname} not found in ${arch}/extra${FILESEXT}"
fi
done
@@ -75,7 +75,7 @@ testCreateSplitFileLists() {
testCleanupFileLists() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
@@ -92,10 +92,10 @@ testCleanupFileLists() {
done
for arch in ${arches[@]}; do
- if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/pkg-simple-b"; then
+ if ! bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep "usr/bin/pkg-simple-b" &>/dev/null; then
fail "usr/bin/pkg-simple-b not found in ${arch}/extra${FILESEXT}"
fi
- if bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/pkg-simple-a"; then
+ if bsdtar -xOf "${FTP_BASE}/extra/os/${arch}/extra${FILESEXT}" | grep "usr/bin/pkg-simple-a" &>/dev/null; then
fail "usr/bin/pkg-simple-a still found in ${arch}/extra${FILESEXT}"
fi
done
diff --git a/test/test.d/db-move.sh b/test/test.d/db-move.sh
index 9d7c1f6..3cf355b 100755
--- a/test/test.d/db-move.sh
+++ b/test/test.d/db-move.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testMoveSimplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
@@ -28,7 +28,7 @@ testMoveSimplePackages() {
}
testMoveMultiplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
@@ -52,7 +52,7 @@ testMoveMultiplePackages() {
}
testMoveEpochPackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-epoch')
local pkgbase
local arch
@@ -90,7 +90,7 @@ testMoveAnyPackages() {
}
testMoveSplitPackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
@@ -107,12 +107,12 @@ testMoveSplitPackages() {
for arch in ${arches[@]}; do
for pkg in "${pkgdir}/pkg-split-a"/*-${arch}${PKGEXT}; do
- checkPackage extra $(basename ${pkg}) ${arch}
+ checkPackage extra ${pkg##*/} ${arch}
done
done
for arch in ${arches[@]}; do
for pkg in "${pkgdir}/pkg-split-b"/*-${arch}${PKGEXT}; do
- checkPackage testing $(basename ${pkg}) ${arch}
+ checkPackage testing ${pkg##*/} ${arch}
done
done
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh
index 416e693..d79605e 100755
--- a/test/test.d/db-remove.sh
+++ b/test/test.d/db-remove.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testRemovePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
local pkgbase
local arch
@@ -31,7 +31,7 @@ testRemovePackages() {
}
testRemoveMultiplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
local pkgbase
local arch
diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh
index 8603104..09fc52f 100755
--- a/test/test.d/db-repo-add.sh
+++ b/test/test.d/db-repo-add.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testAddSimplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
@@ -27,7 +27,7 @@ testAddSimplePackages() {
}
testAddMultiplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
diff --git a/test/test.d/db-repo-remove.sh b/test/test.d/db-repo-remove.sh
index 315d63d..eec0109 100755
--- a/test/test.d/db-repo-remove.sh
+++ b/test/test.d/db-repo-remove.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testRemovePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
local pkgbase
local arch
@@ -31,7 +31,7 @@ testRemovePackages() {
}
testRemoveMultiplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
local pkgbase
local arch
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index e38c328..7f1874b 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testAddSimplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
@@ -52,7 +52,7 @@ testAddAnyPackages() {
}
testAddSplitPackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
@@ -69,7 +69,7 @@ testAddSplitPackages() {
for pkgbase in ${pkgs[@]}; do
for arch in ${arches[@]}; do
for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${PKGEXT}; do
- checkPackage extra $(basename ${pkg}) ${arch}
+ checkPackage extra ${pkg##*/} ${arch}
done
done
done
@@ -81,8 +81,8 @@ testUpdateAnyPackage() {
pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null
sed 's/pkgrel=1/pkgrel=2/g' -i PKGBUILD
- svn commit -q -m"update pkg to pkgrel=2" >/dev/null
- sudo extra-i686-build >/dev/null 2>&1
+ arch_svn commit -q -m"update pkg to pkgrel=2" >/dev/null
+ sudo libremakepkg
mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/"
popd >/dev/null
@@ -99,8 +99,8 @@ testUpdateAnyPackageToDifferentRepositoriesAtOnce() {
pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null
sed 's/pkgrel=1/pkgrel=2/g' -i PKGBUILD
- svn commit -q -m"update pkg to pkgrel=2" >/dev/null
- sudo extra-i686-build >/dev/null 2>&1
+ arch_svn commit -q -m"update pkg to pkgrel=2" >/dev/null
+ sudo libremakepkg
mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/"
popd >/dev/null
@@ -132,16 +132,16 @@ testUpdateSameAnyPackageToDifferentRepositories() {
../db-update >/dev/null 2>&1 && (fail 'Adding an existing package to another repository should fail'; return 1)
local arch
- for arch in i686 x86_64; do
+ for arch in $(arches); do
( [ -r "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep -q ${pkgbase}) \
+ && 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
}
testAddIncompleteSplitPackage() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local repo='extra'
local pkgbase='pkg-split-a'
local arch
@@ -157,9 +157,19 @@ testAddIncompleteSplitPackage() {
for arch in ${arches[@]}; do
( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep -q ${pkgbase}) \
+ && 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
}
+testUnknownRepo() {
+ mkdir "${STAGING}/unknown/"
+ releasePackage extra 'pkg-simple-a' 'i686'
+ releasePackage unknown 'pkg-simple-b' 'i686'
+ ../db-update
+ checkPackage extra 'pkg-simple-a-1-1-i686.pkg.tar.xz' 'i686'
+ [ -e "${FTP_BASE}/unknown" ] && fail "db-update pushed a package into an unknown repository"
+ rm -rf "${STAGING}/unknown/"
+}
+
. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/ftpdir-cleanup.sh b/test/test.d/ftpdir-cleanup.sh
index 20026b4..630b88f 100755
--- a/test/test.d/ftpdir-cleanup.sh
+++ b/test/test.d/ftpdir-cleanup.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testCleanupSimplePackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
@@ -35,7 +35,7 @@ testCleanupSimplePackages() {
}
testCleanupEpochPackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-epoch')
local pkgbase
local arch
@@ -85,7 +85,7 @@ testCleanupAnyPackages() {
}
testCleanupSplitPackages() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
@@ -113,7 +113,7 @@ testCleanupSplitPackages() {
done
for pkg in "${pkgdir}/${pkgs[1]}"/*-${arch}${PKGEXT}; do
- checkPackage extra $(basename ${pkg}) ${arch}
+ checkPackage extra ${pkg##*/} ${arch}
done
done
}
diff --git a/test/test.d/pool-transition.sh b/test/test.d/pool-transition.sh
deleted file mode 100755
index 5873f00..0000000
--- a/test/test.d/pool-transition.sh
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
-testMovePackagesWithoutPool() {
- local arches=('i686' 'x86_64')
- local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b')
- local pkgbase
- local arch
- local pkg
- local old
-
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- releasePackage testing ${pkgbase} ${arch}
- done
- done
-
- ../db-update
-
- # transform two packages to old style layout
- for arch in ${arches[@]}; do
- for old in 0 2; do
- for pkg in "${pkgdir}/${pkgs[${old}]}"/*-${arch}${PKGEXT}; do
- pkg=$(basename $pkg)
- mv -f "${FTP_BASE}/${PKGPOOL}/${pkg}" "${FTP_BASE}/testing/os/${arch}/${pkg}"
- done
- done
- done
-
- ../cron-jobs/ftpdir-cleanup >/dev/null
-
- ../db-move testing extra ${pkgs[@]}
-
- ../cron-jobs/ftpdir-cleanup >/dev/null
-
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${PKGEXT}; do
- checkPackage extra $(basename ${pkg}) ${arch}
- done
- checkRemovedPackage testing ${pkgbase} ${arch}
- done
- done
-}
-
-testUpdateAnyPackageWithoutPool() {
- local pkgname='pkg-any-a'
- local pkg1='pkg-any-a-1-1-any.pkg.tar.xz'
- local pkg2='pkg-any-a-1-2-any.pkg.tar.xz'
- local arch
-
-
- releasePackage extra pkg-any-a any
- ../db-update
- # transform two packages to old style layout
- mv -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" "${FTP_BASE}/extra/os/any"
- for arch in i686 x86_64; do
- ln -sf "../any/${pkg1}" "${FTP_BASE}/extra/os/${arch}"
- done
-
- pushd "${TMP}/svn-packages-copy/${pkgname}/trunk/" >/dev/null
- sed 's/pkgrel=1/pkgrel=2/g' -i PKGBUILD
- svn commit -q -m"update pkg to pkgrel=2" >/dev/null
- sudo extra-i686-build >/dev/null 2>&1
- mv "${pkg2}" "${pkgdir}/${pkgname}/"
- popd >/dev/null
-
- releasePackage extra ${pkgname} any
- ../db-update
- rm -f "${pkgdir}/${pkgname}/${pkg2}"
-
- ../cron-jobs/ftpdir-cleanup >/dev/null
-
- checkAnyPackage extra "${pkg2}"
-
- [ -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found"
- for arch in any i686 x86_64; do
- [ -f "${FTP_BASE}/extra/os/${arch}/${pkg1}" ] && fail "extra/os/${arch}/${pkg1} found"
- done
-}
-
-testMoveAnyPackagesWithoutPool() {
- local pkgs=('pkg-any-a' 'pkg-any-b')
- local pkgbase
- local arch
- local pkg
-
- for pkgbase in ${pkgs[@]}; do
- releasePackage testing ${pkgbase} any
- done
-
- ../db-update
-
- # transform a package to old style layout
- for pkg in "${pkgdir}/${pkgs[0]}"/*-any${PKGEXT}; do
- pkg=$(basename $pkg)
- mv -f "${FTP_BASE}/${PKGPOOL}/${pkg}" "${FTP_BASE}/testing/os/any/${pkg}"
- for arch in i686 x86_64; do
- ln -sf "../any/${pkg}" "${FTP_BASE}/testing/os/${arch}/${pkg}"
- done
- done
-
- ../cron-jobs/ftpdir-cleanup >/dev/null
-
- ../db-move testing extra ${pkgs[@]}
-
- ../cron-jobs/ftpdir-cleanup >/dev/null
-
- for pkgbase in ${pkgs[@]}; do
- for pkg in "${pkgdir}/${pkgbase}"/*-any${PKGEXT}; do
- checkAnyPackage extra $(basename ${pkg})
- done
- checkRemovedAnyPackage testing ${pkgbase}
- done
-
- for pkg in "${pkgdir}/${pkgs[0]}"/*-any${PKGEXT}; do
- pkg=$(basename $pkg)
- for arch in any i686 x86_64; do
- [ -f "${FTP_BASE}/testing/os/${arch}/${pkg}" ] && fail "testing/os/${arch}/${pkg} found"
- done
- done
-}
-
-testUpdateSameAnyPackageToDifferentRepositoriesWithoutPool() {
- local pkg
- local arch
-
- releasePackage extra pkg-any-a any
- ../db-update
-
- # transform a package to old style layout
- for pkg in "${pkgdir}/pkg-any-a"/*-any${PKGEXT}; do
- pkg=$(basename $pkg)
- mv -f "${FTP_BASE}/${PKGPOOL}/${pkg}" "${FTP_BASE}/extra/os/any/${pkg}"
- for arch in i686 x86_64; do
- ln -sf "../any/${pkg}" "${FTP_BASE}/extra/os/${arch}/${pkg}"
- done
- done
-
- releasePackage testing pkg-any-a any
- ../db-update >/dev/null 2>&1 && (fail 'Adding an existing package to another repository should fail'; return 1)
-
- for arch in i686 x86_64; do
- ( [ -r "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \
- && bsdtar -xf "${FTP_BASE}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep -q pkg-any-a) \
- && fail "pkg-any-a should not be in testing/os/${arch}/testing${DBEXT%.tar.*}"
- done
-}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/signed-packages.sh b/test/test.d/signed-packages.sh
index 5d6f4ff..03566ef 100755
--- a/test/test.d/signed-packages.sh
+++ b/test/test.d/signed-packages.sh
@@ -3,11 +3,34 @@
curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
+testAddSignedPackage() {
+ releasePackage extra 'pkg-simple-a' 'i686'
+ ../db-update || fail "db-update failed!"
+}
+
testAddUnsignedPackage() {
releasePackage extra 'pkg-simple-a' 'i686'
- # remove any signature
rm "${STAGING}"/extra/*.sig
../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is missing!"
}
+testAddInvalidSignedPackage() {
+ local p
+ releasePackage extra 'pkg-simple-a' 'i686'
+ for p in "${STAGING}"/extra/*${PKGEXT}; do
+ unxz $p
+ xz -0 ${p%%.xz}
+ done
+ ../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is invalid!"
+}
+
+testAddBrokenSignature() {
+ local s
+ releasePackage extra 'pkg-simple-a' 'i686'
+ for s in "${STAGING}"/extra/*.sig; do
+ echo 0 > $s
+ done
+ ../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is broken!"
+}
+
. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh
index fdcf08c..472cb30 100755
--- a/test/test.d/sourceballs.sh
+++ b/test/test.d/sourceballs.sh
@@ -4,7 +4,7 @@ curdir=$(readlink -e $(dirname $0))
. "${curdir}/../lib/common.inc"
testSourceballs() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
local pkgbase
local arch
@@ -38,7 +38,7 @@ testAnySourceballs() {
}
testSplitSourceballs() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-split-a' 'pkg-split-b')
local pkg
local pkgbase
@@ -59,7 +59,7 @@ testSplitSourceballs() {
}
testSourceballsCleanup() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-simple-a' 'pkg-simple-b')
local pkgbase
local arch
diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh
index eda6cd6..0c2fa83 100755
--- a/test/test.d/testing2x.sh
+++ b/test/test.d/testing2x.sh
@@ -9,8 +9,8 @@ testTesting2xAnyPackage() {
pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null
sed 's/pkgrel=1/pkgrel=2/g' -i PKGBUILD
- svn commit -q -m"update pkg to pkgrel=2" >/dev/null
- sudo extra-i686-build >/dev/null 2>&1
+ arch_svn commit -q -m"update pkg to pkgrel=2" >/dev/null
+ sudo libremakepkg
mv pkg-any-a-1-2-any.pkg.tar.xz "${pkgdir}/pkg-any-a/"
popd >/dev/null
diff --git a/testing2x b/testing2x
index 54cae11..14610c2 100755
--- a/testing2x
+++ b/testing2x
@@ -1,16 +1,16 @@
#!/bin/bash
-. "$(dirname $0)/db-functions"
-. "$(dirname $0)/config"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 1 ]; then
- msg "usage: $(basename $0) <pkgname|pkgbase> ..."
+ msg "usage: ${0##*/} <pkgname|pkgbase> ..."
exit 1
fi
-# Lock everything to reduce possibility of interfering task between the different repo-updates
+# Lock everything to reduce possibility of interfering task between the different repo-updates
script_lock
-for repo in 'core' 'extra' 'testing'; do
+for repo in ${TESTING_REPO} ${STABLE_REPOS[@]}; do
for pkgarch in ${ARCHES[@]}; do
repo_lock ${repo} ${pkgarch} || exit 1
done
@@ -20,41 +20,39 @@ declare -A pkgs
for pkgbase in $*; do
if [ ! -d "${WORKDIR}/${pkgbase}" ]; then
- /usr/bin/svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null
-
found_source=false
for pkgarch in ${ARCHES[@]} 'any'; do
- svnrepo_from="${WORKDIR}/${pkgbase}/testing-${pkgarch}"
- if [ -r "${svnrepo_from}/PKGBUILD" ]; then
+ xbsrepo_from="$(xbs releasepath ${pkgbase} ${TESTING_REPO} ${pkgarch})"
+ if [ -r "${xbsrepo_from}/PKGBUILD" ]; then
found_source=true
break
fi
done
- ${found_source} || die "${pkgbase} not found in [testing]"
+ ${found_source} || die "${pkgbase} not found in [${TESTING_REPO}]"
found_target=false
for pkgarch in ${ARCHES[@]} 'any'; do
- for repo in 'core' 'extra'; do
- svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}"
- if [ -r "${svnrepo_to}/PKGBUILD" ]; then
+ for repo in ${STABLE_REPOS[@]}; do
+ xbsrepo_to="$(xbs releasepath ${pkgbase} ${repo} ${pkgarch})"
+ if [ -r "${xbsrepo_to}/PKGBUILD" ]; then
found_target=true
pkgs[${repo}]+="${pkgbase} "
break 2
fi
done
done
- ${found_target} || die "${pkgbase} neither found in [core] nor [extra]"
+ ${found_target} || die "${pkgbase} not found in any of these repos: ${STABLE_REPOS[@]}"
fi
done
for pkgarch in ${ARCHES[@]}; do
- repo_unlock 'testing' ${pkgarch}
+ repo_unlock ${TESTING_REPO} ${pkgarch}
done
-for repo in 'core' 'extra'; do
+for repo in ${STABLE_REPOS[@]}; do
for pkgarch in ${ARCHES[@]}; do
repo_unlock ${repo} ${pkgarch}
done
if [ -n "${pkgs[${repo}]}" ]; then
- "$(dirname $0)/db-move" 'testing' "${repo}" ${pkgs[${repo}]}
+ "$(dirname $0)/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]}
fi
done