aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt
diff options
context:
space:
mode:
authorcrees <crees@FreeBSD.org>2012-03-03 21:31:02 +0800
committercrees <crees@FreeBSD.org>2012-03-03 21:31:02 +0800
commitaa3729ff94067f8f50d0b04f3d4945fe1a06a65a (patch)
treecb4e5c41a8cde15fe4739dae9b3b081e4de801fe /ports-mgmt
parenta4a143c7a563ff3f0ecb0f34b60dad59a53e981e (diff)
downloadfreebsd-ports-gnome-aa3729ff94067f8f50d0b04f3d4945fe1a06a65a.tar.gz
freebsd-ports-gnome-aa3729ff94067f8f50d0b04f3d4945fe1a06a65a.tar.zst
freebsd-ports-gnome-aa3729ff94067f8f50d0b04f3d4945fe1a06a65a.zip
- Improve the heuristic for finding the port's directory name:
- If applicable, use CVS/Repository as the source of the port's directory name, - else try to fall back to the basename of the working directory if the PORTNAME heuristic fails. - The patches also fix <http://sourceforge.net/support/tracker.php?aid=1969774>. - Add CVSauto as a new diff mode: - Handle added/deleted files without having to cvs add/delete them. - Works with :pserver:anoncvs@anoncvs.fr.freebsd.org. - When submitting you're asked to use "port submit -L" if files are added or deleted, because that's FATAL for portlint. - Don't use the full path of the working directory in diffs. - Include a port's PORTEPOCH in update mode in the generated PR. - To aid in debugging porttools include this information in the PR: - porttools' PORTREVISION and PORTEPOCH (if defined), - submit and diff mode used by the submitter. - Bump PORTREVISION. - Pass maintainership to submitter PR: ports/139872 Submitted by: Johannes 5 Joemann <joemann@beefree.free.de>
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/porttools/Makefile14
-rw-r--r--ports-mgmt/porttools/files/patch-Makefile29
-rw-r--r--ports-mgmt/porttools/files/patch-cmd_diff.in10
-rw-r--r--ports-mgmt/porttools/files/patch-cmd_submit.in174
-rw-r--r--ports-mgmt/porttools/files/patch-port.121
-rw-r--r--ports-mgmt/porttools/files/patch-porttools.511
-rw-r--r--ports-mgmt/porttools/files/patch-util_diff.in152
7 files changed, 390 insertions, 21 deletions
diff --git a/ports-mgmt/porttools/Makefile b/ports-mgmt/porttools/Makefile
index cb335d7d90f7..e7429c0c1087 100644
--- a/ports-mgmt/porttools/Makefile
+++ b/ports-mgmt/porttools/Makefile
@@ -7,11 +7,11 @@
PORTNAME= porttools
PORTVERSION= 0.99
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= ports-mgmt
MASTER_SITES= SF
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= joemann@beefree.free.de
COMMENT= Tools for testing and submitting port updates and new ports
RUN_DEPENDS= portlint:${PORTSDIR}/ports-mgmt/portlint \
@@ -27,6 +27,16 @@ INSTALL_TARGET= install install-docs
.endif
MAKE_ENV= DATADIR="${DATADIR}" DOCSDIR="${DOCSDIR}"
+# Make the version information of porttools itself
+# available for inclusion in the PRs generated by it.
+MAKE_ENV+= PORTVERSION="${PORTVERSION}"
+.if defined(PORTREVISION)
+MAKE_ENV+= PORTREVISION="${PORTREVISION}"
+.endif
+.if defined(PORTEPOCH)
+MAKE_ENV+= PORTEPOCH="${PORTEPOCH}"
+.endif
+
MAN1= port.1
MAN5= porttools.5
diff --git a/ports-mgmt/porttools/files/patch-Makefile b/ports-mgmt/porttools/files/patch-Makefile
new file mode 100644
index 000000000000..4a96e3ac2f48
--- /dev/null
+++ b/ports-mgmt/porttools/files/patch-Makefile
@@ -0,0 +1,29 @@
+--- ./Makefile.orig 2009-09-09 21:59:59.000000000 +0200
++++ ./Makefile 2011-11-23 23:11:14.000000000 +0100
+@@ -9,6 +9,15 @@
+ PORTNAME?= porttools
+ PORTVERSION?= 0.99
+ DISTNAME?= ${PORTNAME}-${PORTVERSION}
++.if defined(PORTREVISION) && defined(PORTEPOCH)
++VERSIONSTRING= ${PORTVERSION}_${PORTREVISION},${PORTEPOCH}
++.elif defined(PORTREVISION)
++VERSIONSTRING= ${PORTVERSION}_${PORTREVISION}
++.elif defined(PORTEPOCH)
++VERSIONSTRING= ${PORTVERSION},${PORTEPOCH}
++.else
++VERSIONSTRING= ${PORTVERSION}
++.endif
+
+ PROGRAMS= port
+ SCRIPTS= cmd_commit cmd_create cmd_diff cmd_fetch cmd_getpr cmd_help \
+@@ -31,8 +40,8 @@
+
+ .SUFFIXES: .in
+
+-.in:
+- sed -e 's,__VERSION__,${PORTVERSION},;s,__PREFIX__,${PREFIX},' \
++.in:
++ sed -e 's%__VERSION__%${VERSIONSTRING}%;s,__PREFIX__,${PREFIX},' \
+ inc_header.in ${.IMPSRC} > ${.TARGET}
+ chmod a+x ${.TARGET}
+
diff --git a/ports-mgmt/porttools/files/patch-cmd_diff.in b/ports-mgmt/porttools/files/patch-cmd_diff.in
new file mode 100644
index 000000000000..23629482ade1
--- /dev/null
+++ b/ports-mgmt/porttools/files/patch-cmd_diff.in
@@ -0,0 +1,10 @@
+--- cmd_diff.in.orig 2009-09-09 21:59:59.000000000 +0200
++++ cmd_diff.in 2009-10-25 16:28:14.000000000 +0100
+@@ -21,6 +21,7 @@
+ -h - Display this usage summary
+ -d <diff mode> - Select diff generation mode:
+ 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
diff --git a/ports-mgmt/porttools/files/patch-cmd_submit.in b/ports-mgmt/porttools/files/patch-cmd_submit.in
index 0932a80a2692..2c03b7302da3 100644
--- a/ports-mgmt/porttools/files/patch-cmd_submit.in
+++ b/ports-mgmt/porttools/files/patch-cmd_submit.in
@@ -1,31 +1,167 @@
-$FreeBSD$
-
-From bugs.freebsd.org/154809
-
-Porttools will now include PORTREVISION and PORTEPOCH in PRs sent
-
---- cmd_submit.in.old 2011-02-15 12:55:54.000000000 -0800
-+++ cmd_submit.in 2011-02-15 12:59:51.000000000 -0800
-@@ -146,6 +146,7 @@
+--- ./cmd_submit.in.orig 2009-09-09 21:59:59.000000000 +0200
++++ ./cmd_submit.in 2011-11-26 15:37:51.000000000 +0100
+@@ -26,6 +26,7 @@
+ update - updating a port to newer version
+ -d <diff mode> - Select diff generation mode:
+ 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>
+@@ -126,6 +127,15 @@
+ [ "`grep '\$FreeBSD: ' Makefile`" ] || MODE="new"
+ fi
+
++# util_diff will set
++# - PORTBASENAME if PORTNAME != port's directory name
++# - DIFF_TYPE to CVS, CVSauto, ports, or suffix
++PORTBASENAME=""
++DIFF_TYPE=""
++
++# Generate diff or shar, depending on the mode, and create TEMPROOT
++. ${SCRIPT_DIR}/util_diff
++
+ # Run portlint(1) to validate port's sanity
+ if [ "${RUN_PORTLINT}" = "yes" ]
+ then
+@@ -133,10 +143,24 @@
+ FLAGS="-${PORTLINT_FLAGS:-abt}"
+ [ "${COMMITTER}" = "yes" ] && FLAGS="${FLAGS} -c"
+ [ "${MODE}" = "new" ] && FLAGS="${FLAGS} -N"
+- portlint ${FLAGS}
+- if [ $? -ne 0 ]
++ if portlint ${FLAGS} > ${TEMPROOT}/.portlint.out
+ then
++ cat ${TEMPROOT}/.portlint.out
++ else
++ cat ${TEMPROOT}/.portlint.out
+ echo "Error validating port"
++ if [ "$DIFF_MODE" = "CVSauto" ]
++ then
++ grep "^FATAL:" ${TEMPROOT}/.portlint.out > ${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 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"
++ fi
++ fi
++ rm -rf ${TEMPROOT}
+ exit 1
+ fi
+ else
+@@ -146,6 +170,12 @@
# Collect information about the port
PORTNAME="`make -V PKGNAMEPREFIX``make -V PORTNAME``make -V PKGNAMESUFFIX`"
PORTVERSION="`make -V PORTVERSION`"
+PORTREVISION="`make -V PORTREVISION`"
++PORTEPOCH="`make -V PORTEPOCH`"
++VERSIONSTRING="${PORTVERSION}"
++[ "$PORTREVISION" != "0" ] && VERSIONSTRING="${VERSIONSTRING}_${PORTREVISION}"
++[ "$PORTEPOCH" != "0" ] && VERSIONSTRING="${VERSIONSTRING},${PORTEPOCH}"
++
PKGNAME="`make -V PKGNAME`"
CATEGORY="`make -V CATEGORIES | sed -E 's/^([^ ]+).*$/\1/'`"
MAINTAINER="`make -V MAINTAINER`"
-@@ -194,8 +195,14 @@
+@@ -155,9 +185,6 @@
+ RELEASE="`uname -srp`"
+ SYSTEM="`uname -a | cut -d ' ' -f 1-12`"
+
+-# Generate diff or shar, depending on the mode
+-. ${SCRIPT_DIR}/util_diff
+-
+ CC=""
+ if [ "${MODE}" = "new" ]
+ then
+@@ -194,10 +221,10 @@
# Override some parameters if submitting an update to a newer
# version of an existing port
CLASS="update"
-+ if [ "${PORTREVISION}" = "0" ]
-+ then
- SUFFIX="update to ${PORTVERSION}"
- DESCRIPTION="- Update to ${PORTVERSION}"
-+ else
-+ SUFFIX="update to ${PORTVERSION}_${PORTREVISION}"
-+ DESCRIPTION="- Update to ${PORTVERSION}_${PORTREVISION}"
-+ fi
+- SUFFIX="update to ${PORTVERSION}"
+- DESCRIPTION="- Update to ${PORTVERSION}"
++ SUFFIX="update to ${VERSIONSTRING}"
++ DESCRIPTION="- Update to ${VERSIONSTRING}"
fi
-
+-
++
# Check to see if maintainership was requested
+ MAINT_CHANGE="`grep '^[+-]MAINTAINER' ${PATCH} | wc -l`"
+ if [ ${MAINT_CHANGE} -eq 2 ]
+@@ -242,7 +269,12 @@
+ fi
+
+ # Generate Synopsis line
+-SYNOPSIS="[${PREFIX}] ${CATEGORY}/${PORTNAME}: ${SUFFIX}"
++if [ -z "${PORTBASENAME}" ]
++then
++ SYNOPSIS="[${PREFIX}] ${CATEGORY}/${PORTNAME}: ${SUFFIX}"
++else
++ SYNOPSIS="[${PREFIX}] ${CATEGORY}/${PORTBASENAME}: ${SUFFIX}"
++fi
+
+ echo "===> Generating PR form"
+ PR_FORM="${TEMPROOT}/PR"
+@@ -266,9 +298,10 @@
+ SEND-PR: [ low | medium | high ]
+ >Category: ports
+ SEND-PR: <choose from the list of categories below (one line)>
+- SEND-PR: advocacy alpha bin conf docs gnu
+- SEND-PR: i386 ia64 java kern misc ports
+- SEND-PR: powerpc sparc64 standards www
++ SEND-PR: advocacy alpha amd64 arm bin conf
++ SEND-PR: docs gnu i386 ia64 java kern
++ SEND-PR: misc ports powerpc sparc64 standards sun4v
++ SEND-PR: threads usb www
+ >Class: ${CLASS}
+ SEND-PR: [ sw-bug | doc-bug | change-request | update | maintainer-update ]
+ >Release: ${RELEASE}
+@@ -277,24 +310,33 @@
+ >Description:
+ EOF
+
++MODESTRING="mode: ${MODE}"
++
+ if [ "${MODE}" = "new" ]
+ then
+ cat pkg-descr >> ${PR_FORM}
+ else
+ echo -e ${DESCRIPTION} >> ${PR_FORM}
+
++ MODESTRING="${MODESTRING}, diff: ${DIFF_TYPE}"
+ # Get list of added/removed files
+ 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}" = "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
+- TEMP=`mktemp -t porttools` || exit 1
+- find -s ${ORIG_DIR} -type f | sed -e "s#${ORIG_DIR}/##" > ${TEMP}
+- CURR_DIR=`pwd`
+- FILES_ADD=`find -s ${CURR_DIR} -type f | sed -e "s#${CURR_DIR}/##" | comm -23 - ${TEMP}`
+- FILES_DEL=`find -s ${CURR_DIR} -type f | sed -e "s#${CURR_DIR}/##" | comm -13 - ${TEMP}`
+- rm -f ${TEMP}
++ TEMPORIG=`mktemp -t porttools` || exit 1
++ TEMPNEW=`mktemp -t porttools` || exit 1
++ 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}
+ fi
+
+ if [ -n "${FILES_ADD}" ]
+@@ -326,7 +368,7 @@
+
+ cat >> ${PR_FORM} <<- EOF
+
+- Generated with FreeBSD Port Tools __VERSION__
++ Generated with FreeBSD Port Tools __VERSION__ (${MODESTRING})
+ >How-To-Repeat:
+ >Fix:
+ EOF
diff --git a/ports-mgmt/porttools/files/patch-port.1 b/ports-mgmt/porttools/files/patch-port.1
new file mode 100644
index 000000000000..5a93a400a18b
--- /dev/null
+++ b/ports-mgmt/porttools/files/patch-port.1
@@ -0,0 +1,21 @@
+--- port.1.orig 2009-09-09 21:59:59.000000000 +0200
++++ port.1 2009-10-25 20:01:28.000000000 +0100
+@@ -125,6 +125,9 @@
+ .Bl -tag -width ".Pa suffix"
+ .It CVS
+ diff against CVS repository (default).
++.It CVSauto
++diff against CVS repository, no cvs add/delete required.
++Useful with read-only CVS servers that don't support add/delete.
+ .It Pa dir
+ diff against original version of the port in the Ports tree with root at
+ .Pa dir
+@@ -215,6 +218,8 @@
+ .Bl -tag -width ".Fl s Ar severity"
+ .It Fl h
+ display usage summary for this command.
++.It Fl d Ar mode
++select diff generation mode - see the port diff command above for details.
+ .It Fl m Ar mode
+ Overrides automatic detection of operation mode:
+ .Bl -tag -width update
diff --git a/ports-mgmt/porttools/files/patch-porttools.5 b/ports-mgmt/porttools/files/patch-porttools.5
new file mode 100644
index 000000000000..b17e93a0f4dd
--- /dev/null
+++ b/ports-mgmt/porttools/files/patch-porttools.5
@@ -0,0 +1,11 @@
+--- porttools.5.orig 2009-09-09 21:59:59.000000000 +0200
++++ porttools.5 2009-10-25 19:09:02.000000000 +0100
+@@ -51,7 +51,7 @@
+ Default to
+ .Pa /tmp .
+ .It Ev DIFF_MODE
+-Selects diff generation mode. Valid values are: CVS, directory
++Selects diff generation mode. Valid values are: CVS, CVSauto, directory
+ .Pq e.g. Pa /usr/ports ,
+ or suffix
+ .Pq e.g. Pa .orig .
diff --git a/ports-mgmt/porttools/files/patch-util_diff.in b/ports-mgmt/porttools/files/patch-util_diff.in
new file mode 100644
index 000000000000..e5428cddfc28
--- /dev/null
+++ b/ports-mgmt/porttools/files/patch-util_diff.in
@@ -0,0 +1,152 @@
+--- ./util_diff.in.orig 2009-09-09 21:59:59.000000000 +0200
++++ ./util_diff.in 2011-11-28 21:54:50.000000000 +0100
+@@ -37,49 +37,122 @@
+ fi
+ cd ${SAVE_CWD}
+ else
+- # Default to CVS diff mode
+- [ "${DIFF_MODE}" = "" ] && DIFF_MODE="CVS"
+-
+- # If there is no CVS subdirectory then
+- # fallback to diffing against /usr/ports tree
+- if [ "${DIFF_MODE}" = "CVS" -a ! -d CVS ]
++ # Determine the default diff mode
++ if [ "${DIFF_MODE}" = "" ]
+ then
+- DIFF_MODE="/usr/ports"
++ if [ -d CVS ]
++ then
++ if grep -iq ":pserver:anoncvs@anoncvs.fr.FreeBSD.org:" CVS/Root
++ then
++ DIFF_MODE="CVSauto"
++ else
++ DIFF_MODE="CVS"
++ fi
++ else
++ DIFF_MODE="/usr/ports"
++ fi
++ echo "Default diff mode is ${DIFF_MODE}"
++ elif [ "${DIFF_MODE}" = "CVS" -o "${DIFF_MODE}" = "CVSauto" ]
++ then
++ # If there is no CVS subdirectory then
++ # fallback to diffing against /usr/ports tree
++ if [ ! -d CVS ]
++ then
++ echo "Diff mode was set to ${DIFF_MODE}, but there's no CVS subdirectory"
++ echo -n "Trying /usr/ports ... "
++ if [ -d /usr/ports ]
++ then
++ DIFF_MODE="/usr/ports"
++ echo "found"
++ else
++ echo "not found - please choose an approriate diff mode"
++ rm -rf ${TEMPROOT}
++ exit 1
++ fi
++ fi
+ fi
+
+- if [ "${DIFF_MODE}" = "CVS" ]
++ 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 'cvs update' first
+ echo "===> Updating from CVS"
+- cvs -R update -Pd
+- if [ $? -ne 0 ]
++ if [ "${DIFF_MODE}" = "CVSauto" ]
++ then
++ cvs -R update -Pd 2> ${TEMPROOT}/.cvs.err > ${TEMPROOT}/.cvs.out
++ status=$?
++ cat ${TEMPROOT}/.cvs.err ${TEMPROOT}/.cvs.out
++ else
++ cvs -R update -Pd
++ status=$?
++ fi
++ if [ $status -ne 0 ]
+ then
+ echo "Error updating CVS"
+ rm -rf ${TEMPROOT}
+ exit 1
+ fi
+-
+- DIFF_CMD="cvs -R diff -uN"
++ PORTBASENAME=`sed -E -e 's%.*/([^/]+)$%\1%' CVS/Repository`
++ if [ "${DIFF_MODE}" = "CVSauto" ]
++ then
++ 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 (.*)$/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="cvs -R diff -uN"
++ fi
+ else
+ # Non-CVS modes
++ DIRBASENAME=`basename \`pwd\``
++ PORTBASENAME_HEADER=`sed -n -E -e '1,/^($|[^#].*$)|\\$FreeBSD: /tmp/pcvs/ports/ports-mgmt/porttools/files/patch-util_diff.in,v 1.5 2012-03-03 13:31:02 crees Exp $FreeBSD:[[:space:]]*ports/([^/]+)/([^/]+)/Makefile.*$%\2%p' Makefile`
++ if [ "${DIRBASENAME}" != "${PORTBASENAME_HEADER}" ]
++ then
++ echo "Warning: current directory name differs from Makefile header:"
++ echo " ${DIRBASENAME}" != "${PORTBASENAME_HEADER}"
++ fi
++ PYTHON_SUFFIX="`make -V PYTHON_SUFFIX`"
++ RUBY_SUFFIX="`make -V RUBY_SUFFIX`"
++ PKGNAMEPREFIX="`make -V PKGNAMEPREFIX | sed -E "s,py${PYTHON_SUFFIX}-,py-," | sed -E "s,ruby${RUBY_SUFFIX}-,ruby-,"`"
++ PKGNAMESUFFIX="`make -V PKGNAMESUFFIX`"
++ PORTNAME="${PKGNAMEPREFIX}`make -V PORTNAME`${PKGNAMESUFFIX}"
+ if [ -d ${DIFF_MODE} ]
+ then
+ # -d <dir> have been specified
+ # it should be Ports tree location
++ DIFF_TYPE="ports"
+ CATEGORY="`make -V CATEGORIES | sed -E 's/^([^ ]+).*$/\1/'`"
+- PYTHON_SUFFIX="`make -V PYTHON_SUFFIX`"
+- RUBY_SUFFIX="`make -V RUBY_SUFFIX`"
+- PKGNAMEPREFIX="`make -V PKGNAMEPREFIX | sed -E "s,py${PYTHON_SUFFIX}-,py-," | sed -E "s,ruby${RUBY_SUFFIX}-,ruby-,"`"
+- PKGNAMESUFFIX="`make -V PKGNAMESUFFIX`"
+- PORTNAME="${PKGNAMEPREFIX}`make -V PORTNAME`${PKGNAMESUFFIX}"
+ ORIG_DIR="${DIFF_MODE}/${CATEGORY}/${PORTNAME}"
++ if [ ! -d ${ORIG_DIR} ]
++ then
++ echo "Original version does not exist at ${ORIG_DIR}"
++ if [ -d "${DIFF_MODE}/${CATEGORY}/${PORTBASENAME}" ]
++ then
++ PORTBASENAME=${DIRBASENAME}
++ ORIG_DIR="${DIFF_MODE}/${CATEGORY}/${PORTBASENAME}"
++ elif [ -d "${DIFF_MODE}/${CATEGORY}/${PORTBASENAME_HEADER}" ]
++ then
++ PORTBASENAME=${PORTBASENAME_HEADER}
++ ORIG_DIR="${DIFF_MODE}/${CATEGORY}/${PORTBASENAME}"
++ fi
++ [ -d ${ORIG_DIR} ] && echo "Using ${ORIG_DIR} instead"
++ fi
+ else
+ # -d <pattern> have been specified
+ # <pattern> is used to determine original port location
+- ORIG_DIR="`pwd`${DIFF_MODE}"
++ DIFF_TYPE="suffix"
++ ORIG_DIR="../${DIRBASENAME}${DIFF_MODE}"
++ if [ "${DIRBASENAME}" != "${PORTNAME}" -a "${DIRBASENAME}" = "${PORTBASENAME_HEADER}" ]
++ then
++ PORTBASENAME=${DIRBASENAME}
++ echo "Using ${PORTBASENAME} instead of ${PORTNAME} as the port's directory name"
++ fi
+ fi
+
+ # Check to see if the original version of port exist
+@@ -90,7 +163,7 @@
+ exit 1
+ fi
+
+- DIFF_CMD="diff -ruN --exclude=CVS ${ORIG_DIR} `pwd`"
++ DIFF_CMD="diff -ruN --exclude=CVS ${ORIG_DIR} ."
+ fi
+
+ # Generate patch