summaryrefslogtreecommitdiff
path: root/repo-restore-to-normal
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-10-28 12:17:38 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-10-28 12:17:38 -0300
commit560d8b718c59acf36fb76b9766add53434c98b1d (patch)
tree21199c8102f85f5c1921653d16978b8c8e1591df /repo-restore-to-normal
parent9612e5d915faf63ea6d5a5ca5c3ff74cca8eb923 (diff)
parente9d0581b173853e647b36caa170b7c4bbee43643 (diff)
Merge branch 'master' of https://projects.parabolagnulinux.org/dbscripts
Conflicts: config
Diffstat (limited to 'repo-restore-to-normal')
-rwxr-xr-xrepo-restore-to-normal58
1 files changed, 58 insertions, 0 deletions
diff --git a/repo-restore-to-normal b/repo-restore-to-normal
new file mode 100755
index 0000000..9463731
--- /dev/null
+++ b/repo-restore-to-normal
@@ -0,0 +1,58 @@
+#!/bin/bash
+# Solves issue165
+
+. "$(dirname $0)/db-functions"
+. "$(dirname $0)/config"
+
+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
+ msg "Restoring [${_repo}]"
+
+# Find all pkgnames on this repo's abs
+ 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 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
+
+ done
+ ))
+
+# quit if abs is empty
+ if [ ${#on_abs[*]} -eq 0 ]; then
+ warning "[${_repo}]'s ABS tree is empty, skipping"
+ 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)))
+
+ msg2 "Restoring the following packages:"
+# plain "$(echo ${restore[@]} | tr ' ' "\n")"
+
+ for _pkg in ${on_abs[@]}; do
+ find ${CLEANUP_DESTDIR} -name "${_pkg}*" -exec cp -v '{}' ${STAGING}/${_repo} \;
+ done
+
+done
+
+exit $?