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 ) id 1LYP7S-0007kH-Px for garchives@archives.gentoo.org; Sat, 14 Feb 2009 18:20:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0863DE03CF; Sat, 14 Feb 2009 18:20:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B561EE03CF for ; Sat, 14 Feb 2009 18:20:01 +0000 (UTC) Received: from [192.168.1.101] (bl8-211-179.dsl.telepac.pt [85.241.211.179]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 8EA28B4AC3 for ; Sat, 14 Feb 2009 18:20:00 +0000 (UTC) Message-ID: <49970B3F.40809@gentoo.org> Date: Sat, 14 Feb 2009 17:19:43 -0100 From: "Jorge Manuel B. S. Vicetto" User-Agent: Thunderbird 2.0.0.19 (X11/20090101) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] bzr.eclass References: <20090214132152.2aff08a0@terra.solaris> In-Reply-To: <20090214132152.2aff08a0@terra.solaris> X-Enigmail-Version: 0.95.7 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig79C01BB91B75E41F49CBBE7B" X-Archives-Salt: b51b0710-cb12-449b-8994-c6b793890f29 X-Archives-Hash: a756e7531902dd7de2a5b85ac5026b77 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig79C01BB91B75E41F49CBBE7B Content-Type: multipart/mixed; boundary="------------060400050701080500090808" This is a multi-part message in MIME format. --------------060400050701080500090808 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi. Christian Faulhammer wrote: > Hi, >=20 > 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. >=20 > V-Li I'm attaching a revised patch that tries to improve some issues in the current version in the tree, incorporates your changes and Peter Volkov's (pva) patch about sftp URIs. --=20 Regards, Jorge Vicetto (jmbsvicetto) - jmbsvicetto at gentoo dot org Gentoo- forums / Userrel / Devrel / SPARC / KDE --------------060400050701080500090808 Content-Type: text/x-patch; name="bzr.eclass.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="bzr.eclass.patch" Index: bzr.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/bzr.eclass,v retrieving revision 1.1 diff -u -b -B -r1.1 bzr.eclass --- bzr.eclass 25 Oct 2008 12:17:23 -0000 1.1 +++ bzr.eclass 14 Feb 2009 18:03:39 -0000 @@ -6,6 +6,8 @@ # @MAINTAINER: # Jorge Manuel B. S. Vicetto , # Ulrich Mueller , +# Christian Faulhammer +# Mark Lee , # 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: @@ -72,10 +75,10 @@ # - https:// # - sftp:// # - rsync:// -# - lp:// +# - lp: # @CODE # -# Note: lp =3D https://launchpad.net +# Note: lp: seems to be an alias to https://launchpad.net EBZR_REPO_URI=3D"${EBZR_REPO_URI:-}" =20 # @ECLASS-VARIABLE: EBZR_BOOTSTRAP @@ -112,12 +115,55 @@ # 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_update +# @DESCRIPTION: +# Updates the source code from a repository, via ${EBZR_FETCH_CMD}. +bzr_update() { + local repository=3D"${1}"; + local branch_dir=3D"${2}"; + 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}" + + pushd "${EBZR_BRANCH_DIR}" + ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \ + || die "${EBZR}: can't update from ${repository}." + ${EBZR_DIFF_CMD} | diffstat + popd + fi +} + # @FUNCTION: bzr_fetch # @DESCRIPTION: # Wrapper function to fetch sources from bazaar via bzr fetch or bzr upd= ate, # depending on whether there is an existing working copy in ${EBZR_BRANC= H_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." @@ -125,8 +171,15 @@ # check for the protocol or pull from a local repo. if [[ -z ${EBZR_REPO_URI%%:*} ]] ; then case ${EBZR_REPO_URI%%:*} in - # lp:// is https://launchpad.net - http|https|rsync|sftp|lp) + # lp: seems to be an alias to https://launchpad.net + http|https|rsync|lp) + ;; + sftp) + if ! built_with_use dev-util/bzr sftp; then + eerror "To fetch sources from ${EBZR_REPO_URI} you need sftp" + eerror "support in dev-util/bzr." + die "Please, rebuild dev-util/bzr with the sftp USE flag enabled." + fi ;; *) die "${EBZR}: fetch from ${EBZR_REPO_URI%:*} is not yet implemented.= " @@ -142,7 +195,7 @@ export SANDBOX_WRITE=3D"${SANDBOX_WRITE%%:/}" fi =20 - cd -P "${EBZR_STORE_DIR}" || die "${EBZR}: can't chdir to ${EBZR_STORE_= DIR}" + pushd "${EBZR_STORE_DIR}" || die "${EBZR}: can't chdir to ${EBZR_STORE_= DIR}" =20 EBZR_BRANCH_DIR=3D"${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}" =20 @@ -151,31 +204,18 @@ =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} + bzr_update "${repository}" "${EBZR_BRANCH_DIR}" fi =20 cd "${EBZR_BRANCH_DIR}" @@ -193,7 +233,7 @@ =20 einfo "Revision ${revision} is now in ${WORKDIR}/${P}" =20 - cd "${WORKDIR}" + popd } =20 # @FUNCTION: bzr_bootstrap @@ -202,7 +242,7 @@ bzr_bootstrap() { local patch lpatch =20 - cd "${S}" + pushd "${S}" =20 if [[ -n ${EBZR_PATCHES} ]] ; then einfo "apply patches -->" @@ -235,6 +275,8 @@ || die "${EBZR}: can't eval EBZR_BOOTSTRAP." fi fi + + popd } =20 # @FUNCTION: bzr_src_unpack --------------060400050701080500090808-- --------------enig79C01BB91B75E41F49CBBE7B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkmXC0gACgkQcAWygvVEyAIDpgCglm4wkp+ob4KIjduSlmyl/7vC 7hUAn3CmXzCBDRZdTOjb5pUFO+yOln8H =THUR -----END PGP SIGNATURE----- --------------enig79C01BB91B75E41F49CBBE7B--