* [gentoo-dev] subversion.eclass
@ 2008-02-15 22:39 Bo Ørsted Andresen
2008-02-15 23:07 ` Donnie Berkholz
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Bo Ørsted Andresen @ 2008-02-15 22:39 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1: Type: text/plain, Size: 1008 bytes --]
For quite a while the KDE herd has had a modified version of subversion.eclass
in the kde overlay. During that time we have added the following features to
the eclass which we would like to put back in gentoo-x86 soon. Since the
changes are fairly extensive we decided to send it to this list for review
first.
1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
purpose).
2) ESVN_OFFLINE which disables svn up.
3) ESVN_UP_FREQ which uses GNU find to determine if the specified number of
hours has passed and only do svn up if it has. This is currently used in the
kde4svn-meta eclass for split kde ebuilds that use the same checkout of each
module.
4) ESCM_LOGDIR for logging which revisions packages get installed with. See
[1]. Users need to explicitly enable this feature to use it.
Other than this the eclass has been documented for use with eclass-manpages.
[1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
--
Bo Andresen
Gentoo KDE dev
[-- Attachment #1.2: subversion.eclass.patch --]
[-- Type: text/x-diff, Size: 16338 bytes --]
--- /var/repositories/gentoo/eclass/subversion.eclass 2007-07-03 10:36:11.000000000 +0200
+++ /home/bo/git/genkde4svn-dev/eclass/subversion.eclass 2008-02-15 23:27:36.000000000 +0100
@@ -1,56 +1,52 @@
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.44 2007/07/03 08:27:40 peper Exp $
+# $Header: $
-## --------------------------------------------------------------------------- #
-# Author: Akinori Hattori <hattya@gentoo.org>
+# @ECLASS: subversion.eclass
+# @MAINTAINER:
+# ???
+#
+# Original author: Akinori Hattori <hattya@gentoo.org>
+# @BLURB: The subversion eclass is written to fetch software sources from subversion repositories
+# @DESCRIPTION:
+# The subversion eclass provides functions to fetch, patch and bootstrap
+# software sources from subversion repositories.
#
-# The subversion eclass is written to fetch the software sources from
-# subversion repositories like the cvs eclass.
-#
-#
-# Description:
-# If you use this eclass, the ${S} is ${WORKDIR}/${P}.
-# It is necessary to define the ESVN_REPO_URI variable at least.
-#
-## --------------------------------------------------------------------------- #
+# You must define the ESVN_REPO_URI variable before inheriting this eclass.
inherit eutils
ESVN="subversion.eclass"
-EXPORT_FUNCTIONS src_unpack
+EXPORT_FUNCTIONS src_unpack pkg_preinst
DESCRIPTION="Based on the ${ECLASS} eclass"
-
-## -- add subversion in DEPEND
-#
DEPEND="dev-util/subversion"
-
-## -- ESVN_STORE_DIR: subversion sources store directory
-#
-ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/svn-src"
-
-
-## -- ESVN_FETCH_CMD: subversion fetch command
-#
+# @ECLASS-VARIABLE: ESVN_STORE_DIR
+# @DESCRIPTION:
+# subversion sources store directory
+ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
+
+# @ECLASS-VARIABLE: ESVN_FETCH_CMD
+# @DESCRIPTION:
+# subversion fetch command
ESVN_FETCH_CMD="svn checkout"
-## -- ESVN_UPDATE_CMD: subversion update command
-#
+# @ECLASS-VARIABLE: ESVN_UPDATE_CMD
+# @DESCRIPTION:
+# subversion update command
ESVN_UPDATE_CMD="svn update"
-
-## -- ESVN_OPTIONS:
-#
+# @ECLASS-VARIABLE: ESVN_OPTIONS:
+# @DESCRIPTION:
# the options passed to checkout or update.
-#
-: ${ESVN_OPTIONS=}
-
+ESVN_OPTIONS="${ESVN_OPTIONS:=}"
-## -- ESVN_REPO_URI: repository uri
+# @ECLASS-VARIABLE: ESVN_REPO_URI
+# @DESCRIPTION:
+# repository uri
#
# e.g. http://foo/trunk, svn://bar/trunk
#
@@ -59,11 +55,19 @@
# https://
# svn://
# svn+ssh://
-#
-: ${ESVN_REPO_URI=}
-
+ESVN_REPO_URI="${ESVN_REPO_URI:=}"
-## -- ESVN_PROJECT: project name of your ebuild (= name space)
+# @ECLASS-VARIABLE: ESVN_REVISION
+# @DESCRIPTION:
+# svn revision to fetch
+#
+# Note that if you're specifying a revision to fetch in ESVN_OPTIONS while
+# setting ESVN_REVISION, you will get an error message.
+ESVN_REVISION="${ESVN_REVISION:=}"
+
+# @ECLASS-VARIABLE: ESVN_PROJECT
+# @DESCRIPTION:
+# project name of your ebuild (= name space)
#
# subversion eclass will check out the subversion repository like:
#
@@ -82,45 +86,62 @@
# ESVN_PROJECT=commons/logging
#
# default: ${PN/-svn}.
-#
-: ${ESVN_PROJECT:=${PN/-svn}}
-
+ESVN_PROJECT="${ESVN_PROJECT:=${PN/-svn}}"
-## -- ESVN_BOOTSTRAP:
-#
+# @ECLASS-VARIABLE: ESVN_BOOTSTRAP
+# @DESCRIPTION:
# bootstrap script or command like autogen.sh or etc..
-#
-: ${ESVN_BOOTSTRAP=}
-
+ESVN_BOOTSTRAP="${ESVN_BOOTSTRAP:=}"
-## -- ESVN_PATCHES:
-#
-# subversion eclass can apply pathces in subversion_bootstrap().
+# @ECLASS-VARIABLE: ESVN_PATCHES
+# @DESCRIPTION:
+# subversion eclass can apply patches in subversion_bootstrap().
# you can use regexp in this variable like *.diff or *.patch or etc.
# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed.
#
# Patches are searched both in / and ${FILESDIR}, if not found in both locations,
# the installation dies.
-#
-: ${ESVN_PATCHES=}
-
+ESVN_PATCHES="${ESVN_PATCHES:=}"
-## -- ESVN_RESTRICT:
-#
+# @ECLASS-VARIABLE: ESVN_RESTRICT
+# @DESCRIPTION:
# this should be a space delimited list of subversion eclass features to
# restrict.
# export)
# don't export the working copy to S.
-#
-: ${ESVN_RESTRICT=}
-
+ESVN_RESTRICT="${ESVN_RESTRICT:=}"
-## -- subversion_fetch() ----------------------------------------------------- #
-#
-# @param $1 - a repository URI. default is the ESVN_REPO_URI.
-# @param $2 - a check out path in S.
-#
-function subversion_fetch() {
+# @ECLASS-VARIABLE: ESVN_OFFLINE
+# @DESCRIPTION:
+# setting this variable to a non-empty value disables the automatic updating of an svn source
+# tree. It is meant to be set outside the subversion source tree by the user.
+ESVN_OFFLINE="${ESVN_OFFLINE:=${ESCM_OFFLINE}}"
+
+# @ECLASS-VARIABLE: ESVN_UP_FREQ
+# @DESCRIPTION:
+# Set the minimum number of hours between svn up'ing in any given svn module. This is particularly
+# useful for split KDE ebuilds where we want to ensure that all submodules are compiled for the same
+# revision. It should also be kept user overrideable.
+ESVN_UP_FREQ="${ESVN_UP_FREQ:=}"
+
+# @ECLASS-VARIABLE: ESCM_LOGDIR
+# @DESCRIPTION:
+# User configuration variable. If set to a path such as e.g. /var/log/scm any
+# package inheriting from subversion.eclass will record svn revision to
+# ${CATEGORY}/${PN}.log in that path in pkg_preinst. This is not supposed to be
+# set by ebuilds/eclasses. It defaults to empty so users need to opt in.
+ESCM_LOGDIR="${ESCM_LOGDIR:=}"
+
+# @FUNCTION: subversion_fetch
+# @USAGE: [repo_uri] [destination]
+# @DESCRIPTION:
+# Wrapper function to fetch sources from subversion ( either svn checkout or svn update, depending on
+# whether we're doing an initial checkout or an incremental update ).
+#
+# Can take two optional parameters:
+# repo_uri - a repository URI. default is ESVN_REPO_URI.
+# destination - a check out path in S.
+subversion_fetch() {
local repo_uri="$(subversion__get_repository_uri "${1}")"
local S_dest="${2}"
@@ -147,7 +168,11 @@
addread "/etc/subversion"
addwrite "${ESVN_STORE_DIR}"
- if [[ ! -d "${ESVN_STORE_DIR}" ]]; then
+ if [[ ! -d ${ESVN_STORE_DIR} ]]; then
+ if [[ ${ESVN_STORE_DIR} != ${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src && \
+ ${ESVN_STORE_DIR} == ${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src* ]]; then
+ addwrite "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
+ fi
debug-print "${FUNCNAME}: initial checkout. creating subversion directory"
mkdir -p "${ESVN_STORE_DIR}" || die "${ESVN}: can't mkdir ${ESVN_STORE_DIR}."
fi
@@ -155,38 +180,59 @@
cd "${ESVN_STORE_DIR}" || die "${ESVN}: can't chdir to ${ESVN_STORE_DIR}"
local wc_path="$(subversion__get_wc_path "${repo_uri}")"
+ local revision= nosvnup=
+ [[ -n ${ESVN_REVISION} ]] && revision="-r${ESVN_REVISION}"
local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
+ debug-print "${FUNCNAME}: ESVN_REVISION = \"${ESVN_REVISION}\""
+ debug-print "${FUNCNAME}: revision = \"${revision}\""
debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
debug-print "${FUNCNAME}: options = \"${options}\""
- if [[ ! -d "${wc_path}/.svn" ]]; then
+ if [[ ! -d ${wc_path}/.svn ]]; then
# first check out
einfo "subversion check out start -->"
einfo " repository: ${repo_uri}"
- debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
+ debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${revision} ${options} ${repo_uri}"
mkdir -p "${ESVN_PROJECT}" || die "${ESVN}: can't mkdir ${ESVN_PROJECT}."
cd "${ESVN_PROJECT}" || die "${ESVN}: can't chdir to ${ESVN_PROJECT}"
- ${ESVN_FETCH_CMD} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}."
+ ${ESVN_FETCH_CMD} ${revision} ${options} "${repo_uri}" || die "${ESVN}: can't fetch from ${repo_uri}."
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
+ elif [[ -n ${ESVN_OFFLINE} ]]; then
+ subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
+ if [[ -n ${ESVN_REVISION} && ${ESVN_REVISION} != ${ESVN_WC_REVISION} ]]; then
+ die "${ESVN}: You requested off-line updating and revision ${ESVN_REVISION} but only revision ${ESVN_WC_REVISION} is available locally."
+ fi
+ einfo "Fetching disabled: Using existing repository copy"
else
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
- if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}" 1)" ]; then
+ if [[ ${ESVN_WC_URL} != $(subversion__get_repository_uri "${repo_uri}" 1) ]]; then
die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched."
fi
- # update working copy
- einfo "subversion update start -->"
- einfo " repository: ${repo_uri}"
+ if [[ -n ${ESVN_UP_FREQ} ]]; then
+ if [[ -n ${ESVN_UP_FREQ//[[:digit:]]} ]]; then
+ die "${ESVN}: ESVN_UP_FREQ must be an integer value corresponding to the minimum number of hours between svn up."
+ fi
+ if [[ -z $(find "${wc_path}/.svn/entries" -mmin "+$((ESVN_UP_FREQ*60))") ]]; then
+ nosvnup=0
+ fi
+ fi
- debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
+ if [[ -z ${nosvnup} ]]; then
+ # update working copy
+ einfo "subversion update start -->"
+ einfo " repository: ${repo_uri}"
- cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
- ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
+ debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${revision} ${options}"
+
+ cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
+ ${ESVN_UPDATE_CMD} ${revision} ${options} || die "${ESVN}: can't update from ${repo_uri}."
+ fi
fi
einfo " working copy: ${wc_path}"
@@ -205,26 +251,26 @@
echo
}
-
-## -- subversion_bootstrap() ------------------------------------------------ #
-#
-function subversion_bootstrap() {
+# @FUNCTION: subversion_bootstrap
+# @DESCRIPTION:
+# Apply patches in ${ESVN_PATCHES} and run ${ESVN_BOOTSTRAP} if specified.
+subversion_bootstrap() {
if has "export" ${ESVN_RESTRICT}; then
return
fi
cd "${S}"
- if [[ -n "${ESVN_PATCHES}" ]]; then
+ if [[ -n ${ESVN_PATCHES} ]]; then
einfo "apply patches -->"
local patch fpatch
for patch in ${ESVN_PATCHES}; do
- if [[ -f "${patch}" ]]; then
+ if [[ -f ${patch} ]]; then
epatch "${patch}"
else
for fpatch in ${FILESDIR}/${patch}; do
- if [[ -f "${fpatch}" ]]; then
+ if [[ -f ${fpatch} ]]; then
epatch "${fpatch}"
else
die "${ESVN}: ${patch} not found"
@@ -235,10 +281,10 @@
echo
fi
- if [[ -n "${ESVN_BOOTSTRAP}" ]]; then
+ if [[ -n ${ESVN_BOOTSTRAP} ]]; then
einfo "begin bootstrap -->"
- if [[ -f "${ESVN_BOOTSTRAP}" && -x "${ESVN_BOOTSTRAP}" ]]; then
+ if [[ -f ${ESVN_BOOTSTRAP} && -x ${ESVN_BOOTSTRAP} ]]; then
einfo " bootstrap with a file: ${ESVN_BOOTSTRAP}"
eval "./${ESVN_BOOTSTRAP}" || die "${ESVN}: can't execute ESVN_BOOTSTRAP."
else
@@ -248,26 +294,27 @@
fi
}
-## -- subversion_src_unpack() ------------------------------------------------ #
-#
-function subversion_src_unpack() {
+# @FUNCTION: subversion_src_unpack
+# @DESCRIPTION:
+# default src_unpack. fetch and bootstrap.
+subversion_src_unpack() {
subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
}
-
-## -- subversion_wc_info() --------------------------------------------------- #
-#
-# @param $1 - repository URI. default is ESVN_REPO_URI.
-#
-function subversion_wc_info() {
+# @FUNCTION: subversion_wc_info
+# @USAGE: [repo_uri]
+# @RETURN: ESVN_WC_URL and ESVN_WC_REVISION
+# @DESCRIPTION:
+# Get svn info for the specified repo_uri. The default repo_uri is ESVN_REPO_URI.
+subversion_wc_info() {
local repo_uri="$(subversion__get_repository_uri "${1}")"
local wc_path="$(subversion__get_wc_path "${repo_uri}")"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
debug-print "${FUNCNAME}: wc_path = ${wc_path}"
- if [[ ! -e "${wc_path}" ]]; then
+ if [[ ! -e ${wc_path} ]]; then
return 1
fi
@@ -282,10 +329,10 @@
## -- subversion__svn_info() ------------------------------------------------- #
#
-# @param $1 - a target.
-# @param $2 - a key name.
+# param $1 - a target.
+# param $2 - a key name.
#
-function subversion__svn_info() {
+subversion__svn_info() {
local target="${1}"
local key="${2}"
@@ -295,27 +342,27 @@
## -- subversion__get_repository_uri() --------------------------------------- #
#
-# @param $1 - a repository URI.
-# @param $2 - a peg revision is deleted from a return value if this is
+# param $1 - a repository URI.
+# param $2 - a peg revision is deleted from a return value if this is
# specified.
#
-function subversion__get_repository_uri() {
+subversion__get_repository_uri() {
local repo_uri="${1:-${ESVN_REPO_URI}}"
local remove_peg_revision="${2}"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
debug-print "${FUNCNAME}: remove_peg_revision = ${remove_peg_revision}"
- if [[ -z "${repo_uri}" ]]; then
+ if [[ -z ${repo_uri} ]]; then
die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty."
fi
# delete trailing slash
- if [[ -z "${repo_uri##*/}" ]]; then
+ if [[ -z ${repo_uri##*/} ]]; then
repo_uri="${repo_uri%/}"
fi
- if [[ -n "${remove_peg_revision}" ]]; then
+ if [[ -n ${remove_peg_revision} ]]; then
if subversion__has_peg_revision "${repo_uri}"; then
repo_uri="${repo_uri%@*}"
@@ -330,9 +377,9 @@
## -- subversion__get_wc_path() ---------------------------------------------- #
#
-# @param $1 - a repository URI.
+# param $1 - a repository URI.
#
-function subversion__get_wc_path() {
+subversion__get_wc_path() {
local repo_uri="$(subversion__get_repository_uri "${1}" 1)"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
@@ -343,15 +390,15 @@
## -- subversion__has_peg_revision() ----------------------------------------- #
#
-# @param $1 - a repository URI.
+# param $1 - a repository URI.
#
-function subversion__has_peg_revision() {
+subversion__has_peg_revision() {
local repo_uri="${1}"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
# repo_uri has peg revision ?
- if [[ "${repo_uri}" != *@* ]]; then
+ if [[ ${repo_uri} != *@* ]]; then
debug-print "${FUNCNAME}: repo_uri does not have a peg revision."
return 1
fi
@@ -381,8 +428,31 @@
## -- subversion__to_upper_case() ----------------------------------------- #
#
-# @param $@ - the strings to upper case.
+# param $@ - the strings to upper case.
#
-function subversion__to_upper_case() {
- echo "${@}" | tr "[a-z]" "[A-Z]"
+subversion__to_upper_case() {
+ echo "${@}" | tr "[:lower:]" "[:upper:]"
+}
+
+# @FUNCTION: subversion_pkg_preinst
+# @DESCRIPTION:
+# Log the svn revision of source code. Doing this in pkg_preinst because we
+# want the logs to stick around if packages are uninstalled without messing with
+# config protection.
+subversion_pkg_preinst() {
+ local pkgdate=$(date "+%Y%m%d %H:%M:%S")
+ subversion_wc_info
+ if [[ -n ${ESCM_LOGDIR} ]]; then
+ local dir="${ROOT}/${ESCM_LOGDIR}/${CATEGORY}"
+ if [[ ! -d ${dir} ]]; then
+ mkdir -p "${dir}" || \
+ eerror "Failed to create '${dir}' for logging svn revision to '${PORTDIR_SCM}'"
+ fi
+ local logmessage="svn: ${pkgdate} - ${PF}:${SLOT} was merged at revision ${ESVN_WC_REVISION}"
+ if [[ -d ${dir} ]]; then
+ echo "${logmessage}" >> "${dir}/${PN}.log"
+ else
+ eerror "Could not log the message '${logmessage}' to '${dir}/${PN}.log'"
+ fi
+ fi
}
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-15 22:39 [gentoo-dev] subversion.eclass Bo Ørsted Andresen
@ 2008-02-15 23:07 ` Donnie Berkholz
2008-02-16 0:05 ` Bernd Steinhauser
2008-02-15 23:40 ` Doug Klima
2008-02-19 20:06 ` Doug Klima
2 siblings, 1 reply; 12+ messages in thread
From: Donnie Berkholz @ 2008-02-15 23:07 UTC (permalink / raw
To: gentoo-dev
On 23:39 Fri 15 Feb , Bo Ørsted Andresen wrote:
> For quite a while the KDE herd has had a modified version of subversion.eclass
> in the kde overlay. During that time we have added the following features to
> the eclass which we would like to put back in gentoo-x86 soon. Since the
> changes are fairly extensive we decided to send it to this list for review
> first.
>
> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
> purpose).
> 2) ESVN_OFFLINE which disables svn up.
> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified number of
> hours has passed and only do svn up if it has. This is currently used in the
> kde4svn-meta eclass for split kde ebuilds that use the same checkout of each
> module.
> 4) ESCM_LOGDIR for logging which revisions packages get installed with. See
> [1]. Users need to explicitly enable this feature to use it.
>
> Other than this the eclass has been documented for use with eclass-manpages.
>
> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
Some of these features seem like they should get pushed up into a
generic framework for all SCMs like scm.eclass.
Thanks,
Donnie
--
gentoo-dev@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-15 23:07 ` Donnie Berkholz
@ 2008-02-16 0:05 ` Bernd Steinhauser
0 siblings, 0 replies; 12+ messages in thread
From: Bernd Steinhauser @ 2008-02-16 0:05 UTC (permalink / raw
To: gentoo-dev
Donnie Berkholz schrieb:
> On 23:39 Fri 15 Feb , Bo Ørsted Andresen wrote:
>> For quite a while the KDE herd has had a modified version of
>> subversion.eclass
>> in the kde overlay. During that time we have added the following
>> features to
>> the eclass which we would like to put back in gentoo-x86 soon. Since the
>> changes are fairly extensive we decided to send it to this list for
>> review
>> first.
>>
>> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
>> purpose).
>> 2) ESVN_OFFLINE which disables svn up.
>> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified
>> number of
>> hours has passed and only do svn up if it has. This is currently used
>> in the
>> kde4svn-meta eclass for split kde ebuilds that use the same checkout
>> of each
>> module.
>> 4) ESCM_LOGDIR for logging which revisions packages get installed
>> with. See
>> [1]. Users need to explicitly enable this feature to use it.
>>
>> Other than this the eclass has been documented for use with
>> eclass-manpages.
>>
>> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
>
> Some of these features seem like they should get pushed up into a
> generic framework for all SCMs like scm.eclass.
>
> Thanks,
> Donnie
I'm already working on git.eclass. I've got some nice ideas for that one
(or should
I say, ideas, that I would want in it? ;-)).
But I don't think, that they would benifit from a generic framework,
since it's just
a few lines anyway and since every scm is somewhat different, maybe it
would blow
up the generic thing.
Regards,
Bernd
--
gentoo-dev@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-15 22:39 [gentoo-dev] subversion.eclass Bo Ørsted Andresen
2008-02-15 23:07 ` Donnie Berkholz
@ 2008-02-15 23:40 ` Doug Klima
2008-02-16 0:11 ` Bernd Steinhauser
2008-02-16 0:11 ` Bo Ørsted Andresen
2008-02-19 20:06 ` Doug Klima
2 siblings, 2 replies; 12+ messages in thread
From: Doug Klima @ 2008-02-15 23:40 UTC (permalink / raw
To: gentoo-dev
Bo Ørsted Andresen wrote:
> For quite a while the KDE herd has had a modified version of subversion.eclass
> in the kde overlay. During that time we have added the following features to
> the eclass which we would like to put back in gentoo-x86 soon. Since the
> changes are fairly extensive we decided to send it to this list for review
> first.
>
> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
> purpose).
ESVN_REPO_URI is a standard subversion URI and as such supports @HEAD,
@BASE, @COMMITTED, @PREV and @REV. So this is unnecessary.
> 2) ESVN_OFFLINE which disables svn up.
Isn't this a bit of a hack? The point is for it to run svn up. Now I've
added support in a local refactor that I had started today that if the
working copy's revision matches the requested revision, that no svn up
is performed. Obviously the situation when you have a "live" SVN ebuild
would still result in an svn up, but then again "live" SVN ebuilds are
frowned upon and if the person is trying to emerge a "live" SVN ebuild I
would expect them to always get the latest version.
> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified number of
> hours has passed and only do svn up if it has. This is currently used in the
> kde4svn-meta eclass for split kde ebuilds that use the same checkout of each
> module.
This would be handled by the feature above.
> 4) ESCM_LOGDIR for logging which revisions packages get installed with. See
> [1]. Users need to explicitly enable this feature to use it.
This seems like it belongs in a generic SCM framework/eclass that all
SCM eclasses can support.
However, I personally like to handle this with two different situations.
emerge --info pkg, where the pkg installs a file to
/usr/share/${PN}/revision that stores the revision used and emerge
--info reads out that info. This is only for "live" SVN ebuilds. I don't
have any as an example currently.
The other solution is the way I do this with mythtv. For example,
mythtv-0.21_pre15768 checks out trunk revision 15768. This way the
revision is part of the version of the package and it's always known.
Additionally the changes I've been working on address the 5 outstanding
bugs found in Bugzilla and also remove some unnecessary and unused
functionality found in the eclass.
I had actually planned on providing the eclass on the ML later tonight
when I had it complete.
Since I have a feeling my changes or suggestions won't jive with the kde
herd, I'll offer mine up as svn.eclass
--
Doug Klima <cardoe@gentoo.org>
http://dev.gentoo.org/~cardoe/
--
gentoo-dev@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-15 23:40 ` Doug Klima
@ 2008-02-16 0:11 ` Bernd Steinhauser
2008-02-16 0:28 ` Doug Klima
2008-02-16 0:11 ` Bo Ørsted Andresen
1 sibling, 1 reply; 12+ messages in thread
From: Bernd Steinhauser @ 2008-02-16 0:11 UTC (permalink / raw
To: gentoo-dev
Doug Klima schrieb:
>> 2) ESVN_OFFLINE which disables svn up.
>
> Isn't this a bit of a hack? The point is for it to run svn up. Now
> I've added support in a local refactor that I had started today that
> if the working copy's revision matches the requested revision, that no
> svn up is performed. Obviously the situation when you have a "live"
> SVN ebuild would still result in an svn up, but then again "live" SVN
> ebuilds are frowned upon and if the person is trying to emerge a
> "live" SVN ebuild I would expect them to always get the latest version.
What, if
- the server containing the repository doesn't respond?
- there is currently no connection to update but you need to remerge
because of new useflags added (or similar)?
In both cases with a normal merge it will die when trying to do svn up.
Of course with 1) you could hack around
that and specify the last revision in the repository, which btw. did a
svn up, too, but this was changed today.
Regards,
Bernd
--
gentoo-dev@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-16 0:11 ` Bernd Steinhauser
@ 2008-02-16 0:28 ` Doug Klima
0 siblings, 0 replies; 12+ messages in thread
From: Doug Klima @ 2008-02-16 0:28 UTC (permalink / raw
To: gentoo-dev
Bernd Steinhauser wrote:
> Doug Klima schrieb:
>>> 2) ESVN_OFFLINE which disables svn up.
>> Isn't this a bit of a hack? The point is for it to run svn up. Now
>> I've added support in a local refactor that I had started today that
>> if the working copy's revision matches the requested revision, that no
>> svn up is performed. Obviously the situation when you have a "live"
>> SVN ebuild would still result in an svn up, but then again "live" SVN
>> ebuilds are frowned upon and if the person is trying to emerge a
>> "live" SVN ebuild I would expect them to always get the latest version.
> What, if
> - the server containing the repository doesn't respond?
> - there is currently no connection to update but you need to remerge
> because of new useflags added (or similar)?
> In both cases with a normal merge it will die when trying to do svn up.
> Of course with 1) you could hack around
> that and specify the last revision in the repository, which btw. did a
> svn up, too, but this was changed today.
>
> Regards,
> Bernd
I actually re-evaluated this after I sent that e-mail and changed it to
behave like cvs.eclass. Basically if you set ESVN_REPO_URI=offline, then
it'll assume you've got the revision you already want.
--
Doug Klima <cardoe@gentoo.org>
http://dev.gentoo.org/~cardoe/
--
gentoo-dev@lists.gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-15 23:40 ` Doug Klima
2008-02-16 0:11 ` Bernd Steinhauser
@ 2008-02-16 0:11 ` Bo Ørsted Andresen
1 sibling, 0 replies; 12+ messages in thread
From: Bo Ørsted Andresen @ 2008-02-16 0:11 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2264 bytes --]
On Saturday 16 February 2008 00:40:31 Doug Klima wrote:
> > For quite a while the KDE herd has had a modified version of
> > subversion.eclass in the kde overlay. During that time we have added the
> > following features to the eclass which we would like to put back in
> > gentoo-x86 soon. Since the changes are fairly extensive we decided to
> > send it to this list for review first.
> >
> > 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
> > purpose).
>
> ESVN_REPO_URI is a standard subversion URI and as such supports @HEAD,
> @BASE, @COMMITTED, @PREV and @REV. So this is unnecessary.
The idea is that users can set ESVN_REVISION in the environment without having
to modify the ebuilds. This isn't really possible with appending it to
ESVN_REPO_URI.
> > 2) ESVN_OFFLINE which disables svn up.
>
> Isn't this a bit of a hack? The point is for it to run svn up. Now I've
> added support in a local refactor that I had started today that if the
> working copy's revision matches the requested revision, that no svn up
> is performed. Obviously the situation when you have a "live" SVN ebuild
> would still result in an svn up, but then again "live" SVN ebuilds are
> frowned upon and if the person is trying to emerge a "live" SVN ebuild I
> would expect them to always get the latest version.
Same as above. It's a convenience for users of live ebuilds which enables them
to rebuild a package even when they don't have network without having to look
up the revision of every packages that is currently available.
> > 3) ESVN_UP_FREQ which uses GNU find to determine if the specified number
> > of hours has passed and only do svn up if it has. This is currently used
> > in the kde4svn-meta eclass for split kde ebuilds that use the same
> > checkout of each module.
>
> This would be handled by the feature above.
How?
> > 4) ESCM_LOGDIR for logging which revisions packages get installed with.
> > See [1]. Users need to explicitly enable this feature to use it.
>
> This seems like it belongs in a generic SCM framework/eclass that all
> SCM eclasses can support.
Not opposed to that. But what would that scm eclass do exactly?
> [...]
--
Bo Andresen
Gentoo KDE dev
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-15 22:39 [gentoo-dev] subversion.eclass Bo Ørsted Andresen
2008-02-15 23:07 ` Donnie Berkholz
2008-02-15 23:40 ` Doug Klima
@ 2008-02-19 20:06 ` Doug Klima
2008-02-19 21:37 ` Doug Klima
2 siblings, 1 reply; 12+ messages in thread
From: Doug Klima @ 2008-02-19 20:06 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
Bo Ørsted Andresen wrote:
> For quite a while the KDE herd has had a modified version of subversion.eclass
> in the kde overlay. During that time we have added the following features to
> the eclass which we would like to put back in gentoo-x86 soon. Since the
> changes are fairly extensive we decided to send it to this list for review
> first.
>
> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
> purpose).
> 2) ESVN_OFFLINE which disables svn up.
> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified number of
> hours has passed and only do svn up if it has. This is currently used in the
> kde4svn-meta eclass for split kde ebuilds that use the same checkout of each
> module.
> 4) ESCM_LOGDIR for logging which revisions packages get installed with. See
> [1]. Users need to explicitly enable this feature to use it.
>
> Other than this the eclass has been documented for use with eclass-manpages.
>
> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
>
>
ok. Well zlin and I have been talking lately and we've hammered out his
proposed changes and mine. I'm attaching a patch for the first set of
changes I have proposed.
Attached is a patch for the following:
- use $ECLASS
- adding rsync to deps
- fixing some quoting
- remove multiple subshell calls and problematic to upper usage (bug #s
escape me right now)
- provide some more information about the working copy that will be used
in the future.
- supporting svn switch
The most important being the svn switch functionality.
Please review for commit.
[-- Attachment #2: subversion-cleanups-01.patch --]
[-- Type: text/x-patch, Size: 2699 bytes --]
--- /usr/portage/eclass/subversion.eclass 2008-02-17 03:06:00.000000000 -0500
+++ subversion.eclass 2008-02-18 17:11:52.000000000 -0500
@@ -17,17 +17,16 @@
inherit eutils
-ESVN="subversion.eclass"
+ESVN=$ECLASS
EXPORT_FUNCTIONS src_unpack
DESCRIPTION="Based on the ${ECLASS} eclass"
-
## -- add subversion in DEPEND
#
-DEPEND="dev-util/subversion"
-
+DEPEND="dev-util/subversion
+ net-misc/rsync"
## -- ESVN_STORE_DIR: subversion sources store directory
#
@@ -42,6 +41,10 @@
#
ESVN_UPDATE_CMD="svn update"
+## -- ESVN_SWITCH_CMD: subversion switch command
+#
+ESVN_SWITCH_CMD="svn switch"
+
## -- ESVN_OPTIONS:
#
@@ -143,7 +146,7 @@
svn|svn+ssh)
;;
*)
- die "${ESVN}: fetch from "${protocol}" is not yet implemented."
+ die "${ESVN}: fetch from \"${protocol}\" is not yet implemented."
;;
esac
@@ -180,17 +183,24 @@
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}" 1)" ]; then
- die "${ESVN}: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched."
- fi
+ einfo "subversion switch start -->"
+ einfo " old repository: ${ESVN_WC_URL}"
+ einfo " new repository: ${repo_uri}"
- # update working copy
- einfo "subversion update start -->"
- einfo " repository: ${repo_uri}"
+ debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options}"
- debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
+ cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
+ ${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't switch to ${repo_uri}."
+ else
+ # update working copy
+ einfo "subversion update start -->"
+ einfo " repository: ${repo_uri}"
- cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
- ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
+ debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
+
+ cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
+ ${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
+ fi
fi
@@ -299,12 +309,10 @@
return 1
fi
- local k
-
- for k in url revision; do
- export ESVN_WC_$(subversion__to_upper_case "${k}")="$(subversion__svn_info "${wc_path}" "${k}")"
- done
-
+ export ESVN_WC_URL="$(subversion__svn_info "${wc_path}" "URL")"
+ export ESVN_WC_ROOT="$(subversion__svn_info "${wc_path}" "Repository Root")"
+ export ESVN_WC_UUID="$(subversion__svn_info "${wc_path}" "Repository UUID")"
+ export ESVN_WC_REVISION="$(subversion__svn_info "${wc_path}" "Revision")"
export ESVN_WC_PATH="${wc_path}"
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-19 20:06 ` Doug Klima
@ 2008-02-19 21:37 ` Doug Klima
2008-02-20 16:10 ` Doug Klima
0 siblings, 1 reply; 12+ messages in thread
From: Doug Klima @ 2008-02-19 21:37 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]
Doug Klima wrote:
> Bo Ørsted Andresen wrote:
>> For quite a while the KDE herd has had a modified version of
>> subversion.eclass in the kde overlay. During that time we have added
>> the following features to the eclass which we would like to put back
>> in gentoo-x86 soon. Since the changes are fairly extensive we decided
>> to send it to this list for review first.
>>
>> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for this
>> purpose).
>> 2) ESVN_OFFLINE which disables svn up.
>> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified
>> number of hours has passed and only do svn up if it has. This is
>> currently used in the kde4svn-meta eclass for split kde ebuilds that
>> use the same checkout of each module.
>> 4) ESCM_LOGDIR for logging which revisions packages get installed
>> with. See [1]. Users need to explicitly enable this feature to use it.
>>
>> Other than this the eclass has been documented for use with
>> eclass-manpages.
>>
>> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
>>
>>
> ok. Well zlin and I have been talking lately and we've hammered out
> his proposed changes and mine. I'm attaching a patch for the first set
> of changes I have proposed.
>
> Attached is a patch for the following:
> - use $ECLASS
> - adding rsync to deps
> - fixing some quoting
> - remove multiple subshell calls and problematic to upper usage (bug
> #s escape me right now)
> - provide some more information about the working copy that will be
> used in the future.
> - supporting svn switch
>
> The most important being the svn switch functionality.
>
> Please review for commit.
And the eclass-manpages documentation broken out into it's own patch.
Please review for commit.
[-- Attachment #2: subversion-manpage-02.patch --]
[-- Type: text/x-patch, Size: 5818 bytes --]
--- subversion.eclass 2008-02-19 14:35:10.000000000 -0500
+++ subversion-2.eclass 2008-02-19 16:34:15.000000000 -0500
@@ -2,18 +2,18 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/subversion.eclass,v 1.45 2008/02/17 07:59:06 hattya Exp $
-## --------------------------------------------------------------------------- #
-# Author: Akinori Hattori <hattya@gentoo.org>
+# @ECLASS: subversion.eclass
+# @MAINTAINER:
+# Akinori Hattori <hattya@gentoo.org>
+# Doug Klima <cardoe@gentoo.org>
+#
+# Original Author: Akinori Hattori <hattya@gentoo.org>
+# @BLURB: The subversion eclass is used to fetch sources from subversion repos
+# @DESCRIPTION:
+# The subversion eclass provides functions to fetch (checkout, update, and
+# switch), patch and bootstrap sources from subversion repositories.
#
-# The subversion eclass is written to fetch the software sources from
-# subversion repositories like the cvs eclass.
-#
-#
-# Description:
-# If you use this eclass, the ${S} is ${WORKDIR}/${P}.
-# It is necessary to define the ESVN_REPO_URI variable at least.
-#
-## --------------------------------------------------------------------------- #
+# You must define ESVN_REPO_URI before inheriting this eclass.
inherit eutils
@@ -23,39 +23,47 @@
DESCRIPTION="Based on the ${ECLASS} eclass"
-## -- add subversion in DEPEND
+## -- add subversion and rsync in DEPEND
#
DEPEND="dev-util/subversion
net-misc/rsync"
-## -- ESVN_STORE_DIR: subversion sources store directory
-#
+# @ECLASS-VARIABLE: ESVN_STORE_DIR
+# @DESCRIPTION:
+# subversion sources store directory. Users may overright this by defining this
+# variable in /etc/make.conf
[ -z "${ESVN_STORE_DIR}" ] && ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src"
-## -- ESVN_FETCH_CMD: subversion fetch command
+# @ECLASS-VARIABLE: ESVN_FETCH_CMD
+# @DESCRIPTION:
+# subversion checkout command
#
ESVN_FETCH_CMD="svn checkout"
-## -- ESVN_UPDATE_CMD: subversion update command
-#
+# @ECLASS-VARIABLE: ESVN_UPDATE_CMD
+# @DESCRIPTION:
+# subversion update command
ESVN_UPDATE_CMD="svn update"
-## -- ESVN_SWITCH_CMD: subversion switch command
-#
+# @ECLASS-VARIABLE: ESVN_SWITCH_CMD
+# @DESCRIPTION:
+# subversion switch command
ESVN_SWITCH_CMD="svn switch"
-## -- ESVN_OPTIONS:
-#
-# the options passed to checkout or update.
-#
+# @ECLASS-VARIABLE: ESVN_OPTIONS
+# @DESCRIPTION:
+# the options passed to checkout, update or switch.
+# Not meant for -r REV, see ESVN_REPO_URI
: ${ESVN_OPTIONS:=}
-## -- ESVN_REPO_URI: repository uri
+# @ECLASS-VARIABLE: ESVN_REPO_URI
+# @DESCRIPTION:
+# repository uri
#
-# e.g. http://foo/trunk, svn://bar/trunk
+# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234
#
# supported protocols:
# http://
@@ -63,10 +71,14 @@
# svn://
# svn+ssh://
#
+# to peg to a specific revision, append @REV to the repo's uri
+#
: ${ESVN_REPO_URI:=}
-## -- ESVN_PROJECT: project name of your ebuild (= name space)
+# @ECLASS-VARIABLE: ESVN_PROJECT
+# @DESCRIPTION:
+# project name of your ebuild (= name space)
#
# subversion eclass will check out the subversion repository like:
#
@@ -89,15 +101,15 @@
: ${ESVN_PROJECT:=${PN/-svn}}
-## -- ESVN_BOOTSTRAP:
-#
+# @ECLASS-VARIABLE: ESVN_BOOTSTRAP
+# @DESCRIPTION:
# bootstrap script or command like autogen.sh or etc..
#
: ${ESVN_BOOTSTRAP:=}
-## -- ESVN_PATCHES:
-#
+# @ECLASS-VARIABLE: ESVN_PATCHES
+# @DESCRIPTION:
# subversion eclass can apply pathces in subversion_bootstrap().
# you can use regexp in this variable like *.diff or *.patch or etc.
# NOTE: patches will be applied before ESVN_BOOTSTRAP is processed.
@@ -110,8 +122,8 @@
: ${ESVN_PATCHES:=}
-## -- ESVN_RESTRICT:
-#
+# @ECLASS-VARIABLE: ESVN_RESTRICT
+# @DESCRIPTION:
# this should be a space delimited list of subversion eclass features to
# restrict.
# export)
@@ -120,10 +132,14 @@
: ${ESVN_RESTRICT:=}
-## -- subversion_fetch() ----------------------------------------------------- #
+# @FUNCTION: subversion_fetch
+# @USAGE: [repo_uri] [destination]
+# @DESCRIPTION:
+# Function to fetch sources from subversion via svn checkout, svn update, or
+# svn switch, depending on if have a working copy in $ESVN_STORE_DIR
#
-# @param $1 - a repository URI. default is the ESVN_REPO_URI.
-# @param $2 - a check out path in S.
+# repo_uri - a repository URI. default is the ESVN_REPO_URI.
+# destination - a check out path in S.
#
function subversion_fetch() {
@@ -222,8 +238,9 @@
}
-## -- subversion_bootstrap() ------------------------------------------------ #
-#
+# @ECLASS-VARIABLE: subversion_bootstrap
+# @DESCRIPTION:
+# Apply patches from $ESVN_PATCHES and run $ESVN_BOOTSTRAP as specified
function subversion_bootstrap() {
if has "export" ${ESVN_RESTRICT}; then
@@ -275,8 +292,9 @@
}
-## -- subversion_src_unpack() ------------------------------------------------ #
-#
+# @FUNCTION: subversion_src_unpack
+# @DESCRIPTION:
+# default src-Unpack. fetches and bootstraps
function subversion_src_unpack() {
subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
@@ -285,18 +303,13 @@
}
-## -- subversion_wc_info() --------------------------------------------------- #
-#
+# @FUNCTION: subversion_wc_info
+# @USAGE: [repo_uri]
+# @DESCRIPTION:
# the working copy information on the specified repository URI are set to
# ESVN_WC_* variables.
-#
-# the available variables:
-# ESVN_WC_URL
-# ESVN_WC_REVISION
-# ESVN_WC_PATH
-#
-# @param $1 - repository URI. default is ESVN_REPO_URI.
-#
+# @RETURN: ESVN_WC_URL, ESVN_WC_ROOT, ESVN_WC_UUID, ESVN_WC_REVISION, and
+# ESVN_WC_PATH
function subversion_wc_info() {
local repo_uri="$(subversion__get_repository_uri "${1}")"
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-19 21:37 ` Doug Klima
@ 2008-02-20 16:10 ` Doug Klima
2008-02-20 16:20 ` Doug Klima
0 siblings, 1 reply; 12+ messages in thread
From: Doug Klima @ 2008-02-20 16:10 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]
Doug Klima wrote:
> Doug Klima wrote:
>> Bo Ørsted Andresen wrote:
>>> For quite a while the KDE herd has had a modified version of
>>> subversion.eclass in the kde overlay. During that time we have added
>>> the following features to the eclass which we would like to put back
>>> in gentoo-x86 soon. Since the changes are fairly extensive we
>>> decided to send it to this list for review first.
>>>
>>> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for
>>> this purpose).
>>> 2) ESVN_OFFLINE which disables svn up.
>>> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified
>>> number of hours has passed and only do svn up if it has. This is
>>> currently used in the kde4svn-meta eclass for split kde ebuilds that
>>> use the same checkout of each module.
>>> 4) ESCM_LOGDIR for logging which revisions packages get installed
>>> with. See [1]. Users need to explicitly enable this feature to use it.
>>>
>>> Other than this the eclass has been documented for use with
>>> eclass-manpages.
>>>
>>> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
>>>
>>>
>> ok. Well zlin and I have been talking lately and we've hammered out
>> his proposed changes and mine. I'm attaching a patch for the first
>> set of changes I have proposed.
>>
>> Attached is a patch for the following:
>> - use $ECLASS
>> - adding rsync to deps
>> - fixing some quoting
>> - remove multiple subshell calls and problematic to upper usage (bug
>> #s escape me right now)
>> - provide some more information about the working copy that will be
>> used in the future.
>> - supporting svn switch
>>
>> The most important being the svn switch functionality.
>>
>> Please review for commit.
> And the eclass-manpages documentation broken out into it's own patch.
>
> Please review for commit.
Here's a patch that implements the ESVN_REVISION variable. It finally
removes all the problematic to_upper usage. It builds off the previous
patches that make the official way for an ebuild to pass the revision it
wants via the ESVN_REPO_URI. It ewarn's if an ebuild tries to stick a
revision into ESVN_OPTIONS. It prints out the revision that it's going
to be pulling. This was the issue I had with zlin's original patch since
it would break for the MythTV ebuilds since we request the revision in
the ebuild.
[-- Attachment #2: subversion-revision-03.patch --]
[-- Type: text/x-patch, Size: 5265 bytes --]
--- subversion-2.eclass 2008-02-19 16:34:15.000000000 -0500
+++ subversion-3.eclass 2008-02-20 11:07:57.000000000 -0500
@@ -75,6 +75,14 @@
#
: ${ESVN_REPO_URI:=}
+# @ECLASS-VARIABLE: ESVN_REVISION
+# @DESCRIPTION:
+# user configurable revision to use from the repo
+#
+# useful for live svn or trunk svn ebuilds to allow pegging to
+# a specific revision
+: ${ESVN_REVISION:=}
+
# @ECLASS-VARIABLE: ESVN_PROJECT
# @DESCRIPTION:
@@ -143,9 +151,14 @@
#
function subversion_fetch() {
- local repo_uri="$(subversion__get_repository_uri "${1}")"
+ local repo_uri="$(subversion__get_repository_uri "${1:-${ESVN_REPO_URI}}")"
+ local revision="$(subversion__get_peg_revision "${1:-${ESVN_REPO_URI}}")"
local S_dest="${2}"
+ if [[ -n "${ESVN_REVISION}" ]]; then
+ revision="${ESVN_REVISION}"
+ fi
+
# check for the protocol
local protocol="${repo_uri%%:*}"
@@ -180,6 +193,15 @@
local wc_path="$(subversion__get_wc_path "${repo_uri}")"
local options="${ESVN_OPTIONS} --config-dir ${ESVN_STORE_DIR}/.subversion"
+ if [[ -n "${revision}" ]]; then
+ options="${options} -r ${revision}"
+ fi
+
+ if [[ "${ESVN_OPTIONS}" = *-r* ]]; then
+ ewarn "\${ESVN_OPTIONS} contains -r, this usage is unsupported. Please"
+ ewarn "see \${ESVN_REPO_URI}"
+ fi
+
debug-print "${FUNCNAME}: wc_path = \"${wc_path}\""
debug-print "${FUNCNAME}: ESVN_OPTIONS = \"${ESVN_OPTIONS}\""
debug-print "${FUNCNAME}: options = \"${options}\""
@@ -187,7 +209,7 @@
if [[ ! -d "${wc_path}/.svn" ]]; then
# first check out
einfo "subversion check out start -->"
- einfo " repository: ${repo_uri}"
+ einfo " repository: ${repo_uri}${revision:+@}${revision}"
debug-print "${FUNCNAME}: ${ESVN_FETCH_CMD} ${options} ${repo_uri}"
@@ -198,10 +220,10 @@
else
subversion_wc_info "${repo_uri}" || die "${ESVN}: unknown problem occurred while accessing working copy."
- if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}" 1)" ]; then
+ if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}")" ]; then
einfo "subversion switch start -->"
einfo " old repository: ${ESVN_WC_URL}"
- einfo " new repository: ${repo_uri}"
+ einfo " new repository: ${repo_uri}${revision:+@}${revision}"
debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options}"
@@ -210,7 +232,7 @@
else
# update working copy
einfo "subversion update start -->"
- einfo " repository: ${repo_uri}"
+ einfo " repository: ${repo_uri}${revision:+@}${revision}"
debug-print "${FUNCNAME}: ${ESVN_UPDATE_CMD} ${options}"
@@ -297,7 +319,7 @@
# default src-Unpack. fetches and bootstraps
function subversion_src_unpack() {
- subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
+ subversion_fetch || die "${ESVN}: unknown problem occurred in subversion_fetch."
subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
}
@@ -352,8 +374,6 @@
## -- subversion__get_repository_uri() --------------------------------------- #
#
# @param $1 - a repository URI.
-# @param $2 - a peg revision is deleted from a return value if this is
-# specified.
#
function subversion__get_repository_uri() {
@@ -361,7 +381,6 @@
local remove_peg_revision="${2}"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
- debug-print "${FUNCNAME}: remove_peg_revision = ${remove_peg_revision}"
if [[ -z "${repo_uri}" ]]; then
die "${ESVN}: ESVN_REPO_URI (or specified URI) is empty."
@@ -372,14 +391,7 @@
repo_uri="${repo_uri%/}"
fi
- if [[ -n "${remove_peg_revision}" ]]; then
- if subversion__has_peg_revision "${repo_uri}"; then
- repo_uri="${repo_uri%@*}"
-
- debug-print "${FUNCNAME}: repo_uri has a peg revision"
- debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
- fi
- fi
+ repo_uri="${repo_uri%@*}"
echo "${repo_uri}"
@@ -392,7 +404,7 @@
#
function subversion__get_wc_path() {
- local repo_uri="$(subversion__get_repository_uri "${1}" 1)"
+ local repo_uri="$(subversion__get_repository_uri "${1}")"
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
@@ -401,11 +413,11 @@
}
-## -- subversion__has_peg_revision() ----------------------------------------- #
+## -- subversion__get_peg_revision() ----------------------------------------- #
#
# @param $1 - a repository URI.
#
-function subversion__has_peg_revision() {
+function subversion__get_peg_revision() {
local repo_uri="${1}"
@@ -414,39 +426,11 @@
# repo_uri has peg revision ?
if [[ "${repo_uri}" != *@* ]]; then
debug-print "${FUNCNAME}: repo_uri does not have a peg revision."
- return 1
fi
local peg_rev="${repo_uri##*@}"
- case "$(subversion__to_upper_case "${peg_rev}")" in
- [[:digit:]]*)
- # NUMBER
- ;;
- HEAD|BASE|COMMITED|PREV)
- ;;
- {[^}]*})
- # DATE
- ;;
- *)
- debug-print "${FUNCNAME}: repo_uri does not have a peg revision."
- return 1
- ;;
- esac
-
debug-print "${FUNCNAME}: peg_rev = ${peg_rev}"
- return 0
-
-}
-
-
-## -- subversion__to_upper_case() ----------------------------------------- #
-#
-# @param $@ - the strings to upper case.
-#
-function subversion__to_upper_case() {
-
- echo "${@}" | tr "[:lower:]" "[:upper:]"
-
+ echo "${peg_rev}"
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-20 16:10 ` Doug Klima
@ 2008-02-20 16:20 ` Doug Klima
2008-02-20 16:39 ` Doug Klima
0 siblings, 1 reply; 12+ messages in thread
From: Doug Klima @ 2008-02-20 16:20 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2842 bytes --]
Doug Klima wrote:
> Doug Klima wrote:
>> Doug Klima wrote:
>>> Bo Ørsted Andresen wrote:
>>>> For quite a while the KDE herd has had a modified version of
>>>> subversion.eclass in the kde overlay. During that time we have
>>>> added the following features to the eclass which we would like to
>>>> put back in gentoo-x86 soon. Since the changes are fairly extensive
>>>> we decided to send it to this list for review first.
>>>>
>>>> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for
>>>> this purpose).
>>>> 2) ESVN_OFFLINE which disables svn up.
>>>> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified
>>>> number of hours has passed and only do svn up if it has. This is
>>>> currently used in the kde4svn-meta eclass for split kde ebuilds
>>>> that use the same checkout of each module.
>>>> 4) ESCM_LOGDIR for logging which revisions packages get installed
>>>> with. See [1]. Users need to explicitly enable this feature to use it.
>>>>
>>>> Other than this the eclass has been documented for use with
>>>> eclass-manpages.
>>>>
>>>> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
>>>>
>>>>
>>> ok. Well zlin and I have been talking lately and we've hammered out
>>> his proposed changes and mine. I'm attaching a patch for the first
>>> set of changes I have proposed.
>>>
>>> Attached is a patch for the following:
>>> - use $ECLASS
>>> - adding rsync to deps
>>> - fixing some quoting
>>> - remove multiple subshell calls and problematic to upper usage (bug
>>> #s escape me right now)
>>> - provide some more information about the working copy that will be
>>> used in the future.
>>> - supporting svn switch
>>>
>>> The most important being the svn switch functionality.
>>>
>>> Please review for commit.
>> And the eclass-manpages documentation broken out into it's own patch.
>>
>> Please review for commit.
> Here's a patch that implements the ESVN_REVISION variable. It finally
> removes all the problematic to_upper usage. It builds off the previous
> patches that make the official way for an ebuild to pass the revision
> it wants via the ESVN_REPO_URI. It ewarn's if an ebuild tries to stick
> a revision into ESVN_OPTIONS. It prints out the revision that it's
> going to be pulling. This was the issue I had with zlin's original
> patch since it would break for the MythTV ebuilds since we request the
> revision in the ebuild.
Here's another patch in the series.
This patch will skip running svn update when it's unnecessary. Basically
if your local working copy is the same URI and same revision, it won't
run svn update which should speed up emerge times for those svn KDE
users that specify a revision they're looking to use. Also MythTV users
that re-emerge with different use flags.
[-- Attachment #2: subversion-skipunecessary-04.patch --]
[-- Type: text/x-patch, Size: 1141 bytes --]
--- subversion-3.eclass 2008-02-20 11:07:57.000000000 -0500
+++ subversion-4.eclass 2008-02-20 11:14:23.000000000 -0500
@@ -222,14 +222,14 @@
if [ "${ESVN_WC_URL}" != "$(subversion__get_repository_uri "${repo_uri}")" ]; then
einfo "subversion switch start -->"
- einfo " old repository: ${ESVN_WC_URL}"
+ einfo " old repository: ${ESVN_WC_URL}@${ESVN_WC_REVISION}"
einfo " new repository: ${repo_uri}${revision:+@}${revision}"
debug-print "${FUNCNAME}: ${ESVN_SWITCH_CMD} ${options}"
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
${ESVN_SWITCH_CMD} ${options} ${repo_uri} || die "${ESVN}: can't switch to ${repo_uri}."
- else
+ elif [ "${ESVN_WC_REVISION}" -ne "${revision}" ]; then
# update working copy
einfo "subversion update start -->"
einfo " repository: ${repo_uri}${revision:+@}${revision}"
@@ -238,6 +238,8 @@
cd "${wc_path}" || die "${ESVN}: can't chdir to ${wc_path}"
${ESVN_UPDATE_CMD} ${options} || die "${ESVN}: can't update from ${repo_uri}."
+ else
+ einfo "subversion update skipped. local copy is at requested revision"
fi
fi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] subversion.eclass
2008-02-20 16:20 ` Doug Klima
@ 2008-02-20 16:39 ` Doug Klima
0 siblings, 0 replies; 12+ messages in thread
From: Doug Klima @ 2008-02-20 16:39 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 3432 bytes --]
Doug Klima wrote:
> Doug Klima wrote:
>> Doug Klima wrote:
>>> Doug Klima wrote:
>>>> Bo Ørsted Andresen wrote:
>>>>> For quite a while the KDE herd has had a modified version of
>>>>> subversion.eclass in the kde overlay. During that time we have
>>>>> added the following features to the eclass which we would like to
>>>>> put back in gentoo-x86 soon. Since the changes are fairly
>>>>> extensive we decided to send it to this list for review first.
>>>>>
>>>>> 1) ESVN_REVISION (before this people had to use ESVN_OPTIONS for
>>>>> this purpose).
>>>>> 2) ESVN_OFFLINE which disables svn up.
>>>>> 3) ESVN_UP_FREQ which uses GNU find to determine if the specified
>>>>> number of hours has passed and only do svn up if it has. This is
>>>>> currently used in the kde4svn-meta eclass for split kde ebuilds
>>>>> that use the same checkout of each module.
>>>>> 4) ESCM_LOGDIR for logging which revisions packages get installed
>>>>> with. See [1]. Users need to explicitly enable this feature to use
>>>>> it.
>>>>>
>>>>> Other than this the eclass has been documented for use with
>>>>> eclass-manpages.
>>>>>
>>>>> [1] http://thread.gmane.org/gmane.linux.gentoo.devel/54233
>>>>>
>>>>>
>>>> ok. Well zlin and I have been talking lately and we've hammered out
>>>> his proposed changes and mine. I'm attaching a patch for the first
>>>> set of changes I have proposed.
>>>>
>>>> Attached is a patch for the following:
>>>> - use $ECLASS
>>>> - adding rsync to deps
>>>> - fixing some quoting
>>>> - remove multiple subshell calls and problematic to upper usage
>>>> (bug #s escape me right now)
>>>> - provide some more information about the working copy that will be
>>>> used in the future.
>>>> - supporting svn switch
>>>>
>>>> The most important being the svn switch functionality.
>>>>
>>>> Please review for commit.
>>> And the eclass-manpages documentation broken out into it's own patch.
>>>
>>> Please review for commit.
>> Here's a patch that implements the ESVN_REVISION variable. It finally
>> removes all the problematic to_upper usage. It builds off the
>> previous patches that make the official way for an ebuild to pass the
>> revision it wants via the ESVN_REPO_URI. It ewarn's if an ebuild
>> tries to stick a revision into ESVN_OPTIONS. It prints out the
>> revision that it's going to be pulling. This was the issue I had with
>> zlin's original patch since it would break for the MythTV ebuilds
>> since we request the revision in the ebuild.
> Here's another patch in the series.
>
> This patch will skip running svn update when it's unnecessary.
> Basically if your local working copy is the same URI and same
> revision, it won't run svn update which should speed up emerge times
> for those svn KDE users that specify a revision they're looking to
> use. Also MythTV users that re-emerge with different use flags.
The following patch makes changes to where the svn checkouts are stored.
This will fix the issue where for example:
mytharchive, mythdvd, mythvideo, mythweather are all stored in
http://svn.mythtv/svn/trunk/mythplugins
the KDE team has similar issues with their split out ebuilds and are
currently solving the issues by calling "private" subversion.eclass
Giving the ebuild and eclass programmer full control over the
ESVN_PROJECT path will allow for these hacks to disappear.
[-- Attachment #2: subversion-project-05.patch --]
[-- Type: text/x-patch, Size: 564 bytes --]
--- subversion-4.eclass 2008-02-20 11:14:23.000000000 -0500
+++ subversion-5.eclass 2008-02-20 11:35:10.000000000 -0500
@@ -104,9 +104,9 @@
# # jakarta commons-loggin
# ESVN_PROJECT=commons/logging
#
-# default: ${PN/-svn}.
+# default: ${CATEGORY/${PN/-svn}.
#
-: ${ESVN_PROJECT:=${PN/-svn}}
+: ${ESVN_PROJECT:=${CATEGORY}/${PN}}
# @ECLASS-VARIABLE: ESVN_BOOTSTRAP
@@ -410,7 +410,7 @@
debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
- echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/${repo_uri##*/}"
+ echo "${ESVN_STORE_DIR}/${ESVN_PROJECT}/"
}
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-02-20 16:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-15 22:39 [gentoo-dev] subversion.eclass Bo Ørsted Andresen
2008-02-15 23:07 ` Donnie Berkholz
2008-02-16 0:05 ` Bernd Steinhauser
2008-02-15 23:40 ` Doug Klima
2008-02-16 0:11 ` Bernd Steinhauser
2008-02-16 0:28 ` Doug Klima
2008-02-16 0:11 ` Bo Ørsted Andresen
2008-02-19 20:06 ` Doug Klima
2008-02-19 21:37 ` Doug Klima
2008-02-20 16:10 ` Doug Klima
2008-02-20 16:20 ` Doug Klima
2008-02-20 16:39 ` Doug Klima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox