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.
--- /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}"
 
 }

Reply via email to