SHA256 checksums

Vasil Dimov vd at datamax.bg
Thu Nov 10 05:59:07 PST 2005


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:
> > > 
> > > * 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)
> > 
> > Ok, here is a tool that takes a ports dir and hacks it, adding 
> > sha256 sums for the available distfiles.
> 
> 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=${1:-/usr/ports}
distfilesdir=${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 \(([^)]+)\) = [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)
> 
> 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.

-- 
Vasil Dimov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20051110/3799158c/attachment.bin


More information about the freebsd-ports mailing list