From owner-freebsd-ports-bugs@FreeBSD.ORG Mon May 6 09:40:00 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B5FE7969 for ; Mon, 6 May 2013 09:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 9D49C240 for ; Mon, 6 May 2013 09:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r469e0Sa006762 for ; Mon, 6 May 2013 09:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r469e0XW006761; Mon, 6 May 2013 09:40:00 GMT (envelope-from gnats) Resent-Date: Mon, 6 May 2013 09:40:00 GMT Resent-Message-Id: <201305060940.r469e0XW006761@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Yanhui Shen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 762F085E for ; Mon, 6 May 2013 09:38:42 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.FreeBSD.org (oldred.freebsd.org [8.8.178.121]) by mx1.freebsd.org (Postfix) with ESMTP id 6942C22D for ; Mon, 6 May 2013 09:38:42 +0000 (UTC) Received: from oldred.FreeBSD.org ([127.0.1.6]) by oldred.FreeBSD.org (8.14.5/8.14.5) with ESMTP id r469cgqK052679 for ; Mon, 6 May 2013 09:38:42 GMT (envelope-from nobody@oldred.FreeBSD.org) Received: (from nobody@localhost) by oldred.FreeBSD.org (8.14.5/8.14.5/Submit) id r469cg0H052678; Mon, 6 May 2013 09:38:42 GMT (envelope-from nobody) Message-Id: <201305060938.r469cg0H052678@oldred.FreeBSD.org> Date: Mon, 6 May 2013 09:38:42 GMT From: Yanhui Shen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/178365: New port: ports-mgmt/pkg-rmleaf "Remove leaf packages" X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 May 2013 09:40:00 -0000 >Number: 178365 >Category: ports >Synopsis: New port: ports-mgmt/pkg-rmleaf "Remove leaf packages" >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: Mon May 06 09:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Yanhui Shen >Release: FreeBSD 9.1-STABLE >Organization: NONE >Environment: FreeBSD ThinkPad 9.1-STABLE FreeBSD 9.1-STABLE #0 r249397: Fri Apr 12 17:28:25 CST 2013 shen@ThinkPad:/usr/obj/usr/src/sys/ThinkPad amd64 >Description: A little script for removing leaf packages. (requires pkgng) shar file: pkg-rmleaf.txt >How-To-Repeat: >Fix: Patch attached with submission follows: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # pkg-rmleaf # pkg-rmleaf/files # pkg-rmleaf/files/pkg-rmleaf # pkg-rmleaf/Makefile # pkg-rmleaf/pkg-descr # echo c - pkg-rmleaf mkdir -p pkg-rmleaf > /dev/null 2>&1 echo c - pkg-rmleaf/files mkdir -p pkg-rmleaf/files > /dev/null 2>&1 echo x - pkg-rmleaf/files/pkg-rmleaf sed 's/^X//' >pkg-rmleaf/files/pkg-rmleaf << '29ef2316dbde3ecdd0c6487fcf644a44' X#!/bin/sh X X# Copyright (c) 2013 Yanhui Shen, shen.elf@gmail.c0m X# All rights reserved. X# X# Redistribution and use in source and binary forms, with or without X# modification, are permitted provided that the following conditions X# are met: X# 1. Redistributions of source code must retain the above copyright X# notice, this list of conditions and the following disclaimer. X# 2. Redistributions in binary form must reproduce the above copyright X# notice, this list of conditions and the following disclaimer in the X# documentation and/or other materials provided with the distribution. X# X# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X# SUCH DAMAGE. X XKeptLeaves="" XListDialog="dialog --checklist \"leaf packages\" 30 80 30" XDeletePkg="pkg delete -y" XTempFile=`mktemp -t pkg-rmleaf` X XQuit () { X rm $TempFile X exit X} X Xif [ -z $TempFile ]; then X echo "Failed to create tempfile!" X exit Xfi X Xwhile true; do X #==== refresh leaves ==== X echo "Calculating..." X AllLeaves=`pkg query "%o#%c\t#%?r#" | grep "#0#" | cut -f1 | sort` X NewLeaves="" X IFS=$'\n' X for line in $AllLeaves; do X port=$(echo "$line" | cut -d'#' -f1) X desc=$(echo "$line" | cut -d'#' -f2 | sed -e 's/"/\\"/g') X ret=$(echo "$KeptLeaves" | grep "$port") X if [ -z "$ret" ]; then X NewLeaves="$NewLeaves $port \"$desc\" off" X fi X done X X #==== show dialog ==== X if [ -z "$NewLeaves" ]; then X echo "Nothing to do!" X Quit X fi X eval "$ListDialog $NewLeaves" 2>$TempFile X X #==== record old leaves ==== X KeptLeaves="$AllLeaves" X X #==== deinstall selected ==== X selections=`cat $TempFile` X if [ -z $selections ]; then X echo "No selection, quit." X Quit X fi X IFS=$' ' X for pkg in $selections; do X eval "$DeletePkg $pkg" X done Xdone 29ef2316dbde3ecdd0c6487fcf644a44 echo x - pkg-rmleaf/Makefile sed 's/^X//' >pkg-rmleaf/Makefile << '90b081522a03c78615bf1fbde8757eba' X# New ports collection makefile for: pkg-rmleaf X# Date created: 05.06.2013 X# Whom: Yanhui Shen X XPORTNAME= pkg-rmleaf XPORTVERSION= 0.1 XCATEGORIES= ports-mgmt XMASTER_SITES= # none XDISTFILES= # none X XMAINTAINER= shen.elf@gmail.com XCOMMENT= Remove leaf packages XLICENSE= BSD X XNO_BUILD= yes XRUN_DEPENDS= ${LOCALBASE}/sbin/pkg:${PORTSDIR}/ports-mgmt/pkg X XWRKSRC= ${WRKDIR} X XPLIST_FILES= sbin/pkg-rmleaf X Xdo-extract: X ${MKDIR} ${WRKSRC} X ${CP} ${FILESDIR}/pkg-rmleaf ${WRKSRC} X Xdo-install: X ${INSTALL_SCRIPT} ${WRKSRC}/pkg-rmleaf ${PREFIX}/sbin/pkg-rmleaf X X.include 90b081522a03c78615bf1fbde8757eba echo x - pkg-rmleaf/pkg-descr sed 's/^X//' >pkg-rmleaf/pkg-descr << '7fe204c325fc4fdeef345cc0f0a99f60' XA little script for removing leaf packages. (requires pkgng) 7fe204c325fc4fdeef345cc0f0a99f60 exit >Release-Note: >Audit-Trail: >Unformatted: