From owner-freebsd-ports@FreeBSD.ORG Wed Jul 19 20:23:10 2006 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07EE116A4DF for ; Wed, 19 Jul 2006 20:23:10 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.187.76.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CCB343F31 for ; Wed, 19 Jul 2006 20:19:37 +0000 (GMT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from [IPv6:::1] (localhost [IPv6:::1]) by smtp.infracaninophile.co.uk (8.13.6/8.13.6) with ESMTP id k6JKJAPJ076090; Wed, 19 Jul 2006 21:19:13 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) Authentication-Results: smtp.infracaninophile.co.uk from=m.seaman@infracaninophile.co.uk; sender-id=softfail; spf=softfail X-SenderID: Sendmail Sender-ID Filter v0.2.13 smtp.infracaninophile.co.uk k6JKJAPJ076090 Message-ID: <44BE93B8.4090601@infracaninophile.co.uk> Date: Wed, 19 Jul 2006 21:19:04 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 1.5.0.4 (X11/20060610) MIME-Version: 1.0 To: Dan Langille References: <44BE4F89.16402.3BFDA1A6@dan.langille.org> In-Reply-To: <44BE4F89.16402.3BFDA1A6@dan.langille.org> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enigE96E0F9CA57A2B8821460734" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (smtp.infracaninophile.co.uk [IPv6:::1]); Wed, 19 Jul 2006 21:19:33 +0100 (BST) X-Virus-Scanned: ClamAV 0.88.3/1609/Wed Jul 19 13:13:27 2006 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on happy-idiot-talk.infracaninophile.co.uk Cc: ports@freebsd.org Subject: Re: FreshPorts - scripting help wanted 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: Wed, 19 Jul 2006 20:23:10 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE96E0F9CA57A2B8821460734 Content-Type: multipart/mixed; boundary="------------010005040300070209060900" This is a multi-part message in MIME format. --------------010005040300070209060900 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Dan Langille wrote: > Hi folks, >=20 > Some scripting help wanted please. Either Perl or Python. Details=20 > at descriptions/> (also known as ). Try this. Run it as: cat-parse.pl categories or even cat-parse.pl < categories Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------010005040300070209060900 Content-Type: text/plain; name="cat-parse.pl" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="cat-parse.pl" #!/usr/bin/perl -w use strict; # Read in the categories file from the filehandle passed as the # argument to this function and return a hash keyed on category name # containing category description and group. See # http://www.freebsd.org/cgi/cvsweb.cgi/www/en/ports/categories for # the imput. # sub cat_parse (*) { my $filehandle =3D shift; my %categories; my $c; my $d; my $g; while (<$filehandle>) { next unless ( ( $c, $d, $g ) =3D m/^([^,]+),"([^"]+)",([A-Z]+)/g ); = #" $categories{$c} =3D { DESCR =3D> $d, GROUP =3D> $g }; } return \%categories; } MAIN: { my $categories; $categories =3D cat_parse(ARGV); for my $c ( keys %{$categories} ) { print "$c\t$categories->{$c}{DESCR}\t$categories->{$c}{GROUP}\n";= } } --------------010005040300070209060900-- --------------enigE96E0F9CA57A2B8821460734 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEvpO+8Mjk52CukIwRAw0GAJ0a12rRTlsmEiBSaFiOS65b2sMa6wCglUlB Gsp4NvSewoYzJ9n4f0fmZm0= =F+2m -----END PGP SIGNATURE----- --------------enigE96E0F9CA57A2B8821460734--