From owner-freebsd-current@FreeBSD.ORG Thu Aug 30 21:44:16 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A3441065674; Thu, 30 Aug 2012 21:44:16 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (secure.freebsdsolutions.net [69.55.234.48]) by mx1.freebsd.org (Postfix) with ESMTP id EC07F8FC08; Thu, 30 Aug 2012 21:44:15 +0000 (UTC) Received: from [10.10.1.32] (office.betterlinux.com [199.58.199.60]) (authenticated bits=0) by ns1.jnielsen.net (8.14.4/8.14.4) with ESMTP id q7ULi8rD026294 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 30 Aug 2012 17:44:09 -0400 (EDT) (envelope-from lists@jnielsen.net) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) From: John Nielsen In-Reply-To: <503FDB2A.4000609@freebsd.org> Date: Thu, 30 Aug 2012 15:44:23 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <503FDB2A.4000609@freebsd.org> To: Julien Laffaye X-Mailer: Apple Mail (2.1486) X-DCC-sonic.net-Metrics: ns1.jnielsen.net 1117; Body=3 Fuz1=3 Fuz2=3 X-Virus-Scanned: clamav-milter 0.97.5 at ns1.jnielsen.net X-Virus-Status: Clean Cc: "ports@freebsd.org" , "current@freebsd.org" Subject: Re: Script to set/unset "automatic" status in PKGNG database X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 21:44:16 -0000 On Aug 30, 2012, at 3:29 PM, Julien Laffaye = wrote: > On 8/30/2012 11:19 PM, John Nielsen wrote: >> I today noticed the "pkg autoremove" command for the first time, = which does much the same thing as pkg_cutleaves but relies on the = "automatic" flag in the pkgng database rather than user input to = determine which "leaf" ports can be removed. Unfortunately, the pkg2ng = utility has no way of knowing which old-style packages it converts were = installed automatically as dependencies, so they are all marked as = non-automatic (i.e. user-requested). In my case, this was not true for = the majority of installed ports. Since I really like this functionality, = I decided to update my local package database to match my preferences. >>=20 >> Having succeeded, I decided a tool to make doing so easy could well = benefit others (as well as my future self). (Plus I wanted an excuse to = play with dialog(1) and "pkg query" a bit.) So here's the result. I'm = not too attached to the name. It shouldn't eat your package database or = steal your lunch money, but I'm not responsible if it does. Other than = that, feedback is welcome. >>=20 > You want to use `pkg set -A` :) > We make zero promises concerning the SQL schema in pkgng so it can = change at every time and break your script. Thanks. I looked for something like that but not hard enough obviously. = I'll change it. After dialog(1) exits the script has a list of packages to mark as = automatic. Is there a non-SQL way to efficiently get the inverse? I.e. = the set { all_packages - new_automatic_package_list } ? JN