From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-dev+bounces-34304-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1LYJYo-0007jh-29
	for garchives@archives.gentoo.org; Sat, 14 Feb 2009 12:23:54 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 67662E02B4;
	Sat, 14 Feb 2009 12:23:38 +0000 (UTC)
Received: from mo-p05-ob.rzone.de (mo-p05-ob.rzone.de [81.169.146.181])
	by pigeon.gentoo.org (Postfix) with ESMTP id 1CF9BE02B4
	for <gentoo-dev@lists.gentoo.org>; Sat, 14 Feb 2009 12:23:37 +0000 (UTC)
X-RZG-AUTH: :K2kKYU+nW/MMMlTokcN5Yot1/Bj/FTl+WviP6RIJci0HRMpbh/x+X6ShOQjVOj0+68LQLwoHNm8=
X-RZG-CLASS-ID: mo05
Received: from terra.solaris (p54AE4373.dip.t-dialin.net [84.174.67.115])
	by post.strato.de (klopstock mo54) (RZmta 18.18)
	with ESMTP id N0392fl1EBJ7XQ for <gentoo-dev@lists.gentoo.org>;
	Sat, 14 Feb 2009 13:23:36 +0100 (MET)
Date: Sat, 14 Feb 2009 13:21:52 +0100
From: Christian Faulhammer <fauli@gentoo.org>
To: gentoo-dev@lists.gentoo.org <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] bzr.eclass
Message-ID: <20090214132152.2aff08a0@terra.solaris>
X-Mailer: Claws Mail 3.7.0 (GTK+ 2.12.11; i686-pc-linux-gnu)
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
Mime-Version: 1.0
Content-Type: multipart/signed; boundary="Sig_/.RfRgRHc36dL=yHh+e0_0zM";
 protocol="application/pgp-signature"; micalg=PGP-SHA1
X-Archives-Salt: ca8029ca-dcbd-4a13-a017-f6e0f66a682a
X-Archives-Hash: 5bb9bc2f3756de2e5a5991ca76175410

--Sig_/.RfRgRHc36dL=yHh+e0_0zM
Content-Type: multipart/mixed; boundary="MP_/IqzYAJ0ZhSCtlcmtySjFVoC"

--MP_/IqzYAJ0ZhSCtlcmtySjFVoC
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

a user maintained a Bazaar overlay for some time now and introduced
some changes to bzr eclass, I would like to introduce into the tree.
Please review the attached patch.

V-Li

--=20
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode

<URL:http://www.faulhammer.org/>

--MP_/IqzYAJ0ZhSCtlcmtySjFVoC
Content-Type: text/x-patch
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=bzr.eclass.patch

--- /usr/portage/eclass/bzr.eclass	2008-10-25 14:17:23.000000000 +0200
+++ eclass/bzr.eclass	2009-02-13 22:54:39.000000000 +0100
@@ -6,6 +6,8 @@
 # @MAINTAINER:
 # Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>,
 # Ulrich Mueller <ulm@gentoo.org>,
+# Christian Faulhammer <fauli@gentoo.org>
+# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>,
 # and anyone who wants to help
 # @BLURB: This eclass provides support to use the Bazaar DSCM
 # @DESCRIPTION:
@@ -25,7 +27,8 @@
 HOMEPAGE=3D"http://bazaar-vcs.org/"
 DESCRIPTION=3D"Based on the ${EBZR} eclass"
=20
-DEPEND=3D">=3Ddev-util/bzr-1.5"
+DEPEND=3D">=3Ddev-util/bzr-1.5
+	dev-util/diffstat"
=20
 # @ECLASS-VARIABLE: EBZR_STORE_DIR
 # @DESCRIPTION:
@@ -35,17 +38,17 @@
 # @ECLASS-VARIABLE: EBZR_FETCH_CMD
 # @DESCRIPTION:
 # The bzr command to fetch the sources.
-EBZR_FETCH_CMD=3D"bzr branch"
+EBZR_FETCH_CMD=3D"bzr checkout --lightweight"
=20
 # @ECLASS-VARIABLE: EBZR_UPDATE_CMD
 # @DESCRIPTION:
 # The bzr command to update the sources.
-EBZR_UPDATE_CMD=3D"bzr pull"
+EBZR_UPDATE_CMD=3D"bzr update"
=20
 # @ECLASS-VARIABLE: EBZR_DIFFSTAT_CMD
 # @DESCRIPTION:
-# The bzr command to get the diffstat output.
-EBZR_DIFFSTAT_CMD=3D"bzr diff"
+# The bzr command to get the diff output.
+EBZR_DIFF_CMD=3D"bzr diff"
=20
 # @ECLASS-VARIABLE: EBZR_EXPORT_CMD
 # @DESCRIPTION:
@@ -112,12 +115,27 @@
 # default: ${PN}
 EBZR_CACHE_DIR=3D"${EBZR_CACHE_DIR:-${PN}}"
=20
+# @FUNCTION: bzr_initial_fetch
+# @DESCRIPTION:
+# Retrieves the source code from a repository for the first time, via
+# ${EBZR_FETCH_CMD}.
+bzr_initial_fetch() {
+	local repository=3D"${1}";
+	local branch_dir=3D"${2}";
+	# fetch branch
+	einfo "bzr fetch start -->"
+	einfo "   repository: ${repository} =3D> ${branch_dir}"
+
+	${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repository}" "${branch_dir}" \
+		|| die "${EBZR}: can't branch from ${repository}."
+}
+
 # @FUNCTION: bzr_fetch
 # @DESCRIPTION:
 # Wrapper function to fetch sources from bazaar via bzr fetch or bzr updat=
e,
 # depending on whether there is an existing working copy in ${EBZR_BRANCH_=
DIR}.
 bzr_fetch() {
-	local EBZR_BRANCH_DIR
+	local EBZR_BRANCH_DIR repository
=20
 	# EBZR_REPO_URI is empty.
 	[[ ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty."
@@ -151,31 +169,32 @@
=20
 	debug-print "${FUNCNAME}: EBZR_OPTIONS =3D ${EBZR_OPTIONS}"
=20
-	local repository
-
 	if [[ ${EBZR_REPO_URI} =3D=3D */* ]]; then
-		repository=3D"${EBZR_REPO_URI}${EBZR_BRANCH}"
+		repository=3D"${EBZR_REPO_URI}/${EBZR_BRANCH}"
+	elif [[ -n ${EBZR_BRANCH} ]] ; then
+		repository=3D"${EBZR_REPO_URI}/${EBZR_BRANCH}"
 	else
 		repository=3D"${EBZR_REPO_URI}"
 	fi
=20
 	if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then
-		# fetch branch
-		einfo "bzr branch start -->"
-		einfo "   repository: ${repository} =3D> ${EBZR_BRANCH_DIR}"
-
-		${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repository}" "${EBZR_BRANCH_DIR}" \
-			|| die "${EBZR}: can't branch from ${repository}."
-
+		bzr_initial_fetch "${repository}" "${EBZR_BRANCH_DIR}"
 	else
-		# update branch
-		einfo "bzr pull start -->"
-		einfo "   repository: ${repository}"
-
-		cd "${EBZR_BRANCH_DIR}"
-		${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repository}" \
-			|| die "${EBZR}: can't merge from ${repository}."
-		${EBZR_DIFFSTAT_CMD}
+		local repo_type=3D$(bzr info "${EBZR_BRANCH_DIR}" | head -n 1 | cut -d '=
(' -f 1)
+		if [[ "${repo_type}" !=3D "Lightweight checkout " ]]; then
+			einfo "Re-fetching the branch to save space..."
+			rm -rf "${EBZR_BRANCH_DIR}"
+			bzr_initial_fetch "${repository}" "${EBZR_BRANCH_DIR}"
+		else
+			# update branch
+			einfo "bzr update start -->"
+			einfo "   repository: ${repository}"
+
+			cd "${EBZR_BRANCH_DIR}"
+			${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \
+				|| die "${EBZR}: can't update from ${repository}."
+			${EBZR_DIFF_CMD} | diffstat
+		fi
 	fi
=20
 	cd "${EBZR_BRANCH_DIR}"

--MP_/IqzYAJ0ZhSCtlcmtySjFVoC--

--Sig_/.RfRgRHc36dL=yHh+e0_0zM
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkmWt2AACgkQNQqtfCuFneMzUQCdHJGTtj3G5iQ2Z/nQiDRJt1qt
hREAn0/cew/M09eKaNOJwjDoGgroGcFo
=aYcZ
-----END PGP SIGNATURE-----

--Sig_/.RfRgRHc36dL=yHh+e0_0zM--