From owner-freebsd-ports@FreeBSD.ORG Thu Aug 30 22:40:09 2012 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28177106564A; Thu, 30 Aug 2012 22:40:09 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 074858FC0A; Thu, 30 Aug 2012 22:40:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q7UMe8NU072396; Thu, 30 Aug 2012 22:40:08 GMT (envelope-from bapt@freebsd.org) Received: (from bapt@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q7UMe8Ji072395; Thu, 30 Aug 2012 22:40:08 GMT (envelope-from bapt@freebsd.org) X-Authentication-Warning: freefall.freebsd.org: bapt set sender to bapt@freebsd.org using -f Date: Fri, 31 Aug 2012 00:40:06 +0200 From: Baptiste Daroussin To: John Nielsen Message-ID: <20120830224006.GP64447@ithaqua.etoilebsd.net> References: <20120830212833.GN64447@ithaqua.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U+NfgObvpQT1Q9Yq" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "ports@freebsd.org" , "current@freebsd.org" Subject: Re: Script to set/unset "automatic" status in PKGNG database X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 22:40:09 -0000 --U+NfgObvpQT1Q9Yq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 30, 2012 at 04:33:09PM -0600, John Nielsen wrote: > On Aug 30, 2012, at 3:28 PM, Baptiste Daroussin wrote: >=20 > > On Thu, Aug 30, 2012 at 03:19:59PM -0600, 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" fl= ag in the pkgng database rather than user input to determine which "leaf" p= orts can be removed. Unfortunately, the pkg2ng utility has no way of knowin= g which old-style packages it converts were installed automatically as depe= ndencies, 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 re= ally 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 be= nefit 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 at= tached to the name. It shouldn't eat your package database or steal your lu= nch money, but I'm not responsible if it does. Other than that, feedback is= welcome. > >=20 > > Would you mind adding create a patch against the git tree of pkgng so t= hat we > > can include your script into the scripts subdirectory, so that we provi= de your > > script along with the next pkg 1.0.1 as a contributed script? >=20 > No problem. Attached is the output of "git diff origin" after dropping my= script in to my local tree. Let me know if you need something else. >=20 > Changes between this and the version I originally posted: > Added 2-clause license and disclaimer > Replaced SQL with 'pkg set' commands. Since I didn't come up with a fast= way to list the packages not in the 'automatic' list, I first set all pack= ages to 0 (not automatic), then set the ones in the list to 1. This is like= ly slower than the SQL variant was, but it's not bad and not something like= ly to be run frequently. >=20 > JN Thanks you should be enough, can you provide a git format-patch patch so th= at you get your name in the logs :D regards, Bapt --U+NfgObvpQT1Q9Yq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlA/68YACgkQ8kTtMUmk6EyWuwCffRhghFv3v96W743y4YKAiy2k JPoAnjKhvEVYLNDF7fzQAfTux93F1Om/ =bgox -----END PGP SIGNATURE----- --U+NfgObvpQT1Q9Yq--