summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--versioncp/svnupdater96
1 files changed, 96 insertions, 0 deletions
diff --git a/versioncp/svnupdater b/versioncp/svnupdater
new file mode 100644
index 0000000..d82479c
--- /dev/null
+++ b/versioncp/svnupdater
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+overlayname="gentoo-php-overlay"
+listofpkgs="app-admin/php-toolkit app-doc/php-docs dev-db/freetds dev-lang/php dev-php dev-php4 dev-php5"
+listofeclasses="confutils.eclass depend.php.eclass php*.eclass"
+echo "Starting with ${overlayname} ..."
+
+cd /svnupdaters/${overlayname}/svnoverlay/portage/ && svn up
+
+for pkg in ${listofpkgs} ; do
+ mkdir -p /svnupdaters/${overlayname}/portage-new/${pkg}/
+ cp -Rf /usr/portage/${pkg}/* /svnupdaters/${overlayname}/portage-new/${pkg}/
+done
+
+for eclass in ${listofeclasses} ; do
+ mkdir -p /svnupdaters/${overlayname}/portage-new/eclass/
+ cp -Rf /usr/portage/eclass/${eclass} /svnupdaters/${overlayname}/portage-new/eclass/
+done
+
+find /svnupdaters/${overlayname}/svnoverlay/portage/ -type f -print > /svnupdaters/${overlayname}/old
+find /svnupdaters/${overlayname}/svnoverlay/portage/ -type d -print > /svnupdaters/${overlayname}/old-dirs
+find /svnupdaters/${overlayname}/portage-new/ -type f -print > /svnupdaters/${overlayname}/new
+find /svnupdaters/${overlayname}/portage-new/ -type d -print > /svnupdaters/${overlayname}/new-dirs
+
+sed -e "s|.*/.svn/.*||g" -i /svnupdaters/${overlayname}/old
+sed -e "s|.*/.svn.*||g" -i /svnupdaters/${overlayname}/old-dirs
+sed -e "s|^/svnupdaters/${overlayname}/svnoverlay/portage/||g" -i /svnupdaters/${overlayname}/old
+sed -e "s|^/svnupdaters/${overlayname}/svnoverlay/portage/||g" -i /svnupdaters/${overlayname}/old-dirs
+cat /svnupdaters/${overlayname}/old | sort | uniq > /svnupdaters/${overlayname}/old-fixed
+cat /svnupdaters/${overlayname}/old-dirs | sort | uniq > /svnupdaters/${overlayname}/old-fixed-dirs
+sed -e "s|^/svnupdaters/${overlayname}/portage-new/||g" -i /svnupdaters/${overlayname}/new
+sed -e "s|^/svnupdaters/${overlayname}/portage-new/||g" -i /svnupdaters/${overlayname}/new-dirs
+cat /svnupdaters/${overlayname}/new | sort | uniq > /svnupdaters/${overlayname}/new-fixed
+cat /svnupdaters/${overlayname}/new-dirs | sort | uniq > /svnupdaters/${overlayname}/new-fixed-dirs
+
+diff -au /svnupdaters/${overlayname}/old-fixed /svnupdaters/${overlayname}/new-fixed > /svnupdaters/${overlayname}/diff
+diff -au /svnupdaters/${overlayname}/old-fixed-dirs /svnupdaters/${overlayname}/new-fixed-dirs > /svnupdaters/${overlayname}/diff-dirs
+
+sed -e "s|^---.*||" -i /svnupdaters/${overlayname}/diff
+sed -e "s|^+++.*||" -i /svnupdaters/${overlayname}/diff
+sed -e "s|^---.*||" -i /svnupdaters/${overlayname}/diff-dirs
+sed -e "s|^+++.*||" -i /svnupdaters/${overlayname}/diff-dirs
+
+grep -i "^-" /svnupdaters/${overlayname}/diff > /svnupdaters/${overlayname}/pkgdel
+grep -i "^+" /svnupdaters/${overlayname}/diff > /svnupdaters/${overlayname}/pkgadd
+grep -i "^-" /svnupdaters/${overlayname}/diff-dirs > /svnupdaters/${overlayname}/pkgdel-dirs
+grep -i "^+" /svnupdaters/${overlayname}/diff-dirs > /svnupdaters/${overlayname}/pkgadd-dirs
+
+sed -e "s|^-||g" -i /svnupdaters/${overlayname}/pkgdel
+sed -e '/^$/d' -i /svnupdaters/${overlayname}/pkgdel
+sed -e "s|^+||g" -i /svnupdaters/${overlayname}/pkgadd
+sed -e '/^$/d' -i /svnupdaters/${overlayname}/pkgadd
+sed -e "s|^-||g" -i /svnupdaters/${overlayname}/pkgdel-dirs
+sed -e '/^$/d' -i /svnupdaters/${overlayname}/pkgdel-dirs
+sed -e "s|^+||g" -i /svnupdaters/${overlayname}/pkgadd-dirs
+sed -e '/^$/d' -i /svnupdaters/${overlayname}/pkgadd-dirs
+
+cp -Rf /svnupdaters/${overlayname}/portage-new/* /svnupdaters/${overlayname}/svnoverlay/portage/
+
+cd /svnupdaters/${overlayname}/svnoverlay/portage/
+
+while read line ; do
+ svn del ${line}
+done < /svnupdaters/${overlayname}/pkgdel
+
+while read line ; do
+ svn del ${line}
+done < /svnupdaters/${overlayname}/pkgdel-dirs
+
+while read line ; do
+ svn add ${line}
+done < /svnupdaters/${overlayname}/pkgadd-dirs
+
+while read line ; do
+ svn add ${line}
+done < /svnupdaters/${overlayname}/pkgadd
+
+svn commit -m 'Automatic SVN update of portage/ branch.'
+
+rm -f /svnupdaters/${overlayname}/old
+rm -f /svnupdaters/${overlayname}/old-fixed
+rm -f /svnupdaters/${overlayname}/new
+rm -f /svnupdaters/${overlayname}/new-fixed
+rm -f /svnupdaters/${overlayname}/diff
+rm -f /svnupdaters/${overlayname}/pkgdel
+rm -f /svnupdaters/${overlayname}/pkgadd
+rm -f /svnupdaters/${overlayname}/old-dirs
+rm -f /svnupdaters/${overlayname}/old-fixed-dirs
+rm -f /svnupdaters/${overlayname}/new-dirs
+rm -f /svnupdaters/${overlayname}/new-fixed-dirs
+rm -f /svnupdaters/${overlayname}/diff-dirs
+rm -f /svnupdaters/${overlayname}/pkgdel-dirs
+rm -f /svnupdaters/${overlayname}/pkgadd-dirs
+rm -Rf /svnupdaters/${overlayname}/portage-new/*
+
+echo "Run completed ..."