From: Christian Faulhammer <fauli@gentoo.org>
To: gentoo-dev@lists.gentoo.org <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] bzr.eclass
Date: Sat, 14 Feb 2009 13:21:52 +0100 [thread overview]
Message-ID: <20090214132152.2aff08a0@terra.solaris> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 344 bytes --]
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
--
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
<URL:http://www.faulhammer.org/>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: bzr.eclass.patch --]
[-- Type: text/x-patch, Size: 3896 bytes --]
--- /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="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:
@@ -112,12 +115,27 @@
# 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_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."
@@ -151,31 +169,32 @@
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}
+ 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}"
+
+ cd "${EBZR_BRANCH_DIR}"
+ ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} \
+ || die "${EBZR}: can't update from ${repository}."
+ ${EBZR_DIFF_CMD} | diffstat
+ fi
fi
cd "${EBZR_BRANCH_DIR}"
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2009-02-14 12:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-14 12:21 Christian Faulhammer [this message]
2009-02-14 15:37 ` [gentoo-dev] bzr.eclass Ulrich Mueller
2009-02-14 16:15 ` [gentoo-dev] bzr.eclass Christian Faulhammer
2009-02-14 18:19 ` [gentoo-dev] bzr.eclass Jorge Manuel B. S. Vicetto
2009-02-15 6:49 ` 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=20090214132152.2aff08a0@terra.solaris \
--to=fauli@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