ports/139872: [PATCH] ports-mgmt/porttools: improve port's directory name heuristic and handle added/deleted files in CVS mode

Johannes 5 Joemann joemann at beefree.free.de
Fri Oct 23 22:00:13 UTC 2009


>Number:         139872
>Category:       ports
>Synopsis:       [PATCH] ports-mgmt/porttools: improve port's directory name heuristic and handle added/deleted files in CVS mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 23 22:00:13 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Johannes 5 Joemann
>Release:        FreeBSD 8.0-RC1 i386
>Organization:
>Environment:
System: FreeBSD xxx.free.de 8.0-RC1 FreeBSD 8.0-RC1 #0: Thu Sep 24 23:14:55 CEST 2009
>Description:
- 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 at FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99 (with the patches below applied)
>How-To-Repeat:
>Fix:

--- porttools-0.99_1.patch 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	23 Oct 2009 20:34:46 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	porttools
 PORTVERSION=	0.99
+PORTREVISION=	1
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	SF
 
--- files/patch-cmd_submit.in.orig	1970-01-01 00:00:00.000000000 +0100
+++ files/patch-cmd_submit.in	2009-10-23 22:30:57.000000000 +0200
@@ -0,0 +1,25 @@
+--- cmd_submit.in.orig	2009-09-09 21:59:59.000000000 +0200
++++ cmd_submit.in	2009-10-23 20:37:25.000000000 +0200
+@@ -155,6 +155,8 @@
+ RELEASE="`uname -srp`"
+ SYSTEM="`uname -a | cut -d ' ' -f 1-12`"
+ 
++# PORTBASENAME will be set by util_diff if PORTNAME != port's directory
++PORTBASENAME=""
+ # Generate diff or shar, depending on the mode
+ . ${SCRIPT_DIR}/util_diff
+ 
+@@ -242,7 +244,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"
--- files/patch-util_diff.in.orig	1970-01-01 00:00:00.000000000 +0100
+++ files/patch-util_diff.in	2009-10-23 22:30:57.000000000 +0200
@@ -0,0 +1,71 @@
+--- util_diff.in.orig	2009-09-09 21:59:59.000000000 +0200
++++ util_diff.in	2009-10-23 20:39:33.000000000 +0200
+@@ -20,6 +20,7 @@
+ # Create a temporary dir for generated files (patch/shar, PR form)
+ TEMPROOT="`mktemp -d -t port`" || exit 1
+ 
++FILTER_CMD="cat"
+ if [ "${MODE}" = "new" ]
+ then
+ 	# Generate shar file with new port
+@@ -54,15 +55,24 @@
+ 
+ 		# Run 'cvs update' first
+ 		echo "===> Updating from CVS"
+-		cvs -R update -Pd
++		cvs -R update -Pd 2> ${TEMPROOT}/.cvs.out
+ 		if [ $? -ne 0 ]
+ 		then
+ 			echo "Error updating CVS"
+ 			rm -rf ${TEMPROOT}
+ 			exit 1
+ 		fi
++		PORTBASENAME=`sed -E -e 's%.*/([^/]+)$%\1%' CVS/Repository`
++		DELETED_FILES=`sed -E -n -e 's%^cvs update: warning: (.*) was lost$%\1%p' ${TEMPROOT}/.cvs.out`
++		ADDED_FILES=`cvs -R status | sed -E -n -e 's%^\? (.*)$%\1%p'`
++		for f in ${DELETED_FILES}
++		do
++			rm -f $f
++			touch -t 197001010000 $f
++		done
+ 
+ 		DIFF_CMD="cvs -R diff -uN"
++		FILTER_CMD='grep -v ^\?[[:space:]]'
+ 	else 
+ 		# Non-CVS modes
+ 		if [ -d ${DIFF_MODE} ]
+@@ -76,6 +86,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,7 +119,14 @@
+ 	echo "===> Generating patch"
+ 	PKGNAME="`make -V PKGNAME`"
+ 	PATCH="${TEMPROOT}/${PKGNAME}.patch"
+-	${DIFF_CMD} > ${PATCH}
++	${DIFF_CMD} | ${FILTER_CMD} > ${PATCH}
++	[ -z "${DELETED_FILES}" ] || rm -f ${DELETED_FILES}
++	for f in ${ADDED_FILES}
++	do
++		touch -t 197001010000 $f.orig
++		diff -u $f.orig $f >> ${PATCH}
++		rm -f $f.orig
++	done
+ 	#if [ $? -ne 0 ]
+ 	#then
+ 	#	echo "Error generating patch"
--- porttools-0.99_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list