From owner-freebsd-current@FreeBSD.ORG Fri Aug 31 14:46:19 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE5EC106566B; Fri, 31 Aug 2012 14:46:18 +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 C9CB98FC1F; Fri, 31 Aug 2012 14:46:18 +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 q7VEkHO4034834 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 31 Aug 2012 10:46:17 -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: <50405219.8090804@FreeBSD.org> Date: Fri, 31 Aug 2012 08:46:19 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <95FAC698-F7DA-4E49-BB20-EBB023ACF1F2@jnielsen.net> References: <503FDB2A.4000609@freebsd.org> <50405219.8090804@FreeBSD.org> To: Matthew Seaman X-Mailer: Apple Mail (2.1486) X-DCC-sonic.net-Metrics: ns1.jnielsen.net 1117; Body=4 Fuz1=4 Fuz2=4 X-Virus-Scanned: clamav-milter 0.97.5 at ns1.jnielsen.net X-Virus-Status: Clean Cc: "ports@freebsd.org" , "current@freebsd.org" , Julien Laffaye 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: Fri, 31 Aug 2012 14:46:19 -0000 On Aug 30, 2012, at 11:56 PM, Matthew Seaman = wrote: > On 30/08/2012 22:44, John Nielsen wrote: >> 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 } ? >=20 > Use pkg query - it is really quite powerful. This shows all > non-autoremove packages as name-version: >=20 > pkg query -e '%a =3D=3D 0' '%n-%v' >=20 > and this shows the port origin for all autoremove packages: >=20 > pkg query -e '%a =3D=3D 1' '%o' Thanks. I know about pkg query (and in fact my script uses something = very much like that to get the initial list of automatic packages). What = I was trying to do was get a list of packages installed but not in = another list. The other list represents _future_ automatic packages but = not necessarily what is in the database now. In any case, I worked around it but first unsetting all packages and = then setting the user-selected list back to automatic. JN