summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorBertrand Jacquin <beber@meleeweb.net>2006-05-02 00:05:37 +0200
committerBertrand Jacquin <beber@meleeweb.net>2006-05-02 00:05:37 +0200
commitba6f22d9889a6efce30dd64738774e999ceeb520 (patch)
tree09488dd4913b4b388c90dea36517bb038e4a9a0c /eclass
parentadd a git git version (diff)
downloadportage-ba6f22d9889a6efce30dd64738774e999ceeb520.tar.xz
git.eclass: make it work better
Diffstat (limited to 'eclass')
-rw-r--r--eclass/git.eclass79
1 files changed, 29 insertions, 50 deletions
diff --git a/eclass/git.eclass b/eclass/git.eclass
index 31aa3f88..55146d30 100644
--- a/eclass/git.eclass
+++ b/eclass/git.eclass
@@ -2,20 +2,19 @@
# 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 modified version of the subversion eclass
+# This is a modified version of the git eclass
-## --------------------------------------------------------------------------- #
# Author: Ycarus <ycarus@zugaina.org>
+# Hacked by: Beber <beber@gna.org>
#
# The git eclass is written to fetch the software sources from
-# git repositories like the cvs eclass.
+# git repositories.
#
#
# Description:
# If you use this eclass, the ${S} is ${WORKDIR}/${P}.
# It is necessary to define the EGIT_REPO_URI variables at least.
#
-## --------------------------------------------------------------------------- #
inherit eutils
@@ -28,42 +27,28 @@ EXPORT_FUNCTIONS src_unpack
HOMEPAGE="http://kernel.org/pub/software/scm/git/"
DESCRIPTION="GIT eclass"
-
-## -- add cogito in DEPEND
-#
DEPEND="dev-util/cogito"
+# EGIT_TOP_DIR -- The directory under which GIT branches are checked out.
+[ -z "$EGIT_TOP_DIR" ] && EGIT_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/git-src"
-## -- EGIT_STORE_DIR: subversion sources store directory
-#
-EGIT_STORE_DIR="${DISTDIR}/git-src"
-
-
-## -- EGIT_FETCH_CMD: subversion fetch command
-#
-# default: git checkout
-#
-[ -z "${EGIT_FETCH_CMD}" ] && EGIT_FETCH_CMD="cg-clone"
-[ -z "${EGIT_UPDATE_CMD}" ] && EGIT_UPDATE_CMD="cg-update"
-
-
-## -- EGIT_REPO_URI: repository uri
-#
-[ -z "${EGIT_REPO_URI}" ] && EGIT_REPO_URI=""
+# EGIT_FETCH_CMD -- git fetch command
+[ -z "${EGIT_FETCH_CMD}" ] && EGIT_FETCH_CMD="cg-clone"
+[ -z "${EGIT_UPDATE_CMD}" ] && EGIT_UPDATE_CMD="cg-update"
+# EGIT_REPO_URI -- repository uri
+[ -z "${EGIT_REPO_URI}" ] && EGIT_REPO_URI=""
-## -- EGIT_PROJECT: project name of your ebuild
-#
-# git eclass will check out the subversion repository like:
+## -- EGIT_PROJECT: project name of your ebuild
#
-# ${EGIT_STORE_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/}
+# git eclass will check out the git repository like:
#
+# ${EGIT_TOP_DIR}/${EGIT_PROJECT}/${EGIT_REPO_URI##*/}
#
# default: ${PN/-git}.
#
[ -z "${EGIT_PROJECT}" ] && EGIT_PROJECT="${PN/-git}"
-
## -- git_fetch() ------------------------------------------------- #
function git_fetch() {
@@ -72,28 +57,29 @@ function git_fetch() {
EGIT_REPO_URI="${EGIT_REPO_URI} ${EGIT_PROJECT}"
# check for the protocol.
case ${EGIT_REPO_URI%%:*} in
- rsync) ;;
- http) ;;
- ssh) ;;
+ rsync) ;;
+ http) ;;
+ ssh) ;;
+ git+ssh) ;;
+ git) ;;
*)
die "${EGITN}: fetch from "${EGIT_REPO_URI%:*}" is not yet implemented."
;;
esac
- if [ ! -d "${EGIT_STORE_DIR}" ]; then
+ if [ ! -d "${EGIT_TOP_DIR}" ]; then
debug-print "${FUNCNAME}: initial checkout. creating git directory"
addwrite /
- mkdir -p "${EGIT_STORE_DIR}" || die "${EGIT}: can't mkdir ${EGIT_STORE_DIR}."
- chmod -f o+rw "${EGIT_STORE_DIR}" || die "${EGIT}: can't chmod ${EGIT_STORE_DIR}."
+ mkdir -p "${EGIT_TOP_DIR}" || die "${EGIT}: can't mkdir ${EGIT_TOP_DIR}."
+ chmod -f o+rw "${EGIT_TOP_DIR}" || die "${EGIT}: can't chmod ${EGIT_TOP_DIR}."
export SANDBOX_WRITE="${SANDBOX_WRITE%%:/}"
fi
- cd -P "${EGIT_STORE_DIR}" || die "${EGIT}: can't chdir to ${EGIT_STORE_DIR}"
- EGIT_STORE_DIR=${PWD}
+ cd -P "${EGIT_TOP_DIR}" || die "${EGIT}: can't chdir to ${EGIT_TOP_DIR}"
# every time
- addwrite "${EGIT_STORE_DIR}"
+ addwrite "${EGIT_TOP_DIR}"
[ -z "${EGIT_REPO_URI##*/}" ] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
EGIT_CO_DIR="${EGIT_PROJECT}/${EGIT_PROJECT}"
@@ -107,31 +93,24 @@ function git_fetch() {
cd "${EGIT_PROJECT}"
${EGIT_FETCH_CMD} ${EGIT_REPO_URI} || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}."
- einfo " checkouted in: ${EGIT_STORE_DIR}/${EGIT_CO_DIR}"
-
+ einfo " checkouted in: ${EGIT_TOP_DIR}/${EGIT_CO_DIR}"
else
# update working copy
einfo "git update start -->"
einfo " update from: ${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}"
-
+ einfo " updated in: ${EGIT_TOP_DIR}/${EGIT_CO_DIR}"
fi
# copy to the ${WORKDIR}
- cp -Rf "${EGIT_STORE_DIR}/${EGIT_CO_DIR}" "${S}" || die "${EGIT}: can't copy to ${S}."
+ cp -Rf "${EGIT_TOP_DIR}/${EGIT_CO_DIR}" "${S}" || die "${EGIT}: can't copy to ${S}."
einfo " copied to: ${S}"
echo
-
}
-## -- git_src_unpack() ------------------------------------------------ #
-
-function git_src_unpack() {
-
- if [ "${A}" != "" ]; then
- unpack ${A}
- fi
+function git_src_unpack()
+{
+ [ "${A}" != "" ] && unpack ${A}
git_fetch || die "${EGIT}: unknown problem in git_fetch()."
}