Contents of /trunk/pkgtools/regen_mage_tree_rsync-mcore.sh
Parent Directory | Revision Log
Revision 2017 -
(show annotations)
(download)
(as text)
Thu Jan 3 10:02:24 2013 UTC (11 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 4184 byte(s)
Thu Jan 3 10:02:24 2013 UTC (11 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 4184 byte(s)
-added more scripts
1 | #!/bin/bash |
2 | |
3 | minclude() |
4 | { |
5 | echo "error: minclude found in ${PKGNAME}" |
6 | } |
7 | |
8 | export -f minclude |
9 | |
10 | MY_SVN_REPO="/var/www/htdocs/magellan/mcore-dev" |
11 | MY_SVN_DEST="${MY_SVN_REPO}/rsync" |
12 | MY_SVN_MODULES="mcore/mage/trunk mcore/smage/trunk magellan-source/trunk/mage" |
13 | MY_SVN_OPTS="" |
14 | MY_SVN_ROOT="svn://cvs.magellan-linux.de/" |
15 | MY_SVN_REMOVE_MAGE_SOURCES=true |
16 | MY_TARBALL_VERSION_TAG="$(date +%Y%m%d-%k%M | sed 's:\ :0:')" |
17 | |
18 | MY_SVN_ARCHES="i486" |
19 | MY_SVN_DISTRIBUTIONS="stable testing unstable" |
20 | |
21 | # like mage.rc; needed only for smage2 |
22 | export ARCH=i486 |
23 | export PKGDIR="${MY_SVN_REPO}/unstable/packages/${ARCH}" |
24 | export SMAGESCRIPTSDIR="${MY_SVN_DEST}/smage" |
25 | export MAGE_TREE_DEST="${MY_SVN_DEST}/mage" |
26 | export REGEN_MAGE_TREE=true |
27 | |
28 | # setup a fake mage rc |
29 | MY_MAGE_RC=$(mktemp) |
30 | echo "ARCH=${ARCH}" > ${MY_MAGE_RC} |
31 | echo "PKGDIR=${PKGDIR}" >> ${MY_MAGE_RC} |
32 | echo "SMAGESCRIPTSDIR=${SMAGESCRIPTSDIR}" >> ${MY_MAGE_RC} |
33 | echo "MAGE_TREE_DEST=${MAGE_TREE_DEST}" >> ${MY_MAGE_RC} |
34 | echo "REGEN_MAGE_TREE=${REGEN_MAGE_TREE}" >> ${MY_MAGE_RC} |
35 | export MAGERC=${MY_MAGE_RC} |
36 | |
37 | # svn root |
38 | export SVNROOT="${MY_SVN_ROOT}" |
39 | |
40 | [ ! -d "${MY_SVN_DEST}" ] && install -d ${MY_SVN_DEST} |
41 | |
42 | # get rid of old cruft (fixes some rsync issues) |
43 | rm -rf ${MY_SVN_DEST}/* |
44 | |
45 | # get all our modules or update them |
46 | for module in ${MY_SVN_MODULES} |
47 | do |
48 | case ${module} in |
49 | mcore/mage/trunk) codir=mage;; |
50 | mcore/smage/trunk) codir=smage;; |
51 | magellan-source/*) codir=mage-src;; |
52 | esac |
53 | |
54 | if [ ! -d ${MY_SVN_DEST}/${module}/.svn ] |
55 | then |
56 | ( cd ${MY_SVN_DEST}; svn checkout ${MY_SVN_OPTS} ${SVNROOT}/${module} ${codir} ) |
57 | else |
58 | ( cd ${MY_SVN_DEST}; svn update ${MY_SVN_OPTS} ${SVNROOT}/${module} ${codir} ) |
59 | fi |
60 | done |
61 | |
62 | # delete CVS directories |
63 | for file in $(find ${MY_SVN_DEST} -type d -name .svn) |
64 | do |
65 | rm -rf ${file} |
66 | done |
67 | |
68 | # correct permissions |
69 | find ${MY_SVN_DEST} -type f -exec chmod 0644 '{}' ';' |
70 | find ${MY_SVN_DEST} -type d -exec chmod 0755 '{}' ';' |
71 | |
72 | # now regen mage tree |
73 | |
74 | if [ -f ${MY_SVN_DEST}/smage/.regenignore ] |
75 | then |
76 | export EXCLUDED="$(< ${MY_SVN_DEST}/smage/.regenignore )" |
77 | fi |
78 | |
79 | if [[ -n ${EXCLUDED} ]] |
80 | then |
81 | for i in ${EXCLUDED} |
82 | do |
83 | if [ -e "${MY_SVN_DEST}/smage/${i}" ] |
84 | then |
85 | rm -rf "${MY_SVN_DEST}/smage/${i}" |
86 | fi |
87 | done |
88 | fi |
89 | |
90 | # exec permissions |
91 | chmod a+x ${MY_SVN_DEST}/mage-src/usr/lib/mage/smage2.sh |
92 | |
93 | # shut up some warnings |
94 | [ ! -f /etc/mage.rc ] && touch /etc/mage.rc |
95 | [ ! -f /usr/lib/mage/version ] && { install -d /usr/lib/mage; touch /usr/lib/mage/version; } |
96 | |
97 | # fix includes |
98 | [[ ! -e ${MY_SVN_DEST}/smage/include ]] && ln -snf core/include ${MY_SVN_DEST}/smage/include |
99 | |
100 | for dist in ${MY_SVN_DISTRIBUTIONS} |
101 | do |
102 | for arch in ${MY_SVN_ARCHES} |
103 | do |
104 | export ARCH="${arch}" |
105 | export PKGDIR="${MY_SVN_REPO}/${dist}/packages/${ARCH}" |
106 | sed -i -e "s:\(ARCH=\).*:\1${ARCH}:" -e "s:\(PKGDIR=\).*:\1${PKGDIR}:" ${MY_MAGE_RC} |
107 | |
108 | for i in $(find ${MY_SVN_DEST}/smage -type f -name "*.smage2" | sort) |
109 | do |
110 | ${MY_SVN_DEST}/mage-src/usr/lib/mage/smage2.sh only-regen-tree "${i}" |
111 | done |
112 | done |
113 | done |
114 | |
115 | |
116 | # create tarballs |
117 | pushd ${MY_SVN_DEST} |
118 | for module in ${MY_SVN_MODULES} |
119 | do |
120 | case ${module} in |
121 | magellan-source/*) continue;; |
122 | esac |
123 | |
124 | fixed_module="${module/\/trunk/}" |
125 | fixed_module="${fixed_module/mcore\//}" |
126 | |
127 | tar cvjf ${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ./${fixed_module} |
128 | done |
129 | popd |
130 | |
131 | # remove mage sources |
132 | if [[ ${MY_SVN_REMOVE_MAGE_SOURCES} = true ]] |
133 | then |
134 | [ -d ${MY_SVN_DEST}/mage-src ] && rm -rf ${MY_SVN_DEST}/mage-src |
135 | [ -d ${MY_SVN_DEST}/mage-src-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ] && |
136 | rm -rf ${MY_SVN_DEST}/mage-src-"${MY_TARBALL_VERSION_TAG}".tar.bz2 |
137 | fi |
138 | |
139 | |
140 | # move tarballs to a proper location |
141 | install -d ${MY_SVN_DEST}/tarballs |
142 | for module in ${MY_SVN_MODULES} |
143 | do |
144 | fixed_module="${module/\/trunk/}" |
145 | fixed_module="${fixed_module/mcore\//}" |
146 | |
147 | if [ -f ${MY_SVN_DEST}/${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ] |
148 | then |
149 | [ -f ${MY_SVN_DEST}/${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ] && |
150 | mv ${MY_SVN_DEST}/${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ${MY_SVN_DEST}/tarballs |
151 | |
152 | # and symlink them |
153 | ln -snf ${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ${MY_SVN_DEST}/tarballs/${fixed_module}-latest.tar.bz2 |
154 | fi |
155 | done |
156 | |
157 | # delete fake mage.rc |
158 | if [[ -f ${MY_MAGE_RC} ]] |
159 | then |
160 | rm -f ${MY_MAGE_RC} |
161 | fi |
162 |