Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2012 22:35:06 -0400
From:      Steve Wills <swills@FreeBSD.org>
To:        joemann@beefree.free.de, ports@FreeBSD.org
Subject:   FreeBSD Port: ports-mgmt/porttools - Update to work with svn
Message-ID:  <62DEC305-862E-4D1E-9122-808EC8B8B8D5@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

--Apple-Mail-1-76002581
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi,

I did a quick hack to make porttools work with svn. It's far from =
perfect, but it makes "port submit" work for me. It's available here:

http://meatwad.mouf.net/~steve/porttools_svn.diff

and attached. If anyone wants to finish it up, that'd be cool.

Steve


--Apple-Mail-1-76002581
Content-Disposition: attachment;
	filename=porttools_svn.diff.txt
Content-Type: text/plain;
	x-unix-mode=0644;
	name="porttools_svn.diff.txt"
Content-Transfer-Encoding: quoted-printable

--- /usr/local/share/porttools/cmd_commit	2012-08-21 =
21:56:45.062006082 -0400
+++ /usr/local/share/porttools/cmd_commit.orig	2012-08-21 =
21:51:52.437009531 -0400
@@ -28,7 +28,7 @@
 #
 # cmd_commit
 # Module for port(1)
-# SUMMARY: commit a port into the FreeBSD Ports SVN Repository
+# SUMMARY: commit a port into the FreeBSD Ports CVS Repository
 #
 # $Id: cmd_commit.in,v 1.2 2009/09/09 19:58:30 skolobov Exp $
 #
@@ -93,7 +93,7 @@
 echo "=3D=3D=3D> Pre-commit portlint check"
 FLAGS=3D"-C"
 [ "${MODE}" =3D "new" ] && FLAGS=3D"${FLAGS} -N"
-PL_SVN_IGNORE=3D'^\d+$|^pr-patch$|^svn-msg$' \
+PL_CVS_IGNORE=3D'^\d+$|^pr-patch$|^cvs-msg$' \
 portlint ${FLAGS}
 if [ $? -ne 0 ]
 then
@@ -107,15 +107,15 @@
 then
 	${PORTSDIR}/Tools/scripts/addport -d `pwd` -u =
${FREEFALL_USERNAME}
 else
-	# Initialize SVN environment
-	PSVN=3D"${PORTSDIR}/Tools/scripts/psvn"
+	# Initialize CVS environment
+	PCVS=3D"cvs -d ${FREEFALL_USERNAME}@pcvs.FreeBSD.org:/home/pcvs"
=20
 	# Make sure we are working with up-to-date version
-	echo "=3D=3D=3D> Pre-commit SVN update"
-	${PSVN} update
+	echo "=3D=3D=3D> Pre-commit CVS update"
+	${PCVS} update
=20
-	# See if SVN message already exists, and use that for commit log
-	MSG=3D"svn-msg"
+	# See if CVS message already exists, and use that for commit log
+	MSG=3D"cvs-msg"
 	FLAGS=3D""
 	if [ -e ${MSG} ]
 	then
@@ -127,16 +127,16 @@
 			echo =
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D'
 			cat ${MSG}
 			echo =
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D'
-			read -p "Is the SVN message above correct? =
(y/n)" ANSWER
+			read -p "Is the CVS message above correct? =
(y/n)" ANSWER
 			[ "${ANSWER}" =3D "y" ] && break
 			${VISUAL:-vi} ${MSG}
 		done
 	fi=20
 	# Commit the port update
 	echo "=3D=3D=3D> Committing port update"
-	${PSVN} commit ${FLAGS}
+	${PCVS} commit ${FLAGS}
 =09
-	# Remove SVN message file only if commit was successful
+	# Remove CVS message file only if commit was successful
 	[ $? -eq 0 -a -e ${MSG} ] && rm ${MSG}
 fi
=20
--- /usr/local/share/porttools/cmd_diff	2012-08-21 21:57:52.520007848 =
-0400
+++ /usr/local/share/porttools/cmd_diff.orig	2012-08-21 =
21:51:52.443006550 -0400
@@ -48,8 +48,8 @@
 Usage: port diff [-h] [-d <diff mode>]
 	-h	- Display this usage summary
 	-d <diff mode> - Select diff generation mode:
-		SVN - against SVN
-		SVNauto - against SVN, no svn add/delete required
+		CVS - against CVS
+		CVSauto - against CVS, no cvs add/delete required
 		<dir> - against Ports tree in <dir>
 		<pattern> - against original port in <pwd><pattern>
 EOF
--- /usr/local/share/porttools/cmd_submit	2012-08-21 =
21:59:42.875411346 -0400
+++ /usr/local/share/porttools/cmd_submit.orig	2012-08-21 =
21:51:52.449007838 -0400
@@ -53,8 +53,8 @@
 		change - changing a port=20
 		update - updating a port to newer version
 	-d <diff mode> - Select diff generation mode:
-		SVN - against SVN
-		SVNauto - against SVN, no svn add/delete required
+		CVS - against CVS
+		CVSauto - against CVS, no cvs add/delete required
 		<dir> - against Ports tree in <dir>
 		<pattern> - against original port in <pwd><pattern>
 	-s <severity> - Set PR's severity to <severity>
@@ -163,7 +163,7 @@
=20
 # util_diff will set
 # - PORTBASENAME if PORTNAME !=3D port's directory name
-# - DIFF_TYPE to SVN, SVNauto, ports, or suffix
+# - DIFF_TYPE to CVS, CVSauto, ports, or suffix
 PORTBASENAME=3D""
 DIFF_TYPE=3D""
=20
@@ -183,12 +183,12 @@
 	else
 		cat ${TEMPROOT}/.portlint.out
 		echo "Error validating port"
-		if [ "$DIFF_MODE" =3D "SVNauto" ]
+		if [ "$DIFF_MODE" =3D "CVSauto" ]
 		then
 			grep "^FATAL:" ${TEMPROOT}/.portlint.out > =
${TEMPROOT}/.portlint.fatal
-			if ! egrep -qv '^FATAL:[[:space:]]+(file .+ not =
in SVN|SVN file .+ missing)' ${TEMPROOT}/.portlint.fatal
+			if ! egrep -qv '^FATAL:[[:space:]]+(file .+ not =
in CVS|CVS file .+ missing)' ${TEMPROOT}/.portlint.fatal
 			then
-				echo "All fatal portlint errors are SVN =
errors,"
+				echo "All fatal portlint errors are CVS =
errors,"
 				echo "consider using portlint without =
the -c flag or"
 				echo "use 'port submit -L' if all =
portlint messages are"
 				echo "caused by your intentional =
addition/deletion of files"
@@ -354,20 +354,20 @@
=20
 	MODESTRING=3D"${MODESTRING}, diff: ${DIFF_TYPE}"
 	# Get list of added/removed files
-	if [ "${DIFF_MODE}" =3D "SVN" ]
+	if [ "${DIFF_MODE}" =3D "CVS" ]
 	then
 		FILES_ADD=3D`grep --after-context=3D1 "^--- /dev/null" =
${PATCH} | grep "^+++ " | awk '{print $2;}'`
 		FILES_DEL=3D`grep --before-context=3D1 "^+++ /dev/null" =
${PATCH} | grep "^--- " | awk '{print $2;}'`
-	elif [ "${DIFF_MODE}" =3D "SVNauto" ]
+	elif [ "${DIFF_MODE}" =3D "CVSauto" ]
 	then
 		FILES_ADD=3D`sed -n -e '/^diff -uN / { N;N;N;N;s/^diff =
-uN \(.*\)\.orig \1\n--- \1\.orig	[-+:.[:digit:] ]\{19,\}\n+++ \1	=
[-+:.[:digit:] ]\{19,\}\n@@ [-+,[:digit:] ]\{9,\} @@\n+.*$/\1/p; }' =
${PATCH}`
 		FILES_DEL=3D`sed -n -e '/^diff -uN / { N;N;N;N;s/^diff =
-uN \(.*\)\.orig \1\n--- \1\.orig	[-+:.[:digit:] ]\{19,\}\n+++ \1	=
[-+:.[:digit:] ]\{19,\}\n@@ [-+,[:digit:] ]\{9,\} @@\n-.*$/\1/p; }' =
${PATCH}`
 	else
 		TEMPORIG=3D`mktemp -t porttools` || exit 1
 		TEMPNEW=3D`mktemp -t porttools` || exit 1
-		SVN_FILTER=3D"egrep -v /SVN/[^/]*$"
-		find -s ${ORIG_DIR} -type f | ${SVN_FILTER} | sed -e =
"s#^${ORIG_DIR}/##" > ${TEMPORIG}
-		find -s . -type f | ${SVN_FILTER} | sed -e "s#^\./##" > =
${TEMPNEW}
+		CVS_FILTER=3D"egrep -v /CVS/[^/]*$"
+		find -s ${ORIG_DIR} -type f | ${CVS_FILTER} | sed -e =
"s#^${ORIG_DIR}/##" > ${TEMPORIG}
+		find -s . -type f | ${CVS_FILTER} | sed -e "s#^\./##" > =
${TEMPNEW}
 		FILES_ADD=3D`comm -13 ${TEMPORIG} ${TEMPNEW}`
 		FILES_DEL=3D`comm -23 ${TEMPORIG} ${TEMPNEW}`
 		rm -f ${TEMPORIG} ${TEMPNEW}
--- /usr/local/share/porttools/util_diff	2012-08-21 =
22:18:52.706008071 -0400
+++ /usr/local/share/porttools/util_diff.orig	2012-08-21 =
21:51:52.455007703 -0400
@@ -68,28 +68,25 @@
 	# Determine the default diff mode
 	if [ "${DIFF_MODE}" =3D "" ]
 	then
-		DIFF_MODE=3D"SVN"
-		svn info > /dev/null 2> /dev/null
-		if [ ! $? ]
+		if [ -d CVS ]
 		then
-			if grep -iq =
":pserver:anoncvs@anoncvs.fr.FreeBSD.org:" SVN/Root
+			if grep -iq =
":pserver:anoncvs@anoncvs.fr.FreeBSD.org:" CVS/Root
 			then
-				DIFF_MODE=3D"SVNauto"
+				DIFF_MODE=3D"CVSauto"
 			else
-				DIFF_MODE=3D"SVN"
+				DIFF_MODE=3D"CVS"
 			fi
 		else
 			DIFF_MODE=3D"/usr/ports"
 		fi
 		echo "Default diff mode is ${DIFF_MODE}"
-	elif [ "${DIFF_MODE}" =3D "SVN" -o "${DIFF_MODE}" =3D "SVNauto" =
]
+	elif [ "${DIFF_MODE}" =3D "CVS" -o "${DIFF_MODE}" =3D "CVSauto" =
]
 	then
-		# If there is no SVN subdirectory then
+		# If there is no CVS subdirectory then
 		# fallback to diffing against /usr/ports tree
-		svn info > /dev/null 2> /dev/null
-		if [ ! $? ]
+		if [ ! -d CVS ]
 		then
-			echo "Diff mode was set to ${DIFF_MODE}, but =
this is not a svn working copy"
+			echo "Diff mode was set to ${DIFF_MODE}, but =
there's no CVS subdirectory"
 			echo -n "Trying /usr/ports ... "
 			if [ -d /usr/ports ]
 			then
@@ -103,42 +100,44 @@
 		fi
 	fi
=20
-	if [ "${DIFF_MODE}" =3D "SVN" -o "${DIFF_MODE}" =3D "SVNauto" ]
+	if [ "${DIFF_MODE}" =3D "CVS" -o "${DIFF_MODE}" =3D "CVSauto" ]
 	then
 		DIFF_TYPE=3D${DIFF_MODE}
+		# Test for ~/.cvspass and create if necessary
+		test -f ${HOME}/.cvspass || touch ${HOME}/.cvspass
=20
-		# Run 'svn update' first
-		echo "=3D=3D=3D> Updating from SVN"
-		if [ "${DIFF_MODE}" =3D "SVNauto" ]
+		# Run 'cvs update' first
+		echo "=3D=3D=3D> Updating from CVS"
+		if [ "${DIFF_MODE}" =3D "CVSauto" ]
 		then
-			svn update 2> ${TEMPROOT}/.svn.err > =
${TEMPROOT}/.svn.out
+			cvs -R update -Pd 2> ${TEMPROOT}/.cvs.err > =
${TEMPROOT}/.cvs.out
 			status=3D$?
-			cat ${TEMPROOT}/.svn.err ${TEMPROOT}/.svn.out
+			cat ${TEMPROOT}/.cvs.err ${TEMPROOT}/.cvs.out
 		else
-			svn update
+			cvs -R update -Pd
 			status=3D$?
 		fi
 		if [ $status -ne 0 ]
 		then
-			echo "Error updating SVN"
+			echo "Error updating CVS"
 			rm -rf ${TEMPROOT}
 			exit 1
 		fi
-		PORTBASENAME=3D`sed -E -e 's%.*/([^/]+)$%\1%' =
SVN/Repository`
-		if [ "${DIFF_MODE}" =3D "SVNauto" ]
+		PORTBASENAME=3D`sed -E -e 's%.*/([^/]+)$%\1%' =
CVS/Repository`
+		if [ "${DIFF_MODE}" =3D "CVSauto" ]
 		then
-			sort -k 2,666 ${TEMPROOT}/.svn.out | \
+			sort -k 2,666 ${TEMPROOT}/.cvs.out | \
 			sed -nE	-e 's/^[?A] (.*)$/echo "diff -uN \1.orig =
\1" \&\& diff -uN "\1.orig" "\1" /p' \
 				-e 's/^U (.*)$/mv "\1" "\1.orig" \&\& =
echo "diff -uN \1.orig \1" \&\& diff -uN "\1.orig" "\1" ; rm =
"\1.orig"/p' \
-				-e 's/^R (.*)$/svn -q update "\1" > =
"\1.orig" \&\& echo "diff -uN \1.orig \1" \&\& diff -uN "\1.orig" "\1" ; =
rm "\1.orig"/p' \
-				-e 's/^M (.*)$/svn diff "\1"/p' \
-				> ${TEMPROOT}/.svn.diff_cmd
-			DIFF_CMD=3D"sh -x ${TEMPROOT}/.svn.diff_cmd"
+				-e 's/^R (.*)$/cvs -R -q update -p "\1" =
> "\1.orig" \&\& echo "diff -uN \1.orig \1" \&\& diff -uN "\1.orig" "\1" =
; rm "\1.orig"/p' \
+				-e 's/^M (.*)$/cvs -R diff -u "\1"/p' \
+				> ${TEMPROOT}/.cvs.diff_cmd
+			DIFF_CMD=3D"sh -x ${TEMPROOT}/.cvs.diff_cmd"
 		else
-			DIFF_CMD=3D"svn diff"
+			DIFF_CMD=3D"cvs -R diff -uN"
 		fi
 	else=20
-		# Non-SVN modes
+		# Non-CVS modes
 		DIRBASENAME=3D`basename \`pwd\``
 		PORTBASENAME_HEADER=3D`sed -n -E -e =
'1,/^($|[^#].*$)|\\$FreeBSD\:/s%^#.*\\$FreeBSD\:[[:space:]]*([^/]+/)*([^/]=
+)/Makefile.*\\$%\2%p' Makefile`
 		if [ "${DIRBASENAME}" !=3D "${PORTBASENAME_HEADER}" ]
@@ -192,7 +191,7 @@
 			exit 1
 		fi
 	=09
-		DIFF_CMD=3D"diff -ruN --exclude=3DSVN ${ORIG_DIR} ."
+		DIFF_CMD=3D"diff -ruN --exclude=3DCVS ${ORIG_DIR} ."
 	fi
=20
 	# Generate patch
--- /usr/local/bin/port.orig	2012-08-21 22:14:49.638007678 -0400
+++ /usr/local/bin/port	2012-08-21 22:15:06.056007135 -0400
@@ -47,7 +47,7 @@
 	ORGANIZATION=3D""
 	BUILDROOT=3D"/tmp"
 	ARCHIVE_DIR=3D""
-	DIFF_MODE=3D"CVS"
+	DIFF_MODE=3D"SVN"
 	DIFF_VIEWER=3D"more"
 	PORTLINT_FLAGS=3D"abct"
 	EOF

--Apple-Mail-1-76002581--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?62DEC305-862E-4D1E-9122-808EC8B8B8D5>