summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-10 21:40:24 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-10 21:40:24 +0200
commitaf4f86808e8cd45cc171f55a1ec15bf30d858a0d (patch)
tree8bc626956bad716595c7123d956cddf583087d87
parent9c06372cf6caa2ba25e9ab1f32cbb02b2d280b13 (diff)
downloaddbscripts-af4f86808e8cd45cc171f55a1ec15bf30d858a0d.tar.gz
dbscripts-af4f86808e8cd45cc171f55a1ec15bf30d858a0d.tar.xz
Use more consitent naming for package pool
There are no longer architecture-specific subdirs and the structure was switch to this: ftp └── pool ├── community └── packages packages contains all packages from core, extra and testing; this naming is in sync with the svn repo naming: svn-packages and svn-community
-rwxr-xr-xcron-jobs/adjust-permissions8
-rwxr-xr-xcron-jobs/ftpdir-cleanup20
-rw-r--r--db-functions4
-rwxr-xr-xdb-move8
-rwxr-xr-xdb-update12
-rw-r--r--test/lib/common.inc13
-rwxr-xr-xtest/runTest10
7 files changed, 36 insertions, 39 deletions
diff --git a/cron-jobs/adjust-permissions b/cron-jobs/adjust-permissions
index c21af0c..c28ca7c 100755
--- a/cron-jobs/adjust-permissions
+++ b/cron-jobs/adjust-permissions
@@ -17,9 +17,9 @@ get_dir_owner() {
echo "root:tusers" ;;
community-testing)
echo "root:tusers" ;;
- packages/arch)
+ pool/packages)
echo "ftp:ftp-extra" ;;
- packages/community)
+ pool/community)
echo "root:tusers" ;;
esac
}
@@ -35,8 +35,8 @@ for d in $(get_repos_for_host); do
done
for p in $(get_pkgpool_for_host); do
owner="$(get_dir_owner $p)"
- /bin/chown -R $owner $p/{any,i686,x86_64}
- /bin/chmod -R g+w $p/{any,i686,x86_64}
+ /bin/chown $owner $p
+ /bin/chmod g+w $p
done
/bin/chmod 555 $FTP_BASE
popd >/dev/null
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index f5e401a..7668ab5 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -17,18 +17,16 @@ for repo in $repos; do
done
to_cleanup=""
-for _arch in any ${ARCHES[@]}; do
- poolpath="$FTP_BASE/$(get_pkgpool_for_host)/$_arch/"
- pushd $poolpath >/dev/null
- for pkg in *$PKGEXT; do
- [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz"
- LINKS="$(/usr/bin/find $repopaths -type l -name "$pkg" 2>/dev/null)"
- if [ -z "$LINKS" ]; then
- to_cleanup="$to_cleanup $poolpath/$pkg"
- fi
- done
- popd >/dev/null
+poolpath="$FTP_BASE/$(get_pkgpool_for_host)/"
+pushd $poolpath >/dev/null
+for pkg in *$PKGEXT; do
+[ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz"
+LINKS="$(/usr/bin/find $repopaths -type l -name "$pkg" 2>/dev/null)"
+if [ -z "$LINKS" ]; then
+ to_cleanup="$to_cleanup $poolpath/$pkg"
+fi
done
+popd >/dev/null
if [ -n "$to_cleanup" ]; then
echo " The following packages are no longer in any repo"
diff --git a/db-functions b/db-functions
index 9abb694..c4fc8f3 100644
--- a/db-functions
+++ b/db-functions
@@ -228,9 +228,9 @@ get_repos_for_host() {
get_pkgpool_for_host() {
if [ "$(hostname)" = "sigurd" ]; then
- echo "packages/community"
+ echo "pool/community"
else
- echo "packages/arch"
+ echo "pool/packages"
fi
}
diff --git a/db-move b/db-move
index bbe7ff7..d18a4fa 100755
--- a/db-move
+++ b/db-move
@@ -53,13 +53,13 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
# copy package to pool if needed
# TODO: can be removed once every package has been moved to the package pool
- if [ ! -f $FTP_BASE/$(get_pkgpool_for_host)/${arch}/$pkgfile ]; then
- cp $pkgpath $FTP_BASE/$(get_pkgpool_for_host)/${arch}/
+ if [ ! -f $FTP_BASE/$(get_pkgpool_for_host)/$pkgfile ]; then
+ cp $pkgpath $FTP_BASE/$(get_pkgpool_for_host)
fi
- ln -s "../../../$(get_pkgpool_for_host)/${arch}/${pkgfile}" $ftppath_to/${tarch}/
+ ln -s "../../../$(get_pkgpool_for_host)/${pkgfile}" $ftppath_to/${tarch}/
done
- pkgfiles="${pkgfiles} $FTP_BASE/$(get_pkgpool_for_host)/${arch}/${pkgfile}"
+ pkgfiles="${pkgfiles} $FTP_BASE/$(get_pkgpool_for_host)/${pkgfile}"
done
for tarch in ${tarches[@]}; do
diff --git a/db-update b/db-update
index 375ed02..46becac 100755
--- a/db-update
+++ b/db-update
@@ -89,11 +89,9 @@ for current_arch in ${ARCHES[@]}; do
ftppath="$FTP_BASE/$reponame/os/$current_arch"
ftppath_any="$FTP_BASE/$reponame/os/any"
- poolpath="$FTP_BASE/$(get_pkgpool_for_host)/$current_arch"
- poolpath_any="$FTP_BASE/$(get_pkgpool_for_host)/any"
+ poolpath="$FTP_BASE/$(get_pkgpool_for_host)"
# The following is used to create relative symlinks
- poolrel="../../../$(get_pkgpool_for_host)/$current_arch"
- poolrel_any="../../../$(get_pkgpool_for_host)/any"
+ poolrel="../../../$(get_pkgpool_for_host)"
if [ ! -d "$ftppath" ]; then
echo "FTP path for this repo ($reponame) is missing"
@@ -190,11 +188,11 @@ for current_arch in ${ARCHES[@]}; do
for f in "$WORKDIR/build/"*-any$PKGEXT; do
/bin/chmod 664 "$f" &>/dev/null
fname="$(basename $f)"
- if ! /bin/cp "$f" "$poolpath_any/"; then
- die "error: failure while copying files to $poolpath_any"
+ if ! /bin/cp "$f" "$poolpath/"; then
+ die "error: failure while copying files to $poolpath"
fi
- if ! ln -s "$poolrel_any/$fname" "$ftppath/$fname"; then
+ if ! ln -s "$poolrel/$fname" "$ftppath/$fname"; then
die "error: failure symlinking $fname to $ftppath"
fi
done
diff --git a/test/lib/common.inc b/test/lib/common.inc
index ba5be9f..89155c7 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -28,7 +28,8 @@ setUp() {
#echo "Using ${TMP}"
mkdir -p "${TMP}/"{ftp,tmp,staging,{package,source}-cleanup,svn-{packages,community}-{copy,repo}}
- mkdir -p "${TMP}/ftp/"{{core,extra,community,testing,community-testing}/os,packages/{arch,community}}/{i686,any,x86_64}
+ mkdir -p "${TMP}/ftp/"{core,extra,community,testing,community-testing}/os/{i686,any,x86_64}
+ mkdir -p "${TMP}/ftp/pool/"{packages,community}
mkdir -p "${TMP}/staging/"{core,extra,community,testing,community-testing}
echo -n 'Creating svn repository...'
@@ -81,11 +82,11 @@ checkAnyPackage() {
local pkg=$2
local arch
- [ -f "${FTP_BASE}/packages/arch/any/${pkg}" ] || fail "packages/arch/any/${pkg} not found"
+ [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}" ] || fail "$(get_pkgpool_for_host)/${pkg} not found"
for arch in i686 x86_64; do
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} not a symlink"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/packages/arch/any/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} does not link to packages/arch/any/${pkg}"
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} does not link to $(get_pkgpool_for_host)/${pkg}"
done
[ -f "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir"
@@ -99,15 +100,15 @@ checkPackage() {
local pkg=$2
local arch=$3
- [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg}" ] || fail "packages/arch/${arch}/${pkg} not found"
+ [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}" ] || fail "$(get_pkgpool_for_host)/${pkg} not found"
[ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} not a symlink"
[ -f "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir"
- [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/packages/arch/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} does not link to packages/arch/${arch}/${pkg}"
+ [ "$(readlink -e "${FTP_BASE}/${repo}/os/${arch}/${pkg}")" == "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} does not link to $(get_pkgpool_for_host)/${pkg}"
bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep -q ${pkg} || fail "${pkg} not in ${repo}/os/${arch}/${repo}${DBEXT%.tar.*}"
- local pkgbase=$(getpkgbase "${FTP_BASE}/packages/arch/${arch}/${pkg}")
+ local pkgbase=$(getpkgbase "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}")
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"
}
diff --git a/test/runTest b/test/runTest
index 5bbea05..75c7a05 100755
--- a/test/runTest
+++ b/test/runTest
@@ -240,7 +240,7 @@ testCleanupSimplePackages() {
for arch in ${arches[@]}; do
local pkg1="pkg-simple-a-1-1-${arch}.pkg.tar.xz"
checkRemovedPackage extra 'pkg-simple-a' ${arch}
- [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg1}" ] && fail "packages/arch/${arch}/${pkg1} found"
+ [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg1}" ] && fail "$(get_pkgpool_for_host)/${pkg1} found"
[ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found"
local pkg2="pkg-simple-b-1-1-${arch}.pkg.tar.xz"
@@ -263,7 +263,7 @@ testCleanupAnyPackages() {
local pkg1='pkg-any-a-1-1-any.pkg.tar.xz'
checkRemovedAnyPackage extra 'pkg-any-a'
- [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg1}" ] && fail "packages/arch/${arch}/${pkg1} found"
+ [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg1}" ] && fail "$(get_pkgpool_for_host)/${pkg1} found"
[ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found"
local pkg2="pkg-any-b-1-1-${arch}.pkg.tar.xz"
@@ -294,7 +294,7 @@ testCleanupSplitPackages() {
for arch in ${arches[@]}; do
for pkg in "${pkgdir}/${pkgs[0]}"/*-${arch}.pkg.tar.*; do
checkRemovedPackage extra ${pkgs[0]} ${arch}
- [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg}" ] && fail "packages/arch/${arch}/${pkg} found"
+ [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}" ] && fail "$(get_pkgpool_for_host)/${pkg} found"
[ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] && fail "${repo}/os/${arch}/${pkg} found"
done
@@ -329,7 +329,7 @@ testMovePackagesWithoutPool() {
for old in 0 2; do
for pkg in "${pkgdir}/${pkgs[${old}]}"/*-${arch}.pkg.tar.*; do
pkg=$(basename $pkg)
- mv -f "${FTP_BASE}/packages/arch/${arch}/${pkg}" "${FTP_BASE}/testing/os/${arch}/${pkg}"
+ mv -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkg}" "${FTP_BASE}/testing/os/${arch}/${pkg}"
done
done
done
@@ -369,7 +369,7 @@ testMoveAnyPackagesWithoutPool() {
# transform a package to old style layout
for pkg in "${pkgdir}/${pkgs[0]}"/*-any.pkg.tar.*; do
pkg=$(basename $pkg)
- mv -f "${FTP_BASE}/packages/arch/any/${pkg}" "${FTP_BASE}/testing/os/any/${pkg}"
+ mv -f "${FTP_BASE}/$(get_pkgpool_for_host)/${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