summaryrefslogtreecommitdiff
blob: d82479ce09f7461259aa90430ed421c7858cceb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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 ..."