* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-04-20 10:56 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-04-20 10:56 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/04/20 10:56:27
Added: git-2.eclass
Log:
Introduce git-2 eclass
This is next-gen eclass for git using live ebuilds.
Complete usage is documented in eclassdoc.
Note that for migration some variables have different names so
the ebuilds should be doublechecked that nothing will break.
Also this eclass define just one phase src_unpack, so no git-2_src_prepare.
Revision Changes Path
1.1 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.1&content-type=text/plain
Index: git-2.eclass
===================================================================
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.1 2011/04/20 10:56:27 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
# Tomas Chvatal <scarabeus@gentoo.org>
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
# Eclass for easing maitenance of live ebuilds using git as remote repository.
# Eclass support working with git submodules and branching.
# This eclass support all EAPIs
EXPORT_FUNCTIONS src_unpack
DEPEND="dev-vcs/git"
# @ECLASS-VARIABLE: EGIT_SOURCEDIR
# @DESCRIPTION:
# This variable specifies destination where the cloned
# data are copied to.
#
# EGIT_SOURCEDIR="${S}"
# @ECLASS-VARIABLE: EGIT_STORE_DIR
# @DESCRIPTION:
# Storage directory for git sources.
#
# EGIT_STORE_DIR="${DISTDIR}/egit-src"
# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty this variable enables support for git submodules in our
# checkout. Also this makes the checkout to be non-bare for now.
# @ECLASS-VARIABLE: EGIT_OPTIONS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Variable specifying additional options for fetch command.
# @ECLASS-VARIABLE: EGIT_MASTER
# @DESCRIPTION:
# Variable for specifying master branch.
# Usefull when upstream don't have master branch or name it differently.
#
# EGIT_MASTER="master"
# @ECLASS-VARIABLE: EGIT_DIR
# @DESCRIPTION:
# Directory where we want to store the git data.
# This should not be overriden unless really required.
#
# EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_REPO_URI##*/}"
# @ECLASS-VARIABLE: EGIT_REPO_URI
# @REQUIRED
# @DEFAULT_UNSET
# @DESCRIPTION:
# URI for the repository
# e.g. http://foo, git://bar
#
# Support multiple values:
# EGIT_REPO_URI="git://a/b.git http://c/d.git"
# @ECLASS-VARIABLE: EVCS_OFFLINE
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty this variable prevents performance of any online
# operations.
# @ECLASS-VARIABLE: EGIT_BRANCH
# @DESCRIPTION:
# Variable containing branch name we want to check out.
# It can be overriden via env using packagename_LIVE_BRANCH
# variable.
#
# EGIT_BRANCH="${EGIT_MASTER}"
# @ECLASS-VARIABLE: EGIT_COMMIT
# @DESCRIPTION:
# Variable containing commit hash/tag we want to check out.
# It can be overriden via env using packagename_LIVE_COMMIT
# variable.
#
# EGIT_BRANCH="${EGIT_BRANCH}"
# @ECLASS-VARIABLE: EGIT_REPACK
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty this variable specifies that repository will be repacked to
# save space. However this can take a REALLY LONG time with VERY big
# repositories.
# @ECLASS-VARIABLE: EGIT_PRUNE
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty this variable enables pruning all loose objects on each fetch.
# This is useful if upstream rewinds and rebases branches often.
# @ECLASS-VARIABLE: EGIT_NONBARE
# @DEFAULT_UNSET
# @DESCRIPTION:
# If non-empty this variable specifies that all checkouts will be done using
# non bare repositories. This is useful if you can't operate with bare
# checkouts for some reason.
# @FUNCTION: git-2_init_variables
# @DESCRIPTION:
# Internal function initializing all git variables.
# We define it in function scope so user can define
# all the variables before and after inherit.
git-2_init_variables() {
debug-print-function ${FUNCNAME} "$@"
local x
: ${EGIT_SOURCEDIR="${S}"}
: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"}
: ${EGIT_HAS_SUBMODULES:=}
: ${EGIT_OPTIONS:=}
: ${EGIT_MASTER:=master}
eval x="\$${PN//[-+]/_}_LIVE_REPO"
EGIT_REPO_URI=${x:-${EGIT_REPO_URI}}
[[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value"
: ${EVCS_OFFLINE:=}
eval x="\$${PN//[-+]/_}_LIVE_BRANCH"
[[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_BRANCH\" variable, you won't get any support"
EGIT_BRANCH=${x:-${EGIT_BRANCH:-${EGIT_MASTER}}}
eval x="\$${PN//[-+]/_}_LIVE_COMMIT"
[[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_COMMIT\" variable, you won't get any support"
EGIT_COMMIT=${x:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
: ${EGIT_REPACK:=}
: ${EGIT_PRUNE:=}
}
# @FUNCTION: git-2_submodules
# @DESCRIPTION:
# Internal function wrapping the submodule initialisation and update.
git-2_submodules() {
debug-print-function ${FUNCNAME} "$@"
if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
if [[ -n ${EVCS_OFFLINE} ]]; then
# for submodules operations we need to be online
debug-print "${FUNCNAME}: not updating submodules in offline mode"
return 1
fi
debug-print "${FUNCNAME}: working in \"${1}\""
pushd "${EGIT_DIR}" > /dev/null
debug-print "${FUNCNAME}: git submodule init"
git submodule init || die
debug-print "${FUNCNAME}: git submodule sync"
git submodule sync || die
debug-print "${FUNCNAME}: git submodule update"
git submodule update || die
popd > /dev/null
fi
}
# @FUNCTION: git-2_branch
# @DESCRIPTION:
# Internal function that changes branch for the repo based on EGIT_COMMIT and
# EGIT_BRANCH variables.
git-2_branch() {
debug-print-function ${FUNCNAME} "$@"
debug-print "${FUNCNAME}: working in \"${EGIT_SOURCEDIR}\""
pushd "${EGIT_SOURCEDIR}" > /dev/null
local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then
branchname=tree-${EGIT_COMMIT}
src=${EGIT_COMMIT}
fi
debug-print "${FUNCNAME}: git checkout -b ${branchname} ${src}"
git checkout -b ${branchname} ${src} \
|| die "${FUNCNAME}: changing the branch failed"
popd > /dev/null
unset branchname src
}
# @FUNCTION: git-2_gc
# @DESCRIPTION:
# Internal function running garbage collector on checked out tree.
git-2_gc() {
debug-print-function ${FUNCNAME} "$@"
pushd "${EGIT_DIR}" > /dev/null
if [[ -n ${EGIT_REPACK} || -n ${EGIT_PRUNE} ]]; then
ebegin "Garbage collecting the repository"
local args
[[ -n ${EGIT_PRUNE} ]] && args='--prune'
debug-print "${FUNCNAME}: git gc ${args}"
git gc ${args}
eend $?
fi
popd > /dev/null
}
# @FUNCTION: git-2_prepare_storedir
# @DESCRIPTION:
# Internal function preparing directory where we are going to store SCM
# repository.
git-2_prepare_storedir() {
debug-print-function ${FUNCNAME} "$@"
local clone_dir
# initial clone, we have to create master git storage directory and play
# nicely with sandbox
if [[ ! -d ${EGIT_STORE_DIR} ]]; then
debug-print "${FUNCNAME}: Creating git main storage directory"
addwrite /
mkdir -p "${EGIT_STORE_DIR}" \
|| die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\""
fi
cd -P "${EGIT_STORE_DIR}" \
|| die "${FUNCNAME}: can't chdir to \"${EGIT_STORE_DIR}\""
# allow writing into EGIT_STORE_DIR
addwrite "${EGIT_STORE_DIR}"
# calculate the proper store dir for data
[[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
if [[ -z ${EGIT_DIR} ]]; then
clone_dir=${EGIT_REPO_URI##*/}
EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
fi
export EGIT_DIR=${EGIT_DIR}
debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
}
# @FUNCTION: git-2_move_source
# @DESCRIPTION:
# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir.
git-2_move_source() {
debug-print-function ${FUNCNAME} "$@"
debug-print "${FUNCNAME}: ${MOVE_COMMAND} \"${EGIT_DIR}\" \"${EGIT_SOURCEDIR}\""
pushd "${EGIT_DIR}" > /dev/null
mkdir -p "${EGIT_SOURCEDIR}" \
|| die "${FUNCNAME}: failed to create ${EGIT_SOURCEDIR}"
${MOVE_COMMAND} "${EGIT_SOURCEDIR}" \
|| die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed"
popd > /dev/null
}
# @FUNCTION: git-2_initial_clone
# @DESCRIPTION:
# Internal function running initial clone on specified repo_uri.
git-2_initial_clone() {
debug-print-function ${FUNCNAME} "$@"
local repo_uri
EGIT_REPO_URI_SELECTED=""
for repo_uri in ${EGIT_REPO_URI}; do
debug-print "${FUNCNAME}: git clone ${EGIT_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
git clone ${EGIT_OPTIONS} "${repo_uri}" "${EGIT_DIR}"
if [[ $? -eq 0 ]]; then
# global variable containing the repo_name we will be using
debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
EGIT_REPO_URI_SELECTED="${repo_uri}"
break
fi
done
if [[ -z ${EGIT_REPO_URI_SELECTED} ]]; then
die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
fi
}
# @FUNCTION: git-2_update_repo
# @DESCRIPTION:
# Internal function running update command on specified repo_uri.
git-2_update_repo() {
debug-print-function ${FUNCNAME} "$@"
local repo_uri
if [[ -n ${EGIT_NONBARE} ]]; then
# checkout master branch and drop all other local branches
git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}"
for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do
debug-print "${FUNCNAME}: git branch -D ${x}"
git branch -D ${x} > /dev/null
done
fi
EGIT_REPO_URI_SELECTED=""
for repo_uri in ${EGIT_REPO_URI}; do
# git urls might change, so reset it
git config remote.origin.url "${repo_uri}"
debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
${EGIT_UPDATE_CMD} > /dev/null
if [[ $? -eq 0 ]]; then
# global variable containing the repo_name we will be using
debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
EGIT_REPO_URI_SELECTED="${repo_uri}"
break
fi
done
if [[ -z ${EGIT_REPO_URI_SELECTED} ]]; then
die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}"
fi
}
# @FUNCTION: git-2_fetch
# @DESCRIPTION:
# Internal function fetching repository from EGIT_REPO_URI and storing it in
# specified EGIT_STORE_DIR.
git-2_fetch() {
debug-print-function ${FUNCNAME} "$@"
local oldsha cursha repo_type
[[ -n ${EGIT_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
if [[ ! -d ${EGIT_DIR} ]]; then
git-2_initial_clone
pushd "${EGIT_DIR}" > /dev/null
cursha=$(git rev-parse ${UPSTREAM_BRANCH})
echo "GIT NEW clone -->"
echo " repository: ${EGIT_REPO_URI_SELECTED}"
echo " at the commit: ${cursha}"
popd > /dev/null
elif [[ -n ${EVCS_OFFLINE} ]]; then
pushd "${EGIT_DIR}" > /dev/null
cursha=$(git rev-parse ${UPSTREAM_BRANCH})
echo "GIT offline update -->"
echo " repository: $(git config remote.origin.url)"
echo " at the commit: ${cursha}"
popd > /dev/null
else
pushd "${EGIT_DIR}" > /dev/null
oldsha=$(git rev-parse ${UPSTREAM_BRANCH})
git-2_update_repo
cursha=$(git rev-parse ${UPSTREAM_BRANCH})
# fetch updates
echo "GIT update -->"
echo " repository: ${EGIT_REPO_URI_SELECTED}"
# write out message based on the revisions
if [[ "${oldsha1}" != "${cursha1}" ]]; then
echo " updating from commit: ${oldsha}"
echo " to commit: ${cursha}"
else
echo " at the commit: ${cursha}"
fi
# print nice statistic of what was changed
git --no-pager diff --stat ${oldsha}..${UPSTREAM_BRANCH}
popd > /dev/null
fi
# export the version the repository is at
export EGIT_VERSION="${cursha1}"
# log the repo state
[[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
&& echo " commit: ${EGIT_COMMIT}"
echo " branch: ${EGIT_BRANCH}"
echo " storage directory: \"${EGIT_DIR}\""
echo " checkout type: ${repo_type}"
}
# @FUNCTION: git_bootstrap
# @DESCRIPTION:
# Internal function that runs bootstrap command on unpacked source.
git-2_bootstrap() {
debug-print-function ${FUNCNAME} "$@"
# @ECLASS_VARIABLE: EGIT_BOOTSTRAP
# @DESCRIPTION:
# Command to be executed after checkout and clone of the specified
# repository.
# enviroment the package will fail if there is no update, thus in
# combination with --keep-going it would lead in not-updating
# pakcages that are up-to-date.
if [[ -n ${EGIT_BOOTSTRAP} ]]; then
pushd "${EGIT_SOURCEDIR}" > /dev/null
einfo "Starting bootstrap"
if [[ -f ${EGIT_BOOTSTRAP} ]]; then
# we have file in the repo which we should execute
debug-print "${FUNCNAME}: bootstraping with file \"${EGIT_BOOTSTRAP}\""
if [[ -x ${EGIT_BOOTSTRAP} ]]; then
eval "./${EGIT_BOOTSTRAP}" \
|| die "${FUNCNAME}: bootstrap script failed"
else
eerror "\"${EGIT_BOOTSTRAP}\" is not executable."
eerror "Report upstream, or bug ebuild maintainer to remove bootstrap command."
die "\"${EGIT_BOOTSTRAP}\" is not executable"
fi
else
# we execute some system command
debug-print "${FUNCNAME}: bootstraping with commands \"${EGIT_BOOTSTRAP}\""
eval "${EGIT_BOOTSTRAP}" \
|| die "${FUNCNAME}: bootstrap commands failed"
fi
einfo "Bootstrap finished"
popd > /dev/null
fi
}
# @FUNCTION: git-2_migrate_repository
# @DESCRIPTION:
# Internal function migrating between bare and normal checkout repository.
# This is based on usage of EGIT_SUBMODULES, at least until they
# start to work with bare checkouts sanely.
git-2_migrate_repository() {
debug-print-function ${FUNCNAME} "$@"
local target returnstate
# first find out if we have submodules
if [[ -z ${EGIT_HAS_SUBMODULES} ]]; then
target="bare"
else
target="full"
fi
[[ -n ${EGIT_NONBARE} ]] && target="full"
# test if we already have some repo and if so find out if we have
# to migrate the data
if [[ -d ${EGIT_DIR} ]]; then
if [[ ${target} == bare && -d ${EGIT_DIR}/.git ]]; then
debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy"
ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy"
mv "${EGIT_DIR}/.git" "${EGIT_DIR}.bare"
export GIT_DIR="${EGIT_DIR}.bare"
git config core.bare true > /dev/null
returnstate=$?
unset GIT_DIR
rm -rf "${EGIT_DIR}"
mv "${EGIT_DIR}.bare" "${EGIT_DIR}"
eend ${returnstate}
fi
if [[ ${target} == full && ! -d ${EGIT_DIR}/.git ]]; then
debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy"
ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy"
git clone -l "${EGIT_DIR}" "${EGIT_DIR}.nonbare" > /dev/null
returnstate=$?
rm -rf "${EGIT_DIR}"
mv "${EGIT_DIR}.nonbare" "${EGIT_DIR}"
eend ${returnstate}
fi
fi
if [[ ${returnstate} -ne 0 ]]; then
debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" failed, removing to start from scratch"
# migration failed, remove the EGIT_DIR to play it safe
einfo "Migration failed, removing \"${EGIT_DIR}\" to start from scratch."
rm -rf "${EGIT_DIR}"
fi
# set various options to work with both targets
if [[ ${target} == bare ]]; then
debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
EGIT_OPTIONS+=" --bare"
MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
EGIT_UPDATE_CMD="git fetch -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
UPSTREAM_BRANCH="${EGIT_BRANCH}"
else
debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
MOVE_COMMAND="cp -pPR ."
EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}"
UPSTREAM_BRANCH="origin/${EGIT_BRANCH}"
EGIT_NONBARE="true"
fi
}
# @FUNCTION: git-2_src_unpack
# @DESCRIPTION:
# Default git src_upack function.
git-2_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
git-2_init_variables
git-2_prepare_storedir
git-2_migrate_repository
git-2_fetch "$@"
git-2_gc
git-2_submodules
git-2_move_source
git-2_branch
git-2_bootstrap
echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-04-20 21:51 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-04-20 21:51 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/04/20 21:51:21
Modified: git-2.eclass
Log:
Play it safe and fetch all tags when working on bare repository.
Revision Changes Path
1.2 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.1&r2=1.2
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- git-2.eclass 20 Apr 2011 10:56:27 -0000 1.1
+++ git-2.eclass 20 Apr 2011 21:51:21 -0000 1.2
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.1 2011/04/20 10:56:27 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.2 2011/04/20 21:51:21 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -479,7 +479,7 @@
debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
EGIT_OPTIONS+=" --bare"
MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
- EGIT_UPDATE_CMD="git fetch -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
+ EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
UPSTREAM_BRANCH="${EGIT_BRANCH}"
else
debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-04-23 10:21 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-04-23 10:21 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/04/23 10:21:11
Modified: git-2.eclass
Log:
Remove wrong variable from debug-log message.
Revision Changes Path
1.3 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.2&r2=1.3
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- git-2.eclass 20 Apr 2011 21:51:21 -0000 1.2
+++ git-2.eclass 23 Apr 2011 10:21:11 -0000 1.3
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.2 2011/04/20 21:51:21 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.3 2011/04/23 10:21:11 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -306,7 +306,7 @@
# git urls might change, so reset it
git config remote.origin.url "${repo_uri}"
- debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
+ debug-print "${EGIT_UPDATE_CMD}"
${EGIT_UPDATE_CMD} > /dev/null
if [[ $? -eq 0 ]]; then
# global variable containing the repo_name we will be using
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-04-24 15:33 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-04-24 15:33 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/04/24 15:33:56
Modified: git-2.eclass
Log:
Fix comment typo.
Revision Changes Path
1.4 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.3&r2=1.4
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- git-2.eclass 23 Apr 2011 10:21:11 -0000 1.3
+++ git-2.eclass 24 Apr 2011 15:33:56 -0000 1.4
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.3 2011/04/23 10:21:11 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.4 2011/04/24 15:33:56 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -83,7 +83,7 @@
# It can be overriden via env using packagename_LIVE_COMMIT
# variable.
#
-# EGIT_BRANCH="${EGIT_BRANCH}"
+# EGIT_COMMIT="${EGIT_BRANCH}"
# @ECLASS-VARIABLE: EGIT_REPACK
# @DEFAULT_UNSET
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-05-02 21:15 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-05-02 21:15 UTC (permalink / raw
To: gentoo-commits
mgorny 11/05/02 21:15:30
Modified: git-2.eclass
Log:
Fix variable references ({cur,old}sha1 -> {cur,old}sha).
Revision Changes Path
1.5 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.4&r2=1.5
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- git-2.eclass 24 Apr 2011 15:33:56 -0000 1.4
+++ git-2.eclass 2 May 2011 21:15:30 -0000 1.5
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.4 2011/04/24 15:33:56 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.5 2011/05/02 21:15:30 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -358,7 +358,7 @@
echo "GIT update -->"
echo " repository: ${EGIT_REPO_URI_SELECTED}"
# write out message based on the revisions
- if [[ "${oldsha1}" != "${cursha1}" ]]; then
+ if [[ "${oldsha}" != "${cursha}" ]]; then
echo " updating from commit: ${oldsha}"
echo " to commit: ${cursha}"
else
@@ -370,7 +370,7 @@
popd > /dev/null
fi
# export the version the repository is at
- export EGIT_VERSION="${cursha1}"
+ export EGIT_VERSION="${cursha}"
# log the repo state
[[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]] \
&& echo " commit: ${EGIT_COMMIT}"
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-05-20 14:35 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-05-20 14:35 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/05/20 14:35:01
Modified: git-2.eclass
Log:
Fix typo upack -> unpack
Revision Changes Path
1.7 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.7&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.7&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.6&r2=1.7
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- git-2.eclass 19 May 2011 12:03:41 -0000 1.6
+++ git-2.eclass 20 May 2011 14:35:01 -0000 1.7
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.6 2011/05/19 12:03:41 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.7 2011/05/20 14:35:01 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -506,7 +506,7 @@
# @FUNCTION: git-2_src_unpack
# @DESCRIPTION:
-# Default git src_upack function.
+# Default git src_unpack function.
git-2_src_unpack() {
debug-print-function ${FUNCNAME} "$@"
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-05-20 15:32 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-05-20 15:32 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/05/20 15:32:54
Modified: git-2.eclass
Log:
Drop useless cd so we won't polute the environment.
Revision Changes Path
1.8 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.8&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.8&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.7&r2=1.8
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- git-2.eclass 20 May 2011 14:35:01 -0000 1.7
+++ git-2.eclass 20 May 2011 15:32:54 -0000 1.8
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.7 2011/05/20 14:35:01 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.8 2011/05/20 15:32:54 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -238,8 +238,6 @@
|| die "${FUNCNAME}: can't mkdir \"${EGIT_STORE_DIR}\""
fi
- cd -P "${EGIT_STORE_DIR}" \
- || die "${FUNCNAME}: can't chdir to \"${EGIT_STORE_DIR}\""
# allow writing into EGIT_STORE_DIR
addwrite "${EGIT_STORE_DIR}"
# calculate the proper store dir for data
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-05-20 15:53 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-05-20 15:53 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/05/20 15:53:43
Modified: git-2.eclass
Log:
Run default src_unpack at the end. Because users can specify something in src_uri and we should unpack it.
Revision Changes Path
1.9 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.9&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.9&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.8&r2=1.9
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- git-2.eclass 20 May 2011 15:32:54 -0000 1.8
+++ git-2.eclass 20 May 2011 15:53:43 -0000 1.9
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.8 2011/05/20 15:32:54 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.9 2011/05/20 15:53:43 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -518,4 +518,8 @@
git-2_branch
git-2_bootstrap
echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
+
+ # Users can specify some SRC_URI and we should
+ # unpack the files too.
+ default_src_unpack
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-06-08 15:18 Donnie Berkholz (dberkholz)
0 siblings, 0 replies; 23+ messages in thread
From: Donnie Berkholz (dberkholz) @ 2011-06-08 15:18 UTC (permalink / raw
To: gentoo-commits
dberkholz 11/06/08 15:18:13
Modified: git-2.eclass
Log:
Take over as maintainer.
Revision Changes Path
1.11 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.11&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.11&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.10&r2=1.11
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- git-2.eclass 31 May 2011 10:17:01 -0000 1.10
+++ git-2.eclass 8 Jun 2011 15:18:13 -0000 1.11
@@ -1,10 +1,10 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.10 2011/05/31 10:17:01 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.11 2011/06/08 15:18:13 dberkholz Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
-# Maintainer needed <maintainer-needed@gentoo.org>
+# Donnie Berkholz <dberkholz@gentoo.org>
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
# Eclass for easing maitenance of live ebuilds using git as remote repository.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-07-16 13:11 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-07-16 13:11 UTC (permalink / raw
To: gentoo-commits
mgorny 11/07/16 13:11:54
Modified: git-2.eclass
Log:
Fix calling default_src_unpack in EAPI < 2. Use inlined default code instead.
Revision Changes Path
1.12 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.12&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.12&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.11&r2=1.12
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- git-2.eclass 8 Jun 2011 15:18:13 -0000 1.11
+++ git-2.eclass 16 Jul 2011 13:11:54 -0000 1.12
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.11 2011/06/08 15:18:13 dberkholz Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.12 2011/07/16 13:11:54 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -521,5 +521,9 @@
# Users can specify some SRC_URI and we should
# unpack the files too.
- default_src_unpack
+ if has ${EAPI:-0} 0 1; then
+ [[ -n ${A} ]] && unpack ${A}
+ else
+ default_src_unpack
+ fi
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-07-30 15:10 Tomas Chvatal (scarabeus)
0 siblings, 0 replies; 23+ messages in thread
From: Tomas Chvatal (scarabeus) @ 2011-07-30 15:10 UTC (permalink / raw
To: gentoo-commits
scarabeus 11/07/30 15:10:34
Modified: git-2.eclass
Log:
Implement support for multiple checkouts from one ebuild by cleaning up environment. Also allow overriding unpacking of . This is required for live libreoffice ebuild.
Revision Changes Path
1.13 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.13&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.13&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.12&r2=1.13
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- git-2.eclass 16 Jul 2011 13:11:54 -0000 1.12
+++ git-2.eclass 30 Jul 2011 15:10:34 -0000 1.13
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.12 2011/07/16 13:11:54 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.13 2011/07/30 15:10:34 scarabeus Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -57,7 +57,7 @@
# @ECLASS-VARIABLE: EGIT_DIR
# @DESCRIPTION:
# Directory where we want to store the git data.
-# This should not be overriden unless really required.
+# This variable should not be overriden.
#
# EGIT_DIR="${EGIT_STORE_DIR}/${EGIT_PROJECT}"
@@ -113,6 +113,12 @@
# non bare repositories. This is useful if you can't operate with bare
# checkouts for some reason.
+# @ECLASS-VARIABLE: EGIT_NOUNPACK
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If non-empty this variable bans unpacking of ${A} content into the srcdir.
+# Default behaviour is to unpack ${A} content.
+
# @FUNCTION: git-2_init_variables
# @DESCRIPTION:
# Internal function initializing all git variables.
@@ -185,6 +191,8 @@
git-2_branch() {
debug-print-function ${FUNCNAME} "$@"
+ local branchname src
+
debug-print "${FUNCNAME}: working in \"${EGIT_SOURCEDIR}\""
pushd "${EGIT_SOURCEDIR}" > /dev/null
@@ -198,8 +206,6 @@
|| die "${FUNCNAME}: changing the branch failed"
popd > /dev/null
-
- unset branchname src
}
# @FUNCTION: git-2_gc
@@ -208,10 +214,11 @@
git-2_gc() {
debug-print-function ${FUNCNAME} "$@"
+ local args
+
pushd "${EGIT_DIR}" > /dev/null
if [[ -n ${EGIT_REPACK} || -n ${EGIT_PRUNE} ]]; then
ebegin "Garbage collecting the repository"
- local args
[[ -n ${EGIT_PRUNE} ]] && args='--prune'
debug-print "${FUNCNAME}: git gc ${args}"
git gc ${args}
@@ -281,8 +288,8 @@
EGIT_REPO_URI_SELECTED=""
for repo_uri in ${EGIT_REPO_URI}; do
- debug-print "${FUNCNAME}: git clone ${EGIT_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
- git clone ${EGIT_OPTIONS} "${repo_uri}" "${EGIT_DIR}"
+ debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
+ git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"
if [[ $? -eq 0 ]]; then
# global variable containing the repo_name we will be using
debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
@@ -304,7 +311,7 @@
local repo_uri
- if [[ -n ${EGIT_NONBARE} ]]; then
+ if [[ -n ${EGIT_LOCAL_NONBARE} ]]; then
# checkout master branch and drop all other local branches
git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}"
for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do
@@ -342,7 +349,7 @@
local oldsha cursha repo_type
- [[ -n ${EGIT_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
+ [[ -n ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
if [[ ! -d ${EGIT_DIR} ]]; then
git-2_initial_clone
@@ -438,6 +445,8 @@
# Internal function migrating between bare and normal checkout repository.
# This is based on usage of EGIT_SUBMODULES, at least until they
# start to work with bare checkouts sanely.
+# This function also set some global variables that differ between
+# bare and non-bare checkout.
git-2_migrate_repository() {
debug-print-function ${FUNCNAME} "$@"
@@ -449,7 +458,11 @@
else
target="full"
fi
- [[ -n ${EGIT_NONBARE} ]] && target="full"
+ # check if user didn't specify that we want non-bare repo
+ if [[ -n ${EGIT_NONBARE} ]]; then
+ target="full"
+ EGIT_LOCAL_NONBARE="true"
+ fi
# test if we already have some repo and if so find out if we have
# to migrate the data
@@ -489,19 +502,40 @@
# set various options to work with both targets
if [[ ${target} == bare ]]; then
debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
- EGIT_OPTIONS+=" --bare"
+ EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare"
MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
UPSTREAM_BRANCH="${EGIT_BRANCH}"
else
debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
MOVE_COMMAND="cp -pPR ."
+ EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}"
EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}"
UPSTREAM_BRANCH="origin/${EGIT_BRANCH}"
- EGIT_NONBARE="true"
+ EGIT_LOCAL_NONBARE="true"
fi
}
+# @FUNCTION: git-2_cleanup
+# @DESCRIPTION:
+# Internal function cleaning up all the global variables
+# that are not required after the unpack has been done.
+git-2_cleanup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Here we can unset only variables that are GLOBAL
+ # defined by the eclass, BUT NOT subject to change
+ # by user (like EGIT_PROJECT).
+ # If ebuild writer polutes his environment it is
+ # his problem only.
+ unset EGIT_DIR
+ unset MOVE_COMMAND
+ unset EGIT_LOCAL_OPTIONS
+ unset EGIT_UPDATE_CMD
+ unset UPSTREAM_BRANCH
+ unset EGIT_LOCAL_NONBARE
+}
+
# @FUNCTION: git-2_src_unpack
# @DESCRIPTION:
# Default git src_unpack function.
@@ -517,13 +551,16 @@
git-2_move_source
git-2_branch
git-2_bootstrap
+ git-2_cleanup
echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
# Users can specify some SRC_URI and we should
# unpack the files too.
- if has ${EAPI:-0} 0 1; then
- [[ -n ${A} ]] && unpack ${A}
- else
- default_src_unpack
+ if [[ -z ${EGIT_NOUNPACK} ]]; then
+ if has ${EAPI:-0} 0 1; then
+ [[ -n ${A} ]] && unpack ${A}
+ else
+ default_src_unpack
+ fi
fi
}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:55 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:55 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:55:47
Modified: git-2.eclass
Log:
Replace variable 'eval's with ${!foo}.
Revision Changes Path
1.15 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.15&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.15&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.14&r2=1.15
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- git-2.eclass 22 Aug 2011 04:46:31 -0000 1.14
+++ git-2.eclass 23 Sep 2011 13:55:47 -0000 1.15
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.14 2011/08/22 04:46:31 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.15 2011/09/23 13:55:47 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -127,7 +127,8 @@
git-2_init_variables() {
debug-print-function ${FUNCNAME} "$@"
- local x
+ local esc_pn liverepo livebranch livecommit
+ esc_pn=${PN//[-+]/_}
: ${EGIT_SOURCEDIR="${S}"}
@@ -139,19 +140,19 @@
: ${EGIT_MASTER:=master}
- eval x="\$${PN//[-+]/_}_LIVE_REPO"
- EGIT_REPO_URI=${x:-${EGIT_REPO_URI}}
+ liverepo=${esc_pn}_LIVE_REPO
+ EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}}
[[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value"
: ${EVCS_OFFLINE:=}
- eval x="\$${PN//[-+]/_}_LIVE_BRANCH"
- [[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_BRANCH\" variable, you won't get any support"
- EGIT_BRANCH=${x:-${EGIT_BRANCH:-${EGIT_MASTER}}}
-
- eval x="\$${PN//[-+]/_}_LIVE_COMMIT"
- [[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_COMMIT\" variable, you won't get any support"
- EGIT_COMMIT=${x:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
+ livebranch=${esc_pn}_LIVE_BRANCH
+ [[ -n ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
+ EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}}
+
+ livecommit=${esc_pn}_LIVE_COMMIT
+ [[ -n ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
+ EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
: ${EGIT_REPACK:=}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:56 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:56 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:56:29
Modified: git-2.eclass
Log:
Remove unnecessary scary trailing-slash check for EGIT_REPO_URI.
If the slash is not there, ${EGIT_REPO_URI%/} will simply do nothing.
Revision Changes Path
1.16 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.16&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.16&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.15&r2=1.16
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- git-2.eclass 23 Sep 2011 13:55:47 -0000 1.15
+++ git-2.eclass 23 Sep 2011 13:56:29 -0000 1.16
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.15 2011/09/23 13:55:47 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.16 2011/09/23 13:56:29 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -251,7 +251,7 @@
# calculate the proper store dir for data
# If user didn't specify the EGIT_DIR, we check if he did specify
# the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
- [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
+ EGIT_REPO_URI=${EGIT_REPO_URI%/}
if [[ -z ${EGIT_DIR} ]]; then
if [[ -n ${EGIT_PROJECT} ]]; then
clone_dir=${EGIT_PROJECT}
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:57 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:57 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:57:15
Modified: git-2.eclass
Log:
Drop -n & -z test operators -- they're redundant in [[ ]].
Revision Changes Path
1.17 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.17&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.17&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.16&r2=1.17
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- git-2.eclass 23 Sep 2011 13:56:29 -0000 1.16
+++ git-2.eclass 23 Sep 2011 13:57:15 -0000 1.17
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.16 2011/09/23 13:56:29 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.17 2011/09/23 13:57:15 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -142,16 +142,16 @@
liverepo=${esc_pn}_LIVE_REPO
EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}}
- [[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value"
+ [[ ${EGIT_REPO_URI} ]] || die "EGIT_REPO_URI must have some value"
: ${EVCS_OFFLINE:=}
livebranch=${esc_pn}_LIVE_BRANCH
- [[ -n ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
+ [[ ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}}
livecommit=${esc_pn}_LIVE_COMMIT
- [[ -n ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
+ [[ ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
: ${EGIT_REPACK:=}
@@ -164,8 +164,8 @@
# Internal function wrapping the submodule initialisation and update.
git-2_submodules() {
debug-print-function ${FUNCNAME} "$@"
- if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
- if [[ -n ${EVCS_OFFLINE} ]]; then
+ if [[ ${EGIT_HAS_SUBMODULES} ]]; then
+ if [[ ${EVCS_OFFLINE} ]]; then
# for submodules operations we need to be online
debug-print "${FUNCNAME}: not updating submodules in offline mode"
return 1
@@ -218,9 +218,9 @@
local args
pushd "${EGIT_DIR}" > /dev/null
- if [[ -n ${EGIT_REPACK} || -n ${EGIT_PRUNE} ]]; then
+ if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then
ebegin "Garbage collecting the repository"
- [[ -n ${EGIT_PRUNE} ]] && args='--prune'
+ [[ ${EGIT_PRUNE} ]] && args='--prune'
debug-print "${FUNCNAME}: git gc ${args}"
git gc ${args}
eend $?
@@ -252,8 +252,8 @@
# If user didn't specify the EGIT_DIR, we check if he did specify
# the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
EGIT_REPO_URI=${EGIT_REPO_URI%/}
- if [[ -z ${EGIT_DIR} ]]; then
- if [[ -n ${EGIT_PROJECT} ]]; then
+ if [[ ! ${EGIT_DIR} ]]; then
+ if [[ ${EGIT_PROJECT} ]]; then
clone_dir=${EGIT_PROJECT}
else
clone_dir=${EGIT_REPO_URI##*/}
@@ -299,9 +299,8 @@
fi
done
- if [[ -z ${EGIT_REPO_URI_SELECTED} ]]; then
- die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
- fi
+ [[ ${EGIT_REPO_URI_SELECTED} ]] \
+ || die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
}
# @FUNCTION: git-2_update_repo
@@ -312,7 +311,7 @@
local repo_uri
- if [[ -n ${EGIT_LOCAL_NONBARE} ]]; then
+ if [[ ${EGIT_LOCAL_NONBARE} ]]; then
# checkout master branch and drop all other local branches
git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}"
for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do
@@ -336,9 +335,8 @@
fi
done
- if [[ -z ${EGIT_REPO_URI_SELECTED} ]]; then
- die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}"
- fi
+ [[ ${EGIT_REPO_URI_SELECTED} ]] \
+ || die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}"
}
# @FUNCTION: git-2_fetch
@@ -350,7 +348,7 @@
local oldsha cursha repo_type
- [[ -n ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
+ [[ ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
if [[ ! -d ${EGIT_DIR} ]]; then
git-2_initial_clone
@@ -361,7 +359,7 @@
echo " at the commit: ${cursha}"
popd > /dev/null
- elif [[ -n ${EVCS_OFFLINE} ]]; then
+ elif [[ ${EVCS_OFFLINE} ]]; then
pushd "${EGIT_DIR}" > /dev/null
cursha=$(git rev-parse ${UPSTREAM_BRANCH})
echo "GIT offline update -->"
@@ -412,7 +410,7 @@
# enviroment the package will fail if there is no update, thus in
# combination with --keep-going it would lead in not-updating
# pakcages that are up-to-date.
- if [[ -n ${EGIT_BOOTSTRAP} ]]; then
+ if [[ ${EGIT_BOOTSTRAP} ]]; then
pushd "${EGIT_SOURCEDIR}" > /dev/null
einfo "Starting bootstrap"
@@ -454,13 +452,13 @@
local target returnstate
# first find out if we have submodules
- if [[ -z ${EGIT_HAS_SUBMODULES} ]]; then
+ if [[ ! ${EGIT_HAS_SUBMODULES} ]]; then
target="bare"
else
target="full"
fi
# check if user didn't specify that we want non-bare repo
- if [[ -n ${EGIT_NONBARE} ]]; then
+ if [[ ${EGIT_NONBARE} ]]; then
target="full"
EGIT_LOCAL_NONBARE="true"
fi
@@ -557,9 +555,9 @@
# Users can specify some SRC_URI and we should
# unpack the files too.
- if [[ -z ${EGIT_NOUNPACK} ]]; then
+ if [[ ! ${EGIT_NOUNPACK} ]]; then
if has ${EAPI:-0} 0 1; then
- [[ -n ${A} ]] && unpack ${A}
+ [[ ${A} ]] && unpack ${A}
else
default_src_unpack
fi
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:57 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:57 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:57:28
Modified: git-2.eclass
Log:
Replace redundant $? checks with explicit if..fi.
Revision Changes Path
1.18 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.18&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.18&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.17&r2=1.18
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- git-2.eclass 23 Sep 2011 13:57:15 -0000 1.17
+++ git-2.eclass 23 Sep 2011 13:57:28 -0000 1.18
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.17 2011/09/23 13:57:15 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.18 2011/09/23 13:57:28 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -290,8 +290,7 @@
EGIT_REPO_URI_SELECTED=""
for repo_uri in ${EGIT_REPO_URI}; do
debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
- git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"
- if [[ $? -eq 0 ]]; then
+ if git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"; then
# global variable containing the repo_name we will be using
debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
EGIT_REPO_URI_SELECTED="${repo_uri}"
@@ -326,8 +325,7 @@
git config remote.origin.url "${repo_uri}"
debug-print "${EGIT_UPDATE_CMD}"
- ${EGIT_UPDATE_CMD} > /dev/null
- if [[ $? -eq 0 ]]; then
+ if ${EGIT_UPDATE_CMD} > /dev/null; then
# global variable containing the repo_name we will be using
debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
EGIT_REPO_URI_SELECTED="${repo_uri}"
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:57 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:57 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:57:42
Modified: git-2.eclass
Log:
Drop redundant EGIT_LOCAL_NONBARE setting.
It is set later in the function anyway.
Revision Changes Path
1.19 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.19&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.19&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.18&r2=1.19
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- git-2.eclass 23 Sep 2011 13:57:28 -0000 1.18
+++ git-2.eclass 23 Sep 2011 13:57:42 -0000 1.19
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.18 2011/09/23 13:57:28 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.19 2011/09/23 13:57:42 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -458,7 +458,6 @@
# check if user didn't specify that we want non-bare repo
if [[ ${EGIT_NONBARE} ]]; then
target="full"
- EGIT_LOCAL_NONBARE="true"
fi
# test if we already have some repo and if so find out if we have
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:57 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:57 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:57:55
Modified: git-2.eclass
Log:
Simplify bare/non-bare logic.
Revision Changes Path
1.20 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.20&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.20&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.19&r2=1.20
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- git-2.eclass 23 Sep 2011 13:57:42 -0000 1.19
+++ git-2.eclass 23 Sep 2011 13:57:55 -0000 1.20
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.19 2011/09/23 13:57:42 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.20 2011/09/23 13:57:55 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -447,23 +447,18 @@
git-2_migrate_repository() {
debug-print-function ${FUNCNAME} "$@"
- local target returnstate
+ local bare returnstate
# first find out if we have submodules
- if [[ ! ${EGIT_HAS_SUBMODULES} ]]; then
- target="bare"
- else
- target="full"
- fi
- # check if user didn't specify that we want non-bare repo
- if [[ ${EGIT_NONBARE} ]]; then
- target="full"
+ # or user explicitly wants us to use non-bare clones
+ if ! [[ ${EGIT_HAS_SUBMODULES} || ${EGIT_NONBARE} ]]; then
+ bare=1
fi
# test if we already have some repo and if so find out if we have
# to migrate the data
if [[ -d ${EGIT_DIR} ]]; then
- if [[ ${target} == bare && -d ${EGIT_DIR}/.git ]]; then
+ if [[ ${bare} && -d ${EGIT_DIR}/.git ]]; then
debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy"
ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy"
@@ -475,8 +470,7 @@
rm -rf "${EGIT_DIR}"
mv "${EGIT_DIR}.bare" "${EGIT_DIR}"
eend ${returnstate}
- fi
- if [[ ${target} == full && ! -d ${EGIT_DIR}/.git ]]; then
+ elif [[ ! ${bare} && ! -d ${EGIT_DIR}/.git ]]; then
debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy"
ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy"
@@ -496,7 +490,7 @@
fi
# set various options to work with both targets
- if [[ ${target} == bare ]]; then
+ if [[ ${bare} ]]; then
debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare"
MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:58 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:58 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:58:09
Modified: git-2.eclass
Log:
Move pushd/popds within conditional to avoid needless exec.
Revision Changes Path
1.21 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.21&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.21&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.20&r2=1.21
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- git-2.eclass 23 Sep 2011 13:57:55 -0000 1.20
+++ git-2.eclass 23 Sep 2011 13:58:09 -0000 1.21
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.20 2011/09/23 13:57:55 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.21 2011/09/23 13:58:09 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -217,15 +217,15 @@
local args
- pushd "${EGIT_DIR}" > /dev/null
if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then
+ pushd "${EGIT_DIR}" > /dev/null
ebegin "Garbage collecting the repository"
[[ ${EGIT_PRUNE} ]] && args='--prune'
debug-print "${FUNCNAME}: git gc ${args}"
git gc ${args}
eend $?
+ popd > /dev/null
fi
- popd > /dev/null
}
# @FUNCTION: git-2_prepare_storedir
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:58 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:58 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:58:22
Modified: git-2.eclass
Log:
Mark internal functions @INTERNAL.
Revision Changes Path
1.22 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.22&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.22&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.21&r2=1.22
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- git-2.eclass 23 Sep 2011 13:58:09 -0000 1.21
+++ git-2.eclass 23 Sep 2011 13:58:22 -0000 1.22
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.21 2011/09/23 13:58:09 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.22 2011/09/23 13:58:22 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -120,6 +120,7 @@
# Default behaviour is to unpack ${A} content.
# @FUNCTION: git-2_init_variables
+# @INTERNAL
# @DESCRIPTION:
# Internal function initializing all git variables.
# We define it in function scope so user can define
@@ -160,6 +161,7 @@
}
# @FUNCTION: git-2_submodules
+# @INTERNAL
# @DESCRIPTION:
# Internal function wrapping the submodule initialisation and update.
git-2_submodules() {
@@ -186,6 +188,7 @@
}
# @FUNCTION: git-2_branch
+# @INTERNAL
# @DESCRIPTION:
# Internal function that changes branch for the repo based on EGIT_COMMIT and
# EGIT_BRANCH variables.
@@ -210,6 +213,7 @@
}
# @FUNCTION: git-2_gc
+# @INTERNAL
# @DESCRIPTION:
# Internal function running garbage collector on checked out tree.
git-2_gc() {
@@ -229,6 +233,7 @@
}
# @FUNCTION: git-2_prepare_storedir
+# @INTERNAL
# @DESCRIPTION:
# Internal function preparing directory where we are going to store SCM
# repository.
@@ -265,6 +270,7 @@
}
# @FUNCTION: git-2_move_source
+# @INTERNAL
# @DESCRIPTION:
# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir.
git-2_move_source() {
@@ -280,6 +286,7 @@
}
# @FUNCTION: git-2_initial_clone
+# @INTERNAL
# @DESCRIPTION:
# Internal function running initial clone on specified repo_uri.
git-2_initial_clone() {
@@ -303,6 +310,7 @@
}
# @FUNCTION: git-2_update_repo
+# @INTERNAL
# @DESCRIPTION:
# Internal function running update command on specified repo_uri.
git-2_update_repo() {
@@ -338,6 +346,7 @@
}
# @FUNCTION: git-2_fetch
+# @INTERNAL
# @DESCRIPTION:
# Internal function fetching repository from EGIT_REPO_URI and storing it in
# specified EGIT_STORE_DIR.
@@ -396,6 +405,7 @@
}
# @FUNCTION: git_bootstrap
+# @INTERNAL
# @DESCRIPTION:
# Internal function that runs bootstrap command on unpacked source.
git-2_bootstrap() {
@@ -438,6 +448,7 @@
}
# @FUNCTION: git-2_migrate_repository
+# @INTERNAL
# @DESCRIPTION:
# Internal function migrating between bare and normal checkout repository.
# This is based on usage of EGIT_SUBMODULES, at least until they
@@ -507,6 +518,7 @@
}
# @FUNCTION: git-2_cleanup
+# @INTERNAL
# @DESCRIPTION:
# Internal function cleaning up all the global variables
# that are not required after the unpack has been done.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:58 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:58 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:58:35
Modified: git-2.eclass
Log:
Ensure EGIT_LOCAL_NONBARE doesn't leak in from env.
Revision Changes Path
1.23 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.23&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.23&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.22&r2=1.23
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- git-2.eclass 23 Sep 2011 13:58:22 -0000 1.22
+++ git-2.eclass 23 Sep 2011 13:58:35 -0000 1.23
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.22 2011/09/23 13:58:22 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.23 2011/09/23 13:58:35 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -507,6 +507,7 @@
MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
UPSTREAM_BRANCH="${EGIT_BRANCH}"
+ EGIT_LOCAL_NONBARE=
else
debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
MOVE_COMMAND="cp -pPR ."
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:58 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:58 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:58:58
Modified: git-2.eclass
Log:
Try to migrate git.eclass checkouts to the new eclass.
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=383761
Revision Changes Path
1.24 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.24&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.24&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.23&r2=1.24
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- git-2.eclass 23 Sep 2011 13:58:35 -0000 1.23
+++ git-2.eclass 23 Sep 2011 13:58:58 -0000 1.24
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.23 2011/09/23 13:58:35 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.24 2011/09/23 13:58:58 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -264,6 +264,18 @@
clone_dir=${EGIT_REPO_URI##*/}
fi
EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
+
+ # Try to migrate from git.eclass git-src/
+ if [[ ! -d ${EGIT_DIR} && ${EGIT_STORE_DIR} == */egit-src ]]; then
+ local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
+ local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
+
+ if [[ -d ${old_location} ]]; then
+ elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
+ elog "It will be necessary to rebuild the package to fetch updates."
+ EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}"
+ fi
+ fi
fi
export EGIT_DIR=${EGIT_DIR}
debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 13:59 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 13:59 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 13:59:11
Modified: git-2.eclass
Log:
Remove git.eclass old clones if git-2 clone succeeds.
Revision Changes Path
1.25 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.25&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.25&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.24&r2=1.25
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- git-2.eclass 23 Sep 2011 13:58:58 -0000 1.24
+++ git-2.eclass 23 Sep 2011 13:59:11 -0000 1.25
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.24 2011/09/23 13:58:58 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.25 2011/09/23 13:59:11 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
@@ -253,6 +253,22 @@
# allow writing into EGIT_STORE_DIR
addwrite "${EGIT_STORE_DIR}"
+
+ # calculate git.eclass store dir for data
+ # We will try to clone the old repository,
+ # and we will remove it if we don't need it anymore.
+ EGIT_OLD_CLONE=
+ if [[ ${EGIT_STORE_DIR} == */egit-src ]]; then
+ local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
+ local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
+
+ if [[ -d ${old_location} ]]; then
+ EGIT_OLD_CLONE=${old_location}
+ # required to remove the old clone
+ addwrite "${old_store_dir}"
+ fi
+ fi
+
# calculate the proper store dir for data
# If user didn't specify the EGIT_DIR, we check if he did specify
# the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
@@ -265,16 +281,10 @@
fi
EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
- # Try to migrate from git.eclass git-src/
- if [[ ! -d ${EGIT_DIR} && ${EGIT_STORE_DIR} == */egit-src ]]; then
- local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
- local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
-
- if [[ -d ${old_location} ]]; then
- elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
- elog "It will be necessary to rebuild the package to fetch updates."
- EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}"
- fi
+ if [[ ${EGIT_OLD_CLONE} && ! -d ${EGIT_DIR} ]]; then
+ elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
+ elog "It will be necessary to rebuild the package to fetch updates."
+ EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}"
fi
fi
export EGIT_DIR=${EGIT_DIR}
@@ -414,6 +424,12 @@
echo " branch: ${EGIT_BRANCH}"
echo " storage directory: \"${EGIT_DIR}\""
echo " checkout type: ${repo_type}"
+
+ # Cleanup after git.eclass
+ if [[ ${EGIT_OLD_CLONE} ]]; then
+ einfo "${FUNCNAME}: removing old clone in ${EGIT_OLD_CLONE}."
+ rm -rf "${EGIT_OLD_CLONE}"
+ fi
}
# @FUNCTION: git_bootstrap
^ permalink raw reply [flat|nested] 23+ messages in thread
* [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass
@ 2011-09-23 14:10 Michal Gorny (mgorny)
0 siblings, 0 replies; 23+ messages in thread
From: Michal Gorny (mgorny) @ 2011-09-23 14:10 UTC (permalink / raw
To: gentoo-commits
mgorny 11/09/23 14:10:47
Modified: git-2.eclass
Log:
Adding myself as a co-maintainer.
Revision Changes Path
1.26 eclass/git-2.eclass
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.26&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?rev=1.26&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/git-2.eclass?r1=1.25&r2=1.26
Index: git-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- git-2.eclass 23 Sep 2011 13:59:11 -0000 1.25
+++ git-2.eclass 23 Sep 2011 14:10:47 -0000 1.26
@@ -1,10 +1,11 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.25 2011/09/23 13:59:11 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.26 2011/09/23 14:10:47 mgorny Exp $
# @ECLASS: git-2.eclass
# @MAINTAINER:
# Donnie Berkholz <dberkholz@gentoo.org>
+# Michał Górny <mgorny@gentoo.org>
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
# Eclass for easing maitenance of live ebuilds using git as remote repository.
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2011-09-23 14:11 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 21:15 [gentoo-commits] gentoo-x86 commit in eclass: git-2.eclass Michal Gorny (mgorny)
-- strict thread matches above, loose matches on Subject: below --
2011-09-23 14:10 Michal Gorny (mgorny)
2011-09-23 13:59 Michal Gorny (mgorny)
2011-09-23 13:58 Michal Gorny (mgorny)
2011-09-23 13:58 Michal Gorny (mgorny)
2011-09-23 13:58 Michal Gorny (mgorny)
2011-09-23 13:58 Michal Gorny (mgorny)
2011-09-23 13:57 Michal Gorny (mgorny)
2011-09-23 13:57 Michal Gorny (mgorny)
2011-09-23 13:57 Michal Gorny (mgorny)
2011-09-23 13:57 Michal Gorny (mgorny)
2011-09-23 13:56 Michal Gorny (mgorny)
2011-09-23 13:55 Michal Gorny (mgorny)
2011-07-30 15:10 Tomas Chvatal (scarabeus)
2011-07-16 13:11 Michal Gorny (mgorny)
2011-06-08 15:18 Donnie Berkholz (dberkholz)
2011-05-20 15:53 Tomas Chvatal (scarabeus)
2011-05-20 15:32 Tomas Chvatal (scarabeus)
2011-05-20 14:35 Tomas Chvatal (scarabeus)
2011-04-24 15:33 Tomas Chvatal (scarabeus)
2011-04-23 10:21 Tomas Chvatal (scarabeus)
2011-04-20 21:51 Tomas Chvatal (scarabeus)
2011-04-20 10:56 Tomas Chvatal (scarabeus)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox