From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Oct 23 22:00:13 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C67CE106566B for ; Fri, 23 Oct 2009 22:00:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8E13F8FC16 for ; Fri, 23 Oct 2009 22:00:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9NM0Dkc034965 for ; Fri, 23 Oct 2009 22:00:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9NM0DBO034956; Fri, 23 Oct 2009 22:00:13 GMT (envelope-from gnats) Resent-Date: Fri, 23 Oct 2009 22:00:13 GMT Resent-Message-Id: <200910232200.n9NM0DBO034956@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Johannes 5 Joemann Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2672D1065679 for ; Fri, 23 Oct 2009 21:51:09 +0000 (UTC) (envelope-from joemann@beefree.free.de) Received: from beefree.free.de (beefree.free.de [91.204.4.132]) by mx1.freebsd.org (Postfix) with ESMTP id 6B78C8FC13 for ; Fri, 23 Oct 2009 21:51:07 +0000 (UTC) Received: (qmail 76273 invoked by uid 23); 23 Oct 2009 23:42:05 +0200 Message-Id: <20091023214205.76272.qmail@beefree.free.de> Date: 23 Oct 2009 23:42:05 +0200 From: Johannes 5 Joemann To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: sergei@FreeBSD.org Subject: ports/139872: [PATCH] ports-mgmt/porttools: improve port's directory name heuristic and handle added/deleted files in CVS mode X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Oct 2009 22:00:13 -0000 >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 . - 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) >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 have been specified + # 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: