Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Nov 2005 15:59:05 +0200
From:      Vasil Dimov <vd@datamax.bg>
To:        Pav Lucistnik <pav@FreeBSD.org>
Cc:        freebsd-ports@FreeBSD.org, Kris Kennaway <kris@obsecurity.org>
Subject:   Re: SHA256 checksums
Message-ID:  <20051110135905.GA85955@qlovarnika.bg.datamax>
In-Reply-To: <20051110133620.M84613@FreeBSD.org>
References:  <20051109165951.GA75924@qlovarnika.bg.datamax> <20051109170437.GW28443@droso.net> <20051109182405.GB27053@xor.obsecurity.org> <20051110131640.GA85826@qlovarnika.bg.datamax> <20051110133620.M84613@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 10, 2005 at 02:37:00PM +0100, Pav Lucistnik wrote:
> On Thu, 10 Nov 2005 15:16:40 +0200, Vasil Dimov wrote
> > On Wed, Nov 09, 2005 at 01:24:05PM -0500, Kris Kennaway wrote:
> > >=20
> > > * deal with the fact that 'make checksum' on their machine may not add
> > > checksums for all of the files listed in distinfo (and in such a case
> > > will actually remove them, breaking the port for others)
> >=20
> > Ok, here is a tool that takes a ports dir and hacks it, adding=20
> > sha256 sums for the available distfiles.
>=20
> Where? Anyway, "make makesum" is not enough?

Hmmz, i didn't forgot to attach it so it got stripped somewhere
in the way, anyway here it is:

http://vdev.datamax.bg/tmp/portsaddsha256.sh

--- portsaddsha256.sh begins here ---
#!/bin/sh -e

portsdir=3D${1:-/usr/ports}
distfilesdir=3D${2:-$portsdir/distfiles}

get_distinfos()
{
	find $1 -maxdepth 3 -mindepth 3 -name distinfo
}

extract_archives()
{
	# get all archives that have MD5 sum
	# ones that do not have MD5 sum do not deserve SHA256 sum
	for archive in `cat $1 |sed -nE 's/^MD5 \(([^)]+)\) =3D [0-9a-f]{32}$/\1/p=
'` ; do
		# output only archives that do not already have SHA256 sum
		if [ -z "`grep '^SHA256 ($archive)' $1`" ] ; then
			echo $archive
		fi
	done
}

cd $distfilesdir

for distinfo in `get_distinfos $portsdir`; do
	for archive in `extract_archives $distinfo` ; do
		if [ -r $distfilesdir/$archive ] ; then
			sha256 $archive >> $distinfo
		fi
	done
done

# EOF
--- portsaddsha256.sh ends here ---

See Kris's statement about `make makesum', that's why I choose
`sha256 foo.tar.gz >> distinfo'

 >>It *SURELY* does not do anything else than adding the sha256 sum<<

> > A diff from my ports dir can be found at:
> > http://vdev.datamax.bg/tmp/ports_sha256.diff.gz
> > (655 distfiles available)
>=20
> Please send-pr it, otherwise it will almost certainly get lost.

My thought is that this (or similar) script be run on a machine where
all the distfiles are available, mine is about 5% of all :)
Anyway if it does not happen in a week or so I will send-pr it.

--=20
Vasil Dimov

--YiEDa0DAkWCtVeE4
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----

iD8DBQFDc1IpFw6SP/bBpCARAqdoAJ9xuhW/hbcKRlmN7y8Anh4iKT8WPQCfVkJP
7lvVGw4nrVWMdoylafrbsAo=
=aujl
-----END PGP SIGNATURE-----

--YiEDa0DAkWCtVeE4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051110135905.GA85955>