FreeBSD Port: ports-mgmt/porttools - Update to work with svn
Steve Wills
swills at FreeBSD.org
Wed Aug 22 02:35:30 UTC 2012
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
-------------- next part --------------
--- /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 "===> Pre-commit portlint check"
FLAGS="-C"
[ "${MODE}" = "new" ] && FLAGS="${FLAGS} -N"
-PL_SVN_IGNORE='^\d+$|^pr-patch$|^svn-msg$' \
+PL_CVS_IGNORE='^\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="${PORTSDIR}/Tools/scripts/psvn"
+ # Initialize CVS environment
+ PCVS="cvs -d ${FREEFALL_USERNAME}@pcvs.FreeBSD.org:/home/pcvs"
# Make sure we are working with up-to-date version
- echo "===> Pre-commit SVN update"
- ${PSVN} update
+ echo "===> Pre-commit CVS update"
+ ${PCVS} update
- # See if SVN message already exists, and use that for commit log
- MSG="svn-msg"
+ # See if CVS message already exists, and use that for commit log
+ MSG="cvs-msg"
FLAGS=""
if [ -e ${MSG} ]
then
@@ -127,16 +127,16 @@
echo '============================================='
cat ${MSG}
echo '============================================='
- read -p "Is the SVN message above correct? (y/n)" ANSWER
+ read -p "Is the CVS message above correct? (y/n)" ANSWER
[ "${ANSWER}" = "y" ] && break
${VISUAL:-vi} ${MSG}
done
fi
# Commit the port update
echo "===> Committing port update"
- ${PSVN} commit ${FLAGS}
+ ${PCVS} commit ${FLAGS}
- # 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
--- /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
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 @@
# util_diff will set
# - PORTBASENAME if PORTNAME != port's directory name
-# - DIFF_TYPE to SVN, SVNauto, ports, or suffix
+# - DIFF_TYPE to CVS, CVSauto, ports, or suffix
PORTBASENAME=""
DIFF_TYPE=""
@@ -183,12 +183,12 @@
else
cat ${TEMPROOT}/.portlint.out
echo "Error validating port"
- if [ "$DIFF_MODE" = "SVNauto" ]
+ if [ "$DIFF_MODE" = "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 @@
MODESTRING="${MODESTRING}, diff: ${DIFF_TYPE}"
# Get list of added/removed files
- if [ "${DIFF_MODE}" = "SVN" ]
+ if [ "${DIFF_MODE}" = "CVS" ]
then
FILES_ADD=`grep --after-context=1 "^--- /dev/null" ${PATCH} | grep "^+++ " | awk '{print $2;}'`
FILES_DEL=`grep --before-context=1 "^+++ /dev/null" ${PATCH} | grep "^--- " | awk '{print $2;}'`
- elif [ "${DIFF_MODE}" = "SVNauto" ]
+ elif [ "${DIFF_MODE}" = "CVSauto" ]
then
FILES_ADD=`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=`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=`mktemp -t porttools` || exit 1
TEMPNEW=`mktemp -t porttools` || exit 1
- SVN_FILTER="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="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=`comm -13 ${TEMPORIG} ${TEMPNEW}`
FILES_DEL=`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}" = "" ]
then
- DIFF_MODE="SVN"
- svn info > /dev/null 2> /dev/null
- if [ ! $? ]
+ if [ -d CVS ]
then
- if grep -iq ":pserver:anoncvs at anoncvs.fr.FreeBSD.org:" SVN/Root
+ if grep -iq ":pserver:anoncvs at anoncvs.fr.FreeBSD.org:" CVS/Root
then
- DIFF_MODE="SVNauto"
+ DIFF_MODE="CVSauto"
else
- DIFF_MODE="SVN"
+ DIFF_MODE="CVS"
fi
else
DIFF_MODE="/usr/ports"
fi
echo "Default diff mode is ${DIFF_MODE}"
- elif [ "${DIFF_MODE}" = "SVN" -o "${DIFF_MODE}" = "SVNauto" ]
+ elif [ "${DIFF_MODE}" = "CVS" -o "${DIFF_MODE}" = "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
- if [ "${DIFF_MODE}" = "SVN" -o "${DIFF_MODE}" = "SVNauto" ]
+ if [ "${DIFF_MODE}" = "CVS" -o "${DIFF_MODE}" = "CVSauto" ]
then
DIFF_TYPE=${DIFF_MODE}
+ # Test for ~/.cvspass and create if necessary
+ test -f ${HOME}/.cvspass || touch ${HOME}/.cvspass
- # Run 'svn update' first
- echo "===> Updating from SVN"
- if [ "${DIFF_MODE}" = "SVNauto" ]
+ # Run 'cvs update' first
+ echo "===> Updating from CVS"
+ if [ "${DIFF_MODE}" = "CVSauto" ]
then
- svn update 2> ${TEMPROOT}/.svn.err > ${TEMPROOT}/.svn.out
+ cvs -R update -Pd 2> ${TEMPROOT}/.cvs.err > ${TEMPROOT}/.cvs.out
status=$?
- cat ${TEMPROOT}/.svn.err ${TEMPROOT}/.svn.out
+ cat ${TEMPROOT}/.cvs.err ${TEMPROOT}/.cvs.out
else
- svn update
+ cvs -R update -Pd
status=$?
fi
if [ $status -ne 0 ]
then
- echo "Error updating SVN"
+ echo "Error updating CVS"
rm -rf ${TEMPROOT}
exit 1
fi
- PORTBASENAME=`sed -E -e 's%.*/([^/]+)$%\1%' SVN/Repository`
- if [ "${DIFF_MODE}" = "SVNauto" ]
+ PORTBASENAME=`sed -E -e 's%.*/([^/]+)$%\1%' CVS/Repository`
+ if [ "${DIFF_MODE}" = "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="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="sh -x ${TEMPROOT}/.cvs.diff_cmd"
else
- DIFF_CMD="svn diff"
+ DIFF_CMD="cvs -R diff -uN"
fi
else
- # Non-SVN modes
+ # Non-CVS modes
DIRBASENAME=`basename \`pwd\``
PORTBASENAME_HEADER=`sed -n -E -e '1,/^($|[^#].*$)|\\$FreeBSD\:/s%^#.*\\$FreeBSD\:[[:space:]]*([^/]+/)*([^/]+)/Makefile.*\\$%\2%p' Makefile`
if [ "${DIRBASENAME}" != "${PORTBASENAME_HEADER}" ]
@@ -192,7 +191,7 @@
exit 1
fi
- DIFF_CMD="diff -ruN --exclude=SVN ${ORIG_DIR} ."
+ DIFF_CMD="diff -ruN --exclude=CVS ${ORIG_DIR} ."
fi
# 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=""
BUILDROOT="/tmp"
ARCHIVE_DIR=""
- DIFF_MODE="CVS"
+ DIFF_MODE="SVN"
DIFF_VIEWER="more"
PORTLINT_FLAGS="abct"
EOF
More information about the freebsd-ports
mailing list