From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay5.poste.it (relay5.poste.it [62.241.4.67]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j428DWSm024544 for ; Mon, 2 May 2005 08:13:32 GMT Received: from flameeyes.is-a-geek.org (151.44.23.221) by relay5.poste.it (7.2.052.3) (authenticated as emanuela.zanon@poste.it) id 4210C214001B70FE for gentoo-dev@lists.gentoo.org; Mon, 2 May 2005 10:13:37 +0200 From: "Diego 'Flameeyes' =?iso-8859-1?q?Petten=F2?=" To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] File counter Date: Mon, 2 May 2005 10:11:06 +0200 User-Agent: KMail/1.8 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1905128.tGBcDXVsEx"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200505021011.07710@enterprise.flameeyes.is-a-geek.org> X-Archives-Salt: e0e0f08f-8c23-4ed9-8fa8-941bdf4e8d8c X-Archives-Hash: a6bbee82dd4709319a7f76f893d6f2cc --nextPart1905128.tGBcDXVsEx Content-Type: multipart/mixed; boundary="Boundary-01=_bCedC44uAqNIUMN" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_bCedC44uAqNIUMN Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Ok I was a bit quiet lately but that's only because I was vocal elsewhere=20 (irc) ;).. You can find attached a little script I wrote last night to get a count of= =20 files in $FILESDIR for packages to make sure they just are the few needed, = as=20 I'm moving the patches for packages which needs 2 or more patches every=20 versions in patchset tarballs which get downloaded only when requested. It's a probably-wrong, dirty, bad-looking bash script, but it works fine he= re. It must run from a portage basedir (it should work also on a personal overl= ay=20 anyway), and accepts two parameters: the first is the name of the category = if=20 you want to check just one, the other one is the minimum number of files to= =20 report, the default is 1, I usually make it 3. Hope this can be useful. =2D-=20 Diego "Flameeyes" Petten=F2 Gentoo Developer (Gentoo/FreeBSD, Video, Gentoo/AMD64) http://dev.gentoo.org/~flameeyes/ --Boundary-01=_bCedC44uAqNIUMN Content-Type: application/x-shellscript; name="countfiles.sh" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="countfiles.sh" #!/bin/bash # This is a small script which, run into a base portage dir, counts the number # of files present in the $FILESDIR for the packages. It has two parameters: # The first one is the name of the category to look at. # The other one is the minimum number of files to report (default: 1) count_files() { filescount=$(ls $1/$2/files | egrep -v '^CVS$|^digest-' | wc -l) mincount=$3 (( $filescount >= ${mincount:=1} )) && echo "$1/$2 $filescount" } count_cat() { packages=$(ls $1 | egrep -v '^CVS$|^metadata.xml$') for package in $packages; do count_files $1 $package $2 done } if [[ -n "$1" ]]; then count_cat $1 $2 else cats="$(ls | egrep -v \ '^CVS$|^profiles$|^distfiles$|^packages$|^header.txt$|^skel.')" for category in $cats; do count_cat $category $2 done fi --Boundary-01=_bCedC44uAqNIUMN-- --nextPart1905128.tGBcDXVsEx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBCdeCbe2h1+2mHVWMRAic2AKCKCwZF04bktA0+1YBOPrLaXTQdvACfWOKn wUhhAbTKMyX00+TN5DX8iFM= =zr+Z -----END PGP SIGNATURE----- --nextPart1905128.tGBcDXVsEx-- -- gentoo-dev@gentoo.org mailing list