diff options
author | Akinori Hattori <hattya@gentoo.org> | 2004-04-05 14:25:28 +0000 |
---|---|---|
committer | Akinori Hattori <hattya@gentoo.org> | 2004-04-05 14:25:28 +0000 |
commit | 73fe7437150696c2edff91263e209fc8d86c7c3f (patch) | |
tree | a1c1a8cad4ebd67742d06f42aa8febaec52655e3 /eclass/subversion.eclass | |
parent | Marked stable on hppa. (Manifest recommit) (diff) | |
download | gentoo-2-73fe7437150696c2edff91263e209fc8d86c7c3f.tar.gz gentoo-2-73fe7437150696c2edff91263e209fc8d86c7c3f.tar.bz2 gentoo-2-73fe7437150696c2edff91263e209fc8d86c7c3f.zip |
update
Diffstat (limited to 'eclass/subversion.eclass')
-rw-r--r-- | eclass/subversion.eclass | 104 |
1 files changed, 76 insertions, 28 deletions
diff --git a/eclass/subversion.eclass b/eclass/subversion.eclass index 34b131ea078f..9701a3782696 100644 --- a/eclass/subversion.eclass +++ b/eclass/subversion.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.7 2004/03/01 16:37:31 hattya Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.8 2004/04/05 14:25:28 hattya Exp $ ## --------------------------------------------------------------------------- # # Author: Akinori Hattori <hattya@gentoo.org> @@ -15,9 +15,11 @@ # ## --------------------------------------------------------------------------- # +inherit eutils ECLASS="subversion" INHERITED="${INHERITED} ${ECLASS}" +ESVN="subversion.eclass" EXPORT_FUNCTIONS src_unpack @@ -75,24 +77,38 @@ ESVN_STORE_DIR="${DISTDIR}/svn-src" ## -- ESVN_BOOTSTRAP: # -# bootstrap script. like autogen.sh or etc.. +# bootstrap script or command like autogen.sh or etc.. # [ -z "${ESVN_BOOTSTRAP}" ] && ESVN_BOOTSTRAP="" +## -- ESVN_PATCHES: +# +# subversion eclass can apply pathces in subversion_bootstrap(). +# you can use regexp in this valiable like *.diff or *.patch or etc. +# NOTE: this patches will apply before eval ESVN_BOOTSTRAP. +# +# the process of applying the patch is: +# 1. just epatch it, if the patch exists in the path. +# 2. scan it under FILESDIR and epatch it, if the patch exists in FILESDIR. +# 3. die. +# +[ -z "${ESVN_PATCHES}" ] && ESVN_PATCHES="" + + ## -- subversion_svn_fetch() ------------------------------------------------- # subversion_svn_fetch() { # ESVN_REPO_URI is empty. - [ -z "${ESVN_REPO_URI}" ] && die "subversion.eclass: ESVN_REPO_URI is empty." + [ -z "${ESVN_REPO_URI}" ] && die "${ESVN}: ESVN_REPO_URI is empty." # http and https only... case ${ESVN_REPO_URI%%:*} in http) ;; https) ;; *) - die "subversion.eclass: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." + die "${ESVN}: fetch from "${ESVN_REPO_URI%:*}" is not yet implemented." ;; esac @@ -101,11 +117,11 @@ subversion_svn_fetch() { addwrite "/etc/subversion" # -userpriv - addwrite "/root/.subversion" + ! has userpriv ${FEATURE} && addwrite "/root/.subversion" if [ ! -d "${ESVN_STORE_DIR}" ]; then - mkdir -p "${ESVN_STORE_DIR}" || die "subversion.eclass: can't mkdir ${ESVN_STORE_DIR}." - chmod -f o+rw "${ESVN_STORE_DIR}" || die "subversion.eclass: can't chmod ${ESVN_STORE_DIR}." + mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}." + chmod -f o+rw "${ESVN_STORE_DIR}" || die "${ESVN}: can't chmod ${ESVN_STORE_DIR}." einfo "created store directory: ${ESVN_STORE_DIR}" einfo fi @@ -123,32 +139,38 @@ subversion_svn_fetch() { if [ ! -d "${ESVN_CO_DIR}/.svn" ]; then # first check out einfo "subversion check out start -->" - einfo - einfo "check out from: ${ESVN_REPO_URI}" + einfo " checkout from: ${ESVN_REPO_URI}" - mkdir -p "${ESVN_PROJECT}" || die "subversion.eclass: can't mkdir ${ESVN_PROJECT}." - chmod -f o+rw "${ESVN_PROJECT}" || die "subversion.eclass: can't chmod ${ESVN_PROJECT}." + mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}." + chmod -f o+rw "${ESVN_PROJECT}" || die "${ESVN}: can't chmod ${ESVN_PROJECT}." cd "${ESVN_PROJECT}" - ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "subversion.eclass: can't fetch from ${ESVN_REPO_URI}." - einfo " stored in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" + ${ESVN_FETCH_CMD} "${ESVN_REPO_URI}" || die "${ESVN}: can't fetch from ${ESVN_REPO_URI}." + einfo " checkouted in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" else # update working copy einfo "subversion update start -->" - einfo einfo " update from: ${ESVN_REPO_URI}" - cd "${ESVN_CO_DIR}" - ${ESVN_UPDATE_CMD} || die "subversion.eclass: can't update from ${ESVN_REPO_URI}." + + local NOW=$(date +%s) UPDATE=$(date -r .svn/entries +%s) INTERVAL=3600 + if expr ${NOW} - ${UPDATE} \> ${INTERVAL} >/dev/null; then + ${ESVN_UPDATE_CMD} || die "${ESVN}: can't update from ${ESVN_REPO_URI}." + else + echo "Skip updating..." + fi + einfo " updated in: ${ESVN_STORE_DIR}/${ESVN_CO_DIR}" + fi - # permission fix - chmod -Rf o+rw . 2>/dev/null + # permission fix for NFS (root_squash) with -userpriv + find ! -perm -o+rw -exec chmod o+rw {} \; 2>/dev/null # copy to the ${WORKDIR} - cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${WORKDIR}/${P}" || die "subversion.eclass: can't copy to ${WORKDIR}/${P}." - einfo + cp -Rf "${ESVN_STORE_DIR}/${ESVN_CO_DIR}" "${S}" || die "${ESVN}: can't copy to ${S}." + einfo " copied to: ${S}" + echo } @@ -157,14 +179,40 @@ subversion_svn_fetch() { subversion_bootstrap() { - if [ -n "${ESVN_BOOTSTRAP}" ]; then - cd "${WORKDIR}/${P}" + cd "${S}" - if [ -x "${ESVN_BOOTSTRAP}" ]; then - einfo "begin bootstrap -->" - ./${ESVN_BOOTSTRAP} || die "subversion.eclass: can't bootstrap with ${ESVN_BOOTSTRAP}." - fi + if [ "${ESVN_PATCHES}" ]; then + einfo "apply paches -->" + for PATCH in ${ESVN_PATCHES}; do + if [ -f "${PATCH}" ]; then + epatch ${PATCH} + + else + for fPATCH in ${FILESDIR}/${PATCH}; do + if [ -f "${fPATCH}" ]; then + epatch ${fPATCH} + + else + die "${ESVN}; ${PATCH} is not found" + fi + done + fi + done + echo + fi + + if [ "${ESVN_BOOTSTRAP}" ]; then + einfo "begin bootstrap -->" + if [ -f "${ESVN_BOOTSTRAP}" -a -x "${ESVN_BOOTSTRAP}" ]; then + einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}" + eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP." + + else + einfo " bootstrap with command: ESVN_BOOTSTRAP" + eval "${ESVN_BOOTSTRAP}" || die "${ESVN}: can't eval ESVN_BOOTSTRAP." + + fi fi } @@ -174,7 +222,7 @@ subversion_bootstrap() { subversion_src_unpack() { - subversion_svn_fetch || die "subversion.eclass: unknown problem in subversion_svn_fetch()." - subversion_bootstrap || die "subversion.eclass: unknown problem in subversion_bootstrap()." + subversion_svn_fetch || die "${ESVN}: unknown problem in subversion_svn_fetch()." + subversion_bootstrap || die "${ESVN}: unknown problem in subversion_bootstrap()." } |