Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2007 11:23:02 +0900 (JST)
From:      NIIMI Satoshi <sa2c@sa2c.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/116298: ports-mgmt/portmaster: don't delete common distfiles with old and new versions 
Message-ID:  <20070912022302.B180B5C54@berkeley.l.sa2c.net>
Resent-Message-ID: <200709120230.l8C2U305062499@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         116298
>Category:       ports
>Synopsis:       ports-mgmt/portmaster: don't delete common distfiles with old and new versions
>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:   Wed Sep 12 02:30:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     NIIMI Satoshi
>Release:        FreeBSD 6.2-RELEASE-p7 i386
>Organization:
>Environment:
System: FreeBSD berkeley.l.sa2c.net 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #2: Thu Aug 2 09:30:08 JST 2007 root@berkeley.l.sa2c.net:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:

When upgrading ports, distfiles in the old set is deleted even if
listed in the new set.

For example, consider upgrading of editors/vim from 7.1.87 to 7.1.100.
distfiles of the former are "vim-7.1.tar.bz2", "7.1.001"..."7.1.87"
and distfiles of the latter are "vim-7.1.tar.bz2",
"7.1.001"..."7.1.87"..."7.1.100".  In this senario, common distfiles
"vim-7.1.tar.bz2", "7.1.001"..."7.1.87" will be deleted.

In addition, this PR contains small fixes which makes emacs happy
around quote, and makes --clean-distfiles work even if DISTDIR is a
symbolic link.

	
>How-To-Repeat:
	
>Fix:

	

--- portmaster.diff begins here ---
Index: files/portmaster.sh.in
===================================================================
RCS file: /home/ncvs/ports/ports-mgmt/portmaster/files/portmaster.sh.in,v
retrieving revision 1.20
diff -u -r1.20 portmaster.sh.in
--- files/portmaster.sh.in	27 Aug 2007 22:48:24 -0000	1.20
+++ files/portmaster.sh.in	12 Sep 2007 02:04:59 -0000
@@ -28,7 +28,7 @@
 umask 022
 
 usage () {
-	echo "portmaster version `grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`"
+	echo "portmaster version `grep '[$]FreeBSD:' $0 | cut -d ' ' -f 4`"
 	echo ''
 	echo 'Usage:'
 	echo "Common flags: [--force-config] [-CGgntvw B|b uf|i D|d]"
@@ -775,7 +775,7 @@
 delete_stale_distfiles () {
 	# distfiles is used globally
 	# inherit distdir from the environment, but only modify our copy
-	local distdir dist_subdir file DELORNOT distfile
+	local distdir dist_subdir file DELORNOT distfile x
 
 	dist_subdir=`make BEFOREPORTMK=yes $PM_MAKE_ARGS -V DIST_SUBDIR`
 	test -n "$dist_subdir" && distdir="${distdir}/${dist_subdir}"
@@ -800,6 +800,12 @@
 		for file in $cont_distfiles; do
 			[ -f $file ] || continue
 
+			# Don't delete files which are also listed in
+			# the current set.
+			for x in $distfiles; do
+				[ "$file" = "$x" ] && continue 2
+			done
+
 			if [ -n "$ALWAYS_SCRUB_DISTFILES" ]; then
 				echo "===>>> Deleting stale distfile: $file"
 				rm -f $file
@@ -946,7 +952,7 @@
 	read_distinfos
 
 	echo "===>>> Checking for stale distfiles"
-	for df in `find $distdir -type f`; do
+	for df in `find ${distdir%/}/ -type f`; do
 		f=${df#$distdir/}
 		if ! grep -q \(${f}\) $DI_FILES; then
 			if [ -n "$ALL" ]; then
--- portmaster.diff ends here ---


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070912022302.B180B5C54>