summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xany-to-ours2
-rw-r--r--config1
-rw-r--r--config.local.svn-community11
-rw-r--r--config.local.svn-packages11
-rwxr-xr-xcron-jobs/ftpdir-cleanup8
-rwxr-xr-xcron-jobs/repo-sanity-check1
-rwxr-xr-xcron-jobs/sourceballs19
-rw-r--r--cron-jobs/sourceballs.skip24
-rwxr-xr-xdb-cleanup2
-rw-r--r--db-functions141
-rwxr-xr-xdb-import288
-rw-r--r--db-import.conf17
-rwxr-xr-xdb-move35
-rwxr-xr-xdb-pick-mirror24
-rwxr-xr-xdb-remove9
-rwxr-xr-xdb-sync8
-rwxr-xr-xdb-update22
-rwxr-xr-xlibremessages83
-rw-r--r--test/lib/common.inc181
-rwxr-xr-xtest/test.d/create-filelists.sh52
-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-xtesting2x26
31 files changed, 683 insertions, 533 deletions
diff --git a/any-to-ours b/any-to-ours
index d98cc5d..8a4e874 100755
--- a/any-to-ours
+++ b/any-to-ours
@@ -8,7 +8,7 @@ trap_exit() {
}
source "$(dirname "$(readlink -e "$0")")/config"
-source "$(dirname "$(readlink -e "$0")")/libremessages"
+source "$(librelib messages)"
# From makepkg
set -E
diff --git a/config b/config
index 75e88cb..e43c13d 100644
--- a/config
+++ b/config
@@ -4,6 +4,7 @@ SVNREPO="/var/abs"
# Repos from Arch
ARCHREPOS=('core' 'testing' 'extra' 'community' 'multilib' 'multilib-testing')
+TESTING_REPO='testing'
# Official Parabola repos
OURREPOS=('libre' 'libre-testing' 'libre-multilib' 'libre-multilib-testing')
# User repos
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 4a2b418..560689a 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -22,6 +22,14 @@ clean_pkg() {
fi
}
+script_lock
+
+for repo in "${PKGREPOS[@]}"; do
+ for arch in "${ARCHES[@]}"; do
+ repo_lock "${repo}" "${arch}" || exit 1
+ done
+done
+
"${CLEANUP_DRYRUN}" && warning 'dry run mode is active'
for repo in "${PKGREPOS[@]}"; do
diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check
index c7ee377..bd89240 100755
--- a/cron-jobs/repo-sanity-check
+++ b/cron-jobs/repo-sanity-check
@@ -51,5 +51,4 @@ for _repo in "${PKGREPOS[@]}"; do
msg2 "Removed the following packages:"
plain '%s' "${remove[@]}"
-
done
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 2895725..c12a128 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -78,15 +78,10 @@ for repo in "${PKGREPOS[@]}"; do
continue
fi
- # Get the sources from svn
+ # Get the sources from xbs
mkdir -p -m0770 "${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
+ cp -a "$(xbs releasepath "${pkgbase}" "${repo}" "${pkgarch}")" \
+ "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
if [ $? -ge 1 ]; then
failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
continue
@@ -94,7 +89,7 @@ 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_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}"
# Avoid creating the same source package for every arch
@@ -102,6 +97,7 @@ for repo in "${PKGREPOS[@]}"; do
newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
else
failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
+ cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log"
fi
popd >/dev/null
fi
@@ -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/db-cleanup b/db-cleanup
index efe7397..54c1ba8 100755
--- a/db-cleanup
+++ b/db-cleanup
@@ -16,7 +16,7 @@ trap_exit() {
}
source "$(dirname "$(readlink -e "$0")")/config"
-source "$(dirname "$(readlink -e "$0")")/libremessages"
+source "$(librelib messages)"
# From makepkg
set -E
diff --git a/db-functions b/db-functions
index a4b072b..5d13022 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=""
@@ -27,71 +27,14 @@ mv_acl() {
# set up general environment
WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
LOCKS=()
+REPO_MODIFIED=0
-# 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
-}
-
-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
-}
-
-##
-# 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, abort, die
+# Overwritten: cleanup
+# Ignored: stat_busy, stat_done,
+# setup_workdir, trab_abort, trap_exit,
+# lock, slock, lock_close
+. $(librelib common)
script_lock() {
local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
@@ -137,17 +80,12 @@ cleanup() {
script_unlock
fi
rm -rf "$WORKDIR"
- [ "$1" ] && exit "$1"
-}
-abort() {
- msg 'Aborting...'
- cleanup 0
-}
+ if (( REPO_MODIFIED )); then
+ date +%s > "${FTP_BASE}/lastupdate"
+ fi
-die() {
- error "$@"
- cleanup 1
+ [ "$1" ] && exit "$1"
}
trap abort INT QUIT TERM HUP
@@ -340,7 +278,7 @@ check_pkgfile() {
fi
}
-check_pkgsvn() {
+check_pkgxbs() {
local pkgfile="${1}"
local _pkgbase="$(getpkgbase "${pkgfile}")"
[ $? -ge 1 ] && return 1
@@ -354,18 +292,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}"; 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
}
@@ -376,7 +307,7 @@ check_splitpkgs() {
local pkgfiles=("${@}")
local pkgfile
local pkgdir
- local svnname
+ local xbsname
mkdir -p "${WORKDIR}/check_splitpkgs/"
pushd "${WORKDIR}/check_splitpkgs" >/dev/null
@@ -390,29 +321,16 @@ 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[@]}"))
- printf '%s\n' "${svnnames[@]}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn"
+ local xbsnames=($(. "$(xbs releasepath "${_pkgbase}" "${repo}" "${_pkgarch}")/PKGBUILD"; echo "${pkgname[@]}"))
+ printf '%s\n' "${xbsnames[@]}" >> "${repo}/${_pkgarch}/${_pkgbase}/xbs"
done
popd >/dev/null
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
@@ -435,17 +353,6 @@ check_pkgrepos() {
[ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}" ] && return 1
[ -f "${FTP_BASE}/${PKGPOOL}/${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}/${pkgfile##*/}" ] && return 1
- [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkgfile##*/}.sig" ] && return 1
- done
- done
-
return 0
}
@@ -510,6 +417,8 @@ arch_repo_add() {
|| error '%s' "repo-add -f ${repo}${FILESEXT} ${pkgs[*]}"
popd >/dev/null
set_repo_permission "${repo}" "${arch}"
+
+ REPO_MODIFIED=1
}
arch_repo_remove() {
@@ -528,4 +437,6 @@ arch_repo_remove() {
/usr/bin/repo-remove -q "${filesfile}" "${pkgs[@]}" \
|| error '%s' "repo-remove ${filesfile} ${pkgs[*]}"
set_repo_permission "${repo}" "${arch}"
+
+ REPO_MODIFIED=1
}
diff --git a/db-import b/db-import
new file mode 100755
index 0000000..a8a073d
--- /dev/null
+++ b/db-import
@@ -0,0 +1,288 @@
+#!/bin/bash
+set -euE
+# Imports Arch-like repos, running them through a blacklist
+# License: GPLv3
+
+. "$(dirname "$(readlink -e "$0")")/config" # for: FTP_BASE DBEXT
+. "$(dirname "$(readlink -e "$0")")/db-import.conf" # for: IMPORTDIR IMPORTS
+. "$(librelib messages)"
+. "$(librelib blacklist)"
+
+# DBs = pacman DataBases
+
+# This replaces two scripts:
+# - abslibre : imported ABS tree from Arch
+# - db-sync : imported pacman DBs from Arch
+
+# The flow here is:
+# 1. "${IMPORTDIR}/cache/${name}/dbs/" # Download the pacman databases
+# 2. "${IMPORTDIR}/cache/${name}/abs/" # Download the ABS tree
+# 3. "${IMPORTDIR}/clean/${name}/dbs/" # Run the pacman DBs through the blacklist
+# 4. "${IMPORTDIR}/clean/${name}/pkgs/" # Download the pkg files mentioned in "clean/${name}/dbs/"
+# 5. "${IMPORTDIR}/staging/${tag}" # Copy all the package files we just downloaded to here
+# 6. Run `db-update on` with STAGING="${IMPORTDIR}/staging/${tag}"
+
+# generic arguments to pass to rsync, borrowed from `abs`
+SYNCARGS='-mrtvlH --no-motd --no-p --no-o --no-g'
+
+main() {
+ blacklist-update
+
+ local importStr
+ for importStr in "${IMPORTS[@]}"; do
+ local importAry=($importStr)
+ local name=${importAry[0]}
+ local pkgmirror=${importAry[1]}
+ local absmirror=${importAry[2]}
+ local tags=("${importAry[@]:3}")
+
+ msg "Fetching remote package source: %s" "$name"
+ fetch_dbs "$name" "$pkgmirror"
+ fetch_abs "$name" "$absmirror" "${tags[@]}"
+ msg "Filtering blacklisted packages from remote package source: %s" "$name"
+ clean_dbs "$name" "${tags[@]}"
+ fetch_pkgs "$name" "${tags[@]}"
+ msg "Publishing changes from remote package source: %s" "$name"
+ publish "$name" "${tags[@]}"
+ done
+ return $r
+}
+
+fetch_dbs() {
+ local name=$1
+ local pkgmirror=$2
+
+ msg2 'Synchronizing package databases...'
+
+ mkdir -p -- "${IMPORTDIR}/cache/${name}/dbs"
+ # Grab just the .db files from $pkgmirror
+ rsync $SYNCARGS --delete-after \
+ --include="*/" \
+ --include="*.db" \
+ --include="*${DBEXT}" \
+ --exclude="*" \
+ "rsync://${pkgmirror}/" "${IMPORTDIR}/cache/${name}/dbs"
+}
+
+fetch_abs() {
+ local name=$1
+ local absmirror=$2
+ local tags=("${@:3}")
+
+ local fake_home
+ local absroot
+
+ # Sync the ABS tree from $absmirror
+ local arch
+ for arch in $(list_arches "${tags[@]}"); do
+ msg2 'Synchronizing %s ABS tree...' "$arch"
+
+ absroot="${IMPORTDIR}/cache/${name}/abs/${arch}"
+ mkdir -p -- "$absroot"
+
+ # Configure `abs` for this mirror
+ fake_home="${IMPORTDIR}/homes/${name}/${arch}"
+ mkdir -p -- "$fake_home"
+ {
+ printf "ABSROOT='%s'\n" "$absroot"
+ printf "SYNCSERVER='%s'\n" "$absmirror"
+ printf "ARCH='%s'\n" "$arch"
+ printf 'REPOS=(\n'
+ list_repos "$arch" "${tags[@]}"
+ printf ')\n'
+ } > "${fake_home}/.abs.conf"
+
+ # Run `abs`
+ HOME=$fake_home abs
+ done
+}
+
+clean_dbs() {
+ local name=$1
+ local tags=("${@:2}")
+
+ rm -rf -- "${IMPORTDIR}/clean/$name"
+
+ local tag
+ for tag in "${tags[@]}"; do
+ msg2 'Creating clean version of %s package database...' "$tag"
+
+ local cache="${IMPORTDIR}/cache/$name/dbs/$(db_file "$tag")"
+ local clean="${IMPORTDIR}/clean/$name/dbs/$(db_file "$tag")"
+ install -Dm644 "$cache" "$clean"
+
+ blacklist-cat | blacklist-get-pkg | xargs -d '\n' repo-remove "$clean"
+ done
+}
+
+fetch_pkgs() {
+ local name=$1
+ local tags=("${@:2}")
+
+ local repo arch dbfile whitelist
+
+ local tag
+ for tag in "${tags[@]}"; do
+ msg2 'Syncronizing package files for %s...' "$tag"
+ repo=${tag%-*}
+ arch=${tag##*-}
+
+ dbfile="${IMPORTDIR}/clean/$name/dbs/$(db_file "$tag")"
+ whitelist="${IMPORTDIR}/clean/$name/dbs/$tag.whitelist"
+
+ list_pkgs "$dbfile" > "$whitelist"
+
+ # fetch the architecture-specific packages
+ rsync $SYNCARGS --delete-after --delete-excluded \
+ --delay-updates \
+ --include-from=<(sed "s|\$|-$arch.tar.?z|" "$whitelist") \
+ --exclude='*' \
+ "rsync://${pkgmirror}/$(db_dir "$tag")/" \
+ "${IMPORTDIR}/clean/${name}/pkgs/${tag}/"
+
+ # fetch the architecture-independent packages
+ rsync $SYNCARGS --delete-after --delete-excluded \
+ --delay-updates \
+ --include-from=<(sed "s|\$|-any.tar.?z|" "$whitelist") \
+ --exclude='*' \
+ "rsync://${pkgmirror}/$(db_dir "$tag")/" \
+ "${IMPORTDIR}/clean/${name}/pkgs/${repo}-any/"
+ done
+}
+
+publish() {
+ local name=$1
+ local tags=("${@:2}")
+
+ local tag
+ for tag in "${tags[@]}"; do
+ msg2 'Publishing changes to %s...' "$tag"
+ publish_tag "$name" "$tag"
+ done
+}
+
+publish_tag() {
+ local name=$1
+ local tag=$2
+
+ local repo=${tag%-*}
+ local arch=${tag##*-}
+ local dir="${IMPORTDIR}/clean/${name}/pkgs/${tag}"
+
+ local found
+ local error=false
+ local files=()
+
+ local pkgid pkgarch
+ for pkgid in $(list_added_pkgs "$name" "$tag"); do
+ found=false
+
+ for pkgarch in "${arch}" any; do
+ file="${dir}/${pkgid}-${arch}".pkg.tar.?z
+ if ! $found && [[ -r $file ]]; then
+ files+=("$file")
+ found=true
+ fi
+ done
+
+ if ! $found; then
+ error 'Could not find package file for %s' "$pkgid"
+ error=true
+ fi
+ done
+
+ if $error; then
+ error 'Quitting...'
+ return 1
+ fi
+
+ mkdir -p -- "${IMPORTDIR}/staging/${tag}/${repo}"
+ cp -al -- "${files[@]}" "${IMPORTDIR}/staging/${tag}/${repo}/"
+ STAGING="${IMPORTDIR}/staging/${tag}" db-update
+
+ # XXX: db-remove wants pkgbase, not pkgname
+ list_removed_pkgs "$name" "$tag" | xargs -d '\n' db-remove "$repo" "$arch"
+}
+
+################################################################################
+
+# Usage: list_arches repo-arch...
+# Returns a list of the architectures mentioned in a list of "repo-arch" pairs.
+list_arches() {
+ local tags=("$@")
+ printf '%s\n' "${tags[@]##*-}" | sort -u
+}
+
+# Usage: list_repos arch repo-arch...
+# Returns a list of all the repositories mentioned for a given architecture in a
+# list of "repo-arch" pairs.
+list_repos() {
+ local arch=$1
+ local tags=("${@:2}")
+ printf '%s\n' "${tags[@]}" | sed -n "s/-$arch\$//p"
+}
+
+# Usage: db_dir repo-arch
+db_dir() {
+ local tag=$1
+ local repo=${tag%-*}
+ local arch=${tag##*-}
+ echo "${repo}/os/${arch}"
+}
+
+# Usage; db_file repo-arch
+db_file() {
+ local tag=$1
+ local repo=${tag%-*}
+ local arch=${tag##*-}
+ echo "${repo}/os/${arch}/${repo}${DBEXT}"
+}
+
+# Usage: list_pkgs dbfile
+# Prints "$pkgname-$(get_full_version "$pkgname")" for every package in $dbfile
+list_pkgs() {
+ local dbfile=$1
+ bsdtar tf "$dbfile" | cut -d/ -f1
+}
+
+# Usage: list_pkgs | sep_ver
+# Separates the pkgname from the version (replaces the '-' with ' ') for the
+# list provided on stdin.
+sep_ver() {
+ sed -r 's/-([^-]*-[^-]*)$/ \1/'
+}
+
+# Usage: list_removed_pkgs importsrc repo-arch
+# Prints "$pkgname-$(get_full_version "$pkgname")" for every removed package.
+list_removed_pkgs() {
+ local name=$1
+ local tag=$2
+
+ local old="${FTP_BASE}/$(db_file "$tag")"
+ local new="${IMPORTDIR}/clean/$name/dbs/$(db_file "$tag")"
+
+ # make a list of:
+ # pkgname oldver[ newver]
+ # It will include removed or updated packages (changed packages)
+ join -a1 \
+ <(list_pkgs "$old"|sep_ver|sort) \
+ <(list_pkgs "$new"|sep_ver|sort)
+ | grep -v ' .* ' # remove updated packages
+ | sed 's/ /-/' # re-combine the pkgname and version
+}
+
+# Usage: list_added_pkgs importsrc repo-arch
+# slightly a misnomer; added and updated
+# Prints "$pkgname-$(get_full_version "$pkgname")" for every added or updated
+# package.
+list_added_pkgs() {
+ local name=$1
+ local tag=$2
+
+ local old="${FTP_BASE}/$(db_file "$tag")"
+ local new="${IMPORTDIR}/clean/$name/dbs/$(db_file "$tag")"
+
+ comm -13 <(list_pkgs "$old") <(list_pkgs "$new")
+}
+
+main "$@"
diff --git a/db-import.conf b/db-import.conf
new file mode 100644
index 0000000..4330fa9
--- /dev/null
+++ b/db-import.conf
@@ -0,0 +1,17 @@
+#/bin/bash # as a hint to text editors
+
+IMPORTDIR=/srv/repo/import
+
+_archrepos=(
+ {core,extra,testing,staging}-{i686,x86_64}
+ {gnome,kde}-unstable-{i686,x86_64}
+ community{,-testing,-staging}-{i686,x86_64}
+ multilib{,-testing,-staging}-x86_64
+)
+
+_archpkgmirror=$(db-pick-mirror rsync https://www.archlinux.org/mirrors/status/tier/1/json/)
+
+# name pkgmirror absmirror repo-arch...
+IMPORTS=("archlinux ${_archpkgmirror} rsync.archlinux.org ${_archrepos[*]}")
+
+unset _archrepos _archpkgmirror
diff --git a/db-move b/db-move
index b057d28..2c7c19e 100755
--- a/db-move
+++ b/db-move
@@ -27,18 +27,13 @@ done
# First loop is to check that all necessary files exist
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"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}")
- if [ -z "${pkgver}" ]; then
- die "Could not read pkgver"
- fi
-
if [ "${pkgarch}" == 'any' ]; then
tarches=("${ARCHES[@]}")
else
@@ -46,6 +41,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 +60,25 @@ msg "Moving packages from [%s] to [%s]..." "${repo_from}" "${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[@]}")
else
tarches=("${pkgarch}")
fi
- msg2 '%s (%s)' "${pkgbase}" "${tarches[*]}"
- pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}"))
- pkgver=$(. "${svnrepo_from}/PKGBUILD"; 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="${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-pick-mirror b/db-pick-mirror
new file mode 100755
index 0000000..9474ed7
--- /dev/null
+++ b/db-pick-mirror
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require 'json'
+require 'rest_client'
+
+protocol = ARGV[0]
+jsonurl = ARGV[1]
+
+data = JSON::parse(RestClient.get(jsonurl))
+
+if data["version"] != 3
+ print "Data format version != 3"
+ exit 1
+end
+
+urls = data["urls"]
+rsync_urls = urls.select{|a| a["protocol"]==protocol}
+
+# By score ( (delay+speed)/completion )
+#best = rsync_urls.sort{|a,b| (a["score"] || Float::INFINITY) <=> (b["score"] || Float::INFINITY) }.first
+# By delay/completion
+best = rsync_urls.sort{|a,b| a["delay"]/a["completion_pct"] <=> b["delay"]/b["completion_pct"] }.first
+
+puts best["url"]
diff --git a/db-remove b/db-remove
index 8fff9db..c4439a6 100755
--- a/db-remove
+++ b/db-remove
@@ -29,11 +29,12 @@ done
remove_pkgs=()
for pkgbase in "${pkgbases[@]}"; do
msg "Removing %s from [%s]..." "$pkgbase" "$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 "%s not found in ABS(libre)" "$pkgbase"
+ warning "%s not found in XBS %s" "$pkgbase" "$repo-$arch"
warning "Removing only %s from the repo" "$pkgbase"
warning "If it was a split package you have to remove the others yourself!"
remove_pkgs+=("$pkgbase")
diff --git a/db-sync b/db-sync
index 58e211d..b26e917 100755
--- a/db-sync
+++ b/db-sync
@@ -178,6 +178,12 @@ init() {
unset blacklist whitelists _arch _repo repo_file
}
+fatal_error() {
+ local mesg=$1; shift
+ error "$mesg" "$@"
+ exit 1
+}
+
trap_exit() {
local signal=$1; shift
echo
@@ -188,7 +194,7 @@ trap_exit() {
source "$(dirname "$(readlink -e "$0")")/config"
source "$(dirname "$(readlink -e "$0")")/db-sync.conf"
-source "$(dirname "$(readlink -e "$0")")/libremessages"
+source "$(librelib messages)"
# Check variables presence
for var in DBEXT FILESEXT mirror mirrorpath WORKDIR BLACKLIST_FILE FTP_BASE ARCHSRCPOOLS ARCHPKGPOOLS; do
diff --git a/db-update b/db-update
index 4d2cace..9a52e01 100755
--- a/db-update
+++ b/db-update
@@ -11,11 +11,18 @@ if [ $# -ge 1 ]; then
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 %s" "${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
@@ -37,14 +44,19 @@ for repo in "${repos[@]}"; do
if ! check_pkgfile "${pkg}"; then
die "Package %s is not consistent with its meta data" "${repo}/${pkg##*/}"
fi
+ if "${REQUIRE_SIGNATURE}" && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then
+ die "Package %s does not have a valid signature" "${repo}/${pkg##*/}"
+ fi
+ if ! check_pkgxbs "${pkg}" "${repo}"; then
+ die "Package %s is not consistent with XBS" "${repo}/${pkg##*/}"
+ fi
if ! check_pkgrepos "${pkg}"; then
die "Package %s already exists in another repository" "${repo}/${pkg##*/}"
fi
done
- # This is fucking obnoxious
- #if ! check_splitpkgs ${repo} "${pkgs[@]}"; then
- # die "Missing split packages for %s" "${repo}"
- #fi
+ if ! check_splitpkgs "${repo}" "${pkgs[@]}"; then
+ die "Missing split packages for %s" "${repo}"
+ fi
else
die "Could not read %s" "${STAGING}"
fi
diff --git a/libremessages b/libremessages
deleted file mode 100755
index 37df149..0000000
--- a/libremessages
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
-# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
-# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
-# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
-# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
-# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org>
-# Copyright (c) 2011 by Joshua Haase <hahj87@gmail.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# gettext initialization
-export TEXTDOMAIN='libretools'
-export TEXTDOMAINDIR='/usr/share/locale'
-
-# check if messages are to be printed using color
-unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-
-if tput setaf 0 &>/dev/null; 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)"
- PURPLE="${ALL_OFF}$(tput setaf 5)"
-else
- ALL_OFF="\033[1;0m"
- BOLD="\033[1;1m"
- BLUE="${BOLD}\033[1;34m"
- GREEN="${BOLD}\033[1;32m"
- RED="${BOLD}\033[1;31m"
- YELLOW="${BOLD}\033[1;33m"
- PURPLE="${BOLD}\033[1;30;40m"
-fi
-
-stdnull() {
- local action=$1;
- eval "${action} >/dev/null 2>&1"
-}
-
-plain() {
- local mesg=$1; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg2() {
- local mesg=$1; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-warning() {
- local mesg=$1; shift
- printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-error() {
- local mesg=$1; shift
- printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-fatal_error() {
- local mesg=$1; shift
- error "$mesg" "$@"
-
- exit 1
-}
diff --git a/test/lib/common.inc b/test/lib/common.inc
index a2dee10..b9a2f9d 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -1,45 +1,83 @@
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)"
- cp -Lr $(dirname ${BASH_SOURCE[0]})/../packages/* "${pkgdir}"
+ pkgdir="$(mktemp -dt "${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}))
+ pkgname=($(. PKGBUILD; echo "${pkgname[@]}"))
+ pkgarch=($(. PKGBUILD; echo "${arch[@]}"))
+ pkgversion=$(. PKGBUILD; get_full_version)
build=true
- for a in ${pkgarch[@]}; do
- for p in ${pkgname[@]}; do
- [ ! -f ${p}-${pkgversion}-${a}${PKGEXT} ] && build=false
+ for a in "${pkgarch[@]}"; do
+ for p in "${pkgname[@]}"; do
+ [ ! -f "${p}-${pkgversion}-${a}"${PKGEXT} ] && build=false
done
done
- if ! ${build}; then
+ 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"
+ for a in "${pkgarch[@]}"; do
+ 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
@@ -55,17 +93,19 @@ setUp() {
local r
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)"
+ [ -f "$(dirname "${BASH_SOURCE[0]}")/../../config.local" ] && die "$(dirname "${BASH_SOURCE[0]}")/../../config.local exists"
+ init_tmpdir
+ TMP="$(mktemp -dt "${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
+ 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"
+ cp "${p}"/* "${TMP}/svn-packages-copy/${pkg}/trunk/"
+ arch_svn add -q "${TMP}/svn-packages-copy/${pkg}"
+ arch_svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy"
done
- cat <<eot > "$(dirname ${BASH_SOURCE[0]})/../../config.local"
+ 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"
- PKGREPOS=(${PKGREPOS[@]})
+ 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"
@@ -97,12 +149,12 @@ setUp() {
SOURCE_CLEANUP_DRYRUN=false
REQUIRE_SIGNATURE=true
eot
- . "$(dirname ${BASH_SOURCE[0]})/../../config"
+ . "$(dirname "${BASH_SOURCE[0]}")/../../config"
}
tearDown() {
rm -rf "${TMP}"
- rm -f "$(dirname ${BASH_SOURCE[0]})/../../config.local"
+ rm -f "$(dirname "${BASH_SOURCE[0]}")/../../config.local"
echo
}
@@ -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}))
+ pushd "${TMP}/svn-packages-copy/${pkgbase}/trunk/" >/dev/null
+ 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}/
+ 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 \;
+ if "${REQUIRE_SIGNATURE}"; then
+ for a in "${arch[@]}"; do
+ for p in "${pkgname[@]}"; do
+ signpkg "${STAGING}/${repo}/${p}-${pkgver}-${a}"${PKGEXT}
+ done
+ done
fi
}
@@ -132,32 +190,29 @@ checkAnyPackageDB() {
local db
[ -r "${FTP_BASE}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found"
- if ${REQUIRE_SIGNATURE}; then
+ if "${REQUIRE_SIGNATURE}"; then
[ -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..b5ec5c8 100755
--- a/test/test.d/create-filelists.sh
+++ b/test/test.d/create-filelists.sh
@@ -1,24 +1,24 @@
#!/bin/bash
-curdir=$(readlink -e $(dirname $0))
+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
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- releasePackage extra ${pkgbase} ${arch}
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ releasePackage extra "${pkgbase}" "${arch}"
done
done
../db-update
- 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
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ 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,19 +26,19 @@ testCreateSimpleFileLists() {
}
testCreateAnyFileLists() {
- local arches=('i686' 'x86_64')
+ local arches=(`arches`)
local pkgs=('pkg-any-a' 'pkg-any-b')
local pkgbase
local arch
- for pkgbase in ${pkgs[@]}; do
- releasePackage extra ${pkgbase} any
+ for pkgbase in "${pkgs[@]}"; do
+ releasePackage extra "${pkgbase}" any
done
../db-update
- 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
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ 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
@@ -54,18 +54,18 @@ testCreateSplitFileLists() {
local pkgnames
local arch
- for pkgbase in ${pkgs[@]}; do
- for arch in ${arches[@]}; do
- releasePackage extra ${pkgbase} ${arch}
+ for pkgbase in "${pkgs[@]}"; do
+ for arch in "${arches[@]}"; do
+ releasePackage extra "${pkgbase}" "${arch}"
done
done
../db-update
- for pkgbase in ${pkgs[@]}; do
- 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
+ for pkgbase in "${pkgs[@]}"; do
+ 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 "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 0c5c8d7..b76438b 100755
--- a/testing2x
+++ b/testing2x
@@ -8,9 +8,9 @@ if [ $# -lt 1 ]; then
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 "%s not found in [testing]" "${pkgbase}"
+ "${found_source}" || die "%s not found in [%s]" "${pkgbase}" "${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 "%s neither found in [core] nor [extra]" "${pkgbase}"
+ "${found_target}" || die "%s not found in any of these repos: %s" "${pkgbase}" "${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 "$(readlink -e "$0")")/db-move" 'testing' "${repo}" ${pkgs[${repo}]}
+ "$(dirname "$(readlink -e "$0")")/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]}
fi
done