[PC-BSD Commits] r8045 - in pcbsd/current/src-sh/pbi-manager: . man

svn at pcbsd.org svn at pcbsd.org
Thu Nov 18 13:17:09 PST 2010


Author: kris
Date: 2010-11-18 13:17:09 -0800 (Thu, 18 Nov 2010)
New Revision: 8045

Modified:
   pcbsd/current/src-sh/pbi-manager/man/pbi_info.1
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Update to pbi-manager, fix "pbi_info -i" to show PBIs available in the
various repo indexes. Also cleanup the formatting while here



Modified: pcbsd/current/src-sh/pbi-manager/man/pbi_info.1
===================================================================
--- pcbsd/current/src-sh/pbi-manager/man/pbi_info.1	2010-11-18 20:29:40 UTC (rev 8044)
+++ pcbsd/current/src-sh/pbi-manager/man/pbi_info.1	2010-11-18 21:17:09 UTC (rev 8045)
@@ -21,7 +21,7 @@
 .It Fl a
 List all PBIs installed on the system, same as running pbi_info without an argument. 
 .It Fl i
-List all available PBIS from the master index file
+List all available PBIs from any repo index files
 .It Fl v
 Enable verbose output
 .El

Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-11-18 20:29:40 UTC (rev 8044)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-11-18 21:17:09 UTC (rev 8045)
@@ -3328,28 +3328,48 @@
 do_index_listing()
 {
 	# Make sure we have a master index
-	if [ ! -e "${PBI_DBINDEXDIR}/${PBI_INDEXUPFILE}" ] ; then return ; fi
+	ls ${PBI_DBINDEXDIR}/* >/dev/null 2>/dev/null
+	if [ "$?" != "0" ] ; then return ; fi
 
-	echo "Current and available PBIs from master INDEX. * = current"
-	echo "------------------------------------------------------"
+	for _rIndex in `ls ${PBI_DBINDEXDIR}/* | grep -v '.time'`
+	do
+		_rMd5=`basename ${_rIndex} | sed 's|-index||g'`
+		_rDesc=`cat ${PBI_DBREPODIR}/*.${_rMd5} | grep 'Desc: ' | sed 's|Desc: ||g'`
+		echo "Current and available PBIs. * = current"
+		echo "Repository: $_rDesc"
+		echo "----------------------------------------------------------------"
 
-	sort "${PBI_DBINDEXDIR}/${PBI_INDEXUPFILE}" | while read _iLine
-	do
-	        PBI_UPNAME="`echo $_iLine | cut -d ':' -f 1`"
-	        PBI_UPARCH="`echo $_iLine | cut -d ':' -f 2`"
-	        PBI_UPNVER="`echo $_iLine | cut -d ':' -f 3`"
-        	PBI_UPSTATUS="`echo $_iLine | cut -d ':' -f 9`"
+		sort "${_rIndex}" | while read _iLine
+		do
+			PBI_UPNAME="`echo $_iLine | cut -d ':' -f 1`"
+			PBI_UPARCH="`echo $_iLine | cut -d ':' -f 2`"
+	        	PBI_UPNVER="`echo $_iLine | cut -d ':' -f 3`"
+        		PBI_UPSTATUS="`echo $_iLine | cut -d ':' -f 9`"
+			pad_var "${PBI_UPNAME}" "30"
+			PBI_UPNAME="${PAD_VAR}"
+			pad_var "${PBI_UPNVER}" "15"
+			PBI_UPNVER="${PAD_VAR}"
+			pad_var "${PBI_UPARCH}" "6"
+			PBI_UPARCH="${PAD_VAR}"
 	
-		if [ "$PBI_UPSTATUS" = "current" ] ; then
-			echo "$PBI_UPNAME	$PBI_UPNVER	$PBI_UPARCH *"
-		fi
-		if [ "$PBI_UPSTATUS" = "active" ] ; then
-			echo "$PBI_UPNAME	$PBI_UPNVER	$PBI_UPARCH"
-		fi
+			if [ "$PBI_UPSTATUS" = "current" ] ; then
+				echo "$PBI_UPNAME   $PBI_UPNVER	$PBI_UPARCH *"
+			fi
+			if [ "$PBI_UPSTATUS" = "active" ] ; then
+				echo "$PBI_UPNAME   $PBI_UPNVER	$PBI_UPARCH"
+			fi
+		done
 	done
 
 }
 
+# Function to pad a variable to X spaces
+pad_var() {
+	local _pVar="$1"
+	local _pNum="$2"
+	PAD_VAR="`echo \"$_pVar                                                                                    x\" | cut -c 1-$_pNum`"
+}
+
 # Checks if we have a custom script to run prior to port make
 run_pbi_preportmake()
 {



More information about the Commits mailing list