diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-09-09 12:39:56 -0700 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-09-09 12:39:56 -0700 |
commit | e9d0581b173853e647b36caa170b7c4bbee43643 (patch) | |
tree | 81b51b81d427efa681a96dcd16118c2dea0955ad | |
parent | 178c720a4c2fd8adf20e6109784c39cc27dd6b30 (diff) |
Several fixes
-rwxr-xr-x | repo-restore-to-normal | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/repo-restore-to-normal b/repo-restore-to-normal index e46cfc9..9463731 100755 --- a/repo-restore-to-normal +++ b/repo-restore-to-normal @@ -4,9 +4,12 @@ . "$(dirname $0)/db-functions" . "$(dirname $0)/config" -# Find all pkgnames on old with pkgvers - on_repo=($(find ${CLEANUP_DESTDIR} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+-[^-]\+\)-[^-]\+-[^-]\+$/\1/")) +CLEANUP_DESTDIR=/home/parabolavnx/repo/pool/restore +PKGREPOS=(community) + +# Find all pkgnames on old with pkgver-pkgrels +#on_repo=($(find ${CLEANUP_DESTDIR} -name "*.pkg.tar.?z" -printf "%f\n" | \ +# sed "s/^\(.\+-[^-]\+-[^-]\+\)-[^-]\+$/\1/")) # Traverse all repos for _repo in ${PKGREPOS[@]}; do @@ -16,37 +19,38 @@ for _repo in ${PKGREPOS[@]}; do on_abs=($( find ${SVNREPO}/${_repo} -name PKGBUILD | \ while read pkgbuild; do + unset pkgname pkgver pkgrel source ${pkgbuild} >/dev/null 2>&1 # cleanup to save memory - unset build package source md5sums pkgdesc pkgrel epoch \ + unset build package source md5sums pkgdesc epoch \ url license arch depends makedepends optdepends options \ >/dev/null 2>&1 # also cleanup package functions for _pkg in ${pkgname[@]}; do unset package_${pkg} >/dev/null 2>&1 +# this fills the on_abs array + echo ${_pkg}-${pkgver}-${pkgrel} done -# this fills the on_abs array - echo ${pkgname[@]}-${pkgver} done )) # quit if abs is empty if [ ${#on_abs[*]} -eq 0 ]; then warning "[${_repo}]'s ABS tree is empty, skipping" - break + continue fi # Compares them, whatever is on abs should be restored - restore=($(comm -12 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) +# restore=($(comm -12 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ +# <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) msg2 "Restoring the following packages:" - plain "$(echo ${restore[@]} | tr ' ' "\n")" +# plain "$(echo ${restore[@]} | tr ' ' "\n")" - for _pkg in ${restore[@]}; do - find ${CLEANUP_DESTDIR} -name "${_pkg}*" -exec mv -v '{}' ${STAGING}/${_repo} + for _pkg in ${on_abs[@]}; do + find ${CLEANUP_DESTDIR} -name "${_pkg}*" -exec cp -v '{}' ${STAGING}/${_repo} \; done done |