diff options
author | Donnie Berkholz <donnie@comet.(none)> | 2006-05-12 02:02:11 -0700 |
---|---|---|
committer | Donnie Berkholz <donnie@comet.(none)> | 2006-05-12 02:02:11 -0700 |
commit | 3592191755213d293887b0fe034ae5c795d38a03 (patch) | |
tree | a597473334d94856c99e68365aab1baf3ee5a5e9 /eclass | |
parent | Merged to gentoo-x86 CVS. (diff) | |
download | dberkholz-3592191755213d293887b0fe034ae5c795d38a03.tar.gz dberkholz-3592191755213d293887b0fe034ae5c795d38a03.tar.bz2 dberkholz-3592191755213d293887b0fe034ae5c795d38a03.zip |
Rewrite eclass from scratch, based on subversion.eclass, to clear up concerns
about copyright for inclusion into gentoo-x86 CVS.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/git.eclass | 160 |
1 files changed, 123 insertions, 37 deletions
diff --git a/eclass/git.eclass b/eclass/git.eclass index 5465b6f..e4ebefc 100644 --- a/eclass/git.eclass +++ b/eclass/git.eclass @@ -1,38 +1,29 @@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ -# Nonofficial eclass by Ycarus. For new version look here : http://gentoo.zugaina.org/ -# This is a highly modified version of the subversion eclass ## --------------------------------------------------------------------------- # -# Author: Ycarus <ycarus@zugaina.org> -# +# subversion.eclass author: Akinori Hattori <hattya@gentoo.org> +# modified for git by Donnie Berkholz <spyderous@gentoo.org> +# # The git eclass is written to fetch the software sources from -# git repositories like the cvs eclass. +# git repositories like the subversion eclass. # # # Description: # If you use this eclass, the ${S} is ${WORKDIR}/${P}. -# It is necessary to define the EGIT_REPO_URI variables at least. -# -# git.eclass v1.2 (2006/04/08) -# -# Changelog (since v1.1) : -# - Only use git now, no more cogito -# - Update work now... +# It is necessary to define the EGIT_REPO_URI variable at least. # ## --------------------------------------------------------------------------- # inherit eutils -ECLASS="git" -INHERITED="${INHERITED} ${ECLASS}" EGIT="git.eclass" EXPORT_FUNCTIONS src_unpack HOMEPAGE="http://kernel.org/pub/software/scm/git/" -DESCRIPTION="GIT eclass" +DESCRIPTION="Based on the ${ECLASS} eclass" ## -- add git in DEPEND @@ -47,14 +38,32 @@ EGIT_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src" ## -- EGIT_FETCH_CMD: git fetch command # -# default: git pull +EGIT_FETCH_CMD="git-clone" + +## -- EGIT_UPDATE_CMD: git update command +# +EGIT_UPDATE_CMD="git-pull" + + +## -- EGIT_OPTIONS: +# +# the options passed to checkout or update. # -[ -z "${EGIT_FETCH_CMD}" ] && EGIT_FETCH_CMD="git clone" -[ -z "${EGIT_UPDATE_CMD}" ] && EGIT_UPDATE_CMD="git pull" +[ -z "${EGIT_OPTIONS}" ] && EGIT_OPTIONS= ## -- EGIT_REPO_URI: repository uri # +# e.g. http://foo, git://bar +# +# supported protocols: +# http:// +# https:// +# git:// +# git+ssh:// +# rsync:// +# ssh:// +# [ -z "${EGIT_REPO_URI}" ] && EGIT_REPO_URI="" @@ -64,24 +73,51 @@ EGIT_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src" # # ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/} # +# so if you define EGIT_REPO_URI as http://git.collab.net/repo/git or +# http://git.collab.net/repo/git. and PN is subversion-git. +# it will check out like: +# +# ${EGIT_STORE_DIR}/subversion # # default: ${PN/-git}. # [ -z "${EGIT_PROJECT}" ] && EGIT_PROJECT="${PN/-git}" +## -- EGIT_BOOTSTRAP: +# +# bootstrap script or command like autogen.sh or etc.. +# +[ -z "${EGIT_BOOTSTRAP}" ] && EGIT_BOOTSTRAP="" + + +## -- EGIT_PATCHES: +# +# git eclass can apply pathces in git_bootstrap(). +# you can use regexp in this valiable like *.diff or *.patch or etc. +# NOTE: this patches will apply before eval EGIT_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 "${EGIT_PATCHES}" ] && EGIT_PATCHES="" + + ## -- git_fetch() ------------------------------------------------- # function git_fetch() { + + local EGIT_CO_DIR + # EGIT_REPO_URI is empty. [ -z "${EGIT_REPO_URI}" ] && die "${EGIT}: EGIT_REPO_URI is empty." - EGIT_REPO_URI="${EGIT_REPO_URI}" + # check for the protocol. case ${EGIT_REPO_URI%%:*} in - rsync) ;; - ssh) ;; - http) ;; - git) ;; + git|git+ssh|http|https|rsync|ssh) + ;; *) die "${EGIT}: fetch from "${EGIT_REPO_URI%:*}" is not yet implemented." ;; @@ -103,39 +139,89 @@ function git_fetch() { [ -z "${EGIT_REPO_URI##*/}" ] && EGIT_REPO_URI="${EGIT_REPO_URI%/}" EGIT_CO_DIR="${EGIT_PROJECT}" + + debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\"" + if [ ! -d "${EGIT_CO_DIR}/.git" ]; then # first check out einfo "git check out start -->" - einfo " checkout from: ${EGIT_REPO_URI}" - ${EGIT_FETCH_CMD} ${EGIT_REPO_URI} ${EGIT_PROJECT} || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}." + einfo " repository: ${EGIT_REPO_URI}" - einfo " checked out in: ${EGIT_STORE_DIR}/${EGIT_CO_DIR}" + ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${EGIT_PROJECT} || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}." else # update working copy einfo "git update start -->" - einfo " update from: ${EGIT_REPO_URI}" + einfo " repository: ${EGIT_REPO_URI}" + cd "${EGIT_CO_DIR}" - ${EGIT_UPDATE_CMD} || die "${EGIT}: can't update from ${EGIT_REPO_URI}." - einfo " updated in: ${EGIT_STORE_DIR}/${EGIT_CO_DIR}" + ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} || die "${EGIT}: can't update from ${EGIT_REPO_URI}." fi - # copy to the ${WORKDIR} - cp -Rf "${EGIT_STORE_DIR}/${EGIT_CO_DIR}" "${S}" || die "${EGIT}: can't copy to ${S}." - einfo " copied to: ${S}" + einfo " working copy: ${EGIT_STORE_DIR}/${EGIT_CO_DIR}" + + # export to the ${WORKDIR} + # "git export" has a bug. see http://bugs.gentoo.org/119236 + #git export "${EGIT_STORE_DIR}/${EGIT_CO_DIR}" "${S}" || die "${EGIT}: can't export to ${S}." + rsync -a --exclude=".git/" "${EGIT_STORE_DIR}/${EGIT_CO_DIR}/" "${S}" || die "${EGIT}: can't export to ${S}." echo } + +## -- git_bootstrap() ------------------------------------------------ # + +function git_bootstrap() { + + local patch lpatch + + cd "${S}" + + if [ "${EGIT_PATCHES}" ]; then + einfo "apply patches -->" + + for patch in ${EGIT_PATCHES}; do + if [ -f "${patch}" ]; then + epatch ${patch} + + else + for lpatch in ${FILESDIR}/${patch}; do + if [ -f "${lpatch}" ]; then + epatch ${lpatch} + + else + die "${EGIT}; ${patch} is not found" + + fi + done + fi + done + echo + fi + + if [ "${EGIT_BOOTSTRAP}" ]; then + einfo "begin bootstrap -->" + + if [ -f "${EGIT_BOOTSTRAP}" -a -x "${EGIT_BOOTSTRAP}" ]; then + einfo " bootstrap with a file: ${EGIT_BOOTSTRAP}" + eval "./${EGIT_BOOTSTRAP}" || die "${EGIT}: can't execute EGIT_BOOTSTRAP." + + else + einfo " bootstrap with commands: ${EGIT_BOOTSTRAP}" + eval "${EGIT_BOOTSTRAP}" || die "${EGIT}: can't eval EGIT_BOOTSTRAP." + + fi + fi + +} + + ## -- git_src_unpack() ------------------------------------------------ # function git_src_unpack() { - if [ "${A}" != "" ]; then - unpack ${A} - fi git_fetch || die "${EGIT}: unknown problem in git_fetch()." + git_bootstrap || die "${EGIT}: unknown problem in git_bootstrap()." - cd ${S} } |