diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-01-31 21:15:22 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-27 15:46:04 +0200 |
commit | 7ef0b1acd5549f94ac2e57b6ca28343bbdbd96ff (patch) | |
tree | 7ec7260395d88cc18ec735a8476e69e0a9d8479d | |
parent | 48177ff85854baaf184ebc1c9d46def6398b64d8 (diff) | |
download | dbscripts-7ef0b1acd5549f94ac2e57b6ca28343bbdbd96ff.tar.gz dbscripts-7ef0b1acd5549f94ac2e57b6ca28343bbdbd96ff.tar.xz |
cleanup
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | db-add | 2 | ||||
-rw-r--r-- | db-functions | 37 | ||||
-rwxr-xr-x | db-move | 3 | ||||
-rwxr-xr-x | db-update | 4 |
4 files changed, 22 insertions, 24 deletions
@@ -32,7 +32,7 @@ for pkgfile in ${pkgfiles[@]}; do if [[ -f "$pkgfile" ]]; then arch_add_to_pool "$pkgfile" fi - arch_db_add $repo "$pkgfile" ${tarches[@]} + arch_db_add $repo ${tarches[@]} "$pkgfile" done arch_history_commit "db-add: ${tarches[@]}: ${pkgfiles[@]}" diff --git a/db-functions b/db-functions index 4c22bd8..a8595aa 100644 --- a/db-functions +++ b/db-functions @@ -519,27 +519,24 @@ arch_add_to_pool() { # call arch_add_to_pool first arch_db_add() { local repo="$1" - local pkgfile="${2##*/}" - local tarches=(${@:3}) + local tarch="$2" + local pkgfile="${3##*/}" + local srcfile="$FTP_BASE/${PKGPOOL}/${pkgfile}" + local dstdir="$FTP_BASE/$repo/os/$tarch" - for tarch in ${tarches[@]}; do - local srcfile="$FTP_BASE/${PKGPOOL}/${pkgfile}" - local dstdir="$FTP_BASE/$repo/os/$tarch" - - if [[ ! -f "${srcfile}" ]]; then - die "Package file ${pkgfile} not found in ${FTP_BASE}/${PKGPOOL}" - else - msg "Adding $pkgfile to [$repo]-$tarch..." - fi + if [[ ! -f "${srcfile}" ]]; then + die "Package file ${pkgfile} not found in ${FTP_BASE}/${PKGPOOL}" + else + msg "Adding $pkgfile to [$repo]-$tarch..." + fi - ln -sr "$srcfile" "$dstdir/" - if [ -f "${srcfile}.sig" ]; then - ln -sr "${srcfile}.sig" "$dstdir/" - fi + ln -sr "$srcfile" "$dstdir/" + if [ -f "${srcfile}.sig" ]; then + ln -sr "${srcfile}.sig" "$dstdir/" + fi - arch_repo_add "${repo}" "${tarch}" ${pkgfile} - arch_history_add "$repo" "$dstdir/$pkgfile" "$tarch" - done + arch_repo_add "${repo}" "${tarch}" ${pkgfile} + arch_history_add "$repo" "$dstdir/$pkgfile" "$tarch" } arch_db_remove() { @@ -557,7 +554,7 @@ arch_db_remove() { arch_history_add() { local repo="$1" local pkgfile="$2" - local tarches="$3" + local tarch="$3" local pkgname=$(getpkgname "$pkgfile") local pkgbase=$(getpkgbase "$pkgfile") local pkgver=$(getpkgver "$pkgfile") @@ -573,7 +570,7 @@ arch_history_add() { arch_history_remove() { local repo="$1" local pkgname="$2" - local tarches="$3" + local tarch="$3" local history_file="$GITREPO/$repo/$tarch/$pkgname" @@ -30,8 +30,7 @@ msg "Moving packages from [${repo_from}] to [${repo_to}]..." for pkg in "${pkgs[@]}"; do pkgname=$(getpkgname "$FTP_BASE/$PKGPOOL/$pkg") - # TODO: interfaces for db_add and db_remove need some work - arch_db_add "${repo_to}" "$pkg" "$arch" + arch_db_add "${repo_to}" "$arch" "$pkg" arch_db_remove "${repo_from}" "$arch" "$pkgname" done @@ -58,16 +58,18 @@ for repo in ${repos[@]}; do done for repo in ${repos[@]}; do + declare -a pkgs_to_add=() for pkgfile in $(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT} 2>/dev/null); do arch_add_to_pool "$pkgfile" for pkgarch in ${ARCHES[@]}; do pkgfile_arch="$STAGING/$repo/$pkgarch/${pkgfile##*/}" if [[ -h "$pkgfile_arch" ]]; then - arch_db_add $repo "${pkgfile##*/}" $pkgarch + pkgs_to_add=("${pkgs_to_add[@]}" "${pkgfile##*/}") rm "$pkgfile_arch" fi done done + arch_db_add $repo "$pkgarch" "${pkgs_to_add[@]}" done arch_history_commit "db-update: ${repos[@]}" |