From: "Jorge Manuel B. S. Vicetto" <jmbsvicetto@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] bzr.eclass
Date: Sat, 14 Feb 2009 17:19:43 -0100 [thread overview]
Message-ID: <49970B3F.40809@gentoo.org> (raw)
In-Reply-To: <20090214132152.2aff08a0@terra.solaris>
[-- Attachment #1.1: Type: text/plain, Size: 547 bytes --]
Hi.
Christian Faulhammer wrote:
> 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
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.
--
Regards,
Jorge Vicetto (jmbsvicetto) - jmbsvicetto at gentoo dot org
Gentoo- forums / Userrel / Devrel / SPARC / KDE
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: bzr.eclass.patch --]
[-- Type: text/x-patch; name="bzr.eclass.patch", Size: 6004 bytes --]
Index: bzr.eclass
===================================================================
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 <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="http://bazaar-vcs.org/"
DESCRIPTION="Based on the ${EBZR} eclass"
-DEPEND=">=dev-util/bzr-1.5"
+DEPEND=">=dev-util/bzr-1.5
+ dev-util/diffstat"
# @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="bzr branch"
+EBZR_FETCH_CMD="bzr checkout --lightweight"
# @ECLASS-VARIABLE: EBZR_UPDATE_CMD
# @DESCRIPTION:
# The bzr command to update the sources.
-EBZR_UPDATE_CMD="bzr pull"
+EBZR_UPDATE_CMD="bzr update"
# @ECLASS-VARIABLE: EBZR_DIFFSTAT_CMD
# @DESCRIPTION:
-# The bzr command to get the diffstat output.
-EBZR_DIFFSTAT_CMD="bzr diff"
+# The bzr command to get the diff output.
+EBZR_DIFF_CMD="bzr diff"
# @ECLASS-VARIABLE: EBZR_EXPORT_CMD
# @DESCRIPTION:
@@ -72,10 +75,10 @@
# - https://
# - sftp://
# - rsync://
-# - lp://
+# - lp:
# @CODE
#
-# Note: lp = https://launchpad.net
+# Note: lp: seems to be an alias to https://launchpad.net
EBZR_REPO_URI="${EBZR_REPO_URI:-}"
# @ECLASS-VARIABLE: EBZR_BOOTSTRAP
@@ -112,12 +115,55 @@
# default: ${PN}
EBZR_CACHE_DIR="${EBZR_CACHE_DIR:-${PN}}"
+# @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="${1}";
+ local branch_dir="${2}";
+
+ # fetch branch
+ einfo "bzr fetch start -->"
+ einfo " repository: ${repository} => ${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="${1}";
+ local branch_dir="${2}";
+ local repo_type=$(bzr info "${EBZR_BRANCH_DIR}" | head -n 1 | cut -d '(' -f 1)
+
+ if [[ "${repo_type}" != "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 update,
# depending on whether there is an existing working copy in ${EBZR_BRANCH_DIR}.
bzr_fetch() {
- local EBZR_BRANCH_DIR
+ local EBZR_BRANCH_DIR repository
# 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="${SANDBOX_WRITE%%:/}"
fi
- 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}"
EBZR_BRANCH_DIR="${EBZR_STORE_DIR}/${EBZR_CACHE_DIR}"
@@ -151,31 +204,18 @@
debug-print "${FUNCNAME}: EBZR_OPTIONS = ${EBZR_OPTIONS}"
- local repository
-
if [[ ${EBZR_REPO_URI} == */* ]]; then
- repository="${EBZR_REPO_URI}${EBZR_BRANCH}"
+ repository="${EBZR_REPO_URI}/${EBZR_BRANCH}"
+ elif [[ -n ${EBZR_BRANCH} ]] ; then
+ repository="${EBZR_REPO_URI}/${EBZR_BRANCH}"
else
repository="${EBZR_REPO_URI}"
fi
if [[ ! -d ${EBZR_BRANCH_DIR} ]] ; then
- # fetch branch
- einfo "bzr branch start -->"
- einfo " repository: ${repository} => ${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
cd "${EBZR_BRANCH_DIR}"
@@ -193,7 +233,7 @@
einfo "Revision ${revision} is now in ${WORKDIR}/${P}"
- cd "${WORKDIR}"
+ popd
}
# @FUNCTION: bzr_bootstrap
@@ -202,7 +242,7 @@
bzr_bootstrap() {
local patch lpatch
- cd "${S}"
+ pushd "${S}"
if [[ -n ${EBZR_PATCHES} ]] ; then
einfo "apply patches -->"
@@ -235,6 +275,8 @@
|| die "${EBZR}: can't eval EBZR_BOOTSTRAP."
fi
fi
+
+ popd
}
# @FUNCTION: bzr_src_unpack
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2009-02-14 18:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-14 12:21 [gentoo-dev] bzr.eclass Christian Faulhammer
2009-02-14 15:37 ` Ulrich Mueller
2009-02-14 16:15 ` [gentoo-dev] bzr.eclass Christian Faulhammer
2009-02-14 18:19 ` Jorge Manuel B. S. Vicetto [this message]
2009-02-15 6:49 ` [gentoo-dev] bzr.eclass Donnie Berkholz
2009-02-19 8:59 ` [gentoo-dev] bzr.eclass Christian Faulhammer
2009-02-19 9:26 ` Ulrich Mueller
2009-02-19 9:42 ` Nirbheek Chauhan
2009-02-19 15:39 ` Petteri Räty
2009-02-19 15:39 ` Nirbheek Chauhan
2009-02-19 16:01 ` Petteri Räty
2009-02-19 23:11 ` Christian Faulhammer
2009-02-20 7:00 ` Ulrich Mueller
2009-02-23 19:40 ` Christian Faulhammer
2009-02-19 8:52 ` Christian Faulhammer
2009-02-20 12:30 ` [gentoo-dev] bzr.eclass René 'Necoro' Neumann
2009-02-23 19:45 ` [gentoo-dev] bzr.eclass Christian Faulhammer
2009-02-24 12:18 ` Brian Harring
2009-03-02 7:33 ` Christian Faulhammer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49970B3F.40809@gentoo.org \
--to=jmbsvicetto@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox