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.
--- 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:[EMAIL PROTECTED]"
 
 		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:[EMAIL PROTECTED]"
 
 			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:[EMAIL PROTECTED]"
 
 			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="[EMAIL PROTECTED]"
-
-			debug-print "${FUNCNAME}: repo_uri has a peg revision"
-			debug-print "${FUNCNAME}: repo_uri = ${repo_uri}"
-		fi
-	fi
+	repo_uri="[EMAIL PROTECTED]"
 
 	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}" != [EMAIL PROTECTED] ]]; then
 		debug-print "${FUNCNAME}: repo_uri does not have a peg revision."
-		return 1
 	fi
 
 	local peg_rev="[EMAIL PROTECTED]"
 
-	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 "[EMAIL PROTECTED]" | tr "[:lower:]" "[:upper:]"
-
+	echo "${peg_rev}"
 }

Reply via email to