From fa4ff798507ded0b26dcdc310d1f97e2e61198c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?coadde=20=5BM=C3=A1rcio=20Alexandre=20Silva=20Delgado=5D?= Date: Wed, 23 Sep 2015 18:30:39 -0300 Subject: rename FTP_BASE -> root_dir --- abslibre | 8 +++--- any-to-ours | 8 +++--- config | 6 ++--- config.d/gnu+linux_arm_arch_legacy | 2 +- config.d/gnu+linux_x86_arch_legacy | 2 +- create-repo | 2 +- createrepos | 2 +- cron-jobs/ftpdir-cleanup | 12 ++++----- cron-jobs/integrity-check | 2 +- cron-jobs/make_repo_torrents | 4 +-- cron-jobs/repo-sanity-check | 4 +-- cron-jobs/sourceballs | 10 ++++---- db-check-nonfree | 4 +-- db-cleanup | 8 +++--- db-functions | 38 ++++++++++++++--------------- db-list-unsigned-packages | 2 +- db-move | 8 +++--- db-repo-add | 6 ++--- db-repo-remove | 2 +- db-sync | 12 ++++----- db-update | 14 +++++------ mkrepo | 2 +- test/lib/common.inc | 50 +++++++++++++++++++------------------- test/test.d/create-filelists.sh | 10 ++++---- test/test.d/db-repo-add.sh | 16 ++++++------ test/test.d/db-update.sh | 8 +++--- test/test.d/ftpdir-cleanup.sh | 16 ++++++------ test/test.d/pool-transition.sh | 24 +++++++++--------- test/test.d/sourceballs.sh | 10 ++++---- 29 files changed, 146 insertions(+), 146 deletions(-) diff --git a/abslibre b/abslibre index 6b21d24..5c57c41 100755 --- a/abslibre +++ b/abslibre @@ -2,7 +2,7 @@ set -e -FTP_BASE=/srv/repo/main +root_dir=/srv/repo/main ABSLIBRE=/srv/abslibre ABSGIT=/srv/git/abslibre/abslibre.git # Remote @@ -111,11 +111,11 @@ create_tarballs() { arch=$(basename $(dirname $repo)) # Remove the old one - mkdir -p $FTP_BASE/$baserepo/os/$arch/ - rm -fv $FTP_BASE/$baserepo/os/$arch/$baserepo.abs.tar.gz + mkdir -p ${root_dir}/$baserepo/os/$arch/ + rm -fv ${root_dir}/$baserepo/os/$arch/$baserepo.abs.tar.gz # Create a new one joining arch and any # Remove the first part of the path (it could be $repo but any isn't hit) - bsdtar -czf $FTP_BASE/$baserepo/os/$arch/$baserepo.abs.tar.gz \ + bsdtar -czf ${root_dir}/$baserepo/os/$arch/$baserepo.abs.tar.gz \ -s ":${ABSLIBRE}/[a-z0-9_]\+/[a-z]\+::" \ $repo/* ${ABSLIBRE}/any/${baserepo}/* diff --git a/any-to-ours b/any-to-ours index a901d54..a54cf0a 100755 --- a/any-to-ours +++ b/any-to-ours @@ -26,7 +26,7 @@ for _repo in "${ARCHREPOS[@]}"; do # Find 'any' packages # This is hardcoded but it could release other arches... - PKGS=($(find "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ + PKGS=($(find "${root_dir}/${_repo}/os/${BASEARCH}/" \ -iname '*-any.pkg.tar.?z' \ -printf "%f ")) @@ -44,8 +44,8 @@ for _repo in "${ARCHREPOS[@]}"; do --include='*-any.pkg.tar.?z' \ --include='*-any.pkg.tar.?z.sig' \ --exclude='*' \ - "${FTP_BASE}/${_repo}/os/${BASEARCH}/" \ - "${FTP_BASE}/${_repo}/os/${_arch}/" 2>&1 | \ + "${root_dir}/${_repo}/os/${BASEARCH}/" \ + "${root_dir}/${_repo}/os/${_arch}/" 2>&1 | \ grep 'any\.pkg\.tar\..z$' | \ cut -d ' ' -f 1 )) @@ -58,7 +58,7 @@ for _repo in "${ARCHREPOS[@]}"; do msg2 "Adding to db..." - pushd "${FTP_BASE}/${_repo}/os/${_arch}/" >/dev/null + pushd "${root_dir}/${_repo}/os/${_arch}/" >/dev/null # Add the packages to the db repo-add "${_repo}${DBEXT}" "${SYNCED[@]}" diff --git a/config b/config index 97156e0..40961b5 100644 --- a/config +++ b/config @@ -1,6 +1,6 @@ #!/hint/bash -FTP_BASE="/srv/repo/main" +root_dir="/srv/repo/main" NONFREE_DISTROS=('gnu+linux_x86_arch_legacy' 'gnu+linux_arm_arch_legacy') DISTROS=("${NONFREE_DISTROS}") @@ -8,12 +8,12 @@ DISTROS=("${NONFREE_DISTROS}") # add compability support source "$(dirname "$(readlink -e "$0")")/config.d/gnu+linux_x86_arch_legacy -CLEANUP_DESTDIR="$FTP_BASE/old/packages" +CLEANUP_DESTDIR="${root_dir}/old/packages" CLEANUP_DRYRUN=false # Time in days to keep moved packages CLEANUP_KEEP=30 -SOURCE_CLEANUP_DESTDIR="$FTP_BASE/old/sources" +SOURCE_CLEANUP_DESTDIR="${root_dir}/old/sources" SOURCE_CLEANUP_DRYRUN=true # Time in days to keep moved sourcepackages SOURCE_CLEANUP_KEEP=30 diff --git a/config.d/gnu+linux_arm_arch_legacy b/config.d/gnu+linux_arm_arch_legacy index 1a470db..2dcda29 100644 --- a/config.d/gnu+linux_arm_arch_legacy +++ b/config.d/gnu+linux_arm_arch_legacy @@ -14,7 +14,7 @@ PKGPOOL='pool/parabola' SRCPOOL='sources/parabola' # Directories where packages are shared between repos -# *relative to FTP_BASE* +# *relative to root_dir* ARCHPKGPOOLS=(pool/arch_gnu+linux-arm_main) OURPKGPOOLS=(pool/parabola) PKGPOOLS=(${OURPKGPOOLS[@]} ${ARCHPKGPOOLS[@]}) diff --git a/config.d/gnu+linux_x86_arch_legacy b/config.d/gnu+linux_x86_arch_legacy index 186eca9..13d851f 100644 --- a/config.d/gnu+linux_x86_arch_legacy +++ b/config.d/gnu+linux_x86_arch_legacy @@ -14,7 +14,7 @@ PKGPOOL='pool/parabola' SRCPOOL='sources/parabola' # Directories where packages are shared between repos -# *relative to FTP_BASE* +# *relative to root_dir* ARCHPKGPOOLS=(pool/{packages,community}) OURPKGPOOLS=(pool/parabola) PKGPOOLS=(${OURPKGPOOLS[@]} ${ARCHPKGPOOLS[@]}) diff --git a/create-repo b/create-repo index 3feb098..5654078 100755 --- a/create-repo +++ b/create-repo @@ -13,7 +13,7 @@ msg "Creating repos..." for _repo in "$@"; do msg2 "Creating [%s]" "${_repo}" for _arch in "${ARCHES[@]}"; do - mkdir -p "${FTP_BASE}/${_repo}/os/${_arch}" || \ + mkdir -p "${root_dir}/${_repo}/os/${_arch}" || \ error "Failed creating %s dir" "${_arch}" done done diff --git a/createrepos b/createrepos index 8da2455..83e2959 100755 --- a/createrepos +++ b/createrepos @@ -3,6 +3,6 @@ source "$(dirname "$(readlink -e "$0")")/config" -mkdir -p -- "${FTP_BASE}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" +mkdir -p -- "${root_dir}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" "$(dirname "$(readlink -e "$0")")/create-repo" "${PKGREPOS[@]}" diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 4a2b418..8718869 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -26,13 +26,13 @@ clean_pkg() { for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - if [ ! -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi # get a list of actual available package files - find "${FTP_BASE}/${repo}/os/${arch}" -xtype f -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}" + find "${root_dir}/${repo}/os/${arch}" -xtype f -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}" # get a list of package files defined in the repo db - bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" | awk '/^%FILENAME%/{getline;print}' | sort > "${WORKDIR}/db-${repo}-${arch}" + bsdtar -xOf "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" | awk '/^%FILENAME%/{getline;print}' | sort > "${WORKDIR}/db-${repo}-${arch}" missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#missing_pkgs[@]} -ge 1 ]; then @@ -47,14 +47,14 @@ for repo in "${PKGREPOS[@]}"; do msg "Removing old packages from [%s] (%s)..." "${repo}" "${arch}" for old_pkg in "${old_pkgs[@]}"; do msg2 '%s' "${old_pkg}" - clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}" + clean_pkg "${root_dir}/${repo}/os/${arch}/${old_pkg}" done fi done done # get a list of all available packages in the pacakge pool -find "$FTP_BASE/${PKGPOOL}" -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/pool" +find "${root_dir}/${PKGPOOL}" -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/pool" # create a list of packages in our db cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" @@ -63,7 +63,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from package pool..." for old_pkg in "${old_pkgs[@]}"; do msg2 '%s' "${old_pkg}" - clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}" + clean_pkg "${root_dir}/${PKGPOOL}/${old_pkg}" done fi diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 7459380..7896f32 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -16,7 +16,7 @@ check() { "${dirname}"/check_archlinux/check_packages.py \ --repos="${repos}" \ --abs-tree="/srv/abs/rsync/${arch},/srv/abs/rsync/any" \ - --repo-dir="${FTP_BASE}" \ + --repo-dir="${root_dir}" \ --arch="${arch}" \ 2>&1 | "${dirname}"/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" } diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index 2eb0978..bb59d2f 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -34,8 +34,8 @@ esac # so it's OK to just stuff all the torrents into a single directory. script_directory="$(dirname "$(readlink -e "$0")")/.." . "$(dirname "$(readlink -e "$0")")/../config" -public_location="$FTP_BASE/" -torrent_location="$FTP_BASE/torrents/" +public_location="${root_dir}/" +torrent_location="${root_dir}/torrents/" cd "${torrent_location}" diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 239f042..13f1ad1 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -39,7 +39,7 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on repos on_repo=($( - find "${FTP_BASE}/${_repo}" -name "*.pkg.tar.?z" \ + find "${root_dir}/${_repo}" -name "*.pkg.tar.?z" \ -printf "%f\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" )) @@ -49,7 +49,7 @@ for _repo in "${PKGREPOS[@]}"; do <(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" \ + find "${root_dir}/${_repo}" -name "*.db.tar.?z" \ -exec repo-remove {} "${remove[@]}" \; >/dev/null 2>&1 msg2 "Removed the following packages:" diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index c12a128..38104c7 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -21,10 +21,10 @@ renice +10 -p $$ > /dev/null for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do # Repo does not exist; skip it - if [ ! -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi - bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" \ | awk '/^%NAME%/ { getline b }; /^%BASE%/ { getline b }; /^%VERSION%/ { getline v }; @@ -46,7 +46,7 @@ for repo in "${PKGREPOS[@]}"; do done # Create a list of all available source package file names -find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${root_dir}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package for repo in "${PKGREPOS[@]}"; do @@ -91,7 +91,7 @@ for repo in "${PKGREPOS[@]}"; do pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 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}" + mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${root_dir}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") @@ -128,7 +128,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then for old_pkg in "${old_pkgs[@]}"; do msg2 '%s' "${old_pkg}" if ! "${SOURCE_CLEANUP_DRYRUN}"; then - mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + mv_acl "${root_dir}/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done diff --git a/db-check-nonfree b/db-check-nonfree index 37b7cf6..6346dbb 100755 --- a/db-check-nonfree +++ b/db-check-nonfree @@ -20,13 +20,13 @@ nonfree=($(cut -d: -f1 "${BLACKLIST_FILE}" | sort -u)) for repo in "${ARCHREPOS[@]}"; do for pkgarch in "${ARCHES[@]}"; do msg2 "%s %s" "$repo" "$pkgarch" - if [ ! -f "${FTP_BASE}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then + if [ ! -f "${root_dir}/${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 )) + dbpkgs=($(bsdtar -xOf "${root_dir}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u )) for pkgname in "${dbpkgs[@]}"; do if in_array "${pkgname}" "${nonfree[@]}"; then cleanpkgs+=("${pkgname}") diff --git a/db-cleanup b/db-cleanup index ffa2601..ee0b800 100755 --- a/db-cleanup +++ b/db-cleanup @@ -35,7 +35,7 @@ for _repo in "${PKGREPOS[@]}"; do for _arch in "${ARCHES[@]}"; do msg "Getting %s-%s database" "${_repo}" "${_arch}" - dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}" + dbfile="${root_dir}/${_repo}/os/${_arch}/${_repo}${DBEXT}" if [ ! -r "${dbfile}" ]; then warning "Not found" @@ -59,11 +59,11 @@ for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \ --include-from="$filter" \ --exclude="*" \ - "${FTP_BASE}/${POOL}/" \ - "${FTP_BASE}/${POOL}/" + "${root_dir}/${POOL}/" \ + "${root_dir}/${POOL}/" done msg "Removing dead symlinks:" actions=(-print) "${CLEANUP_DRYRUN}" || actions+=(-delete) -find -L "${FTP_BASE}/" -type l "${actions[@]}" +find -L "${root_dir}/" -type l "${actions[@]}" diff --git a/db-functions b/db-functions index d76aa41..b993cd1 100644 --- a/db-functions +++ b/db-functions @@ -140,8 +140,8 @@ cleanup() { rm -rf "$WORKDIR" if (( REPO_MODIFIED )); then - date +%s > "${FTP_BASE}/lastupdate" - date -u +%s > "${FTP_BASE}/lastsync" + date +%s > "${root_dir}/lastupdate" + date -u +%s > "${root_dir}/lastsync" fi [ "$1" ] && exit "$1" @@ -164,8 +164,8 @@ trap cleanup EXIT #repo_lock [timeout] repo_lock () { local LOCKDIR="$TMPDIR/.repolock.$1.$2" - local DBLOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${DBEXT}.lck" - local FILESLOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${FILESEXT}.lck" + local DBLOCKFILE="${root_dir}/${1}/os/${2}/${1}${DBEXT}.lck" + local FILESLOCKFILE="${root_dir}/${1}/os/${2}/${1}${FILESEXT}.lck" local _count local _trial local _timeout @@ -417,19 +417,19 @@ check_pkgrepos() { local pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && return 1 - [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1 - [ -f "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1 - [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}" ] && return 1 - [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig" ] && return 1 + [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1 + [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1 + [ -f "${root_dir}/${PKGPOOL}/${pkgfile##*/}" ] && return 1 + [ -f "${root_dir}/${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 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}" ] && return 1 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}.sig" ] && return 1 done done @@ -454,11 +454,11 @@ check_repo_permission() { in_array "${repo}" "${PKGREPOS[@]}" || return 1 - [ -w "$FTP_BASE/${PKGPOOL}" ] || return 1 + [ -w "${root_dir}/${PKGPOOL}" ] || return 1 local arch for arch in "${ARCHES[@]}"; do - local dir="${FTP_BASE}/${repo}/os/${arch}/" + local dir="${root_dir}/${repo}/os/${arch}/" [ -w "${dir}" ] || return 1 [ -f "${dir}${repo}"${DBEXT} -a ! -w "${dir}${repo}"${DBEXT} ] && return 1 [ -f "${dir}${repo}"${FILESEXT} -a ! -w "${dir}${repo}"${FILESEXT} ] && return 1 @@ -470,8 +470,8 @@ check_repo_permission() { set_repo_permission() { local repo=$1 local arch=$2 - local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" - local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}" + local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" + local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${FILESEXT}" if [ -w "${dbfile}" ]; then local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") @@ -491,7 +491,7 @@ arch_repo_add() { printf -v pkgs_str -- '%q ' "${pkgs[@]}" # package files might be relative to repo dir - pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null + pushd "${root_dir}/${repo}/os/${arch}" >/dev/null /usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" >/dev/null \ || error 'repo-add %q %s' "${repo}${DBEXT}" "${pkgs_str% }" /usr/bin/repo-add -f -q "${repo}${FILESEXT}" "${pkgs[@]}" \ @@ -506,8 +506,8 @@ arch_repo_remove() { local repo=$1 local arch=$2 local pkgs=("${@:3}") - local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" - local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}" + local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" + local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${FILESEXT}" if [ ! -f "${dbfile}" ]; then error "No database found at '%s'" "${dbfile}" diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 095e1e6..e83002f 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -33,6 +33,6 @@ shift for repo in "${PKGREPOS[@]}" do - db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" + db="${root_dir}/${repo}/os/${arch}/${repo}.db" [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" done diff --git a/db-move b/db-move index 275a11a..3df0fd1 100755 --- a/db-move +++ b/db-move @@ -11,8 +11,8 @@ fi args=("${@}") repo_from="${args[0]}" repo_to="${args[1]}" -ftppath_from="${FTP_BASE}/${repo_from}/os/" -ftppath_to="${FTP_BASE}/${repo_to}/os/" +ftppath_from="${root_dir}/${repo_from}/os/" +ftppath_to="${root_dir}/${repo_to}/os/" if ! check_repo_permission "$repo_to" || ! check_repo_permission "$repo_from"; then die "You don't have permission to move packages from %s to %s" "${repo_from}" "${repo_to}" @@ -82,10 +82,10 @@ for pkgbase in "${args[@]:2}"; do pkgfile="${pkgpath##*/}" ln -s "../../../${PKGPOOL}/${pkgfile}" "${ftppath_to}/${tarch}/" - if [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig" ]; then + if [ -f "${root_dir}/${PKGPOOL}/${pkgfile}.sig" ]; then ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "${ftppath_to}/${tarch}/" fi - add_pkgs[${tarch}]+="${FTP_BASE}/${PKGPOOL}/${pkgfile} " + add_pkgs[${tarch}]+="${root_dir}/${PKGPOOL}/${pkgfile} " remove_pkgs[${tarch}]+="${pkgname} " done done diff --git a/db-repo-add b/db-repo-add index 4611bdf..024fce8 100755 --- a/db-repo-add +++ b/db-repo-add @@ -12,7 +12,7 @@ repo="$1" arch="$2" pkgfiles=("${@:3}") -ftppath="$FTP_BASE/$repo/os" +ftppath="${root_dir}/$repo/os" if ! check_repo_permission "$repo"; then die "You don't have permission to add packages to %s" "${repo}" @@ -30,8 +30,8 @@ done for tarch in "${tarches[@]}"; do for pkgfile in "${pkgfiles[@]}"; do - if [[ ! -f "${FTP_BASE}/${repo}/os/${arch}/${pkgfile##*/}" ]]; then - die "Package file %s not found in %s" "${pkgfile##*/}" "${FTP_BASE}/${repo}/os/${arch}/" + if [[ ! -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}" ]]; then + die "Package file %s not found in %s" "${pkgfile##*/}" "${root_dir}/${repo}/os/${arch}/" else msg "Adding %s to [%s]..." "$pkgfile" "$repo" fi diff --git a/db-repo-remove b/db-repo-remove index aadc4ce..ab5f8f8 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -12,7 +12,7 @@ repo="$1" arch="$2" pkgnames=("${@:3}") -ftppath="$FTP_BASE/$repo/os" +ftppath="${root_dir}/$repo/os" if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from %s" "${repo}" diff --git a/db-sync b/db-sync index 5264296..f97718d 100755 --- a/db-sync +++ b/db-sync @@ -117,7 +117,7 @@ init() { --include-from="/tmp/${_repo}-${_arch}.whitelist" \ --exclude="*" \ "rsync://${mirror}/${mirrorpath}/${_repo}/os/${_arch}/" \ - "${FTP_BASE}/${_repo}/os/${_arch}/" + "${root_dir}/${_repo}/os/${_arch}/" # Add a new whitelist whitelists+=(/tmp/${_repo}-${_arch}.whitelist) @@ -127,7 +127,7 @@ init() { --delay-updates \ --safe-links \ "${WORKDIR}/${_repo}/os/${_arch}/" \ - "${FTP_BASE}/${_repo}/os/${_arch}/" + "${root_dir}/${_repo}/os/${_arch}/" # Cleanup unset db @@ -152,7 +152,7 @@ init() { --include-from=/tmp/any.whitelist \ --exclude="*" \ "rsync://${mirror}/${mirrorpath}/${pkgpool}/" \ - "${FTP_BASE}/${pkgpool}/" + "${root_dir}/${pkgpool}/" done # Sync sources @@ -171,10 +171,10 @@ init() { --include-from=/tmp/any.whitelist \ --exclude="*" \ "rsync://${mirror}/${mirrorpath}/${srcpool}/" \ - "${FTP_BASE}/${srcpool}/" + "${root_dir}/${srcpool}/" done - date -u +%s > "${FTP_BASE}/lastsync" + date -u +%s > "${root_dir}/lastsync" # Cleanup unset blacklist whitelists _arch _repo repo_file @@ -192,7 +192,7 @@ source "$(dirname "$(readlink -e "$0")")/config" source "$(dirname "$(readlink -e "$0")")/db-libremessages" # Check variables presence -for var in DBEXT FILESEXT mirror mirrorpath WORKDIR BLACKLIST_FILE FTP_BASE ARCHSRCPOOLS ARCHPKGPOOLS; do +for var in DBEXT FILESEXT mirror mirrorpath WORKDIR BLACKLIST_FILE root_dir ARCHSRCPOOLS ARCHPKGPOOLS; do test -z "${!var}" && fatal_error "Empty %s" "${var}" done diff --git a/db-update b/db-update index 4830791..a4f8746 100755 --- a/db-update +++ b/db-update @@ -68,17 +68,17 @@ for repo in "${repos[@]}"; do msg2 "%s (%s)" "${pkgfile}" "${pkgarch}" # any packages might have been moved by the previous run if [ -f "${pkg}" ]; then - mv "${pkg}" "$FTP_BASE/${PKGPOOL}" + mv "${pkg}" "${root_dir}/${PKGPOOL}" fi - ln -s "../../../${PKGPOOL}/${pkgfile}" "$FTP_BASE/$repo/os/${pkgarch}" + ln -s "../../../${PKGPOOL}/${pkgfile}" "${root_dir}/$repo/os/${pkgarch}" # also move signatures if [ -f "${pkg}.sig" ]; then - mv "${pkg}.sig" "$FTP_BASE/${PKGPOOL}" + mv "${pkg}.sig" "${root_dir}/${PKGPOOL}" fi - if [ -f "$FTP_BASE/${PKGPOOL}/${pkgfile}.sig" ]; then - ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}" + if [ -f "${root_dir}/${PKGPOOL}/${pkgfile}.sig" ]; then + ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "${root_dir}/$repo/os/${pkgarch}" fi - add_dirs+=("${STAGING}/abslibre/$(getpkgarch "$FTP_BASE/$PKGPOOL/$pkgfile")/$repo/$(getpkgbase "$FTP_BASE/$PKGPOOL/$pkgfile")") + add_dirs+=("${STAGING}/abslibre/$(getpkgarch "${root_dir}/$PKGPOOL/$pkgfile")/$repo/$(getpkgbase "${root_dir}/$PKGPOOL/$pkgfile")") add_pkgs+=("${pkgfile}") done for add_dir in "${add_dirs[@]}"; do @@ -108,7 +108,7 @@ dirname -z -- "${dirs[@]}" | # Stage generated source files while read -r file; do - pub="${FTP_BASE}/${file}" + pub="${root_dir}/${file}" if [[ -f "$pub" ]]; then warning "file already exists: %s" "${file}" else diff --git a/mkrepo b/mkrepo index b11dc0b..b7b27f7 100755 --- a/mkrepo +++ b/mkrepo @@ -8,7 +8,7 @@ source "$(dirname "$(readlink -e "$0")")/config" for repo in "$@"; do echo ":: Creating [$repo]" for arch in "${ARCHES[@]}"; do - mkdir -pv "${FTP_BASE}/${repo}/os/${arch}" + mkdir -pv "${root_dir}/${repo}/os/${arch}" done done diff --git a/test/lib/common.inc b/test/lib/common.inc index a2dee10..04bed2b 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -85,7 +85,7 @@ setUp() { done cat < "$(dirname ${BASH_SOURCE[0]})/../../config.local" - FTP_BASE="${TMP}/ftp" + root_dir="${TMP}/ftp" SVNREPO="file://${TMP}/svn-packages-repo" PKGREPOS=(${PKGREPOS[@]}) PKGPOOL="${PKGPOOL}" @@ -131,19 +131,19 @@ checkAnyPackageDB() { local arch local db - [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found" + [ -r "${root_dir}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found" if ${REQUIRE_SIGNATURE}; then - [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found" + [ -r "${root_dir}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found" fi for arch in i686 x86_64; 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}" ] \ + [ -L "${root_dir}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} is not a symlink" + [ "$(readlink -e "${root_dir}/${repo}/os/${arch}/${pkg}")" == "${root_dir}/${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" ] \ + [ -L "${root_dir}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink" + [ "$(readlink -e "${root_dir}/${repo}/os/${arch}/${pkg}.sig")" == "${root_dir}/${PKGPOOL}/${pkg}.sig" ] \ || fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig" fi done @@ -151,13 +151,13 @@ checkAnyPackageDB() { [ -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}) \ + ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/${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" + [ -r "${root_dir}/${repo}/os/any/${pkg}" ] && fail "${repo}/os/any/${pkg} should not exist" + [ -r "${root_dir}/${repo}/os/any/${pkg}.sig" ] && fail "${repo}/os/any/${pkg}.sig should not exist" } checkAnyPackage() { @@ -166,7 +166,7 @@ checkAnyPackage() { checkAnyPackageDB $repo $pkg - local pkgbase=$(getpkgbase "${FTP_BASE}/${PKGPOOL}/${pkg}") + local pkgbase=$(getpkgbase "${root_dir}/${PKGPOOL}/${pkg}") 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" @@ -178,25 +178,25 @@ checkPackageDB() { local arch=$3 local db - [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found" - [ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} not a symlink" + [ -r "${root_dir}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found" + [ -L "${root_dir}/${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 "${root_dir}/${repo}/os/${arch}/${pkg}")" == "${root_dir}/${PKGPOOL}/${pkg}" ] \ || fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}" if ${REQUIRE_SIGNATURE}; then - [ -r "${FTP_BASE}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found" - [ -L "${FTP_BASE}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink" + [ -r "${root_dir}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found" + [ -L "${root_dir}/${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 "${root_dir}/${repo}/os/${arch}/${pkg}.sig")" == "${root_dir}/${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}) \ + ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkg}) \ || fail "${pkg} not in ${repo}/os/${arch}/${repo}${db%.tar.*}" done } @@ -208,7 +208,7 @@ checkPackage() { checkPackageDB $repo $pkg $arch - local pkgbase=$(getpkgbase "${FTP_BASE}/${PKGPOOL}/${pkg}") + local pkgbase=$(getpkgbase "${root_dir}/${PKGPOOL}/${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" @@ -221,8 +221,8 @@ checkRemovedPackageDB() { local db 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}) \ + ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \ && fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${db%.tar.*}" done } @@ -247,8 +247,8 @@ checkRemovedAnyPackageDB() { for db in ${DBEXT} ${FILESEXT}; do for arch in i686 x86_64; do - ( [ -r "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \ - && bsdtar -xf "${FTP_BASE}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \ + ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \ && fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${db%.tar.*}" done done diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh index 49734c4..3e27d64 100755 --- a/test/test.d/create-filelists.sh +++ b/test/test.d/create-filelists.sh @@ -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 "${root_dir}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/${pkgbase}"; then fail "usr/bin/${pkgbase} not found in ${arch}/extra${FILESEXT}" fi done @@ -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 "${root_dir}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/share/${pkgbase}/test"; then fail "usr/share/${pkgbase}/test not found in ${arch}/extra${FILESEXT}" fi done @@ -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 "${root_dir}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/${pkgname}"; then fail "usr/bin/${pkgname} not found in ${arch}/extra${FILESEXT}" fi done @@ -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 "${root_dir}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/pkg-simple-b"; 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 "${root_dir}/extra/os/${arch}/extra${FILESEXT}" | grep -q "usr/bin/pkg-simple-a"; then fail "usr/bin/pkg-simple-a still found in ${arch}/extra${FILESEXT}" fi done diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh index 8603104..7a201f9 100755 --- a/test/test.d/db-repo-add.sh +++ b/test/test.d/db-repo-add.sh @@ -11,10 +11,10 @@ testAddSimplePackages() { for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do - cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/" - touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" - ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/" - ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/" + cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/${PKGPOOL}/" + touch "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" + ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/extra/os/${arch}/" + ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${root_dir}/extra/os/${arch}/" ../db-repo-add extra ${arch} ${pkgbase}-1-1-${arch}.pkg.tar.xz done done @@ -35,10 +35,10 @@ testAddMultiplePackages() { for arch in ${arches[@]}; do add_pkgs=() for pkgbase in ${pkgs[@]}; do - cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/" - touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" - ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/" - ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/" + cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/${PKGPOOL}/" + touch "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" + ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${root_dir}/extra/os/${arch}/" + ln -s "${root_dir}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${root_dir}/extra/os/${arch}/" add_pkgs[${#add_pkgs[*]}]=${pkgbase}-1-1-${arch}.pkg.tar.xz done ../db-repo-add extra ${arch} ${add_pkgs[@]} diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh index e38c328..c0b7501 100755 --- a/test/test.d/db-update.sh +++ b/test/test.d/db-update.sh @@ -133,8 +133,8 @@ testUpdateSameAnyPackageToDifferentRepositories() { local arch 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 ${pkgbase}) \ + ( [ -r "${root_dir}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/testing/os/${arch}/testing${DBEXT%.tar.*}" -O | grep -q ${pkgbase}) \ && fail "${pkgbase} should not be in testing/os/${arch}/testing${DBEXT%.tar.*}" done } @@ -156,8 +156,8 @@ testAddIncompleteSplitPackage() { ../db-update >/dev/null 2>&1 && fail "db-update should fail when a split package is missing!" 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}) \ + ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" -O | grep -q ${pkgbase}) \ && fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${DBEXT%.tar.*}" done } diff --git a/test/test.d/ftpdir-cleanup.sh b/test/test.d/ftpdir-cleanup.sh index 20026b4..ad88484 100755 --- a/test/test.d/ftpdir-cleanup.sh +++ b/test/test.d/ftpdir-cleanup.sh @@ -26,8 +26,8 @@ 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}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" - [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found" + [ -f "${root_dir}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" + [ -f "${root_dir}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found" local pkg2="pkg-simple-b-1-1-${arch}.pkg.tar.xz" checkPackage extra ${pkg2} ${arch} @@ -57,8 +57,8 @@ testCleanupEpochPackages() { for arch in ${arches[@]}; do local pkg1="pkg-simple-epoch-1:1-1-${arch}.pkg.tar.xz" checkRemovedPackage extra 'pkg-simple-epoch' ${arch} - [ -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" - [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found" + [ -f "${root_dir}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" + [ -f "${root_dir}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found" done } @@ -77,8 +77,8 @@ testCleanupAnyPackages() { local pkg1='pkg-any-a-1-1-any.pkg.tar.xz' checkRemovedAnyPackage extra 'pkg-any-a' - [ -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" - [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found" + [ -f "${root_dir}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" + [ -f "${root_dir}/${repo}/os/${arch}/${pkg1}" ] && fail "${repo}/os/${arch}/${pkg1} found" local pkg2="pkg-any-b-1-1-${arch}.pkg.tar.xz" checkAnyPackage extra ${pkg2} @@ -108,8 +108,8 @@ testCleanupSplitPackages() { for arch in ${arches[@]}; do for pkg in "${pkgdir}/${pkgs[0]}"/*-${arch}${PKGEXT}; do checkRemovedPackage extra ${pkgs[0]} ${arch} - [ -f "${FTP_BASE}/${PKGPOOL}/${pkg}" ] && fail "${PKGPOOL}/${pkg} found" - [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkg}" ] && fail "${repo}/os/${arch}/${pkg} found" + [ -f "${root_dir}/${PKGPOOL}/${pkg}" ] && fail "${PKGPOOL}/${pkg} found" + [ -f "${root_dir}/${repo}/os/${arch}/${pkg}" ] && fail "${repo}/os/${arch}/${pkg} found" done for pkg in "${pkgdir}/${pkgs[1]}"/*-${arch}${PKGEXT}; do diff --git a/test/test.d/pool-transition.sh b/test/test.d/pool-transition.sh index 5873f00..e91eed3 100755 --- a/test/test.d/pool-transition.sh +++ b/test/test.d/pool-transition.sh @@ -24,7 +24,7 @@ testMovePackagesWithoutPool() { 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}" + mv -f "${root_dir}/${PKGPOOL}/${pkg}" "${root_dir}/testing/os/${arch}/${pkg}" done done done @@ -55,9 +55,9 @@ testUpdateAnyPackageWithoutPool() { 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" + mv -f "${root_dir}/${PKGPOOL}/${pkg1}" "${root_dir}/extra/os/any" for arch in i686 x86_64; do - ln -sf "../any/${pkg1}" "${FTP_BASE}/extra/os/${arch}" + ln -sf "../any/${pkg1}" "${root_dir}/extra/os/${arch}" done pushd "${TMP}/svn-packages-copy/${pkgname}/trunk/" >/dev/null @@ -75,9 +75,9 @@ testUpdateAnyPackageWithoutPool() { checkAnyPackage extra "${pkg2}" - [ -f "${FTP_BASE}/${PKGPOOL}/${pkg1}" ] && fail "${PKGPOOL}/${pkg1} found" + [ -f "${root_dir}/${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" + [ -f "${root_dir}/extra/os/${arch}/${pkg1}" ] && fail "extra/os/${arch}/${pkg1} found" done } @@ -96,9 +96,9 @@ testMoveAnyPackagesWithoutPool() { # 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}" + mv -f "${root_dir}/${PKGPOOL}/${pkg}" "${root_dir}/testing/os/any/${pkg}" for arch in i686 x86_64; do - ln -sf "../any/${pkg}" "${FTP_BASE}/testing/os/${arch}/${pkg}" + ln -sf "../any/${pkg}" "${root_dir}/testing/os/${arch}/${pkg}" done done @@ -118,7 +118,7 @@ testMoveAnyPackagesWithoutPool() { 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" + [ -f "${root_dir}/testing/os/${arch}/${pkg}" ] && fail "testing/os/${arch}/${pkg} found" done done } @@ -133,9 +133,9 @@ testUpdateSameAnyPackageToDifferentRepositoriesWithoutPool() { # 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}" + mv -f "${root_dir}/${PKGPOOL}/${pkg}" "${root_dir}/extra/os/any/${pkg}" for arch in i686 x86_64; do - ln -sf "../any/${pkg}" "${FTP_BASE}/extra/os/${arch}/${pkg}" + ln -sf "../any/${pkg}" "${root_dir}/extra/os/${arch}/${pkg}" done done @@ -143,8 +143,8 @@ testUpdateSameAnyPackageToDifferentRepositoriesWithoutPool() { ../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) \ + ( [ -r "${root_dir}/testing/os/${arch}/testing${DBEXT%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/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 } diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh index fdcf08c..9e8cb26 100755 --- a/test/test.d/sourceballs.sh +++ b/test/test.d/sourceballs.sh @@ -18,7 +18,7 @@ testSourceballs() { ../cron-jobs/sourceballs for pkgbase in ${pkgs[@]}; do - [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" done } @@ -33,7 +33,7 @@ testAnySourceballs() { ../cron-jobs/sourceballs for pkgbase in ${pkgs[@]}; do - [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" done } @@ -54,7 +54,7 @@ testSplitSourceballs() { ../cron-jobs/sourceballs for pkgbase in ${pkgs[@]}; do - [ ! -r ${FTP_BASE}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" done } @@ -77,8 +77,8 @@ testSourceballsCleanup() { done ../cron-jobs/sourceballs - [ -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-a-*${SRCEXT} ] && fail "source package was not removed!" - [ ! -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-b-*${SRCEXT} ] && fail "source package not found!" + [ -r ${root_dir}/${SRCPOOL}/pkg-simple-a-*${SRCEXT} ] && fail "source package was not removed!" + [ ! -r ${root_dir}/${SRCPOOL}/pkg-simple-b-*${SRCEXT} ] && fail "source package not found!" } . "${curdir}/../lib/shunit2" -- cgit v1.2.3