Re: Script to set/unset "automatic" status in PKGNG database
--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 <bapt@freebsd.org> 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--
討論串 (同標題文章)
完整討論串 (本文為第 9 之 10 篇):