[PC-BSD Commits] r7539 - pcbsd/current/src-qt4/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Sat Sep 11 10:43:28 PDT 2010


Author: kris
Date: 2010-09-11 10:43:28 -0700 (Sat, 11 Sep 2010)
New Revision: 7539

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

Bugfix, check curl return code, don't need to try parsing a failed file download



Modified: pcbsd/current/src-qt4/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-qt4/pbi-manager/pbi-manager	2010-09-11 15:33:18 UTC (rev 7538)
+++ pcbsd/current/src-qt4/pbi-manager/pbi-manager	2010-09-11 17:43:28 UTC (rev 7539)
@@ -2311,31 +2311,35 @@
 			-F "SYSVER=${_ufbsdver}" \
 			-F "SVNREV=${_svnrev}" \
 			"${PBI_UPDATEURL}" >/dev/null 2>/dev/null 
-
-		_newsvnrev=`cat ${PBI_TMPDIR}/.upcheck$$ | grep '^REVISION: ' | sed 's|REVISION: ||g'`
-
-		# Get the diff file
-		cat ${PBI_TMPDIR}/.upcheck$$ | grep -v '^REVISION: ' > ${PBI_TMPDIR}/.index$$.patch
-
-		_diff=`cat ${PBI_TMPDIR}/.index$$.patch`
-		if [ "$_diff" = "CURRENT" ] ; then
-			_fullUp="1" 
-		elif [ -z "$_diff" ] ; then
+		if [ "$?" != 0" ]; then
 			_fullUp="0" 
 		else
-			# Try to apply the diff now
-			cd ${PBI_APPDIR}
-			patch ${PBI_INDEXUPFILE} ${PBI_TMPDIR}/.index$$.patch >/dev/null 2>/dev/null
-			_err="$?"
-			rm ${PBI_INDEXUPFILE}.orig* 2>/dev/null
-			rm ${PBI_INDEXUPFILE}.rej* 2>/dev/null
+			# Good download, so lets try applying the patch
+			_newsvnrev=`cat ${PBI_TMPDIR}/.upcheck$$ | grep '^REVISION: ' | sed 's|REVISION: ||g'`
 
-			# If we had a good patch apply, then we can skip the full download
-			if [ "$_err" = "0" ] ; then 
+			# Get the diff file
+			cat ${PBI_TMPDIR}/.upcheck$$ | grep -v '^REVISION: ' > ${PBI_TMPDIR}/.index$$.patch
+
+			_diff=`cat ${PBI_TMPDIR}/.index$$.patch`
+			if [ "$_diff" = "CURRENT" ] ; then
 				_fullUp="1" 
-				echo "$_newsvnrev" > ${PBI_APPDIR}/${PBI_INDEXUPTIME}
+			elif [ -z "$_diff" ] ; then
+				_fullUp="0" 
+			else
+				# Try to apply the diff now
+				cd ${PBI_APPDIR}
+				patch ${PBI_INDEXUPFILE} ${PBI_TMPDIR}/.index$$.patch >/dev/null 2>/dev/null
+				_err="$?"
+				rm ${PBI_INDEXUPFILE}.orig* 2>/dev/null
+				rm ${PBI_INDEXUPFILE}.rej* 2>/dev/null
+
+				# If we had a good patch apply, then we can skip the full download
+				if [ "$_err" = "0" ] ; then 
+					_fullUp="1" 
+					echo "$_newsvnrev" > ${PBI_APPDIR}/${PBI_INDEXUPTIME}
+				fi
 			fi
-		fi
+		fi 
 	fi
 
 	# We need to do a full download of the index
@@ -2345,11 +2349,12 @@
 		curl --insecure -o ${PBI_TMPDIR}/.upcheck$$ ${PBI_CURLPROXY} \
 			-F "SYSVER=${_ufbsdver}" \
 			"${PBI_UPDATEURL}" >/dev/null 2>/dev/null 
-		
-		# Copy the Index File minus REVISION:
-		_svnrev=`cat ${PBI_TMPDIR}/.upcheck$$ | grep '^REVISION: ' | sed 's|REVISION: ||g'`
-		cat ${PBI_TMPDIR}/.upcheck$$ | grep -v '^REVISION: ' > ${PBI_APPDIR}/${PBI_INDEXUPFILE}
-		echo "$_svnrev" > ${PBI_APPDIR}/${PBI_INDEXUPTIME}
+		if [ "$?" = "0" ] ; then
+			# Copy the Index File minus REVISION:
+			_svnrev=`cat ${PBI_TMPDIR}/.upcheck$$ | grep '^REVISION: ' | sed 's|REVISION: ||g'`
+			cat ${PBI_TMPDIR}/.upcheck$$ | grep -v '^REVISION: ' > ${PBI_APPDIR}/${PBI_INDEXUPFILE}
+			echo "$_svnrev" > ${PBI_APPDIR}/${PBI_INDEXUPTIME}
+		fi
 	fi
 
 



More information about the Commits mailing list