Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jul 2014 18:02:59 +0000 (UTC)
From:      Raphael Kubo da Costa <rakuco@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r361398 - in head/ports-mgmt/pkg-rmleaf: . files
Message-ID:  <201407091802.s69I2xqX033156@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rakuco
Date: Wed Jul  9 18:02:58 2014
New Revision: 361398
URL: http://svnweb.freebsd.org/changeset/ports/361398
QAT: https://qat.redports.org/buildarchive/r361398/

Log:
  Update to 0.3.
  
  PR:		191577
  Submitted by:	shen.elf@gmail.com (maintainer)

Modified:
  head/ports-mgmt/pkg-rmleaf/Makefile
  head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf

Modified: head/ports-mgmt/pkg-rmleaf/Makefile
==============================================================================
--- head/ports-mgmt/pkg-rmleaf/Makefile	Wed Jul  9 17:54:21 2014	(r361397)
+++ head/ports-mgmt/pkg-rmleaf/Makefile	Wed Jul  9 18:02:58 2014	(r361398)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	pkg-rmleaf
-PORTVERSION=	0.2
+PORTVERSION=	0.3
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none

Modified: head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf
==============================================================================
--- head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf	Wed Jul  9 17:54:21 2014	(r361397)
+++ head/ports-mgmt/pkg-rmleaf/files/pkg-rmleaf	Wed Jul  9 18:02:58 2014	(r361398)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
-#  Copyright (c) 2013 Yanhui Shen, shen.elf@gmail.c0m
+# version 0.3 
+
+#  Copyright (c) 2014 Yanhui Shen, shen.elf@gmail.c0m
 #  All rights reserved.
 #
 #  Redistribution and use in source and binary forms, with or without
@@ -24,28 +26,39 @@
 #  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 #  SUCH DAMAGE.
 
-#Twiddle="echo '|/-\\' | cut -c"
-PkgQuery="pkg query -e \"%#r=0\" \"%o#%c\" | sort"
+cols=$((`stty size | cut -w -f2` - 6))
+rows=$((`stty size | cut -w -f1` - 4))
+height=$(($rows - 7))
+sep="#"
+PkgQuery="pkg query -e \"%#r=0\" \"%o$sep%c\" | sort"
 PkgDelete="pkg delete -y"
-DialogList="dialog --stdout --checklist \"leaf packages (%s)\" 30 90 30"
+FmtDialog="dialog --checklist \"Leaf Packages: %s\" $rows $cols $height %s"
 
 KeptLeaves=""
 while true; do
     #==== refresh leaves ====
-    echo "Calculating..."
+    echo "Querying..."
     AllLeaves=`eval $PkgQuery`
     NewLeaves=""
     nNewLeaves="0"
-    #n="0"
-    IFS=$'\n'
+
+    #IFS=$'\n'
+    # see http://svnweb.freebsd.org/base?view=revision&revision=221513
+    # for compatibility, use the following trick instead
+    IFS="
+"
     for line in $AllLeaves; do
-        # print twiddle will be a little slower
-        #n=$(($n % 4 + 1))
-        #ch=`eval "$Twiddle $n"`
-        #printf "Calculating...%s\r" "$ch"
+        case $line in
+            (*"$sep"*)
+                port=${line%%"$sep"*}
+                desc=${line#*"$sep"}
+                ;;
+            (*)
+                echo "Bad line: " $line
+                exit
+                ;;
+        esac
 
-        port=`echo "$line" | cut -d'#' -f1`
-        desc=`echo "$line" | cut -d'#' -f2 | sed -e 's/\"/\\\"/g'`
         ret=`echo "$KeptLeaves" | grep "$port"`
         if [ -z "$ret" ]; then
             NewLeaves="$NewLeaves $port \"$desc\" off"
@@ -58,8 +71,8 @@ while true; do
         echo "Nothing to do!"
         exit
     fi
-    cmd=`printf $DialogList "$nNewLeaves"`
-    selections=`eval "$cmd $NewLeaves"`
+    cmd=`printf $FmtDialog "$nNewLeaves" "$NewLeaves"`
+    selections=`eval "$cmd 3>&2 2>&1 1>&3"`
     if [ $? -ne 0 ]; then
         echo "Canceled."
         exit



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