diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-09-23 19:29:53 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-09-23 19:29:53 -0300 |
commit | 99493a15bde1b1c0d2d8f2ccc985da32570aacec (patch) | |
tree | 781b603cf679870510acc33ac98ac7d32e3f9aa6 | |
parent | 30525051311cab57d27dcd4fd42284dc142696e1 (diff) |
rename generic variables
-rwxr-xr-x | any-to-ours | 2 | ||||
-rw-r--r-- | config | 30 | ||||
-rwxr-xr-x | createrepos | 2 | ||||
-rwxr-xr-x | cron-jobs/check_archlinux/check_packages.py | 6 | ||||
-rwxr-xr-x | cron-jobs/ftpdir-cleanup | 26 | ||||
-rwxr-xr-x | cron-jobs/repo-sanity-check | 2 | ||||
-rwxr-xr-x | cron-jobs/sourceballs | 36 | ||||
-rwxr-xr-x | db-check-nonfree | 4 | ||||
-rwxr-xr-x | db-cleanup | 6 | ||||
-rw-r--r-- | db-functions | 54 | ||||
-rwxr-xr-x | db-move | 4 | ||||
-rwxr-xr-x | db-sync | 10 | ||||
-rwxr-xr-x | db-update | 18 | ||||
-rw-r--r-- | test/lib/common.inc | 98 | ||||
-rwxr-xr-x | test/lib/shunit2 | 10 | ||||
-rwxr-xr-x | test/test.d/create-filelists.sh | 22 | ||||
-rwxr-xr-x | test/test.d/db-move.sh | 4 | ||||
-rwxr-xr-x | test/test.d/db-update.sh | 20 | ||||
-rwxr-xr-x | test/test.d/ftpdir-cleanup.sh | 4 | ||||
-rwxr-xr-x | test/test.d/packages.sh | 2 | ||||
-rwxr-xr-x | test/test.d/pool-transition.sh | 20 | ||||
-rwxr-xr-x | test/test.d/signed-packages.sh | 2 | ||||
-rwxr-xr-x | test/test.d/sourceballs.sh | 10 | ||||
-rwxr-xr-x | test/test.d/testing2x.sh | 2 |
24 files changed, 197 insertions, 197 deletions
diff --git a/any-to-ours b/any-to-ours index a54cf0a..ab34a1e 100755 --- a/any-to-ours +++ b/any-to-ours @@ -61,7 +61,7 @@ for _repo in "${ARCHREPOS[@]}"; do pushd "${root_dir}/${_repo}/os/${_arch}/" >/dev/null # Add the packages to the db - repo-add "${_repo}${DBEXT}" "${SYNCED[@]}" + repo-add "${_repo}${database_extension_suffixfile}" "${SYNCED[@]}" popd >/dev/null @@ -10,27 +10,27 @@ distributions=("${native_distributions}" "${derivative_distributions}") # add compability support source "$(dirname "$(readlink -e "$0")")/config.d/gnu+linux_x86_arch_legacy -CLEANUP_DESTDIR="${root_dir}/old/packages" -CLEANUP_DRYRUN=false +cleanup_destination_directory="${root_dir}/old/packages" +cleanup_dryrun=false # Time in days to keep moved packages -CLEANUP_KEEP=30 +cleanup_keep=30 -SOURCE_CLEANUP_DESTDIR="${root_dir}/old/sources" -SOURCE_CLEANUP_DRYRUN=true +source_cleanup_destination_directory="${root_dir}/old/sources" +source_cleanup_dryrun=true # Time in days to keep moved sourcepackages -SOURCE_CLEANUP_KEEP=30 +source_cleanup_keep=30 -REQUIRE_SIGNATURE=true +require_signature=true -LOCK_DELAY=10 -LOCK_TIMEOUT=300 +lock_delay=10 +lock_timeout=300 -[ -n "${STAGING:-}" ] || STAGING="$HOME/staging/unknown/staging" -TMPDIR="/tmp" -DBEXT=".db.tar.gz" -FILESEXT=".files.tar.gz" -PKGEXT=".pkg.tar.?z" -SRCEXT=".src.tar.gz" +[ -n "${staging_directory:-}" ] || staging_directory="$HOME/staging/unknown/staging" +temporary_directory="/tmp" +database_extension_suffixfile=".db.tar.gz" +files_extension_suffixfile=".files.tar.gz" +package_extension_suffixfile=".pkg.tar.?z" +source_extension_suffixfile=".src.tar.gz" MAKEPKGCONF="~/.makepkg.conf" BLACKLIST_FILE="$HOME/blacklist/blacklist.txt" diff --git a/createrepos b/createrepos index 83e2959..1072c7f 100755 --- a/createrepos +++ b/createrepos @@ -3,6 +3,6 @@ source "$(dirname "$(readlink -e "$0")")/config" -mkdir -p -- "${root_dir}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" +mkdir -p -- "${root_dir}"/{"${PKGPOOL}","${SRCPOOL}"} "${cleanup_destination_directory}" "${source_cleanup_destination_directory}" "${staging_directory}" "$(dirname "$(readlink -e "$0")")/create-repo" "${PKGREPOS[@]}" diff --git a/cron-jobs/check_archlinux/check_packages.py b/cron-jobs/check_archlinux/check_packages.py index ac0194f..9f5a87b 100755 --- a/cron-jobs/check_archlinux/check_packages.py +++ b/cron-jobs/check_archlinux/check_packages.py @@ -22,7 +22,7 @@ import pdb import ctypes _alpm = ctypes.cdll.LoadLibrary("libalpm.so") -DBEXT='.db.tar.gz' +database_extension_suffixfile='.db.tar.gz' packages = {} # pkgname : PacmanPackage repopkgs = {} # pkgname : PacmanPackage @@ -116,7 +116,7 @@ def parse_dbs(repos,arch): dbpkgs = {} for repo in repos: pkgs = set([]) - db = tarfile.open(os.path.join(repodir,repo,'os',arch,repo + DBEXT)) + db = tarfile.open(os.path.join(repodir,repo,'os',arch,repo + database_extension_suffixfile)) for line in db.getnames(): if not '/' in line: pkgs.add(line.rsplit('-',2)[0]) @@ -423,7 +423,7 @@ if __name__ == "__main__": print "Error: the repository directory %s does not exist" % repodir sys.exit() for repo in repos: - path = os.path.join(repodir,repo,'os',arch,repo + DBEXT) + path = os.path.join(repodir,repo,'os',arch,repo + database_extension_suffixfile) if not os.path.isfile(path): print "Error : repo DB %s : File not found" % path sys.exit() diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 8718869..452aa83 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -7,32 +7,32 @@ 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_acl "$pkg" "$CLEANUP_DESTDIR/${pkg##*/}" + mv_acl "$pkg" "${cleanup_destination_directory}/${pkg##*/}" if [ -e "$pkg.sig" ]; then - mv_acl "$pkg.sig" "$CLEANUP_DESTDIR/${pkg##*/}.sig" + mv_acl "$pkg.sig" "${cleanup_destination_directory}/${pkg##*/}.sig" fi - touch "${CLEANUP_DESTDIR}/${pkg##*/}" + touch "${cleanup_destination_directory}/${pkg##*/}" fi done fi } -"${CLEANUP_DRYRUN}" && warning 'dry run mode is active' +"${cleanup_dryrun}" && warning 'dry run mode is active' for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - if [ ! -f "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" ]; then continue fi # get a list of actual available package files - find "${root_dir}/${repo}/os/${arch}" -xtype f -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}" + find "${root_dir}/${repo}/os/${arch}" -xtype f -name "*${package_extension_suffixfile}" -printf '%f\n' | sort > "${WORKDIR}/repo-${repo}-${arch}" # get a list of package files defined in the repo db - bsdtar -xOf "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" | awk '/^%FILENAME%/{getline;print}' | sort > "${WORKDIR}/db-${repo}-${arch}" + bsdtar -xOf "${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" | 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 @@ -54,7 +54,7 @@ for repo in "${PKGREPOS[@]}"; do done # get a list of all available packages in the pacakge pool -find "${root_dir}/${PKGPOOL}" -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/pool" +find "${root_dir}/${PKGPOOL}" -name "*${package_extension_suffixfile}" -printf '%f\n' | sort > "${WORKDIR}/pool" # create a list of packages in our db cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" @@ -67,14 +67,14 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then done fi -old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEANUP_KEEP}" -printf '%f\n')) +old_pkgs=($(find "${cleanup_destination_directory}" -type f -name "*${package_extension_suffixfile}" -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 msg2 '%s' "${old_pkg}" - if ! "${CLEANUP_DRYRUN}"; then - rm -f "${CLEANUP_DESTDIR}/${old_pkg}" - rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig" + if ! "${cleanup_dryrun}"; then + rm -f "${cleanup_destination_directory}/${old_pkg}" + rm -f "${cleanup_destination_directory}/${old_pkg}.sig" fi done fi diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 13f1ad1..203a740 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -13,7 +13,7 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on this repo's abs on_abs=($( - find "${SVNREPO}/${_repo}" -name PKGBUILD | \ + find "${SVN_repository}/${_repo}" -name PKGBUILD | \ while read pkgbuild; do source "${pkgbuild}" >/dev/null 2>&1 # cleanup to save memory diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 38104c7..7df349c 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 "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" ]; then continue fi - bsdtar -xOf "${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" \ | 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 "${root_dir}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${root_dir}/${SRCPOOL}" -xtype f -name "*${source_extension_suffixfile}" -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 @@ -69,12 +69,12 @@ for repo in "${PKGREPOS[@]}"; do # continue # fi # Store the expected file name of the source package - echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs" + echo "${pkgbase}-${pkgver}${source_extension_suffixfile}" >> "${WORKDIR}/expected-src-pkgs" # Build the source package if its not already there - if ! grep -Fqx "${pkgbase}-${pkgver}${SRCEXT}" "${WORKDIR}/available-src-pkgs"; then + if ! grep -Fqx "${pkgbase}-${pkgver}${source_extension_suffixfile}" "${WORKDIR}/available-src-pkgs"; then # Check if we had failed before - if in_array "${pkgbase}-${pkgver}${SRCEXT}" "${failedpkgs[@]}"; then + if in_array "${pkgbase}-${pkgver}${source_extension_suffixfile}" "${failedpkgs[@]}"; then continue fi @@ -83,20 +83,20 @@ for repo in "${PKGREPOS[@]}"; do cp -a "$(xbs releasepath "${pkgbase}" "${repo}" "${pkgarch}")" \ "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 if [ $? -ge 1 ]; then - failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") + failedpkgs+=("${pkgbase}-${pkgver}${source_extension_suffixfile}") continue fi # Build the actual source package 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}" "${root_dir}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}" + if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${source_extension_suffixfile}" ]; then + mv_acl "${pkgbase}-${pkgver}${source_extension_suffixfile}" "${root_dir}/${SRCPOOL}/${pkgbase}-${pkgver}${source_extension_suffixfile}" # Avoid creating the same source package for every arch - echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" - newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") + echo "${pkgbase}-${pkgver}${source_extension_suffixfile}" >> "${WORKDIR}/available-src-pkgs" + newpkgs+=("${pkgbase}-${pkgver}${source_extension_suffixfile}") else - failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") + failedpkgs+=("${pkgbase}-${pkgver}${source_extension_suffixfile}") cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log" fi popd >/dev/null @@ -124,22 +124,22 @@ 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 '%s' "${old_pkg}" - if ! "${SOURCE_CLEANUP_DRYRUN}"; then - mv_acl "${root_dir}/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" - touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + if ! "${source_cleanup_dryrun}"; then + mv_acl "${root_dir}/${SRCPOOL}/${old_pkg}" "${source_cleanup_destination_directory}/${old_pkg}" + touch "${source_cleanup_destination_directory}/${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_destination_directory}" -type f -name "*${source_extension_suffixfile}" -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 '%s' "${old_pkg}" - "${SOURCE_CLEANUP_DRYRUN}" || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + "${source_cleanup_dryrun}" || rm -f "${source_cleanup_destination_directory}/${old_pkg}" done fi diff --git a/db-check-nonfree b/db-check-nonfree index 6346dbb..666f4d6 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 "${root_dir}/${repo}/os/${pkgarch}/${repo}${DBEXT}" ]; then + if [ ! -f "${root_dir}/${repo}/os/${pkgarch}/${repo}${database_extension_suffixfile}" ]; then continue fi unset dbpkgs unset cleanpkgs cleanpkgs=() - dbpkgs=($(bsdtar -xOf "${root_dir}/${repo}/os/${pkgarch}/${repo}${DBEXT}" | awk '/^%NAME%/{getline;print}' | sort -u )) + dbpkgs=($(bsdtar -xOf "${root_dir}/${repo}/os/${pkgarch}/${repo}${database_extension_suffixfile}" | awk '/^%NAME%/{getline;print}' | sort -u )) for pkgname in "${dbpkgs[@]}"; do if in_array "${pkgname}" "${nonfree[@]}"; then cleanpkgs+=("${pkgname}") @@ -26,7 +26,7 @@ trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR EXTRAFLAGS=() -"${CLEANUP_DRYRUN}" && EXTRAFLAGS+=(--dry-run) +"${cleanup_dryrun}" && EXTRAFLAGS+=(--dry-run) filter=$(mktemp -t "${0##*/}.XXXXXXXXXX") trap "rm -f -- $(printf %q "$filter")" EXIT @@ -35,7 +35,7 @@ for _repo in "${PKGREPOS[@]}"; do for _arch in "${ARCHES[@]}"; do msg "Getting %s-%s database" "${_repo}" "${_arch}" - dbfile="${root_dir}/${_repo}/os/${_arch}/${_repo}${DBEXT}" + dbfile="${root_dir}/${_repo}/os/${_arch}/${_repo}${database_extension_suffixfile}" if [ ! -r "${dbfile}" ]; then warning "Not found" @@ -65,5 +65,5 @@ done msg "Removing dead symlinks:" actions=(-print) -"${CLEANUP_DRYRUN}" || actions+=(-delete) +"${cleanup_dryrun}" || actions+=(-delete) find -L "${root_dir}/" -type l "${actions[@]}" diff --git a/db-functions b/db-functions index b993cd1..52676c7 100644 --- a/db-functions +++ b/db-functions @@ -95,7 +95,7 @@ get_full_version() { } script_lock() { - local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" + local LOCKDIR="$temporary_directory/.scriptlock.${0##*/}" if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" error "Script %s is already locked by %s." "${0##*/}" "$_owner" @@ -107,7 +107,7 @@ script_lock() { } script_unlock() { - local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" + local LOCKDIR="$temporary_directory/.scriptlock.${0##*/}" if [ ! -d "$LOCKDIR" ]; then warning "Script %s was not locked!" "${0##*/}" restore_umask @@ -128,12 +128,12 @@ cleanup() { for l in "${LOCKS[@]}"; do repo=${l%.*} arch=${l#*.} - if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then + if [ -d "$temporary_directory/.repolock.$repo.$arch" ]; then msg "Removing left over lock from [%s] (%s)" "${repo}" "${arch}" repo_unlock "$repo" "$arch" fi done - if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then + if [ -d "$temporary_directory/.scriptlock.${0##*/}" ]; then msg "Removing left over lock from %s" "${0##*/}" script_unlock fi @@ -163,9 +163,9 @@ trap cleanup EXIT #repo_lock <repo-name> <arch> [timeout] repo_lock () { - local LOCKDIR="$TMPDIR/.repolock.$1.$2" - local DBLOCKFILE="${root_dir}/${1}/os/${2}/${1}${DBEXT}.lck" - local FILESLOCKFILE="${root_dir}/${1}/os/${2}/${1}${FILESEXT}.lck" + local LOCKDIR="$temporary_directory/.repolock.$1.$2" + local DBLOCKFILE="${root_dir}/${1}/os/${2}/${1}${database_extension_suffixfile}.lck" + local FILESLOCKFILE="${root_dir}/${1}/os/${2}/${1}${files_extension_suffixfile}.lck" local _count local _trial local _timeout @@ -188,7 +188,7 @@ repo_lock () { elif [ $# -eq 3 ]; then _lockblock=false _timeout=$3 - let _trial=$_timeout/$LOCK_DELAY + let _trial=$_timeout/$lock_delay fi _count=0 @@ -196,13 +196,13 @@ repo_lock () { if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" warning "Repo [%s] (%s) is already locked by %s." "${1}" "${2}" "$_owner" - msg2 "Retrying in %d seconds..." "$LOCK_DELAY" + msg2 "Retrying in %d seconds..." "$lock_delay" else LOCKS+=("$1.$2") set_umask return 0 fi - sleep "$LOCK_DELAY" + sleep "$lock_delay" let _count=$_count+1 done @@ -211,7 +211,7 @@ repo_lock () { } repo_unlock () { #repo_unlock <repo-name> <arch> - local LOCKDIR="$TMPDIR/.repolock.$1.$2" + local LOCKDIR="$temporary_directory/.repolock.$1.$2" if [ ! -d "$LOCKDIR" ]; then warning "Repo lock [%s] (%s) was not locked!" "${1}" "${2}" restore_umask @@ -300,7 +300,7 @@ getpkgfile() { elif [ ! -f "${1}" ]; then error "Package %s not found!" "${1}" exit 1 - elif "${REQUIRE_SIGNATURE}" && [ ! -f "${1}.sig" ]; then + elif "${require_signature}" && [ ! -f "${1}.sig" ]; then error "Package signature %s not found!" "${1}.sig" exit 1 fi @@ -319,7 +319,7 @@ getpkgfiles() { if [ ! -f "${f}" ]; then error "Package %s not found!" "${f}" exit 1 - elif "${REQUIRE_SIGNATURE}" && [ ! -f "${f}.sig" ]; then + elif "${require_signature}" && [ ! -f "${f}.sig" ]; then error "Package signature %s not found!" "${f}.sig" exit 1 fi @@ -417,8 +417,8 @@ check_pkgrepos() { local pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && 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}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile} ] && return 1 + [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile}.sig ] && return 1 [ -f "${root_dir}/${PKGPOOL}/${pkgfile##*/}" ] && return 1 [ -f "${root_dir}/${PKGPOOL}/${pkgfile##*/}.sig" ] && return 1 @@ -426,8 +426,8 @@ check_pkgrepos() { local arch for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - [ -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}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile} ] && return 1 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile}.sig ] && return 1 [ -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}" ] && return 1 [ -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}.sig" ] && return 1 done @@ -460,8 +460,8 @@ check_repo_permission() { for arch in "${ARCHES[@]}"; do 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 + [ -f "${dir}${repo}"${database_extension_suffixfile} -a ! -w "${dir}${repo}"${database_extension_suffixfile} ] && return 1 + [ -f "${dir}${repo}"${files_extension_suffixfile} -a ! -w "${dir}${repo}"${files_extension_suffixfile} ] && return 1 done return 0 @@ -470,8 +470,8 @@ check_repo_permission() { set_repo_permission() { local repo=$1 local arch=$2 - local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" - local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${FILESEXT}" + local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" + local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${files_extension_suffixfile}" if [ -w "${dbfile}" ]; then local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") @@ -492,10 +492,10 @@ arch_repo_add() { printf -v pkgs_str -- '%q ' "${pkgs[@]}" # package files might be relative to repo dir 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[@]}" \ - || error 'repo-add -f %q %s' "${repo}${FILESEXT}" "${pkgs_str% }" + /usr/bin/repo-add -q "${repo}${database_extension_suffixfile}" "${pkgs[@]}" >/dev/null \ + || error 'repo-add %q %s' "${repo}${database_extension_suffixfile}" "${pkgs_str% }" + /usr/bin/repo-add -f -q "${repo}${files_extension_suffixfile}" "${pkgs[@]}" \ + || error 'repo-add -f %q %s' "${repo}${files_extension_suffixfile}" "${pkgs_str% }" popd >/dev/null set_repo_permission "${repo}" "${arch}" @@ -506,8 +506,8 @@ arch_repo_remove() { local repo=$1 local arch=$2 local pkgs=("${@:3}") - local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" - local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${FILESEXT}" + local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" + local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${files_extension_suffixfile}" if [ ! -f "${dbfile}" ]; then error "No database found at '%s'" "${dbfile}" @@ -47,7 +47,7 @@ for pkgbase in "${args[@]:2}"; do for pkgname in "${pkgnames[@]}"; do for tarch in "${tarches[@]}"; do - getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} >/dev/null + getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile} >/dev/null done done continue 2 @@ -78,7 +78,7 @@ for pkgbase in "${args[@]:2}"; do for pkgname in "${pkgnames[@]}"; do for tarch in "${tarches[@]}"; do - pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}) + pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile}) pkgfile="${pkgpath##*/}" ln -s "../../../${PKGPOOL}/${pkgfile}" "${ftppath_to}/${tarch}/" @@ -27,9 +27,9 @@ get_repos() { # Exclude everything but db files rsync "${extra[@]}" --no-motd -mrtlH --no-p --include="*/" \ --include="*.db" \ - --include="*${DBEXT}" \ + --include="*${database_extension_suffixfile}" \ --include="*.files" \ - --include="*${FILESEXT}" \ + --include="*${files_extension_suffixfile}" \ --exclude="*" \ --delete-after \ "rsync://${mirror}/${mirrorpath}/" "$WORKDIR" @@ -73,8 +73,8 @@ init() { for _arch in "${ARCHARCHES[@]}"; do msg "Processing %s-%s" "${_repo}-${_arch}" - db_file=$(get_repo_file "${_repo}" "${_arch}")${DBEXT} - files_file=$(get_repo_file "${_repo}" "${_arch}")${FILESEXT} + db_file=$(get_repo_file "${_repo}" "${_arch}")${database_extension_suffixfile} + files_file=$(get_repo_file "${_repo}" "${_arch}")${files_extension_suffixfile} if [ ! -f "${db_file}" ]; then warning "%s doesn't exist, skipping this repo-arch" "${db_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 root_dir ARCHSRCPOOLS ARCHPKGPOOLS; do +for var in database_extension_suffixfile files_extension_suffixfile mirror mirrorpath WORKDIR BLACKLIST_FILE root_dir ARCHSRCPOOLS ARCHPKGPOOLS; do test -z "${!var}" && fatal_error "Empty %s" "${var}" done @@ -9,9 +9,9 @@ if [ $# -ge 1 ]; then fi # Find repos with packages to release -staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u)) +staging_repos=($(find "${staging_directory}" -mindepth 1 -type f -name "*${package_extension_suffixfile}" -printf '%h\n' | sort -u)) if [ $? -ge 1 ]; then - die "Could not read %s" "${STAGING}" + die "Could not read %s" "${staging_directory}" fi repos=() @@ -33,7 +33,7 @@ for repo in "${repos[@]}"; do if ! check_repo_permission "${repo}"; then die "You don't have permission to update packages in %s" "${repo}" fi - pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT})) + pkgs=($(getpkgfiles "${staging_directory}/${repo}/"*${package_extension_suffixfile})) if [ $? -eq 0 ]; then for pkg in "${pkgs[@]}"; do if [ -h "${pkg}" ]; then @@ -51,18 +51,18 @@ for repo in "${repos[@]}"; do # die "Missing split packages for %s" "${repo}" #fi else - die "Could not read %s" "${STAGING}" + die "Could not read %s" "${staging_directory}" fi done dirs=() for repo in "${repos[@]}"; do msg "Updating [%s]..." "${repo}" - any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null)) + any_pkgs=($(getpkgfiles "${staging_directory}/${repo}/"*-any${package_extension_suffixfile} 2>/dev/null)) for pkgarch in "${ARCHES[@]}"; do add_dirs=() add_pkgs=() - arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXT} 2>/dev/null)) + arch_pkgs=($(getpkgfiles "${staging_directory}/${repo}/"*-"${pkgarch}"${package_extension_suffixfile} 2>/dev/null)) for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do pkgfile="${pkg##*/}" msg2 "%s (%s)" "${pkgfile}" "${pkgarch}" @@ -78,7 +78,7 @@ for repo in "${repos[@]}"; do if [ -f "${root_dir}/${PKGPOOL}/${pkgfile}.sig" ]; then ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "${root_dir}/$repo/os/${pkgarch}" fi - add_dirs+=("${STAGING}/abslibre/$(getpkgarch "${root_dir}/$PKGPOOL/$pkgfile")/$repo/$(getpkgbase "${root_dir}/$PKGPOOL/$pkgfile")") + add_dirs+=("${staging_directory}/abslibre/$(getpkgarch "${root_dir}/$PKGPOOL/$pkgfile")/$repo/$(getpkgbase "${root_dir}/$PKGPOOL/$pkgfile")") add_pkgs+=("${pkgfile}") done for add_dir in "${add_dirs[@]}"; do @@ -98,12 +98,12 @@ for repo in "${repos[@]}"; do done done -cd "${STAGING}" +cd "${staging_directory}" # Remove left over XBS files rm -rf -- "${dirs[@]}" dirname -z -- "${dirs[@]}" | - xargs -0 realpath -zm --relative-to="${STAGING}" -- | + xargs -0 realpath -zm --relative-to="${staging_directory}" -- | xargs -0 rmdir -p -- 2>/dev/null # Stage generated source files diff --git a/test/lib/common.inc b/test/lib/common.inc index 04bed2b..c549ac9 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -23,7 +23,7 @@ oneTimeSetUp() { build=true for a in ${pkgarch[@]}; do for p in ${pkgname[@]}; do - [ ! -f ${p}-${pkgversion}-${a}${PKGEXT} ] && build=false + [ ! -f ${p}-${pkgversion}-${a}${package_extension_suffixfile} ] && build=false done done @@ -37,7 +37,7 @@ oneTimeSetUp() { fi for a in ${pkgarch[@]}; do for p in ${pkgname[@]}; do - cp ${p}-${pkgversion}-${a}${PKGEXT} $(dirname ${BASH_SOURCE[0]})/../packages/$(basename ${d}) + cp ${p}-${pkgversion}-${a}${package_extension_suffixfile} $(dirname ${BASH_SOURCE[0]})/../packages/$(basename ${d}) done done fi @@ -56,52 +56,52 @@ 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)" - #msg "Using ${TMP}" + temporary_directory="$(mktemp -d /dev/shm/$(basename $0).XXXXXXXXXX)" + #msg "Using ${temporary_directory}" PKGREPOS=('core' 'extra' 'testing') PKGPOOL='pool/packages' - mkdir -p "${TMP}/"{ftp,tmp,staging,{package,source}-cleanup,svn-packages-{copy,repo}} + mkdir -p "${temporary_directory}/"{ftp,tmp,staging,{package,source}-cleanup,svn-packages-{copy,repo}} for r in ${PKGREPOS[@]}; do - mkdir -p "${TMP}/staging/${r}" + mkdir -p "${temporary_directory}/staging/${r}" for a in ${ARCHES[@]} any; do - mkdir -p "${TMP}/ftp/${r}/os/${a}" + mkdir -p "${temporary_directory}/ftp/${r}/os/${a}" done done - mkdir -p "${TMP}/ftp/${PKGPOOL}" - mkdir -p "${TMP}/ftp/${SRCPOOL}" + mkdir -p "${temporary_directory}/ftp/${PKGPOOL}" + mkdir -p "${temporary_directory}/ftp/${SRCPOOL}" msg 'Creating svn repository...' - svnadmin create "${TMP}/svn-packages-repo" - svn checkout -q "file://${TMP}/svn-packages-repo" "${TMP}/svn-packages-copy" + svnadmin create "${temporary_directory}/svn-packages-repo" + svn checkout -q "file://${temporary_directory}/svn-packages-repo" "${temporary_directory}/svn-packages-copy" for p in "${pkgdir}"/*; do pkg=$(basename $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" + mkdir -p "${temporary_directory}/svn-packages-copy/${pkg}"/{trunk,repos} + cp "${p}"/* "${temporary_directory}/svn-packages-copy"/${pkg}/trunk/ + svn add -q "${temporary_directory}/svn-packages-copy"/${pkg} + svn commit -q -m"initial commit of ${pkg}" "${temporary_directory}/svn-packages-copy" done cat <<eot > "$(dirname ${BASH_SOURCE[0]})/../../config.local" - root_dir="${TMP}/ftp" - SVNREPO="file://${TMP}/svn-packages-repo" + root_dir="${temporary_directory}/ftp" + SVN_repository="file://${temporary_directory}/svn-packages-repo" PKGREPOS=(${PKGREPOS[@]}) PKGPOOL="${PKGPOOL}" - CLEANUP_DESTDIR="${TMP}/package-cleanup" - SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup" - STAGING="${TMP}/staging" - TMPDIR="${TMP}/tmp" - CLEANUP_DRYRUN=false - SOURCE_CLEANUP_DRYRUN=false - REQUIRE_SIGNATURE=true + cleanup_destination_directory="${temporary_directory}/package-cleanup" + source_cleanup_destination_directory="${temporary_directory}/source-cleanup" + staging_directory="${temporary_directory}/staging" + temporary_directory="${temporary_directory}/tmp" + cleanup_dryrun=false + source_cleanup_dryrun=false + require_signature=true eot . "$(dirname ${BASH_SOURCE[0]})/../../config" } tearDown() { - rm -rf "${TMP}" + rm -rf "${temporary_directory}" rm -f "$(dirname ${BASH_SOURCE[0]})/../../config.local" echo } @@ -111,16 +111,16 @@ releasePackage() { local pkgbase=$2 local arch=$3 - pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null + pushd "${temporary_directory}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null archrelease ${repo}-${arch} >/dev/null 2&>1 pkgver=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel})) popd >/dev/null - cp "${pkgdir}/${pkgbase}"/*-${pkgver}-${arch}${PKGEXT} "${STAGING}"/${repo}/ + cp "${pkgdir}/${pkgbase}"/*-${pkgver}-${arch}${package_extension_suffixfile} "${staging_directory}"/${repo}/ - if ${REQUIRE_SIGNATURE}; then + if ${require_signature}; then # TODO: really sign the packages with a valid key - find "${STAGING}"/${repo}/ -type f \ - -name "*-${pkgver}-${arch}${PKGEXT}" \ + find "${staging_directory}"/${repo}/ -type f \ + -name "*-${pkgver}-${arch}${package_extension_suffixfile}" \ -exec touch {}.sig \; fi } @@ -132,7 +132,7 @@ checkAnyPackageDB() { local db [ -r "${root_dir}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found" - if ${REQUIRE_SIGNATURE}; then + if ${require_signature}; then [ -r "${root_dir}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found" fi @@ -141,16 +141,16 @@ checkAnyPackageDB() { [ "$(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 + if ${require_signature}; then [ -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 - [ -r "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir" - [ -r "${STAGING}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging dir" + [ -r "${staging_directory}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging directory" + [ -r "${staging_directory}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging directory" - for db in ${DBEXT} ${FILESEXT}; do + for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do ( [ -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.*}" @@ -167,8 +167,8 @@ checkAnyPackage() { checkAnyPackageDB $repo $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" ] \ + svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}" + [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \ || fail "svn-packages-copy/${pkgbase}/repos/${repo}-any does not exist" } @@ -180,21 +180,21 @@ checkPackageDB() { [ -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" + [ -r "${staging_directory}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging directory" [ "$(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 + if ${require_signature}; then [ -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" + [ -r "${staging_directory}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging directory" [ "$(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 + for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do ( [ -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.*}" @@ -209,8 +209,8 @@ checkPackage() { checkPackageDB $repo $pkg $arch local pkgbase=$(getpkgbase "${root_dir}/${PKGPOOL}/${pkg}") - svn up -q "${TMP}/svn-packages-copy/${pkgbase}" - [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \ + svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}" + [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \ || fail "svn-packages-copy/${pkgbase}/repos/${repo}-${arch} does not exist" } @@ -220,7 +220,7 @@ checkRemovedPackageDB() { local arch=$3 local db - for db in ${DBEXT} ${FILESEXT}; do + for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do ( [ -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.*}" @@ -234,8 +234,8 @@ checkRemovedPackage() { checkRemovedPackageDB $repo $pkgbase $arch - svn up -q "${TMP}/svn-packages-copy/${pkgbase}" - [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \ + svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}" + [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \ && fail "svn-packages-copy/${pkgbase}/repos/${repo}-${arch} should not exist" } @@ -245,7 +245,7 @@ checkRemovedAnyPackageDB() { local arch local db - for db in ${DBEXT} ${FILESEXT}; do + for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do for arch in i686 x86_64; do ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \ && bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \ @@ -260,7 +260,7 @@ checkRemovedAnyPackage() { checkRemovedAnyPackageDB $repo $pkgbase - svn up -q "${TMP}/svn-packages-copy/${pkgbase}" - [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \ + svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}" + [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \ && fail "svn-packages-copy/${pkgbase}/repos/${repo}-any should not exist" } diff --git a/test/lib/shunit2 b/test/lib/shunit2 index 8862ffd..1462562 100755 --- a/test/lib/shunit2 +++ b/test/lib/shunit2 @@ -698,7 +698,7 @@ _shunit_mktempDir() _shunit_random_=`expr ${_shunit_date_} / $$` fi - _shunit_tmpDir_="${TMPDIR:-/tmp}/shunit.${_shunit_random_}" + _shunit_tmpDir_="${temporary_directory:-/tmp}/shunit.${_shunit_random_}" ( umask 077 && mkdir "${_shunit_tmpDir_}" ) || \ _shunit_fatal 'could not create temporary directory! exiting' @@ -995,8 +995,8 @@ __shunit_tmpDir=`_shunit_mktempDir` # provide a public temporary directory for unit test scripts # TODO(kward): document this -SHUNIT_TMPDIR="${__shunit_tmpDir}/tmp" -mkdir "${SHUNIT_TMPDIR}" +SHUNIT_temporary_directory="${__shunit_tmpDir}/tmp" +mkdir "${SHUNIT_temporary_directory}" # setup traps to clean up after ourselves trap '_shunit_cleanup EXIT' 0 @@ -1008,10 +1008,10 @@ _shunit_mktempFunc PATH="${__shunit_tmpDir}:${PATH}" # make sure phantom functions are executable. this will bite if /tmp (or the -# current $TMPDIR) points to a path on a partition that was mounted with the +# current $temporary_directory) points to a path on a partition that was mounted with the # 'noexec' option. the noexec command was created with _shunit_mktempFunc(). noexec 2>/dev/null || _shunit_fatal \ - 'please declare TMPDIR with path on partition with exec permission' + 'please declare temporary_directory with path on partition with exec permission' # we must manually source the tests in standalone mode if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh index 3e27d64..c1f43e9 100755 --- a/test/test.d/create-filelists.sh +++ b/test/test.d/create-filelists.sh @@ -18,8 +18,8 @@ testCreateSimpleFileLists() { for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do - 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}" + if ! bsdtar -xOf "${root_dir}/extra/os/${arch}/extra${files_extension_suffixfile}" | grep -q "usr/bin/${pkgbase}"; then + fail "usr/bin/${pkgbase} not found in ${arch}/extra${files_extension_suffixfile}" fi done done @@ -38,8 +38,8 @@ testCreateAnyFileLists() { for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do - 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}" + if ! bsdtar -xOf "${root_dir}/extra/os/${arch}/extra${files_extension_suffixfile}" | grep -q "usr/share/${pkgbase}/test"; then + fail "usr/share/${pkgbase}/test not found in ${arch}/extra${files_extension_suffixfile}" fi done done @@ -62,11 +62,11 @@ testCreateSplitFileLists() { ../db-update for pkgbase in ${pkgs[@]}; do - pkgnames=($(source "${TMP}/svn-packages-copy/${pkgbase}/trunk/PKGBUILD"; echo ${pkgname[@]})) + pkgnames=($(source "${temporary_directory}/svn-packages-copy/${pkgbase}/trunk/PKGBUILD"; echo ${pkgname[@]})) for pkgname in ${pkgnames[@]}; do for arch in ${arches[@]}; do - 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}" + if ! bsdtar -xOf "${root_dir}/extra/os/${arch}/extra${files_extension_suffixfile}" | grep -q "usr/bin/${pkgname}"; then + fail "usr/bin/${pkgname} not found in ${arch}/extra${files_extension_suffixfile}" fi done done @@ -92,11 +92,11 @@ testCleanupFileLists() { done for arch in ${arches[@]}; do - 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}" + if ! bsdtar -xOf "${root_dir}/extra/os/${arch}/extra${files_extension_suffixfile}" | grep -q "usr/bin/pkg-simple-b"; then + fail "usr/bin/pkg-simple-b not found in ${arch}/extra${files_extension_suffixfile}" fi - 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}" + if bsdtar -xOf "${root_dir}/extra/os/${arch}/extra${files_extension_suffixfile}" | grep -q "usr/bin/pkg-simple-a"; then + fail "usr/bin/pkg-simple-a still found in ${arch}/extra${files_extension_suffixfile}" fi done diff --git a/test/test.d/db-move.sh b/test/test.d/db-move.sh index 9d7c1f6..04c8113 100755 --- a/test/test.d/db-move.sh +++ b/test/test.d/db-move.sh @@ -106,12 +106,12 @@ testMoveSplitPackages() { ../db-move testing extra pkg-split-a for arch in ${arches[@]}; do - for pkg in "${pkgdir}/pkg-split-a"/*-${arch}${PKGEXT}; do + for pkg in "${pkgdir}/pkg-split-a"/*-${arch}${package_extension_suffixfile}; do checkPackage extra $(basename ${pkg}) ${arch} done done for arch in ${arches[@]}; do - for pkg in "${pkgdir}/pkg-split-b"/*-${arch}${PKGEXT}; do + for pkg in "${pkgdir}/pkg-split-b"/*-${arch}${package_extension_suffixfile}; do checkPackage testing $(basename ${pkg}) ${arch} done done diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh index c0b7501..3ce9037 100755 --- a/test/test.d/db-update.sh +++ b/test/test.d/db-update.sh @@ -68,7 +68,7 @@ testAddSplitPackages() { for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do - for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${PKGEXT}; do + for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${package_extension_suffixfile}; do checkPackage extra $(basename ${pkg}) ${arch} done done @@ -79,7 +79,7 @@ testUpdateAnyPackage() { releasePackage extra pkg-any-a any ../db-update - pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null + pushd "${temporary_directory}/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 @@ -97,7 +97,7 @@ testUpdateAnyPackage() { testUpdateAnyPackageToDifferentRepositoriesAtOnce() { releasePackage extra pkg-any-a any - pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null + pushd "${temporary_directory}/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 @@ -133,9 +133,9 @@ testUpdateSameAnyPackageToDifferentRepositories() { local arch for arch in i686 x86_64; do - ( [ -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.*}" + ( [ -r "${root_dir}/testing/os/${arch}/testing${database_extension_suffixfile%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/testing/os/${arch}/testing${database_extension_suffixfile%.tar.*}" -O | grep -q ${pkgbase}) \ + && fail "${pkgbase} should not be in testing/os/${arch}/testing${database_extension_suffixfile%.tar.*}" done } @@ -151,14 +151,14 @@ testAddIncompleteSplitPackage() { done # remove a split package to make db-update fail - rm "${STAGING}"/extra/${pkgbase}1-* + rm "${staging_directory}"/extra/${pkgbase}1-* ../db-update >/dev/null 2>&1 && fail "db-update should fail when a split package is missing!" for arch in ${arches[@]}; do - ( [ -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.*}" + ( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile%.tar.*}" -O | grep -q ${pkgbase}) \ + && fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${database_extension_suffixfile%.tar.*}" done } diff --git a/test/test.d/ftpdir-cleanup.sh b/test/test.d/ftpdir-cleanup.sh index ad88484..4e7e1f5 100755 --- a/test/test.d/ftpdir-cleanup.sh +++ b/test/test.d/ftpdir-cleanup.sh @@ -106,13 +106,13 @@ testCleanupSplitPackages() { ../cron-jobs/ftpdir-cleanup >/dev/null for arch in ${arches[@]}; do - for pkg in "${pkgdir}/${pkgs[0]}"/*-${arch}${PKGEXT}; do + for pkg in "${pkgdir}/${pkgs[0]}"/*-${arch}${package_extension_suffixfile}; do checkRemovedPackage extra ${pkgs[0]} ${arch} [ -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 + for pkg in "${pkgdir}/${pkgs[1]}"/*-${arch}${package_extension_suffixfile}; do checkPackage extra $(basename ${pkg}) ${arch} done done diff --git a/test/test.d/packages.sh b/test/test.d/packages.sh index 488cb15..5028448 100755 --- a/test/test.d/packages.sh +++ b/test/test.d/packages.sh @@ -5,7 +5,7 @@ curdir=$(readlink -e $(dirname $0)) testPackages() { # TODO: namcap -r sodepends fails with i686 packages - find "${pkgdir}" -name "*${PKGEXT}" -exec namcap -e sodepends,pkgnameindesc {} + || fail 'namcap failed' + find "${pkgdir}" -name "*${package_extension_suffixfile}" -exec namcap -e sodepends,pkgnameindesc {} + || fail 'namcap failed' } . "${curdir}/../lib/shunit2" diff --git a/test/test.d/pool-transition.sh b/test/test.d/pool-transition.sh index e91eed3..9f13d83 100755 --- a/test/test.d/pool-transition.sh +++ b/test/test.d/pool-transition.sh @@ -22,7 +22,7 @@ testMovePackagesWithoutPool() { # 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 + for pkg in "${pkgdir}/${pkgs[${old}]}"/*-${arch}${package_extension_suffixfile}; do pkg=$(basename $pkg) mv -f "${root_dir}/${PKGPOOL}/${pkg}" "${root_dir}/testing/os/${arch}/${pkg}" done @@ -37,7 +37,7 @@ testMovePackagesWithoutPool() { for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do - for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${PKGEXT}; do + for pkg in "${pkgdir}/${pkgbase}"/*-${arch}${package_extension_suffixfile}; do checkPackage extra $(basename ${pkg}) ${arch} done checkRemovedPackage testing ${pkgbase} ${arch} @@ -60,7 +60,7 @@ testUpdateAnyPackageWithoutPool() { ln -sf "../any/${pkg1}" "${root_dir}/extra/os/${arch}" done - pushd "${TMP}/svn-packages-copy/${pkgname}/trunk/" >/dev/null + pushd "${temporary_directory}/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 @@ -94,7 +94,7 @@ testMoveAnyPackagesWithoutPool() { ../db-update # transform a package to old style layout - for pkg in "${pkgdir}/${pkgs[0]}"/*-any${PKGEXT}; do + for pkg in "${pkgdir}/${pkgs[0]}"/*-any${package_extension_suffixfile}; do pkg=$(basename $pkg) mv -f "${root_dir}/${PKGPOOL}/${pkg}" "${root_dir}/testing/os/any/${pkg}" for arch in i686 x86_64; do @@ -109,13 +109,13 @@ testMoveAnyPackagesWithoutPool() { ../cron-jobs/ftpdir-cleanup >/dev/null for pkgbase in ${pkgs[@]}; do - for pkg in "${pkgdir}/${pkgbase}"/*-any${PKGEXT}; do + for pkg in "${pkgdir}/${pkgbase}"/*-any${package_extension_suffixfile}; do checkAnyPackage extra $(basename ${pkg}) done checkRemovedAnyPackage testing ${pkgbase} done - for pkg in "${pkgdir}/${pkgs[0]}"/*-any${PKGEXT}; do + for pkg in "${pkgdir}/${pkgs[0]}"/*-any${package_extension_suffixfile}; do pkg=$(basename $pkg) for arch in any i686 x86_64; do [ -f "${root_dir}/testing/os/${arch}/${pkg}" ] && fail "testing/os/${arch}/${pkg} found" @@ -131,7 +131,7 @@ testUpdateSameAnyPackageToDifferentRepositoriesWithoutPool() { ../db-update # transform a package to old style layout - for pkg in "${pkgdir}/pkg-any-a"/*-any${PKGEXT}; do + for pkg in "${pkgdir}/pkg-any-a"/*-any${package_extension_suffixfile}; do pkg=$(basename $pkg) mv -f "${root_dir}/${PKGPOOL}/${pkg}" "${root_dir}/extra/os/any/${pkg}" for arch in i686 x86_64; do @@ -143,9 +143,9 @@ 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 "${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.*}" + ( [ -r "${root_dir}/testing/os/${arch}/testing${database_extension_suffixfile%.tar.*}" ] \ + && bsdtar -xf "${root_dir}/testing/os/${arch}/testing${database_extension_suffixfile%.tar.*}" -O | grep -q pkg-any-a) \ + && fail "pkg-any-a should not be in testing/os/${arch}/testing${database_extension_suffixfile%.tar.*}" done } diff --git a/test/test.d/signed-packages.sh b/test/test.d/signed-packages.sh index 5d6f4ff..d7c5e57 100755 --- a/test/test.d/signed-packages.sh +++ b/test/test.d/signed-packages.sh @@ -6,7 +6,7 @@ curdir=$(readlink -e $(dirname $0)) testAddUnsignedPackage() { releasePackage extra 'pkg-simple-a' 'i686' # remove any signature - rm "${STAGING}"/extra/*.sig + rm "${staging_directory}"/extra/*.sig ../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is missing!" } diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh index 9e8cb26..a34093a 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 ${root_dir}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${source_extension_suffixfile} ] && fail "source package not found!" done } @@ -33,7 +33,7 @@ testAnySourceballs() { ../cron-jobs/sourceballs for pkgbase in ${pkgs[@]}; do - [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${source_extension_suffixfile} ] && fail "source package not found!" done } @@ -54,7 +54,7 @@ testSplitSourceballs() { ../cron-jobs/sourceballs for pkgbase in ${pkgs[@]}; do - [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${SRCEXT} ] && fail "source package not found!" + [ ! -r ${root_dir}/${SRCPOOL}/${pkgbase}-*${source_extension_suffixfile} ] && fail "source package not found!" done } @@ -77,8 +77,8 @@ testSourceballsCleanup() { done ../cron-jobs/sourceballs - [ -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!" + [ -r ${root_dir}/${SRCPOOL}/pkg-simple-a-*${source_extension_suffixfile} ] && fail "source package was not removed!" + [ ! -r ${root_dir}/${SRCPOOL}/pkg-simple-b-*${source_extension_suffixfile} ] && fail "source package not found!" } . "${curdir}/../lib/shunit2" diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh index eda6cd6..d0d08d5 100755 --- a/test/test.d/testing2x.sh +++ b/test/test.d/testing2x.sh @@ -7,7 +7,7 @@ testTesting2xAnyPackage() { releasePackage core pkg-any-a any ../db-update - pushd "${TMP}/svn-packages-copy/pkg-any-a/trunk/" >/dev/null + pushd "${temporary_directory}/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 |