Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: "Jonas Bernoulli" <jonas@...>
Subject: Re: Re: bzr.eclass into Portage
Date: Sun, 5 Oct 2008 22:54:23 +0200
Here is a patch that adds support for shared repositories. Since bzr
is still a bit slow this is quite useful when using multiple branches.

For example I have modified the live emacs(-cvs) ebuild to use the bzr
mirror of emacs instead of cvs. I also have my own emacs branches, and
sometimes want to install from one of these and at other times from
trunk. Without support for shared repositories this would require the
standalone branches to be manually moved out of the way everytime I
want to switch branches. (Or worse the complete tree to be checked out
from scratch every time I switch branches.)

Please consider these changes

Jonas

--- /usr/local/portage/layman/emacs/eclass/bzr.eclass	2008-10-05
22:40:18.000000000 +0200
+++ /usr/portage/eclass/bzr.eclass	2008-10-05 10:22:12.000000000 +0200
@@ -9,6 +9,7 @@
 # @DESCRIPTION:
 # The bzr.eclass provides support for apps using the bazaar DSCM
(distributed source control management system).
 # The eclass was originally derived from the git eclass.
+# Shared repository support added by Jonas Bernoulli <jonas@...>.
 #
 # Note: Just set EBZR_REPO_URI to the url of the branch and the src_unpack
 # this eclass provides will put an export of the branch in ${WORKDIR}/${PN}.
@@ -22,13 +23,23 @@
 HOMEPAGE="http://bazaar-vcs.org/"
 DESCRIPTION="Based on the ${EBZR} eclass"

-DEPEND=">=dev-util/bzr-0.92"
+DEPEND=">=dev-util/bzr-1.6"

 # @ECLASS-VARIABLE: EBZR_STORE_DIR
 # @DESCRIPTION:
 # The dir to store the bzr sources.
 EBZR_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/bzr-src"

+# @ECLASS-VARIABLE: EBZR_SHARED_REPO
+# @DESCRIPTION:
+# Whether to use a shared repository (see bzr help repositories).
+EBZR_SHARED_REPO="${EBZR_SHARED_REPO:-}"
+
+# @ECLASS-VARIABLE: EBZR_INIT_REPO_CMD
+# @DESCRIPTION:
+# The bzr command to initialize the shared repository.
+EBZR_INIT_REPO_CMD="bzr init-repo"
+
 # @ECLASS-VARIABLE: EBZR_FETCH_CMD
 # @DESCRIPTION:
 # The bzr command to fetch the sources.
@@ -54,9 +65,24 @@
 # The bzr command to list revision number of the branch.
 EBZR_REVNO_CMD="bzr revno"

+# @ECLASS-VARIABLE: EBZR_INIT_REPO_OPTS
+# @DESCRIPTION:
+# Options passed to the init-repo commands.
+EBZR_INIT_REPO_OPTS="${EBZR_INIT_REPO_OPTS:-}"
+
+# @ECLASS-VARIABLE: EBZR_FETCH_OPTS
+# @DESCRIPTION:
+# Options passed to the fetch commands in additon to EBZR_OPTIONS.
+EBZR_FETCH_OPTS="${EBZR_FETCH_OPTS:-}"
+
+# @ECLASS-VARIABLE: EBZR_UPDATE_OPTS
+# @DESCRIPTION:
+# Options passed to the update commands in additon to EBZR_OPTIONS.
+EBZR_UPDATE_OPTS="${EBZR_UPDATE_OPTS:-}"
+
 # @ECLASS-VARIABLE: EBZR_OPTIONS
 # @DESCRIPTION:
-# The options passed to the fetch and update commands.
+# The common options passed to the fetch and update commands.
 EBZR_OPTIONS="${EBZR_OPTIONS:-}"

 # @ECLASS-VARIABLE: EBZR_REPO_URI
@@ -72,7 +98,7 @@
 # 		- lp://
 # @CODE
 #
-# Note: lp = https://launchpad.net
+# Note: lp = http://launchpad.net
 EBZR_REPO_URI="${EBZR_REPO_URI:-}"

 # @ECLASS-VARIABLE: EBZR_BOOTSTRAP
@@ -93,21 +119,26 @@
 # @ECLASS-VARIABLE: EBZR_BRANCH
 # @DESCRIPTION:
 # The branch to fetch in bzr_fetch().
-#
-# default: trunk
-EBZR_BRANCH="${EBZR_BRANCH:-trunk}"
+EBZR_BRANCH="${EBZR_BRANCH:-}"

 # @ECLASS-VARIABLE: EBZR_REVISION
 # @DESCRIPTION:
 # Revision to get, if not latest (see http://bazaar-vcs.org/BzrRevisionSpec)
 EBZR_REVISION="${EBZR_REVISION:-}"

-# @ECLASS-VARIABLE: EBZR_CACHE_DIR
+# @ECLASS-VARIABLE: EBZR_CACHE_REPO_DIR
 # @DESCRIPTION:
-# The dir to store the source for the package, relative to EBZR_STORE_DIR.
+# The dir name of the local shared repository (if any).
 #
 # default: ${PN}
-EBZR_CACHE_DIR="${EBZR_CACHE_DIR:-${PN}}"
+EBZR_CACHE_REPO_DIR="${EBZR_CACHE_REPO_DIR:-}"
+
+# @ECLASS-VARIABLE: EBZR_CACHE_BRANCH_DIR
+# @DESCRIPTION:
+# The dir name of the local branch.
+#
+# default: ${EBZR_BRANCH} when using a shared repository or ${PN} otherwise
+EBZR_CACHE_BRANCH_DIR="${EBZR_CACHE_BRANCH_DIR:-}"

 # @FUNCTION: bzr_fetch
 # @DESCRIPTION:
@@ -143,37 +174,64 @@

 	cd -P "${EBZR_STORE_DIR}" || die "${EBZR}: can't chdir to ${EBZR_STORE_DIR}"

-	EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}"
-
 	addwrite "${EBZR_STORE_DIR}"
-	addwrite "${EBZR_BRANCH_DIR}"

-	debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}"
+	if [[ -n ${EBZR_SHARED_REPO} ]]; then
+		# using shared repository
+		EBZR_REPO_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_REPO_DIR:-${PN}}"
+		EBZR_BRANCH_DIR="${EBZR_REPO_DIR}/${EBZR_CACHE_BRANCH_DIR:-${EBZR_BRANCH}}"
+
+		addwrite "${EBZR_REPO_DIR}"
+	else
+		# using stand-alone branch
+		EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_BRANCH_DIR:-${PN}}"
+	fi
+
+	addwrite "${EBZR_BRANCH_DIR}"

-	local repository
+	local branch

-	if [[ ${EBZR_REPO_URI} == */* ]]; then
-		repository="${EBZR_REPO_URI}${EBZR_BRANCH}"
+	if [[ -n ${EBZR_BRANCH} ]] ; then
+		branch="${EBZR_REPO_URI}/${EBZR_BRANCH}"
 	else
-		repository="${EBZR_REPO_URI}"
+		branch="${EBZR_REPO_URI}"
+	fi
+
+	if [[ ${EBZR_SHARED_REPO} && ! -d ${EBZR_REPO_DIR} ]] ; then
+		# create shared repository
+		debug-print "${FUNCNAME}: EBZR_INIT_REPO_OPTS = ${EBZR_INIT_REPO_OPTS}"
+
+		${EBZR_INIT_REPO_CMD} ${EBZR_INIT_REPO_OPTS} ${EBZR_REPO_DIR} \
+			|| die "${EBZR}: can't initialize shared repository."
+	fi
+
+	if [[ ${EBZR_BRANCH} == */* && ! -f $(dirname ${EBZR_BRANCH}) ]]; then
+		# prepare path to branch
+		mkdir -p "${EBZR_REPO_DIR}/$(dirname ${EBZR_BRANCH})"
 	fi

 	if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then
 		# fetch branch
 		einfo "bzr branch start -->"
-		einfo "   repository: ${repository} => ${EBZR_BRANCH_DIR}"
+		einfo "   branch: ${branch} => ${EBZR_BRANCH_DIR}"
+
+		EBZR_OPTIONS="${EBZR_OPTIONS} ${EBZR_FETCH_OPTS}"
+		debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}"

-		${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repository}" "${EBZR_BRANCH_DIR}" \
-			|| die "${EBZR}: can't branch from ${repository}."
+		${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${branch}" "${EBZR_BRANCH_DIR}" \
+			|| die "${EBZR}: can't branch from ${branch}."

 	else
 		# update branch
 		einfo "bzr pull start -->"
-		einfo "   repository: ${repository}"
+		einfo "   branch: ${branch} => ${EBZR_BRANCH_DIR}"
+
+		EBZR_OPTIONS="${EBZR_OPTIONS} ${EBZR_UPDATE_OPTS}"
+		debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}"

 		cd "${EBZR_BRANCH_DIR}"
-		${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repository}" \
-			|| die "${EBZR}: can't merge from ${repository}."
+		${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${branch}" \
+			|| die "${EBZR}: can't merge from ${branch}."
 		${EBZR_DIFFSTAT_CMD}
 	fi

On Sun, Oct 5, 2008 at 7:26 PM, Ulrich Mueller <ulm@g.o> wrote:
>>>>>> On Fri, 21 Mar 2008, Christian Faulhammer wrote:
>
>> "Jorge Manuel B. S. Vicetto" <jmbsvicetto@g.o>:
>>> With the help of Ingmar we did some cleanup and added support for
>>> eclass-manpages at
>>> http://git.overlays.gentoo.org/gitweb/?p=proj/desktop-effects.git;a=blob_plain;f=eclass/bzr.eclass;hb=bzr.
>>> I'll be moving the updated eclass to the master branch, testing and
>>> asking users to try it out during this weekend.
>>> This eclass is used in the overlay for the live
>>> avant-window-navigator ebuilds, so it's probably not as used/tested
>>> as the remaining packages. It has provided us the support we needed
>>> for awn, but you might need additional features or to review existing
>>> ones. Please test the updated eclass on your overlay, feel free to
>>> maintain it and, when you think its ready, add it to the tree. When
>>> you do so, I'll remove it from our overlay and we'll use the eclass
>>> on the tree.
>
>>  We have a prior version for some time now in the Emacs overlay for
>> two live ebuilds...so we go and merge your changed (ulm already
>> did), test it and report any problems.
>
> As I just learned there are (at least) three overlays using
> bzr.eclass, namely desktop-effects, emacs, and ltsp.
>
> So I think it is justified to move bzr.eclass to the Portage tree.
> Currect version of bzr.eclass is attached.
>
> Please raise your objections *now*.
>
> Ulrich
Attachment:
bzr.eclass.patch (Binary data)
References:
bzr.eclass into Portage
-- Christian Faulhammer
Re: bzr.eclass into Portage
-- Petteri Räty
Re: bzr.eclass into Portage
-- Jorge Manuel B. S. Vicetto
Re: bzr.eclass into Portage
-- Christian Faulhammer
Re: Re: bzr.eclass into Portage
-- Jorge Manuel B. S. Vicetto
Re: bzr.eclass into Portage
-- Christian Faulhammer
Re: bzr.eclass into Portage
-- Ulrich Mueller
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: bzr.eclass into Portage
Next by thread:
Re: Re: bzr.eclass into Portage
Previous by date:
Re: EAPI-2 and src_configure in eclasses
Next by date:
"Slacking" arches - which are stable, which aren't?


Updated Jun 17, 2009

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.