[PC-BSD Commits] r19078 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Wed Sep 12 08:50:02 PDT 2012


Author: kris
Date: 2012-09-12 15:50:02 +0000 (Wed, 12 Sep 2012)
New Revision: 19078

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Fix a bug pruning old version from the Index, now it will keep the latest



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2012-09-12 15:47:22 UTC (rev 19077)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2012-09-12 15:50:02 UTC (rev 19078)
@@ -2016,17 +2016,26 @@
 	if [ -z "$PBI_IT_ADDKEEP" ]; then return ; fi
 
 	local found="0"
+	local added="0"
 	while read iLine
 	do
 		echo "$iLine" | grep "^${1}:${2}:" >/dev/null 2>/dev/null
 		if [ "$?" != "0" ] ; then
+			# Ready to add back the saved lines
+			if [ $found -ne 0 ] ; then
+				while read fLine
+				do
+				  if [ $found -le $PBI_IT_ADDKEEP ] ; then
+	 			     echo "$fLine" >> ${PBI_TMPDIR}/.indextmp	
+				  fi
+				  found=`expr $found - 1`
+				done < ${PBI_TMPDIR}/.foundtmp
+			fi
 	 		echo "$iLine" >> ${PBI_TMPDIR}/.indextmp	
 			continue
 		fi
-		if [ $found -lt $PBI_IT_ADDKEEP ] ; then
-	 		echo "$iLine" >> ${PBI_TMPDIR}/.indextmp	
-			found=`expr $found + 1`
-		fi
+		found=`expr $found + 1`
+	 	echo "$iLine" >> ${PBI_TMPDIR}/.foundtmp	
 	done < $PBI_IT_ADDINDEX	
 	mv "${PBI_TMPDIR}/.indextmp" "${PBI_IT_ADDINDEX}"
 }



More information about the Commits mailing list