Magellan Linux

Contents of /trunk/pkgtools/regen_mage_tree_rsync-R11-unstable-only.sh

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *