#!/bin/bash minclude() { echo "error: minclude found in ${PKGNAME}" } export -f minclude MY_SVN_BRANCH="branches/alx-0_6_0" MY_SVN_REPO="/var/www/htdocs/magellan/alx-0.6.0" MY_SVN_DEST="${MY_SVN_REPO}/rsync" MY_SVN_MODULES="alx/mage/${MY_SVN_BRANCH} alx/smage/${MY_SVN_BRANCH} magellan-source/tags/mage-0_4_29" MY_SVN_OPTS="" MY_SVN_ROOT="svn://cvs.magellan-linux.de/" MY_SVN_REMOVE_MAGE_SOURCES=true MY_TARBALL_VERSION_TAG="$(date +%Y%m%d-%k%M | sed 's:\ :0:')" MY_SVN_ARCHES="i486" MY_SVN_DISTRIBUTIONS="stable testing unstable" # like mage.rc; needed only for smage2 export ARCH=i486 export PKGDIR="${MY_SVN_REPO}/unstable/packages/${ARCH}" export SMAGESCRIPTSDIR="${MY_SVN_DEST}/smage" export MAGE_TREE_DEST="${MY_SVN_DEST}/mage" export REGEN_MAGE_TREE=true # setup a fake mage rc MY_MAGE_RC=$(mktemp) echo "ARCH=${ARCH}" > ${MY_MAGE_RC} echo "PKGDIR=${PKGDIR}" >> ${MY_MAGE_RC} echo "SMAGESCRIPTSDIR=${SMAGESCRIPTSDIR}" >> ${MY_MAGE_RC} echo "MAGE_TREE_DEST=${MAGE_TREE_DEST}" >> ${MY_MAGE_RC} echo "REGEN_MAGE_TREE=${REGEN_MAGE_TREE}" >> ${MY_MAGE_RC} export MAGERC=${MY_MAGE_RC} # svn root export SVNROOT="${MY_SVN_ROOT}" [ ! -d "${MY_SVN_DEST}" ] && install -d ${MY_SVN_DEST} # get rid of old cruft (fixes some rsync issues) rm -rf ${MY_SVN_DEST}/* # get all our modules or update them for module in ${MY_SVN_MODULES} do case ${module} in */mage/*) codir=mage;; */smage/*) codir=smage;; magellan-source/*) codir=mage-src;; esac if [ ! -d ${MY_SVN_DEST}/${module}/.svn ] then ( cd ${MY_SVN_DEST}; svn checkout ${MY_SVN_OPTS} ${SVNROOT}/${module} ${codir} ) else ( cd ${MY_SVN_DEST}; svn update ${MY_SVN_OPTS} ${SVNROOT}/${module} ${codir} ) fi done # delete CVS directories for file in $(find ${MY_SVN_DEST} -type d -name .svn) do rm -rf ${file} done # correct permissions find ${MY_SVN_DEST} -type f -exec chmod 0644 '{}' ';' find ${MY_SVN_DEST} -type d -exec chmod 0755 '{}' ';' # now regen mage tree if [ -f ${MY_SVN_DEST}/smage/.regenignore ] then export EXCLUDED="$(< ${MY_SVN_DEST}/smage/.regenignore )" fi if [[ -n ${EXCLUDED} ]] then for i in ${EXCLUDED} do if [ -e "${MY_SVN_DEST}/smage/${i}" ] then rm -rf "${MY_SVN_DEST}/smage/${i}" fi done fi # exec permissions chmod a+x ${MY_SVN_DEST}/mage-src/usr/lib/mage/smage2.sh # shut up some warnings [ ! -f /etc/mage.rc ] && touch /etc/mage.rc [ ! -f /usr/lib/mage/version ] && { install -d /usr/lib/mage; touch /usr/lib/mage/version; } # fix includes [[ ! -e ${MY_SVN_DEST}/smage/include ]] && ln -snf core/include ${MY_SVN_DEST}/smage/include for dist in ${MY_SVN_DISTRIBUTIONS} do for arch in ${MY_SVN_ARCHES} do export ARCH="${arch}" export PKGDIR="${MY_SVN_REPO}/${dist}/packages/${ARCH}" sed -i -e "s:\(ARCH=\).*:\1${ARCH}:" -e "s:\(PKGDIR=\).*:\1${PKGDIR}:" ${MY_MAGE_RC} for i in $(find ${MY_SVN_DEST}/smage -type f -name "*.smage2" | sort) do ${MY_SVN_DEST}/mage-src/usr/lib/mage/smage2.sh only-regen-tree "${i}" done done done # create tarballs pushd ${MY_SVN_DEST} for module in ${MY_SVN_MODULES} do case ${module} in magellan-source/*) continue;; */mage/*) fixed_module=mage;; */smage/*) fixed_module=smage;; esac tar cvjf ${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ./${fixed_module} done popd # remove mage sources if [[ ${MY_SVN_REMOVE_MAGE_SOURCES} = true ]] then [ -d ${MY_SVN_DEST}/mage-src ] && rm -rf ${MY_SVN_DEST}/mage-src [ -d ${MY_SVN_DEST}/mage-src-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ] && rm -rf ${MY_SVN_DEST}/mage-src-"${MY_TARBALL_VERSION_TAG}".tar.bz2 fi # move tarballs to a proper location install -d ${MY_SVN_DEST}/tarballs for module in ${MY_SVN_MODULES} do case ${module} in magellan-source/*) continue;; */mage/*) fixed_module=mage;; */smage/*) fixed_module=smage;; esac if [ -f ${MY_SVN_DEST}/${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ] then [ -f ${MY_SVN_DEST}/${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ] && mv ${MY_SVN_DEST}/${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ${MY_SVN_DEST}/tarballs # and symlink them ln -snf ${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 ${MY_SVN_DEST}/tarballs/${fixed_module}-latest.tar.bz2 # and generate md5 sum for each pushd ${MY_SVN_DEST}/tarballs md5sum ${fixed_module}-"${MY_TARBALL_VERSION_TAG}".tar.bz2 > ${fixed_module}-"${MY_TARBALL_VERSION_TAG}".md5 md5sum ${fixed_module}-latest.tar.bz2 > ${fixed_module}-latest.md5 popd fi done # delete fake mage.rc if [[ -f ${MY_MAGE_RC} ]] then rm -f ${MY_MAGE_RC} fi