public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] git-2.eclass final review
@ 2011-03-22 21:07 Tomáš Chvátal
  2011-03-22 21:26 ` Mike Frysinger
  2011-04-17  8:44 ` [gentoo-dev] " Tomá? Chvátal
  0 siblings, 2 replies; 24+ messages in thread
From: Tomáš Chvátal @ 2011-03-22 21:07 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 311 bytes --]

Hi guys,
as there are no more complaints in kde overlay i would like you to test
your git using live ebuild with this new git-2 eclass and tell me how
you like it.

Also usual review of what already is in is welcomed because i would
really really like to move this thing into main tree.

Cheers

Tom

[-- Attachment #1.2: git-2.eclass --]
[-- Type: text/plain, Size: 12516 bytes --]

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: git-2.eclass
# @MAINTAINER:
# Tomas Chvatal <scarabeus@gentoo.org>
# @BLURB: This eclass provides functions for fetch and unpack 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"

# This static variable is for storing the data in WORKDIR.
# Sometimes we might want to redefine S.
EGIT_SOURCEDIR="${WORKDIR}/${P}"

# @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} "$@"

	# @ECLASS-VARIABLE: EGIT_STORE_DIR
	# @DESCRIPTION:
	# Storage directory for git sources.
	: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"}

	# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
	# @DESCRIPTION:
	# Set this to non-empty value to enable submodule support.
	: ${EGIT_HAS_SUBMODULES:=}

	# @ECLASS-VARIABLE: EGIT_FETCH_CMD
	# @DESCRIPTION:
	# Command for cloning the repository.
	: ${EGIT_FETCH_CMD:="git clone"}

	# @ECLASS-VARIABLE: EGIT_UPDATE_CMD
	# @DESCRIPTION:
	# Git fetch command.
	: ${EGIT_UPDATE_CMD:="git pull -f -u"}

	# @ECLASS-VARIABLE: EGIT_OPTIONS
	# @DESCRIPTION:
	# This variable value is passed to clone and fetch.
	: ${EGIT_OPTIONS:=}

	# @ECLASS-VARIABLE: EGIT_MASTER
	# @DESCRIPTION:
	# Variable for specifying master branch.
	# Usefull when upstream don't have master branch.
	: ${EGIT_MASTER:=master}

	# @ECLASS-VARIABLE: EGIT_REPO_URI
	# @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"
	eval X="\$${PN//[-+]/_}_LIVE_REPO"
	if [[ ${X} = "" ]]; then
		: ${EGIT_REPO_URI:=}
	else
		EGIT_REPO_URI="${X}"
	fi
	[[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value."

	# @ECLASS-VARIABLE: EVCS_OFFLINE
	# @DESCRIPTION:
	# Set this variable to a non-empty value to disable the automatic updating
	# of an GIT source tree. This is intended to be set outside the git source
	# tree by users.
	: ${EVCS_OFFLINE:=}

	# @ECLASS-VARIABLE: EGIT_BRANCH
	# @DESCRIPTION:
	# Specify the branch we want to check out from the repository
	eval X="\$${PN//[-+]/_}_LIVE_BRANCH"
	if [[ "${X}" = "" ]]; then
		: ${EGIT_BRANCH:=${EGIT_MASTER}}
	else
		EGIT_BRANCH="${X}"
	fi

	# @ECLASS-VARIABLE: EGIT_COMMIT
	# @DESCRIPTION:
	# Specify commit we want to check out from the repository.
	eval X="\$${PN//[-+]/_}_LIVE_COMMIT"
	if [[ "${X}" = "" ]]; then
		: ${EGIT_COMMIT:=${EGIT_BRANCH}}
	else
		EGIT_COMMIT="${X}"
	fi

	# @ECLASS-VARIABLE: EGIT_REPACK
	# @DESCRIPTION:
	# Set to non-empty value to repack objects to save disk space. However this
	# can take a REALLY LONG time with VERY big repositories.
	: ${EGIT_REPACK:=}

	# @ECLASS-VARIABLE: EGIT_PRUNE
	# @DESCRIPTION:
	# Set to non-empty value to prune loose objects on each fetch. This is
	# useful if upstream rewinds and rebases branches often.
	: ${EGIT_PRUNE:=}

}

# @FUNCTION: git-2_submodules
# @DESCRIPTION:
# Internal function wrapping the submodule initialisation and update
git-2_submodules() {
	debug-print-function ${FUNCNAME} "$@"

	[[ "$#" -ne 1 ]] && die "${FUNCNAME}: requires 1 argument (path)"

	debug-print "${FUNCNAME}: working in \"${1}\""
	pushd "${1}" &> /dev/null

	# for submodules operations we need to be online
	if [[ -z ${EVCS_OFFLINE} && -n ${EGIT_HAS_SUBMODULES} ]]; then
		export GIT_DIR=${EGIT_DIR}
		debug-print "${FUNCNAME}: git submodule init"
		git submodule init \
			|| die "${FUNCNAME}: git submodule initialisation failed"
		debug-print "${FUNCNAME}: git submodule sync"
		git submodule sync "" die "${FUNCNAME}: git submodule sync failed"
		debug-print "${FUNCNAME}: git submodule update"
		git submodule update || die "${FUNCNAME}: git submodule update failed"
		unset GIT_DIR
	fi

	popd > /dev/null
}

# @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
	local save_sandbox_write=${SANDBOX_WRITE}

	# 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}\"."
		SANDBOX_WRITE=${save_sandbox_write}
	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%/}"
	clone_dir="${EGIT_REPO_URI##*/}"
	export EGIT_DIR="${EGIT_STORE_DIR}/${clone_dir}"
	debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."

	# we can not jump between using and not using SUBMODULES so we need to
	# refetch the source when needed
	if [[ -d "${EGIT_DIR}" && ! -d "${EGIT_DIR}"/.git ]]; then
		debug-print "${FUNCNAME}: \"${clone_dir}\" was bare copy moving..."
		mv "${EGIT_DIR}" "${EGIT_DIR}.bare" \
			|| die "${FUNCNAME}: Moving the bare sources failed."

	fi
	# Tell user that he can remove his bare repository. It is not used.
	if [[ -d "${EGIT_DIR}.bare" ]]; then
		einfo "Found GIT bare repository at \"${EGIT_DIR}.bare\"."
		einfo "This folder can be safely removed to save space."
	fi
}

# @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} "$@"

	pushd "${EGIT_DIR}" &> /dev/null
	debug-print "${FUNCNAME}: rsync -rlpgo . \"${EGIT_SOURCEDIR}\""
	rsync -rlpgo . "${EGIT_SOURCEDIR}" \
		|| die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed"
	popd &> /dev/null
}

# @FUNCTION: git-2_initial_clone
# @DESCRIPTION:
# Run initial clone on specified repo_uri
git-2_initial_clone() {
	debug-print-function ${FUNCNAME} "$@"

	local repo_uri

	for repo_uri in ${EGIT_REPO_URI}; do
		debug-print "${FUNCNAME}: ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
		${EGIT_FETCH_CMD} ${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:
# Run update command on specified repo_uri
git-2_update_repo() {
	debug-print-function ${FUNCNAME} "$@"

	local repo_uri

	# checkout master branch and drop all other local branches
	git checkout ${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}
	done

	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} ${EGIT_OPTIONS}

		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_SELECTED}."
	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 upstream_branch

	upstream_branch=origin/${EGIT_BRANCH}

	if [[ ! -d ${EGIT_DIR} ]] ; then
		git-2_initial_clone
		pushd "${EGIT_DIR}" &> /dev/null
		cursha=$(git rev-parse ${upstream_branch})
		einfo "GIT NEW clone -->"
		einfo "   repository:               ${EGIT_REPO_URI_SELECTED}"
		einfo "   at the commit:            ${cursha}"

		git-2_submodules "${EGIT_DIR}"
		popd &> /dev/null
	elif [[ -n ${EVCS_OFFLINE} ]] ; then
		pushd "${EGIT_DIR}" &> /dev/null
		cursha=$(git rev-parse ${upstream_branch})
		einfo "GIT offline update -->"
		einfo "   repository:               $(git config remote.origin.url)"
		einfo "   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
		einfo "GIT update -->"
		einfo "   repository:               ${EGIT_REPO_URI_SELECTED}"
		# write out message based on the revisions
		if [[ "${oldsha1}" != "${cursha1}" ]]; then
			einfo "   updating from commit:     ${oldsha}"
			einfo "   to commit:                ${cursha}"
		else
			einfo "   at the commit:            ${cursha}"
		fi

		git-2_submodules "${EGIT_DIR}"

		# 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}" ]] \
		&& einfo "   commit:                   ${EGIT_COMMIT}"
	einfo "   branch:                   ${EGIT_BRANCH}"
	einfo "   storage directory:        \"${EGIT_DIR}\""
}

# @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_src_unpack
# @DESCRIPTION:
# src_upack function
git-2_src_unpack() {
	debug-print-function ${FUNCNAME} "$@"

	git-2_init_variables
	git-2_prepare_storedir
	git-2_fetch $@
	git-2_gc
	git-2_move_source
	git-2_branch
	git-2_submodules "${EGIT_SOURCEDIR}"
	git-2_bootstrap
	echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-22 21:07 [gentoo-dev] git-2.eclass final review Tomáš Chvátal
@ 2011-03-22 21:26 ` Mike Frysinger
  2011-03-22 22:38   ` Tomáš Chvátal
  2011-04-17  8:44 ` [gentoo-dev] " Tomá? Chvátal
  1 sibling, 1 reply; 24+ messages in thread
From: Mike Frysinger @ 2011-03-22 21:26 UTC (permalink / raw
  To: gentoo-dev; +Cc: Tomáš Chvátal

> # @BLURB: This eclass provides functions for fetch and unpack git repositories

fetching/unpacking

>	eval X="\$${PN//[-+]/_}_LIVE_REPO"
>	if [[ ${X} = "" ]]; then
>		: ${EGIT_REPO_URI:=}
>	else
>		EGIT_REPO_URI="${X}"
>	fi

X needs to be marked local, and could be condensed:
EGIT_REPO_URI=${X:-${EGIT_REPO_URI}}

the PN_LIVE_REPO override documentation is missing

same feedback for all the vars after this too

> 	git-2_fetch $@

missing quotes
-mike



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-22 21:26 ` Mike Frysinger
@ 2011-03-22 22:38   ` Tomáš Chvátal
  2011-03-22 23:08     ` Mike Frysinger
  0 siblings, 1 reply; 24+ messages in thread
From: Tomáš Chvátal @ 2011-03-22 22:38 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 22.3.2011 22:26, Mike Frysinger napsal(a):
>> # @BLURB: This eclass provides functions for fetch and unpack git repositories
> 
> fetching/unpacking

Yarp fixed.
> 
>> 	eval X="\$${PN//[-+]/_}_LIVE_REPO"
>> 	if [[ ${X} = "" ]]; then
>> 		: ${EGIT_REPO_URI:=}
>> 	else
>> 		EGIT_REPO_URI="${X}"
>> 	fi
> 
> X needs to be marked local, and could be condensed:
> EGIT_REPO_URI=${X:-${EGIT_REPO_URI}}
> 
Hopefully implemented.

> the PN_LIVE_REPO override documentation is missing
It is on purpose.
It is semisecret hack that allows you to localy bend live ebuilds
without any need for rewriting it or adding some variables (eg. reason
why we have just one live mesa ebuild and no branches based ones).

If you think this thing should be official we can document it, but i
really really think that people by default should not be aware of this.
> 
> same feedback for all the vars after this too
> 
>> 	git-2_fetch $@
> 
> missing quotes
Fixed

Handy link to gitdiff over gitweb: http://tinyurl.com/6focxa9

Thanks

Tom



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2JJM0ACgkQHB6c3gNBRYd7fQCffqyoRouirScE2B8npuhEjLEF
Hx4AnRuyyIs5OG3WnRfKgM9itydIpJdE
=Nlbz
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-22 22:38   ` Tomáš Chvátal
@ 2011-03-22 23:08     ` Mike Frysinger
  2011-03-22 23:41       ` [gentoo-dev] " Ryan Hill
                         ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Mike Frysinger @ 2011-03-22 23:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: Tomáš Chvátal

2011/3/22 Tomáš Chvátal:
> Dne 22.3.2011 22:26, Mike Frysinger napsal(a):
>>> # @BLURB: This eclass provides functions for fetch and unpack git repositories
>>
>> fetching/unpacking
>
> Yarp fixed.

well, the fix broke the blurb.  it has to be on one line.
# @BLURB: foo

> EGIT_BRANCH=${x:-${EGIT_BRANCH:=${EGIT_MASTER}}}
> EGIT_COMMIT=${x:-${EGIT_COMMIT:=${EGIT_BRANCH}}}

doesnt make much sense to use := ... it should be :-

> [[ "$#" -ne 1 ]] && die "${FUNCNAME}: requires 1 argument (path)"

quoting doesnt make much sense ... -ne compares an int, not a string

also, the error msg is a bit vague.  it should say "... requires exactly 1 ..."

> pushd "${1}" &> /dev/null
> popd &> /dev/null

do you really want to silence errors ?  normally people only send
stdout to /dev/null because of the echoed dirlist.

seems to come up in every func

> git submodule init || die "${FUNCNAME}: git submodule initialisation failed"
> git submodule sync "" die "${FUNCNAME}: git submodule sync failed"
> git submodule update || die "${FUNCNAME}: git submodule update failed"

the die strings are abit redundant ... when it fails, the output will
show "git submodule init || die", so people can easily figure out "the
git submodule init cmd failed"

> die "\"${EGIT_BOOTSTRAP}\" is not executable."

i find periods in die messages which are a single sentence to be
noise.  but maybe that's just me.

> if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then

quoting doesnt matter here since you're using [[...]]

seems to come up in a bunch of places

> local save_sandbox_write=${SANDBOX_WRITE}
> if [[ ! -d "${EGIT_STORE_DIR}" ]] ; then
> ...
>     SANDBOX_WRITE=${save_sandbox_write}
> fi

might as well have the save done inside the if statement since that's
the only place it's used

> rsync -rlpgo . "${EGIT_SOURCEDIR}" \

this means you need to have DEPEND="net-misc/rsync".  why not just use
`cp -pPR` instead ?  i vaguely recall rsync being slower than a
straight cp too ... not much point of doing a rsync when the vast
majority of the time (all the time?) the destination is empty.

> git-2_initial_clone()
> git-2_update_repo()

shouldnt EGIT_REPO_URI_SELECTED be set to "" at the start ?

> for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do

missing space after each pipe

> if [[ -n ${EGIT_BOOTSTRAP} ]] ; then
> if [[ -f ${EGIT_BOOTSTRAP} ]]; then

seems inconsistent in the whole file ... personally, i prefer the
space before the semicolon in if statements
-mike



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [gentoo-dev] Re: git-2.eclass final review
  2011-03-22 23:08     ` Mike Frysinger
@ 2011-03-22 23:41       ` Ryan Hill
  2011-03-22 23:45         ` Ryan Hill
  2011-03-22 23:55         ` Mike Frysinger
  2011-03-23  0:42       ` [gentoo-dev] " Tomáš Chvátal
  2011-04-05 15:18       ` Marc Schiffbauer
  2 siblings, 2 replies; 24+ messages in thread
From: Ryan Hill @ 2011-03-22 23:41 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

On Tue, 22 Mar 2011 19:08:53 -0400
Mike Frysinger <vapier@gentoo.org> wrote:


> > rsync -rlpgo . "${EGIT_SOURCEDIR}" \
> 
> this means you need to have DEPEND="net-misc/rsync".  why not just use
> `cp -pPR` instead ?  i vaguely recall rsync being slower than a
> straight cp too ... not much point of doing a rsync when the vast
> majority of the time (all the time?) the destination is empty.

i think i remember doing some time tests using a tar pipe at one point with
subversion.eclass that blew cp out of the water.

tar -cf - . | tar -xf - -C "${EGIT_SOURCEDIR}"

might be worth looking at.


-- 
fonts, gcc-porting,                  it makes no sense how it makes no sense
toolchain, wxwidgets                           but i'll take it free anytime
@ gentoo.org                EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [gentoo-dev] Re: git-2.eclass final review
  2011-03-22 23:41       ` [gentoo-dev] " Ryan Hill
@ 2011-03-22 23:45         ` Ryan Hill
  2011-03-22 23:55         ` Mike Frysinger
  1 sibling, 0 replies; 24+ messages in thread
From: Ryan Hill @ 2011-03-22 23:45 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]

On Tue, 22 Mar 2011 17:41:27 -0600
Ryan Hill <dirtyepic@gentoo.org> wrote:

> On Tue, 22 Mar 2011 19:08:53 -0400
> Mike Frysinger <vapier@gentoo.org> wrote:
> 
> 
> > > rsync -rlpgo . "${EGIT_SOURCEDIR}" \
> > 
> > this means you need to have DEPEND="net-misc/rsync".  why not just use
> > `cp -pPR` instead ?  i vaguely recall rsync being slower than a
> > straight cp too ... not much point of doing a rsync when the vast
> > majority of the time (all the time?) the destination is empty.
> 
> i think i remember doing some time tests using a tar pipe at one point with
> subversion.eclass that blew cp out of the water.

That's because subversion.eclass was copying over .svn directories and
then deleting them afterward, and i was using tar's --exclude instead,
nevermind.


-- 
fonts, gcc-porting,                  it makes no sense how it makes no sense
toolchain, wxwidgets                           but i'll take it free anytime
@ gentoo.org                EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-22 23:41       ` [gentoo-dev] " Ryan Hill
  2011-03-22 23:45         ` Ryan Hill
@ 2011-03-22 23:55         ` Mike Frysinger
  2011-03-23 12:28           ` James Cloos
  1 sibling, 1 reply; 24+ messages in thread
From: Mike Frysinger @ 2011-03-22 23:55 UTC (permalink / raw
  To: gentoo-dev

On Tue, Mar 22, 2011 at 7:41 PM, Ryan Hill wrote:
> On Tue, 22 Mar 2011 19:08:53 -0400 Mike Frysinger wrote:
>> > rsync -rlpgo . "${EGIT_SOURCEDIR}" \
>>
>> this means you need to have DEPEND="net-misc/rsync".  why not just use
>> `cp -pPR` instead ?  i vaguely recall rsync being slower than a
>> straight cp too ... not much point of doing a rsync when the vast
>> majority of the time (all the time?) the destination is empty.
>
> i think i remember doing some time tests using a tar pipe at one point with
> subversion.eclass that blew cp out of the water.
>
> tar -cf - . | tar -xf - -C "${EGIT_SOURCEDIR}"
>
> might be worth looking at.

ideally, the git eclass should be creating bare checkouts only in its
store dir, in which case it could use `git archive | tar` to move
things over ...
-mike



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-22 23:08     ` Mike Frysinger
  2011-03-22 23:41       ` [gentoo-dev] " Ryan Hill
@ 2011-03-23  0:42       ` Tomáš Chvátal
  2011-03-31  4:55         ` Jeroen Roovers
  2011-04-05 15:18       ` Marc Schiffbauer
  2 siblings, 1 reply; 24+ messages in thread
From: Tomáš Chvátal @ 2011-03-23  0:42 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 23.3.2011 00:08, Mike Frysinger napsal(a):
> 2011/3/22 Tomáš Chvátal:
>> Dne 22.3.2011 22:26, Mike Frysinger napsal(a):
>>>> # @BLURB: This eclass provides functions for fetch and unpack git repositories
>>>
>>> fetching/unpacking
>>
>> Yarp fixed.
> 
> well, the fix broke the blurb.  it has to be on one line.
> # @BLURB: foo
Oh damn :P
> 
>> EGIT_BRANCH=${x:-${EGIT_BRANCH:=${EGIT_MASTER}}}
>> EGIT_COMMIT=${x:-${EGIT_COMMIT:=${EGIT_BRANCH}}}
> 
> doesnt make much sense to use := ... it should be :-
Yeah it should be but still it was just copy/paste and did no harm :)
Altered :)
> 
>> [[ "$#" -ne 1 ]] && die "${FUNCNAME}: requires 1 argument (path)"
> 
> quoting doesnt make much sense ... -ne compares an int, not a string
> 
> also, the error msg is a bit vague.  it should say "... requires exactly 1 ..."
Altered
> 
>> pushd "${1}" &> /dev/null
>> popd &> /dev/null
> 
> do you really want to silence errors ?  normally people only send
> stdout to /dev/null because of the echoed dirlist.
> 
> seems to come up in every func
Yeah that does not matter that much, altered to make stderr visible again.
> 
>> git submodule init || die "${FUNCNAME}: git submodule initialisation failed"
>> git submodule sync "" die "${FUNCNAME}: git submodule sync failed"
>> git submodule update || die "${FUNCNAME}: git submodule update failed"
> 
> the die strings are abit redundant ... when it fails, the output will
> show "git submodule init || die", so people can easily figure out "the
> git submodule init cmd failed"
Well mostly nobody reads die messages but right here it is pointless.
> 
>> die "\"${EGIT_BOOTSTRAP}\" is not executable."
> 
> i find periods in die messages which are a single sentence to be
> noise.  but maybe that's just me.
Does not matter for me either. Since using both i will just stick
withoutdot for dies everywhere :)
> 
>> if [[ "${EGIT_COMMIT}" != "${EGIT_BRANCH}" ]]; then
> 
> quoting doesnt matter here since you're using [[...]]
> 
> seems to come up in a bunch of places
Yeah overquoting is my favorite thing to do during the long and boring
evenings :) removed
> 
>> local save_sandbox_write=${SANDBOX_WRITE}
>> if [[ ! -d "${EGIT_STORE_DIR}" ]] ; then
>> ...
>>     SANDBOX_WRITE=${save_sandbox_write}
>> fi
> 
> might as well have the save done inside the if statement since that's
> the only place it's used
> 
I actualy can't find any good reason why that var is defined at all.
Removed the code.

>> rsync -rlpgo . "${EGIT_SOURCEDIR}" \
> 
> this means you need to have DEPEND="net-misc/rsync".  why not just use
> `cp -pPR` instead ?  i vaguely recall rsync being slower than a
> straight cp too ... not much point of doing a rsync when the vast
> majority of the time (all the time?) the destination is empty.

Good question, i actualy dunno why i picked rsync back then instead of cp.
I would love to use git bare clones (damn submodules) and just use git
to move this crap around. cp -pPR should be equal so lets try with that
and see how much people whine around :)
> 
>> git-2_initial_clone()
>> git-2_update_repo()
> 
> shouldnt EGIT_REPO_URI_SELECTED be set to "" at the start ?
Why not :)
And found issue in die string because it said wrong variable there :)
> 
>> for x in $(git branch |grep -v "* ${EGIT_MASTER}" |tr '\n' ' '); do
> 
> missing space after each pipe
Added
> 
>> if [[ -n ${EGIT_BOOTSTRAP} ]] ; then
>> if [[ -f ${EGIT_BOOTSTRAP} ]]; then
> 
> seems inconsistent in the whole file ... personally, i prefer the
> space before the semicolon in if statements
Yerp i go with the later mostly but sometimes when i copy part statement
i get space into it. Unified.

Thanks for all the points :)

Again the diff is: http://tinyurl.com/62eb88b

Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2JQgsACgkQHB6c3gNBRYf79QCfV454YtzZD+2m7fOvFHvriDnf
0+4AnjnCA9oCwxPyzWsl8YzAI8ihXdm1
=qdu+
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-22 23:55         ` Mike Frysinger
@ 2011-03-23 12:28           ` James Cloos
  2011-03-23 13:01             ` Tomáš Chvátal
  2011-03-23 16:29             ` Donnie Berkholz
  0 siblings, 2 replies; 24+ messages in thread
From: James Cloos @ 2011-03-23 12:28 UTC (permalink / raw
  To: gentoo-dev

>>>>> "MF" == Mike Frysinger <vapier@gentoo.org> writes:

MF> ideally, the git eclass should be creating bare checkouts only in its
MF> store dir, in which case it could use `git archive | tar` to move
MF> things over ...

Or better yet, git clone.

Most builds from vcs work best when they know that they are building
from vcs.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-23 12:28           ` James Cloos
@ 2011-03-23 13:01             ` Tomáš Chvátal
  2011-03-23 14:44               ` James Cloos
  2011-03-23 16:29             ` Donnie Berkholz
  1 sibling, 1 reply; 24+ messages in thread
From: Tomáš Chvátal @ 2011-03-23 13:01 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 23.3.2011 13:28, James Cloos napsal(a):
>>>>>> "MF" == Mike Frysinger <vapier@gentoo.org> writes:
> 
> MF> ideally, the git eclass should be creating bare checkouts only in its
> MF> store dir, in which case it could use `git archive | tar` to move
> MF> things over ...
> 
> Or better yet, git clone.
> 
> Most builds from vcs work best when they know that they are building
> from vcs.
> 
> -JimC
I explained multiple times already why bare checkouts are not working in
our case.
I don't get why you guys keep repeating it like in the loop.
(I also asked for some implementation where the bare would be possible
with submodules stored in distdir, yet nobody said it is possible)

So live with it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2J7ygACgkQHB6c3gNBRYdVMACfUPxairvFmsCM+gHTODS1EhTM
W0MAoKhDAnzkuOV0HUHfrBUmcY+nPli7
=WVty
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-23 13:01             ` Tomáš Chvátal
@ 2011-03-23 14:44               ` James Cloos
  2011-03-24 12:54                 ` Donnie Berkholz
  0 siblings, 1 reply; 24+ messages in thread
From: James Cloos @ 2011-03-23 14:44 UTC (permalink / raw
  To: gentoo-dev

>>>>> "TC" == Tomáš Chvátal <scarabeus@gentoo.org> writes:

TC> I explained multiple times already why bare checkouts are not
TC> working in our case.

Wait a minute.

Not using bare clones in DISTDIR is completely unacceptable here.

It is bad enough to have to use non-bare for repos which have
submodules.  Doing so for all is b0rked.

TC> I don't get why you guys keep repeating it like in the loop.

I didn't notice that bug until you just pointed it out.  Nor did I see
any of the explanations you mention above.

TC> (I also asked for some implementation where the bare would be possible
TC> with submodules stored in distdir, yet nobody said it is possible)

TC> So live with it.

I cannot.  It makes the eclass useless.

I have almost 2 gigs of bare repo in distdirs/git-src.  

A forced re-download of all of that is just not possible!

The existing distdir clones *MUST* continue to work.

My applogies for not having looked for this kind of breakage in the new
eclass before now.  The current git eclass finally got the submodules-
vs-normal stuff worked out some time ago; the possibility of going
backwards never occurred to me.... ☹

As someone who makes heavy use of live ebuilds, someone who will be
directly and severely affected by such a change, I have to beg you
to keep the current logic for submodule-less repos.

P.S.  The kind of clone used in distdir is irrelevant to the
      fact that git-clone should be used to populate $S.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-23 12:28           ` James Cloos
  2011-03-23 13:01             ` Tomáš Chvátal
@ 2011-03-23 16:29             ` Donnie Berkholz
  2011-03-24 10:52               ` James Cloos
  1 sibling, 1 reply; 24+ messages in thread
From: Donnie Berkholz @ 2011-03-23 16:29 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On 08:28 Wed 23 Mar     , James Cloos wrote:
> >>>>> "MF" == Mike Frysinger <vapier@gentoo.org> writes:
> 
> MF> ideally, the git eclass should be creating bare checkouts only in its
> MF> store dir, in which case it could use `git archive | tar` to move
> MF> things over ...
> 
> Or better yet, git clone.

This could work well with --shared; even worked for me on separate 
partitions.

-- 
Thanks,
Donnie

Donnie Berkholz
Sr. Developer, Gentoo Linux
Blog: http://dberkholz.com

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-23 16:29             ` Donnie Berkholz
@ 2011-03-24 10:52               ` James Cloos
  0 siblings, 0 replies; 24+ messages in thread
From: James Cloos @ 2011-03-24 10:52 UTC (permalink / raw
  To: gentoo-dev

>>>>> "DB" == Donnie Berkholz <dberkholz@gentoo.org> writes:

JC> Or better yet, git clone.

DB> This could work well with --shared; even worked for me on separate 
DB> partitions.

Yes, I did mean »git clone -l -s«.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-03-23 14:44               ` James Cloos
@ 2011-03-24 12:54                 ` Donnie Berkholz
  0 siblings, 0 replies; 24+ messages in thread
From: Donnie Berkholz @ 2011-03-24 12:54 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

On 10:44 Wed 23 Mar     , James Cloos wrote:
> TC> So live with it.
> 
> I cannot.  It makes the eclass useless.
> 
> I have almost 2 gigs of bare repo in distdirs/git-src.  
> 
> A forced re-download of all of that is just not possible!
> 
> The existing distdir clones *MUST* continue to work.
> 
> My applogies for not having looked for this kind of breakage in the new
> eclass before now.  The current git eclass finally got the submodules-
> vs-normal stuff worked out some time ago; the possibility of going
> backwards never occurred to me.... ☹
> 
> As someone who makes heavy use of live ebuilds, someone who will be
> directly and severely affected by such a change, I have to beg you
> to keep the current logic for submodule-less repos.

I was discussing a couple of ideas on IRC with scarabeus yesterday but 
haven't had a chance to look into them in more detail yet:

- Providing automatic migration from the old system to the new. This is 
the simplest approach to deal with your specific problem but still 
leaves separate codepaths for submodule and non-submodule repos.

- Handling submodules in bare checkouts. Perhaps we could detect whether 
submodules are in use (need to find the right place/way in git), then 
grab them as separate bare checkouts that would eventually be cloned 
into TMPDIR by changing the repo location git looks for (again, need to 
sort out how in git).

-- 
Thanks,
Donnie

Donnie Berkholz
Sr. Developer, Gentoo Linux
Blog: http://dberkholz.com

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-23  0:42       ` [gentoo-dev] " Tomáš Chvátal
@ 2011-03-31  4:55         ` Jeroen Roovers
  2011-03-31  6:32           ` Tomáš Chvátal
  0 siblings, 1 reply; 24+ messages in thread
From: Jeroen Roovers @ 2011-03-31  4:55 UTC (permalink / raw
  To: gentoo-dev

On Wed, 23 Mar 2011 01:42:51 +0100
Tomáš Chvátal <scarabeus@gentoo.org> wrote:

> Again the diff is: http://tinyurl.com/62eb88b

Why not attach it? What the hell does that URL lead me to?


     jer



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-31  4:55         ` Jeroen Roovers
@ 2011-03-31  6:32           ` Tomáš Chvátal
  2011-03-31  7:29             ` Fabian Groffen
  2011-03-31 16:00             ` Matt Turner
  0 siblings, 2 replies; 24+ messages in thread
From: Tomáš Chvátal @ 2011-03-31  6:32 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 31.3.2011 06:55, Jeroen Roovers napsal(a):
> On Wed, 23 Mar 2011 01:42:51 +0100
> Tomáš Chvátal <scarabeus@gentoo.org> wrote:
> 
>> Again the diff is: http://tinyurl.com/62eb88b
> 
> Why not attach it? What the hell does that URL lead me to?
> 
> 
>      jer
> 

Because our git webservice allows us to do nice colorfull diffing, but
sadly that url is by default really long...?

You know since we gentoo developers usually post tinyurled porn sites
links to -dev you just can't trust anything I post here...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2UH/sACgkQHB6c3gNBRYc7/ACfTfZBFaaWZ6ttc2Yv6J9Azet7
W/cAn2K5lB390SPGh2pSDTyiCDkalxia
=N3T6
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-31  6:32           ` Tomáš Chvátal
@ 2011-03-31  7:29             ` Fabian Groffen
  2011-03-31 16:00             ` Matt Turner
  1 sibling, 0 replies; 24+ messages in thread
From: Fabian Groffen @ 2011-03-31  7:29 UTC (permalink / raw
  To: gentoo-dev

On 31-03-2011 08:32:27 +0200, Tomáš Chvátal wrote:
> Dne 31.3.2011 06:55, Jeroen Roovers napsal(a):
> > On Wed, 23 Mar 2011 01:42:51 +0100
> > Tomáš Chvátal <scarabeus@gentoo.org> wrote:
> > 
> >> Again the diff is: http://tinyurl.com/62eb88b
> > 
> > Why not attach it? What the hell does that URL lead me to?
> 
> Because our git webservice allows us to do nice colorfull diffing, but
> sadly that url is by default really long...?

Point remains that some of us have smart enough mail clients to do the
colourfull diffing based on an attached diff file inline.  As you can
understand, that is much more convenient (saves a click to another
window) and also persists in time.  Extra bonus, allows to easily reply
to it using inline comments to the diff as well, without having to load
it up in the editor first.

IOW: if you want to post an url, fine, but just include the diff in your
email please.  Thanks.


-- 
Fabian Groffen
Gentoo on a different level



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-31  6:32           ` Tomáš Chvátal
  2011-03-31  7:29             ` Fabian Groffen
@ 2011-03-31 16:00             ` Matt Turner
  2011-03-31 21:23               ` Aaron W. Swenson
  1 sibling, 1 reply; 24+ messages in thread
From: Matt Turner @ 2011-03-31 16:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Tomáš Chvátal

2011/3/31 Tomáš Chvátal <scarabeus@gentoo.org>:
> Dne 31.3.2011 06:55, Jeroen Roovers napsal(a):
>> On Wed, 23 Mar 2011 01:42:51 +0100
>> Tomáš Chvátal <scarabeus@gentoo.org> wrote:
>>
>>> Again the diff is: http://tinyurl.com/62eb88b
>>
>> Why not attach it? What the hell does that URL lead me to?
>
> Because our git webservice allows us to do nice colorfull diffing, but
> sadly that url is by default really long...?

Will the tinyurl link last forever?

Matt



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-31 16:00             ` Matt Turner
@ 2011-03-31 21:23               ` Aaron W. Swenson
  0 siblings, 0 replies; 24+ messages in thread
From: Aaron W. Swenson @ 2011-03-31 21:23 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 03/31/2011 12:00 PM, Matt Turner wrote:
> 2011/3/31 Tomáš Chvátal <scarabeus@gentoo.org>:
>> Dne 31.3.2011 06:55, Jeroen Roovers napsal(a):
>>> On Wed, 23 Mar 2011 01:42:51 +0100
>>> Tomáš Chvátal <scarabeus@gentoo.org> wrote:
>>>
>>>> Again the diff is: http://tinyurl.com/62eb88b
>>>
>>> Why not attach it? What the hell does that URL lead me to?
>>
>> Because our git webservice allows us to do nice colorfull diffing, but
>> sadly that url is by default really long...?
> 
> Will the tinyurl link last forever?
> 
> Matt
> 
Will the proper git URL last forever? (^_^)

- - Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iF4EAREIAAYFAk2U8MAACgkQCOhwUhu5AEn8xwEAvMnl3cbGVKWiUjLDe7UQelTz
zLcdbwz+BKbkfltN6VkBAJHhZCOfwZZglPqt89oBZrY7oYT3v7LyKzr2O5D/MR0u
=shYz
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] git-2.eclass final review
  2011-03-22 23:08     ` Mike Frysinger
  2011-03-22 23:41       ` [gentoo-dev] " Ryan Hill
  2011-03-23  0:42       ` [gentoo-dev] " Tomáš Chvátal
@ 2011-04-05 15:18       ` Marc Schiffbauer
  2 siblings, 0 replies; 24+ messages in thread
From: Marc Schiffbauer @ 2011-04-05 15:18 UTC (permalink / raw
  To: gentoo-dev

* Mike Frysinger schrieb am 23.03.11 um 00:08 Uhr:
> 2011/3/22 Tomáš Chvátal:
> > Dne 22.3.2011 22:26, Mike Frysinger napsal(a):
> >>> # @BLURB: This eclass provides functions for fetch and unpack git repositories
> >>
> >> fetching/unpacking
> >
> > Yarp fixed.
> 
> well, the fix broke the blurb.  it has to be on one line.
> # @BLURB: foo
> 
> > EGIT_BRANCH=${x:-${EGIT_BRANCH:=${EGIT_MASTER}}}
> > EGIT_COMMIT=${x:-${EGIT_COMMIT:=${EGIT_BRANCH}}}
> 
> doesnt make much sense to use := ... it should be :-
> 
> > [[ "$#" -ne 1 ]] && die "${FUNCNAME}: requires 1 argument (path)"
> 
> quoting doesnt make much sense ... -ne compares an int, not a string

If using [[ you never need to quote anyway.

-Marc
-- 
8AAC 5F46 83B4 DB70 8317  3723 296C 6CCA 35A6 4134



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [gentoo-dev] Re: git-2.eclass final review
  2011-03-22 21:07 [gentoo-dev] git-2.eclass final review Tomáš Chvátal
  2011-03-22 21:26 ` Mike Frysinger
@ 2011-04-17  8:44 ` Tomá? Chvátal
  2011-04-17 18:31   ` James Cloos
  1 sibling, 1 reply; 24+ messages in thread
From: Tomá? Chvátal @ 2011-04-17  8:44 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1531 bytes --]

On Tuesday 22 of March 2011 22:07:25 you wrote:
> Hi guys,
> as there are no more complaints in kde overlay i would like you to test
> your git using live ebuild with this new git-2 eclass and tell me how
> you like it.
> 
> Also usual review of what already is in is welcomed because i would
> really really like to move this thing into main tree.
> 
> Cheers
> 
> Tom
So after implementing last request to allow bare and non bare checkouts 
switching i still didn't find time to write support for bare checkouts with 
submodules. But for now it works and migration between both types works 
flawlessly.

New function is "git-2_migrate_repository".

In the attachment you can find both full eclass and patch since last review.
I would really really like to put it into main tree unless issues are 
reported/found :)

I also had to move all eclass_variable definitions out of function scope 
because they were not displayed by eclass-manpages. On that note i kinda hoped 
that from the string i written into the @DESCRIPTION there will be default 
value extracted. so maybe eclass-manpages awk could be altered? What do you 
think?

Cheers

PS: sending this from kmail so i am not sure if the sign will be ok, but for 
sure the FROM and TO lines will be encoded incorrectly :)

-- 
Tomáš Chvátal
Gentoo Linux Developer [Cluster/Council/KDE/QA/Sci/X11]
E-Mail          : scarabeus@gentoo.org
GnuPG FP        : 94A4 5CCD 85D3 DE24 FE99 F924 1C1E 9CDE 0341 4587
GnuPG ID        : 03414587


[-- Attachment #1.2: git-2.eclass --]
[-- Type: text/plain, Size: 15173 bytes --]

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @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 ${ESCM_OFFLINE} ]]; then
			debug-print "${FUNCNAME}: submodules work only in online mode"
			return 1
		fi

		[[ $# -ne 1 ]] && die "${FUNCNAME}: requires exactly 1 argument (path)"

		debug-print "${FUNCNAME}: working in \"${1}\""
		pushd "${1}" > /dev/null

		# for submodules operations we need to be online
		export GIT_DIR=${EGIT_DIR}
		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
		unset GIT_DIR

		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}"

		git-2_submodules "${EGIT_DIR}"
		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

		git-2_submodules "${EGIT_DIR}"

		# 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_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 options
	if [[ ${target} == bare ]]; then
		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
		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_move_source
	git-2_branch
	git-2_submodules "${EGIT_SOURCEDIR}"
	git-2_bootstrap
	echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
}

[-- Attachment #1.3: git-2.patch --]
[-- Type: text/x-patch, Size: 16228 bytes --]

diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass
index 5b46ec6..2e6ea90 100644
--- a/eclass/git-2.eclass
+++ b/eclass/git-2.eclass
@@ -15,9 +15,95 @@ EXPORT_FUNCTIONS src_unpack
 
 DEPEND="dev-vcs/git"
 
-# This static variable is for storing the data in WORKDIR.
-# Sometimes we might want to redefine S.
-EGIT_SOURCEDIR="${WORKDIR}/${P}"
+# @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:
@@ -29,94 +115,52 @@ git-2_init_variables() {
 
 	local x
 
-	# @ECLASS-VARIABLE: EGIT_STORE_DIR
-	# @DESCRIPTION:
-	# Storage directory for git sources.
+	: ${EGIT_SOURCEDIR="${S}"}
+
 	: ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"}
 
-	# @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES
-	# @DESCRIPTION:
-	# Set this to non-empty value to enable submodule support.
 	: ${EGIT_HAS_SUBMODULES:=}
 
-	# @ECLASS-VARIABLE: EGIT_FETCH_CMD
-	# @DESCRIPTION:
-	# Command for cloning the repository.
-	: ${EGIT_FETCH_CMD:="git clone"}
-
-	# @ECLASS-VARIABLE: EGIT_UPDATE_CMD
-	# @DESCRIPTION:
-	# Git fetch command.
-	: ${EGIT_UPDATE_CMD:="git pull -f -u"}
-
-	# @ECLASS-VARIABLE: EGIT_OPTIONS
-	# @DESCRIPTION:
-	# This variable value is passed to clone and fetch.
 	: ${EGIT_OPTIONS:=}
 
-	# @ECLASS-VARIABLE: EGIT_MASTER
-	# @DESCRIPTION:
-	# Variable for specifying master branch.
-	# Usefull when upstream don't have master branch.
 	: ${EGIT_MASTER:=master}
 
-	# @ECLASS-VARIABLE: EGIT_REPO_URI
-	# @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"
 	eval x="\$${PN//[-+]/_}_LIVE_REPO"
 	EGIT_REPO_URI=${x:-${EGIT_REPO_URI}}
 	[[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value"
 
-	# @ECLASS-VARIABLE: EVCS_OFFLINE
-	# @DESCRIPTION:
-	# Set this variable to a non-empty value to disable the automatic updating
-	# of an GIT source tree. This is intended to be set outside the git source
-	# tree by users.
 	: ${EVCS_OFFLINE:=}
 
-	# @ECLASS-VARIABLE: EGIT_BRANCH
-	# @DESCRIPTION:
-	# Specify the branch we want to check out from the repository
 	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}}}
 
-	# @ECLASS-VARIABLE: EGIT_COMMIT
-	# @DESCRIPTION:
-	# Specify commit we want to check out from the repository.
 	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}}}
 
-	# @ECLASS-VARIABLE: EGIT_REPACK
-	# @DESCRIPTION:
-	# Set to non-empty value to repack objects to save disk space. However this
-	# can take a REALLY LONG time with VERY big repositories.
 	: ${EGIT_REPACK:=}
 
-	# @ECLASS-VARIABLE: EGIT_PRUNE
-	# @DESCRIPTION:
-	# Set to non-empty value to prune loose objects on each fetch. This is
-	# useful if upstream rewinds and rebases branches often.
 	: ${EGIT_PRUNE:=}
-
 }
 
 # @FUNCTION: git-2_submodules
 # @DESCRIPTION:
-# Internal function wrapping the submodule initialisation and update
+# Internal function wrapping the submodule initialisation and update.
 git-2_submodules() {
 	debug-print-function ${FUNCNAME} "$@"
+	if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
+		if [[ -n ${ESCM_OFFLINE} ]]; then
+			debug-print "${FUNCNAME}: submodules work only in online mode"
+			return 1
+		fi
 
-	[[ $# -ne 1 ]] && die "${FUNCNAME}: requires exactly 1 argument (path)"
+		[[ $# -ne 1 ]] && die "${FUNCNAME}: requires exactly 1 argument (path)"
 
-	debug-print "${FUNCNAME}: working in \"${1}\""
-	pushd "${1}" > /dev/null
+		debug-print "${FUNCNAME}: working in \"${1}\""
+		pushd "${1}" > /dev/null
 
-	# for submodules operations we need to be online
-	if [[ -z ${EVCS_OFFLINE} && -n ${EGIT_HAS_SUBMODULES} ]]; then
+		# for submodules operations we need to be online
 		export GIT_DIR=${EGIT_DIR}
 		debug-print "${FUNCNAME}: git submodule init"
 		git submodule init || die
@@ -125,9 +169,9 @@ git-2_submodules() {
 		debug-print "${FUNCNAME}: git submodule update"
 		git submodule update || die
 		unset GIT_DIR
-	fi
 
-	popd > /dev/null
+		popd > /dev/null
+	fi
 }
 
 # @FUNCTION: git-2_branch
@@ -196,23 +240,12 @@ git-2_prepare_storedir() {
 	addwrite "${EGIT_STORE_DIR}"
 	# calculate the proper store dir for data
 	[[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}"
-	clone_dir="${EGIT_REPO_URI##*/}"
-	export EGIT_DIR="${EGIT_STORE_DIR}/${clone_dir}"
-	debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
-
-	# we can not jump between using and not using SUBMODULES so we need to
-	# refetch the source when needed
-	if [[ -d ${EGIT_DIR} && ! -d ${EGIT_DIR}/.git ]]; then
-		debug-print "${FUNCNAME}: \"${clone_dir}\" was bare copy moving..."
-		mv "${EGIT_DIR}" "${EGIT_DIR}.bare" \
-			|| die "${FUNCNAME}: Moving the bare sources failed"
-
-	fi
-	# Tell user that he can remove his bare repository. It is not used.
-	if [[ -d ${EGIT_DIR}.bare ]]; then
-		einfo "Found GIT bare repository at \"${EGIT_DIR}.bare\"."
-		einfo "This folder can be safely removed to save space."
+	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
@@ -221,16 +254,18 @@ git-2_prepare_storedir() {
 git-2_move_source() {
 	debug-print-function ${FUNCNAME} "$@"
 
+	debug-print "${FUNCNAME}: ${MOVE_COMMAND} \"${EGIT_DIR}\" \"${EGIT_SOURCEDIR}\""
 	pushd "${EGIT_DIR}" > /dev/null
-	debug-print "${FUNCNAME}: rsync -rlpgo . \"${EGIT_SOURCEDIR}\""
-	cp -pPR . "${EGIT_SOURCEDIR}" \
+	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:
-# Run initial clone on specified repo_uri
+# Internal function running initial clone on specified repo_uri.
 git-2_initial_clone() {
 	debug-print-function ${FUNCNAME} "$@"
 
@@ -238,8 +273,8 @@ git-2_initial_clone() {
 
 	EGIT_REPO_URI_SELECTED=""
 	for repo_uri in ${EGIT_REPO_URI}; do
-		debug-print "${FUNCNAME}: ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
-		${EGIT_FETCH_CMD} ${EGIT_OPTIONS} "${repo_uri}" "${EGIT_DIR}"
+		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}\""
@@ -255,18 +290,20 @@ git-2_initial_clone() {
 
 # @FUNCTION: git-2_update_repo
 # @DESCRIPTION:
-# Run update command on specified repo_uri
+# Internal function running update command on specified repo_uri.
 git-2_update_repo() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	local repo_uri
 
-	# checkout master branch and drop all other local branches
-	git checkout ${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}
-	done
+	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
@@ -274,8 +311,7 @@ git-2_update_repo() {
 		git config remote.origin.url "${repo_uri}"
 
 		debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
-		${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}\""
@@ -296,57 +332,58 @@ git-2_update_repo() {
 git-2_fetch() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	local oldsha cursha upstream_branch
+	local oldsha cursha repo_type
 
-	upstream_branch=origin/${EGIT_BRANCH}
+	[[ -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})
-		einfo "GIT NEW clone -->"
-		einfo "   repository:               ${EGIT_REPO_URI_SELECTED}"
-		einfo "   at the commit:            ${cursha}"
+		cursha=$(git rev-parse ${UPSTREAM_BRANCH})
+		echo "GIT NEW clone -->"
+		echo "   repository:               ${EGIT_REPO_URI_SELECTED}"
+		echo "   at the commit:            ${cursha}"
 
 		git-2_submodules "${EGIT_DIR}"
 		popd > /dev/null
 	elif [[ -n ${EVCS_OFFLINE} ]]; then
 		pushd "${EGIT_DIR}" > /dev/null
-		cursha=$(git rev-parse ${upstream_branch})
-		einfo "GIT offline update -->"
-		einfo "   repository:               $(git config remote.origin.url)"
-		einfo "   at the commit:            ${cursha}"
-		popd 	> /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})
+		oldsha=$(git rev-parse ${UPSTREAM_BRANCH})
 		git-2_update_repo
-		cursha=$(git rev-parse ${upstream_branch})
+		cursha=$(git rev-parse ${UPSTREAM_BRANCH})
 
 		# fetch updates
-		einfo "GIT update -->"
-		einfo "   repository:               ${EGIT_REPO_URI_SELECTED}"
+		echo "GIT update -->"
+		echo "   repository:               ${EGIT_REPO_URI_SELECTED}"
 		# write out message based on the revisions
 		if [[ "${oldsha1}" != "${cursha1}" ]]; then
-			einfo "   updating from commit:     ${oldsha}"
-			einfo "   to commit:                ${cursha}"
+			echo "   updating from commit:     ${oldsha}"
+			echo "   to commit:                ${cursha}"
 		else
-			einfo "   at the commit:            ${cursha}"
+			echo "   at the commit:            ${cursha}"
 		fi
 
 		git-2_submodules "${EGIT_DIR}"
 
 		# print nice statistic of what was changed
-		git --no-pager diff --stat ${oldsha}..${upstream_branch}
+		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} ]] \
-		&& einfo "   commit:                   ${EGIT_COMMIT}"
-	einfo "   branch:                   ${EGIT_BRANCH}"
-	einfo "   storage directory:        \"${EGIT_DIR}\""
+		&& echo "   commit:                   ${EGIT_COMMIT}"
+	echo "   branch:                   ${EGIT_BRANCH}"
+	echo "   storage directory:        \"${EGIT_DIR}\""
+	echo "   checkout type:            ${repo_type}"
 }
 
 # @FUNCTION: git_bootstrap
@@ -391,14 +428,79 @@ git-2_bootstrap() {
 	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_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 options
+	if [[ ${target} == bare ]]; then
+		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
+		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:
-# src_upack function
+# 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_move_source

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-04-17  8:44 ` [gentoo-dev] " Tomá? Chvátal
@ 2011-04-17 18:31   ` James Cloos
  2011-04-18  9:45     ` Tomáš Chvátal
  0 siblings, 1 reply; 24+ messages in thread
From: James Cloos @ 2011-04-17 18:31 UTC (permalink / raw
  To: gentoo-dev

That looks good (by inspection).

My only concern is the branch deletion in the non-bare update.

First of all, * should be escaped.  It seems to work OK with gnu grep,
but it would be better to be explicit.  (grep(1) says that only ?+{|()
loose their meta-meaning in basic regexps.)

Second, why delete the other branches at all?  I'd rather have a
complete clone.  Just the checkout ought to be enough.

Otherwise, cool.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-04-17 18:31   ` James Cloos
@ 2011-04-18  9:45     ` Tomáš Chvátal
  2011-04-18 17:55       ` James Cloos
  0 siblings, 1 reply; 24+ messages in thread
From: Tomáš Chvátal @ 2011-04-18  9:45 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 17.4.2011 20:31, James Cloos napsal(a):
> That looks good (by inspection).
> 
> My only concern is the branch deletion in the non-bare update.
> 
> First of all, * should be escaped.  It seems to work OK with gnu grep,
> but it would be better to be explicit.  (grep(1) says that only ?+{|()
> loose their meta-meaning in basic regexps.)
> 
> Second, why delete the other branches at all?  I'd rather have a
> complete clone.  Just the checkout ought to be enough.
> 
> Otherwise, cool.
> 
> -JimC
They are local clones -> they can be deleted on remote already, so we
wipe them all expect master every time unless needed.

No need to escape it if it is in "". it is parsed as the char itself
like this.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2sCBwACgkQHB6c3gNBRYddlgCfcK1sl4NKmOBWDWP9AJtEzgyw
VGEAmgLY4roHyg8+2szY/lB0B30jaZZv
=X/fM
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [gentoo-dev] Re: git-2.eclass final review
  2011-04-18  9:45     ` Tomáš Chvátal
@ 2011-04-18 17:55       ` James Cloos
  0 siblings, 0 replies; 24+ messages in thread
From: James Cloos @ 2011-04-18 17:55 UTC (permalink / raw
  To: gentoo-dev

>>>>> "TC" == Tomáš Chvátal <scarabeus@gentoo.org> writes:

TC> No need to escape it if it is in "". it is parsed as the char itself
TC> like this.

The escaping is for grep(1), not for sh(1).

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2011-04-18 17:57 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 21:07 [gentoo-dev] git-2.eclass final review Tomáš Chvátal
2011-03-22 21:26 ` Mike Frysinger
2011-03-22 22:38   ` Tomáš Chvátal
2011-03-22 23:08     ` Mike Frysinger
2011-03-22 23:41       ` [gentoo-dev] " Ryan Hill
2011-03-22 23:45         ` Ryan Hill
2011-03-22 23:55         ` Mike Frysinger
2011-03-23 12:28           ` James Cloos
2011-03-23 13:01             ` Tomáš Chvátal
2011-03-23 14:44               ` James Cloos
2011-03-24 12:54                 ` Donnie Berkholz
2011-03-23 16:29             ` Donnie Berkholz
2011-03-24 10:52               ` James Cloos
2011-03-23  0:42       ` [gentoo-dev] " Tomáš Chvátal
2011-03-31  4:55         ` Jeroen Roovers
2011-03-31  6:32           ` Tomáš Chvátal
2011-03-31  7:29             ` Fabian Groffen
2011-03-31 16:00             ` Matt Turner
2011-03-31 21:23               ` Aaron W. Swenson
2011-04-05 15:18       ` Marc Schiffbauer
2011-04-17  8:44 ` [gentoo-dev] " Tomá? Chvátal
2011-04-17 18:31   ` James Cloos
2011-04-18  9:45     ` Tomáš Chvátal
2011-04-18 17:55       ` James Cloos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox