Date: Tue, 29 Nov 2011 23:25:55 +0100 From: Johannes 5 Joemann <joemann@beefree.free.de> To: crees@FreeBSD.org Cc: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/139872: [PATCH] ports-mgmt/porttools: improve port's directory name heuristic and handle added/deleted files in CVS mode Message-ID: <20111129232555.8babc758.joemann@beefree.free.de> In-Reply-To: <201110302010.p9UKADx3084017@freefall.freebsd.org> References: <201110302010.p9UKADx3084017@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --Multipart=_Tue__29_Nov_2011_23_25_55_+0100_g0eEm3M7WMaABLlL Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 30 Oct 2011 20:10:13 GMT, crees@FreeBSD.org wrote: > Johannes, would you like to become maintainer for porttools? Thank you very much for considering this ... OK, I'll try to fill the gap until someone experienced in shell scripting und port PR submitting shows up to take maintainership. > You could approve these patches yourself if you're happy to answer > for them! Approx. 17000 PRs have been submitted with porttools (>= 0.16) until now, only three of them by myself. Therefore, although the tests I did with the patched version of porttools were fine, I'd appreciate if submitters / maintainers / committers with more experience would test and/or review and/or improve my patches. But of course I'll answer for the attached patches, which are an updated and improved version of those above (October 2009). OK, here we go: }Synopsis: [PATCH] ports-mgmt/porttools: improve port's directory name heuristic, add CVSauto mode, take maintainership }Release: FreeBSD 8.2-STABLE i386 }Environment: System: FreeBSD xxx.free.de 8.2-STABLE FreeBSD 8.2-STABLE #0: Fri Sep 16 18:59:44 CEST 2011 }Description: - 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 below 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. - Take maintainership. Added file(s): - files/patch-Makefile - files/patch-cmd_diff.in - files/patch-port.1 - files/patch-porttools.5 - files/patch-util_diff.in Generated with FreeBSD Port Tools 0.99_3 (mode: change, diff: CVSauto) }How-To-Repeat: The behavior of :pserver:anoncvs@anoncvs.fr.FreeBSD.org is still the same as in the How-To-Repeat section of my previous mail (Sun, 25 Oct 2009 23:17:05 +0100). }Fix: porttools-0.99_3.patch is attached. Apply it to the current version of ports-mgmt/porttools (Makefile 1.28). --Multipart=_Tue__29_Nov_2011_23_25_55_+0100_g0eEm3M7WMaABLlL Content-Type: text/x-diff; name="porttools-0.99_3.patch" Content-Disposition: attachment; filename="porttools-0.99_3.patch" Content-Transfer-Encoding: 7bit Index: Makefile =================================================================== RCS file: /home/ncvs/ports/ports-mgmt/porttools/Makefile,v retrieving revision 1.28 diff -u -r1.28 Makefile --- Makefile 30 Oct 2011 20:29:53 -0000 1.28 +++ Makefile 28 Nov 2011 21:12:19 -0000 @@ -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 @@ .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 -uN files/patch-Makefile.orig files/patch-Makefile --- files/patch-Makefile.orig 1970-01-01 01:00:00.000000000 +0100 +++ files/patch-Makefile 2011-11-23 23:40:23.000000000 +0100 @@ -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 -uN files/patch-cmd_diff.in.orig files/patch-cmd_diff.in --- files/patch-cmd_diff.in.orig 1970-01-01 01:00:00.000000000 +0100 +++ files/patch-cmd_diff.in 2011-11-23 22:36:52.000000000 +0100 @@ -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 Index: files/patch-cmd_submit.in =================================================================== RCS file: /home/ncvs/ports/ports-mgmt/porttools/files/patch-cmd_submit.in,v retrieving revision 1.1 diff -u -r1.1 patch-cmd_submit.in --- files/patch-cmd_submit.in 30 Oct 2011 20:29:53 -0000 1.1 +++ files/patch-cmd_submit.in 28 Nov 2011 21:12:20 -0000 @@ -1,31 +1,167 @@ -$FreeBSD: ports/ports-mgmt/porttools/files/patch-cmd_submit.in,v 1.1 2011/10/30 20:29:53 crees Exp $ - -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 -uN files/patch-port.1.orig files/patch-port.1 --- files/patch-port.1.orig 1970-01-01 01:00:00.000000000 +0100 +++ files/patch-port.1 2011-11-23 22:36:52.000000000 +0100 @@ -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 -uN files/patch-porttools.5.orig files/patch-porttools.5 --- files/patch-porttools.5.orig 1970-01-01 01:00:00.000000000 +0100 +++ files/patch-porttools.5 2011-11-23 22:36:52.000000000 +0100 @@ -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 -uN files/patch-util_diff.in.orig files/patch-util_diff.in --- files/patch-util_diff.in.orig 1970-01-01 01:00:00.000000000 +0100 +++ files/patch-util_diff.in 2011-11-28 21:55:42.000000000 +0100 @@ -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:/s%^#.*\\$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 --Multipart=_Tue__29_Nov_2011_23_25_55_+0100_g0eEm3M7WMaABLlL--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111129232555.8babc758.joemann>