- Improve the heuristic for finding the port's directory name: - In CVS mode 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 should also fix <http://sourceforge.net/support/tracker.php?aid=1969774>. - Handle added/deleted files in CVS mode: - When finally submitting you'll have to use "port submit -L" if files are added or deleted, because that's FATAL for portlint. Port maintainer (sergei@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.99 (with the patches below applied)
Responsible Changed From-To: freebsd-ports-bugs->sergei Over to maintainer (via the GNATS Auto Assign Tool)
Please consider the attached patch instead of my original one. The changes regarding the port's directory name heuristic are still the same. If you would prefer them alone in a smaller, separate patch, please let me know. My reason for fiddling with the CVS diff mode was the behaviour of :pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs which is the first one listed in <http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/anoncvs.html#ANONCVS-USAGE>. As a stupid porttools newbie I thought that its behaviour (see below in the How-To-Repeat section) is normal because it's a read-only repository. So I came up with the original patch to handle file additions/deletions without a cooperating CVS repository. Meanwhile I have tried other methods (ssh, local repository mirror, :pserver:anoncvs@anoncvs.tw.FreeBSD.org:/home/ncvs) and all of them permitted cvs add/delete despite of the repository's read-only mode. So if one avoids anoncvs.fr.FreeBSD.org as a pserver, one doesn't need my changes to CVS diff mode. Maybe a note in the documentation would suffice. On the the other hand, people might find it useful if they don't have to issue cvs add/delete commands for files they add to / delete from a port. Therefore I have restructured and improved my changes into a new diff mode called "CVSauto". It parses the output of "cvs -R update" to determine which files were added or removed and adds diffs against /dev/null for those files to the patchset. As this is now a separate, non-default diff mode people (already) using porttools in CVS diff mode won't be affected - if you decide to apply my following patchset (or a variant of it) to porttools. Sorry for any noise and thanx for your consideration (and for porttools:) Johannes Added file(s): - files/patch-cmd_diff.in - files/patch-cmd_submit.in - files/patch-port.1 - files/patch-porttools.5 - files/patch-util_diff.in Port maintainer (sergei@FreeBSD.org) is cc'd. Parts of this mail were Generated with FreeBSD Port Tools 0.99 (mode: change, diff: CVSauto) How-To-Repeat: % cvs -d :pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs login Logging in to :pserver:anoncvs@anoncvs.fr.freebsd.org:2401/home/ncvs CVS password: anoncvs % cvs -d :pserver:anoncvs@anoncvs.fr.FreeBSD.org:/home/ncvs co porttools cvs checkout: Updating porttools U porttools/Makefile U porttools/distinfo U porttools/pkg-descr U porttools/pkg-plist cvs checkout: Updating porttools/files % cd porttools % rm pkg-plist % cvs delete pkg-plist cvs [server aborted]: "remove" requires write access to the repository % cvs -R delete pkg-plist cvs [server aborted]: "remove" requires write access to the repository % echo "new file" > files/extra-foo % cvs add files/extra-foo cvs [server aborted]: "add" requires write access to the repository % cvs -R add files/extra-foo cvs [server aborted]: "add" requires write access to the repository % port diff ===> Generating ~/.porttools configuration file ===> Updating from CVS ? files/extra-foo cvs update: Updating . cvs update: warning: pkg-plist was lost U pkg-plist cvs update: Updating files ===> Generating patch cvs diff: Diffing . cvs diff: Diffing files ===> Viewing diff with more ? files/extra-foo ===> Done Fix: --- porttools.patch.20091025 begins here --- Index: Makefile =================================================================== RCS file: /home/ncvs/ports/ports-mgmt/porttools/Makefile,v retrieving revision 1.25 diff -u -r1.25 Makefile --- Makefile 9 Sep 2009 21:02:21 -0000 1.25 +++ Makefile 25 Oct 2009 19:59:39 -0000 @@ -7,6 +7,7 @@ PORTNAME= porttools PORTVERSION= 0.99 +PORTREVISION= 1 CATEGORIES= ports-mgmt MASTER_SITES= SF --- /dev/null 2009-10-25 20:59:07.000000000 +0100 +++ files/patch-cmd_diff.in 2009-10-25 20:53:24.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 --- /dev/null 2009-10-25 20:59:07.000000000 +0100 +++ files/patch-cmd_submit.in 2009-10-25 20:53:24.000000000 +0100 @@ -0,0 +1,100 @@ +--- cmd_submit.in.orig 2009-09-09 21:59:59.000000000 +0200 ++++ cmd_submit.in 2009-10-25 19:52:02.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> +@@ -120,11 +121,10 @@ + shift + done + +-# Determine if this is a new port +-if [ "${MODE}" = "" ] +-then +- [ "`grep '\$FreeBSD: ' Makefile`" ] || MODE="new" +-fi ++# PORTBASENAME will be set by util_diff if PORTNAME != port's directory name ++PORTBASENAME="" ++# Generate diff or shar, depending on the mode ++. ${SCRIPT_DIR}/util_diff + + # Run portlint(1) to validate port's sanity + if [ "${RUN_PORTLINT}" = "yes" ] +@@ -133,10 +133,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 +@@ -155,8 +169,11 @@ + RELEASE="`uname -srp`" + SYSTEM="`uname -a | cut -d ' ' -f 1-12`" + +-# Generate diff or shar, depending on the mode +-. ${SCRIPT_DIR}/util_diff ++# Determine if this is a new port ++if [ "${MODE}" = "" ] ++then ++ [ "`grep '\$FreeBSD: ' Makefile`" ] || MODE="new" ++fi + + CC="" + if [ "${MODE}" = "new" ] +@@ -242,7 +259,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" +@@ -284,7 +306,7 @@ + echo -e ${DESCRIPTION} >> ${PR_FORM} + + # Get list of added/removed files +- if [ "${DIFF_MODE}" = "CVS" ] ++ if [ "${DIFF_MODE}" = "CVS" -o "${DIFF_MODE}" = "CVSauto" ] + 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;}'` +@@ -326,7 +348,8 @@ + + cat >> ${PR_FORM} <<- EOF + +- Generated with FreeBSD Port Tools __VERSION__ ++ Generated with FreeBSD Port Tools __VERSION__ (mode: ${MODE}, diff: ${DIFF_MODE}) ++ + >How-To-Repeat: + >Fix: + EOF --- /dev/null 2009-10-25 20:59:07.000000000 +0100 +++ files/patch-port.1 2009-10-25 20:53:24.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 --- /dev/null 2009-10-25 20:59:07.000000000 +0100 +++ files/patch-porttools.5 2009-10-25 20:53:25.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 . --- /dev/null 2009-10-25 20:59:07.000000000 +0100 +++ files/patch-util_diff.in 2009-10-25 20:53:25.000000000 +0100 @@ -0,0 +1,141 @@ +--- util_diff.in.orig 2009-09-09 21:59:59.000000000 +0200 ++++ util_diff.in 2009-10-25 16:25:14.000000000 +0100 +@@ -20,6 +20,11 @@ + # Create a temporary dir for generated files (patch/shar, PR form) + TEMPROOT="`mktemp -d -t port`" || exit 1 + ++# Variables used by CVSauto diff mode ++ADDED_FILES= ++DELETED_FILES= ++FILTER_CMD="cat" ++ + if [ "${MODE}" = "new" ] + then + # Generate shar file with new port +@@ -37,32 +42,73 @@ + 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 + # 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 ++ ADDED_FILES=`sed -E -n -e 's%^\? (.*)$%\1%p' ${TEMPROOT}/.cvs.out` ++ DELETED_FILES=`sed -E -n -e 's%^cvs update: warning: (.*) was lost$%\1%p' ${TEMPROOT}/.cvs.err` ++ DIFF_CMD="cvs -R diff -u" ++ FILTER_CMD='grep -v ^\?[[:space:]]' ++ else ++ DIFF_CMD="cvs -R diff -uN" ++ fi + else + # Non-CVS modes + if [ -d ${DIFF_MODE} ] +@@ -76,6 +122,18 @@ + PKGNAMESUFFIX="`make -V PKGNAMESUFFIX`" + PORTNAME="${PKGNAMEPREFIX}`make -V PORTNAME`${PKGNAMESUFFIX}" + ORIG_DIR="${DIFF_MODE}/${CATEGORY}/${PORTNAME}" ++ if [ ! -d ${ORIG_DIR} ] ++ then ++ PORTBASENAME=`basename \`pwd\`` ++ if [ -d "${DIFF_MODE}/${CATEGORY}/${PORTBASENAME}" ] ++ then ++ echo "Original version does not exist at ${ORIG_DIR}" ++ ORIG_DIR="${DIFF_MODE}/${CATEGORY}/${PORTBASENAME}" ++ echo "Using ${ORIG_DIR} instead" ++ else ++ PORTBASENAME="" ++ fi ++ fi + else + # -d <pattern> have been specified + # <pattern> is used to determine original port location +@@ -97,11 +155,20 @@ + echo "===> Generating patch" + PKGNAME="`make -V PKGNAME`" + PATCH="${TEMPROOT}/${PKGNAME}.patch" +- ${DIFF_CMD} > ${PATCH} ++ ${DIFF_CMD} | ${FILTER_CMD} > ${PATCH} + #if [ $? -ne 0 ] + #then + # echo "Error generating patch" + # exit 1 + #fi ++ for f in ${ADDED_FILES} ++ do ++ diff -u /dev/null $f >> ${PATCH} ++ done ++ for f in ${DELETED_FILES} ++ do ++ diff -u $f /dev/null >> ${PATCH} ++ rm -f $f ++ done + + fi --- porttools.patch.20091025 ends here ---
Responsible Changed From-To: sergei->pgollucci maintainer timeout (sergei ; 312 days)
Responsible Changed From-To: pgollucci->sergei sergei wants it back
Responsible Changed From-To: sergei->freebsd-ports-bugs Reassign to the heap
State Changed From-To: open->feedback Johannes, would you like to become maintainer for porttools? You could approve these patches yourself if you're happy to answer for them!
[Migrated reply from Johannes to freebsd-ports-bugs] 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).
State Changed From-To: feedback->open take a look
Responsible Changed From-To: freebsd-ports-bugs->crees I'll take it.
crees 2012-03-03 13:31:02 UTC FreeBSD ports repository Modified files: ports-mgmt/porttools Makefile ports-mgmt/porttools/files patch-cmd_submit.in Added files: ports-mgmt/porttools/files patch-Makefile patch-cmd_diff.in patch-port.1 patch-porttools.5 patch-util_diff.in Log: - 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> Revision Changes Path 1.29 +12 -2 ports/ports-mgmt/porttools/Makefile 1.1 +29 -0 ports/ports-mgmt/porttools/files/patch-Makefile (new) 1.1 +10 -0 ports/ports-mgmt/porttools/files/patch-cmd_diff.in (new) 1.2 +155 -19 ports/ports-mgmt/porttools/files/patch-cmd_submit.in 1.1 +21 -0 ports/ports-mgmt/porttools/files/patch-port.1 (new) 1.1 +11 -0 ports/ports-mgmt/porttools/files/patch-porttools.5 (new) 1.5 +152 -0 ports/ports-mgmt/porttools/files/patch-util_diff.in (new) _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: open->closed Committed. Thanks! Please also consider making a new repository/taking control of the SourceForge repo if you are going to be the new upstream -- this minimises the number of patches in the port.