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/check_archlinux/parse_pkgbuilds.sh36
-rwxr-xr-xcron-jobs/devlist-mailer2
-rwxr-xr-xcron-jobs/ftpdir-cleanup27
-rwxr-xr-xcron-jobs/integrity-check4
-rwxr-xr-xcron-jobs/repo-sanity-check5
-rwxr-xr-xcron-jobs/sourceballs41
-rw-r--r--cron-jobs/sourceballs.skip24
-rwxr-xr-xcron-jobs/sourceballs250
-rwxr-xr-xcron-jobs/update-web-db16
-rwxr-xr-xdb-check-nonfree44
-rwxr-xr-xdb-cleanup62
-rw-r--r--db-functions137
-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-sync17
-rwxr-xr-xdb-update22
-rwxr-xr-xlibremessages83
-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-xtesting2x26
37 files changed, 783 insertions, 623 deletions
diff --git a/any-to-ours b/any-to-ours
index a1697c7..020f623 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 "$(dirname "$(readlink -e "$0")")/db-functions"
# 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/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh
index c8d8618..38af179 100755
--- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh
+++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh
@@ -12,7 +12,7 @@ readonly -a variables splitpkg_overrides
backup_package_variables() {
for var in "${splitpkg_overrides[@]}"; do
indirect="${var}_backup"
- eval "${indirect}=(\${$var[@]})"
+ eval "${indirect}=(\"\${$var[@]}\")"
done
}
@@ -20,9 +20,9 @@ restore_package_variables() {
for var in "${splitpkg_overrides[@]}"; do
indirect="${var}_backup"
if [ -n "${!indirect}" ]; then
- eval "${var}=(\${$indirect[@]})"
+ eval "${var}=(\"\${$indirect[@]}\")"
else
- unset ${var}
+ unset "${var}"
fi
done
}
@@ -42,31 +42,31 @@ print_info() {
if [ -n "$arch" ]; then
echo "%ARCH%"
- for i in "${arch[@]}"; do echo $i; done
+ for i in "${arch[@]}"; do echo "$i"; done
echo ""
fi
if [ -n "$depends" ]; then
echo "%DEPENDS%"
for i in "${depends[@]}"; do
- echo $i
+ echo "$i"
done
echo ""
fi
if [ -n "$makedepends" ]; then
echo "%MAKEDEPENDS%"
for i in "${makedepends[@]}"; do
- echo $i
+ echo "$i"
done
echo ""
fi
if [ -n "$conflicts" ]; then
echo "%CONFLICTS%"
- for i in "${conflicts[@]}"; do echo $i; done
+ for i in "${conflicts[@]}"; do echo "$i"; done
echo ""
fi
if [ -n "$provides" ]; then
echo "%PROVIDES%"
- for i in "${provides[@]}"; do echo $i; done
+ for i in "${provides[@]}"; do echo "$i"; done
echo ""
fi
}
@@ -76,9 +76,9 @@ source_pkgbuild() {
dir=$1
pkgbuild=$dir/PKGBUILD
for var in "${variables[@]}"; do
- unset ${var}
+ unset "${var}"
done
- source $pkgbuild &>/dev/null || ret=$?
+ source "$pkgbuild" &>/dev/null || ret=$?
# ensure $pkgname and $pkgver variables were found
if [ $ret -ne 0 -o -z "$pkgname" -o -z "$pkgver" ]; then
@@ -89,7 +89,7 @@ source_pkgbuild() {
if [ "${#pkgname[@]}" -gt "1" ]; then
pkgbase=${pkgbase:-${pkgname[0]}}
for pkg in "${pkgname[@]}"; do
- if [ "$(type -t package_${pkg})" != "function" ]; then
+ if [ "$(type -t "package_${pkg}")" != "function" ]; then
echo -e "%INVALID%\n$pkgbuild\n"
return 1
else
@@ -104,7 +104,7 @@ source_pkgbuild() {
break
fi
done
- done < <(type package_${pkg})
+ done < <(type "package_${pkg}")
print_info
restore_package_variables
fi
@@ -124,14 +124,14 @@ find_pkgbuilds() {
return
fi
- if [ -f $1/PKGBUILD ]; then
- source_pkgbuild $1
+ if [ -f "$1/PKGBUILD" ]; then
+ source_pkgbuild "$1"
return
fi
empty=1
- for dir in $1/*; do
- if [ -d $dir ]; then
- find_pkgbuilds $dir
+ for dir in "$1"/*; do
+ if [ -d "$dir" ]; then
+ find_pkgbuilds "$dir"
unset empty
fi
done
@@ -147,7 +147,7 @@ fi
CARCH=$1
shift
for dir in "$@"; do
- find_pkgbuilds $dir
+ find_pkgbuilds "$dir"
done
exit 0
diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer
index ca2e46b..61cd32c 100755
--- a/cron-jobs/devlist-mailer
+++ b/cron-jobs/devlist-mailer
@@ -23,6 +23,6 @@ echo "Subject: $SUBJECT
To: $LIST
From: $FROM
-$stdin" | /usr/sbin/sendmail -F$FROM "$LIST"
+$stdin" | /usr/sbin/sendmail -F"$FROM" "$LIST"
fi
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index f2d8b33..292952b 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -7,14 +7,14 @@ clean_pkg() {
local pkg
local target
- if ! ${CLEANUP_DRYRUN}; then
+ if ! "${CLEANUP_DRYRUN}"; then
for pkg in "$@"; do
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}/${pkg##*/}"
fi
@@ -22,8 +22,15 @@ clean_pkg() {
fi
}
+script_lock
-${CLEANUP_DRYRUN} && warning 'dry run mode is active'
+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
for arch in "${ARCHES[@]}"; do
@@ -38,7 +45,7 @@ for repo in "${PKGREPOS[@]}"; do
missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}"))
if [ ${#missing_pkgs[@]} -ge 1 ]; then
error "Missing packages in [${repo}] (${arch})..."
- for missing_pkg in ${missing_pkgs[@]}; do
+ for missing_pkg in "${missing_pkgs[@]}"; do
msg2 "${missing_pkg}"
done
fi
@@ -62,18 +69,18 @@ cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db"
old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db"))
if [ ${#old_pkgs[@]} -ge 1 ]; then
msg "Removing old packages from package pool..."
- for old_pkg in ${old_pkgs[@]}; do
+ for old_pkg in "${old_pkgs[@]}"; do
msg2 "${old_pkg}"
clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}"
done
fi
-old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n'))
+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..."
- for old_pkg in ${old_pkgs[@]}; do
+ for old_pkg in "${old_pkgs[@]}"; do
msg2 "${old_pkg}"
- if ! ${CLEANUP_DRYRUN}; then
+ if ! "${CLEANUP_DRYRUN}"; then
rm -f "${CLEANUP_DESTDIR}/${old_pkg}"
rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig"
fi
@@ -82,7 +89,7 @@ fi
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
- repo_unlock ${repo} ${arch}
+ repo_unlock "${repo}" "${arch}"
done
done
diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check
index 86a8f1d..33a4eb6 100755
--- a/cron-jobs/integrity-check
+++ b/cron-jobs/integrity-check
@@ -13,12 +13,12 @@ fi
mailto=$1
check() {
- ${dirname}/check_archlinux/check_packages.py \
+ "${dirname}"/check_archlinux/check_packages.py \
--repos="${repos}" \
--abs-tree="/srv/abs/rsync/${arch},/srv/abs/rsync/any" \
--repo-dir="${FTP_BASE}" \
--arch="${arch}" \
- 2>&1 | ${dirname}/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}"
+ 2>&1 | "${dirname}"/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}"
}
repos='core,extra,community'
diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check
index 9d351df..8b0758f 100755
--- a/cron-jobs/repo-sanity-check
+++ b/cron-jobs/repo-sanity-check
@@ -41,8 +41,9 @@ for _repo in "${PKGREPOS[@]}"; do
))
# Compares them, whatever is on repos but not on abs should be removed
- remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \
- <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u)))
+ remove=($(comm -13 \
+ <(printf '%s\n' "${on_abs[@]}" | sort -u) \
+ <(printf '%s\n' "${on_repo[@]}" | sort -u) ))
# Remove them from databases, ftpdir-cleanup will take care of the rest
find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 8171980..2c11de2 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -9,7 +9,7 @@ script_lock
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
- repo_lock ${repo} ${arch} || exit 1
+ repo_lock "${repo}" "${arch}" || exit 1
done
done
@@ -41,7 +41,7 @@ done
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
- repo_unlock ${repo} ${arch}
+ repo_unlock "${repo}" "${arch}"
done
done
@@ -74,19 +74,14 @@ for repo in "${PKGREPOS[@]}"; do
# Build the source package if its not already there
if ! grep -Fqx "${pkgbase}-${pkgver}${SRCEXT}" "${WORKDIR}/available-src-pkgs"; then
# Check if we had failed before
- if in_array "${pkgbase}-${pkgver}${SRCEXT}" ${failedpkgs[@]}; then
+ if in_array "${pkgbase}-${pkgver}${SRCEXT}" "${failedpkgs[@]}"; then
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+=("${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}" "${FTP_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
@@ -128,23 +124,28 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s
if [ ${#old_pkgs[@]} -ge 1 ]; then
msg "Removing old source packages..."
- ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active'
+ "${SOURCE_CLEANUP_DRYRUN}" && warning 'dry run mode is active'
for old_pkg in "${old_pkgs[@]}"; do
msg2 "${old_pkg}"
- if ! ${SOURCE_CLEANUP_DRYRUN}; then
- mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}"
+ if ! "${SOURCE_CLEANUP_DRYRUN}"; then
+ mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
fi
done
fi
-old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n'))
+old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime +"${SOURCE_CLEANUP_KEEP}" -printf '%f\n'))
if [ ${#old_pkgs[@]} -ge 1 ]; then
msg "Removing old source packages from the cleanup directory..."
for old_pkg in "${old_pkgs[@]}"; do
msg2 "${old_pkg}"
- ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
+ "${SOURCE_CLEANUP_DRYRUN}" || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
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/sourceballs2 b/cron-jobs/sourceballs2
index 2a26e6a..64bae4a 100755
--- a/cron-jobs/sourceballs2
+++ b/cron-jobs/sourceballs2
@@ -13,7 +13,7 @@ pushd "${WORKDIR}" >/dev/null
script_lock
-#adjust the nice level to run at a lower priority
+# Adjust the nice level to run at a lower priority
renice +10 -p $$ > /dev/null
# Create a list of all available source package file names
@@ -22,41 +22,41 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort
pushd "${SVNREPO}" >/dev/null
for repo in "${PKGREPOS[@]}"; do
- msg "Sourceballing [${repo}]"
+ msg "Sourceballing [${repo}]"
- pushd $repo >/dev/null
- find -maxdepth 1 -type d | while read pkg; do
- pushd "${SVNREPO}/$repo/$pkg" >/dev/null
+ pushd "$repo" >/dev/null
+ find -maxdepth 1 -type d | while read pkg; do
+ pushd "${SVNREPO}/$repo/$pkg" >/dev/null
- [[ ! -e PKGBUILD ]] && {
- warning "$repo/$pkg is not a package"
- continue
- }
+ [[ ! -e ./PKGBUILD ]] && {
+ warning "$repo/$pkg is not a package"
+ continue
+ }
-# Unset the previous data
- unset pkgbase pkgname pkgver pkgrel
- source PKGBUILD
+ # Unset the previous data
+ unset pkgbase pkgname pkgver pkgrel
+ source PKGBUILD
- unset build package url pkgdesc source md5sums depends makedepends \
- optdepends license arch options check mksource
+ unset build package url pkgdesc source md5sums depends makedepends \
+ optdepends license arch options check mksource
- for _pkg in "${pkgname[@]}"; do
- unset package_${_pkg} >/dev/null 2>&1
- done
+ for _pkg in "${pkgname[@]}"; do
+ unset "package_${_pkg}" >/dev/null 2>&1
+ done
- pkgbase=${pkgbase:-$pkgname}
- srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}"
+ pkgbase=${pkgbase:-$pkgname}
+ srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}"
echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs"
- # Skip already sourceballed
- [ -e "${SRCPKGDEST}/${srcfile}" ] && continue
+ # Skip already sourceballed
+ [[ -e "${SRCPKGDEST}/${srcfile}" ]] && continue
- makepkg --allsource --ignorearch -c >/dev/null 2>&1
+ makepkg --allsource --ignorearch -c >/dev/null 2>&1
- [ $? -ne 0 ] && plain ${srcfile}
+ [[ $? -ne 0 ]] && plain "${srcfile}"
- done # end find pkgs
- popd >/dev/null
+ done # end find pkgs
+ popd >/dev/null
done # end repos
diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db
index 713e75e..ec9d255 100755
--- a/cron-jobs/update-web-db
+++ b/cron-jobs/update-web-db
@@ -43,26 +43,26 @@ case "$cmd" in
esac
# Lock the repos and get a copy of the db files to work on
-for repo in ${REPOS[@]}; do
- for arch in ${ARCHES[@]}; do
- repo_lock ${repo} ${arch} || exit 1
+for repo in "${REPOS[@]}"; do
+ for arch in "${ARCHES[@]}"; do
+ repo_lock "${repo}" "${arch}" || exit 1
dbfile="/srv/ftp/${repo}/os/${arch}/${repo}${dbfileext}"
if [ -f "${dbfile}" ]; then
mkdir -p "${WORKDIR}/${repo}/${arch}"
cp "${dbfile}" "${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
fi
- repo_unlock ${repo} ${arch}
+ repo_unlock "${repo}" "${arch}"
done
done
# Run reporead on our db copy
-pushd $SPATH >/dev/null
-for repo in ${REPOS[@]}; do
- for arch in ${ARCHES[@]}; do
+pushd "$SPATH" >/dev/null
+for repo in "${REPOS[@]}"; do
+ for arch in "${ARCHES[@]}"; do
dbcopy="${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
if [ -f "${dbcopy}" ]; then
echo "Updating ${repo}-${arch}" >> "${LOGOUT}"
- ./manage.py reporead ${flags} ${arch} "${dbcopy}" >> "${LOGOUT}" 2>&1
+ ./manage.py reporead "${flags}" "${arch}" "${dbcopy}" >> "${LOGOUT}" 2>&1
echo "" >> "${LOGOUT}"
fi
done
diff --git a/db-check-nonfree b/db-check-nonfree
index 6e2dc17..253490b 100755
--- a/db-check-nonfree
+++ b/db-check-nonfree
@@ -3,7 +3,7 @@
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
-if [ $# -ge 1 ]; then
+if [[ $# -ge 1 ]]; then
warning "Calling ${0##*/} with a specific repository is not supported"
exit 1
fi
@@ -11,36 +11,36 @@ fi
# TODO: this might lock too much (architectures)
for repo in "${repos[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
- repo_lock ${repo} ${pkgarch} || exit 1
+ repo_lock "${repo}" "${pkgarch}" || exit 1
done
done
msg "Check nonfree in repo:"
-nonfree=($(cut -d: -f1 ${BLACKLIST_FILE} | sort -u))
+nonfree=($(cut -d: -f1 "${BLACKLIST_FILE}" | sort -u))
for repo in "${ARCHREPOS[@]}"; do
- for pkgarch in "${ARCHES[@]}"; do
- msg2 "$repo $pkgarch"
- if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then
- continue
- fi
- unset dbpkgs
- unset cleanpkgs
- cleanpkgs=()
- dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u ))
- for pkgname in "${dbpkgs[@]}"; do
- if in_array "${pkgname}" "${nonfree[@]}"; then
- cleanpkgs+=("${pkgname}")
- fi
+ for pkgarch in "${ARCHES[@]}"; do
+ msg2 "$repo $pkgarch"
+ if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then
+ continue
+ fi
+ unset dbpkgs
+ unset cleanpkgs
+ cleanpkgs=()
+ dbpkgs=($(bsdtar -xOf "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u ))
+ for pkgname in "${dbpkgs[@]}"; do
+ if in_array "${pkgname}" "${nonfree[@]}"; then
+ cleanpkgs+=("${pkgname}")
+ fi
+ done
+ if [ ${#cleanpkgs[@]} -ge 1 ]; then
+ msg2 "Nonfree: ${cleanpkgs[*]}"
+ arch_repo_remove "${repo}" "${pkgarch}" "${cleanpkgs[@]}"
+ fi
done
- if [ ${#cleanpkgs[@]} -ge 1 ]; then
- msg2 "Nonfree: ${cleanpkgs[*]}"
- arch_repo_remove "${repo}" "${pkgarch}" "${cleanpkgs[@]}"
- fi
- done
done
for repo in "${repos[@]}"; do
for pkgarch in "${ARCHES[@]}"; do
- repo_unlock ${repo} ${pkgarch}
+ repo_unlock "${repo}" "${pkgarch}"
done
done
diff --git a/db-cleanup b/db-cleanup
index 57ef36e..2051130 100755
--- a/db-cleanup
+++ b/db-cleanup
@@ -10,13 +10,13 @@
# * Instant cleanup!
trap_exit() {
- echo
- error "$@"
- exit 1
+ echo
+ error "$@"
+ exit 1
}
source "$(dirname "$(readlink -e "$0")")/config"
-source "$(dirname "$(readlink -e "$0")")/libremessages"
+source "$(dirname "$(readlink -e "$0")")/db-functions"
# From makepkg
set -E
@@ -25,42 +25,42 @@ trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
-${CLEANUP_DRYRUN} && EXTRAFLAGS+=" --dry-run"
+EXTRAFLAGS=()
+"${CLEANUP_DRYRUN}" && EXTRAFLAGS+=(--dry-run)
-for _repo in ${PKGREPOS[@]}; do
- for _arch in ${ARCHES[@]}; do
- msg "Getting ${_repo}-${_arch} database"
+for _repo in "${PKGREPOS[@]}"; do
+ for _arch in "${ARCHES[@]}"; do
+ msg "Getting ${_repo}-${_arch} database"
- dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}"
+ dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}"
- if [ ! -r "${dbfile}" ]; then
- warning "Not found"
- continue
- fi
+ if [ ! -r "${dbfile}" ]; then
+ warning "Not found"
+ continue
+ fi
-# Echo the contents into a filter file
- bsdtar tf "${dbfile}" | \
- cut -d'/' -f1 | \
- sort -u | \
- sed "s|$|*|" >> /tmp/${0##*/}.$$.filter
+ # Echo the contents into a filter file
+ bsdtar tf "${dbfile}" | \
+ cut -d'/' -f1 | \
+ sort -u | \
+ sed "s|$|*|" >> "/tmp/${0##*/}.$$.filter"
- done
+ done
done
msg "Removing old files:"
-for POOL in ${PKGPOOLS[@]} ${SRCPOOLS[@]}; do
- msg2 "${POOL}"
+for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do
+ msg2 "${POOL}"
- rsync ${EXTRAFLAGS} -va --delete-excluded \
- --include-from="/tmp/${0##*/}.$$.filter" \
- --exclude="*" \
- ${FTP_BASE}/${POOL}/ \
- ${FTP_BASE}/${POOL}/
+ rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \
+ --include-from="/tmp/${0##*/}.$$.filter" \
+ --exclude="*" \
+ "${FTP_BASE}/${POOL}/" \
+ "${FTP_BASE}/${POOL}/"
done
-msg "Removing symlinks:"
-find -L ${FTP_BASE}/ -type l
-${CLEANUP_DRYRUN} || find -L ${FTP_BASE}/ -type l -delete
-
-exit $?
+msg "Removing dead symlinks:"
+actions=(-print)
+"${CLEANUP_DRYRUN}" || actions+=(-delete)
+find -L "${FTP_BASE}/" -type l -print -delete
diff --git a/db-functions b/db-functions
index 6b49e6a..5b10e05 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
+# 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.${0##*/}"
@@ -137,6 +80,11 @@ cleanup() {
script_unlock
fi
rm -rf "$WORKDIR"
+
+ if (( REPO_MODIFIED )); then
+ date +%s > "${FTP_BASE}/lastupdate"
+ fi
+
[ "$1" ] && exit $1
}
@@ -340,7 +288,7 @@ check_pkgfile() {
fi
}
-check_pkgsvn() {
+check_pkgxbs() {
local pkgfile="${1}"
local _pkgbase="$(getpkgbase ${pkgfile})"
[ $? -ge 1 ] && return 1
@@ -354,18 +302,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
}
@@ -376,7 +317,7 @@ check_splitpkgs() {
local pkgfiles=("${@}")
local pkgfile
local pkgdir
- local svnname
+ local xbsname
mkdir -p "${WORKDIR}/check_splitpkgs/"
pushd "${WORKDIR}/check_splitpkgs" >/dev/null
@@ -384,28 +325,15 @@ check_splitpkgs() {
for pkgfile in "${pkgfiles[@]}"; do
issplitpkg "${pkgfile}" || continue
local _pkgbase="$(getpkgbase ${pkgfile})"
- msg2 "Checking $_pkgbase"
+ msg2 "Checking %s" "$_pkgbase"
local _pkgname="$(getpkgname ${pkgfile})"
local _pkgarch="$(getpkgarch ${pkgfile})"
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
@@ -413,8 +341,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
@@ -437,17 +365,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
}
@@ -512,6 +429,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() {
@@ -530,4 +449,6 @@ arch_repo_remove() {
/usr/bin/repo-remove -q "${filesfile}" "${pkgs[@]}" \
|| error "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 f1c3dea..5fe9691 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"; echo $(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 [${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[@]}")
else
tarches=("${pkgarch}")
fi
- msg2 "${pkgbase} (${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="${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 46585ad..33d0933 100755
--- a/db-remove
+++ b/db-remove
@@ -29,11 +29,12 @@ 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 ABS(libre)"
+ warning "$pkgbase not found in XBS $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+=("$pkgbase")
diff --git a/db-sync b/db-sync
index 138328b..2a0e8e1 100755
--- a/db-sync
+++ b/db-sync
@@ -68,8 +68,8 @@ init() {
get_repos
# Traverse all repo-arch pairs
- for _repo in ${ARCHREPOS[@]}; do
- for _arch in ${ARCHARCHES[@]}; do
+ for _repo in "${ARCHREPOS[@]}"; do
+ for _arch in "${ARCHARCHES[@]}"; do
msg "Processing ${_repo}-${_arch}"
db_file=$(get_repo_file ${_repo} ${_arch})${DBEXT}
@@ -125,7 +125,7 @@ init() {
rsync ${extra} --no-motd -rtlH \
--delay-updates \
--safe-links \
- ${WORKDIR}/${_repo}/os/${_arch}/ \
+ "${WORKDIR}/${_repo}/os/${_arch}/" \
${FTP_BASE}/${_repo}/os/${_arch}/
# Cleanup
@@ -177,6 +177,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
@@ -187,18 +193,17 @@ trap_exit() {
source "$(dirname "$(readlink -e "$0")")/config"
source "$(dirname "$(readlink -e "$0")")/db-sync.conf"
-source "$(dirname "$(readlink -e "$0")")/libremessages"
+source "$(dirname "$(readlink -e "$0")")/db-functions"
# Check variables presence
for var in DBEXT FILESEXT mirror mirrorpath WORKDIR BLACKLIST_FILE FTP_BASE ARCHSRCPOOLS ARCHPKGPOOLS; do
-
test -z "${!var}" && fatal_error "Empty ${var}"
done
# From makepkg
set -E
for signal in TERM HUP QUIT; do
- trap "trap_exit $signal '%s signal caught. Exiting...' $signal" $signal
+ trap "trap_exit $signal '%s signal caught. Exiting...' $signal" $signal
done
trap 'trap_exit INT "Aborted by user! Exiting..."' INT
trap 'trap_exit USR1 "An unknown error has occurred. Exiting..."' ERR
diff --git a/db-update b/db-update
index 186ed55..f830e11 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 ${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 ${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}/${pkg##*/} already exists in another repository"
fi
done
- # This is fucking obnoxious
- #if ! check_splitpkgs ${repo} "${pkgs[@]}"; then
- # die "Missing split packages for ${repo}"
- #fi
+ if ! check_splitpkgs ${repo} ${pkgs[@]}; then
+ die "Missing split packages for ${repo}"
+ fi
else
die "Could not read ${STAGING}"
fi
diff --git a/libremessages b/libremessages
deleted file mode 100755
index 0c6ded1..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..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 b6828fc..6646179 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 "${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 "$(readlink -e "$0")")/db-move" 'testing' "${repo}" ${pkgs[${repo}]}
+ "$(dirname "$(readlink -e "$0")")/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]}
fi
done