From alex@cichlids.com  Sun May 21 15:32:22 2000
Return-Path: <alex@cichlids.com>
Received: from mail.surf1.de (mail.surf1.de [194.25.165.21])
	by hub.freebsd.org (Postfix) with ESMTP id C459437B850
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 21 May 2000 15:32:20 -0700 (PDT)
	(envelope-from alex@cichlids.com)
Received: from cichlids.com (p3E9D38E7.dip0.t-ipconnect.de [62.157.56.231])
	by mail.surf1.de (8.9.3/8.9.3) with ESMTP id AAA16846
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 May 2000 00:31:46 +0200
Received: from cichlids.cichlids.com (cichlids.cichlids.com [192.168.0.10])
	by cichlids.com (Postfix) with ESMTP id EB293AC2C
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 May 2000 00:31:55 +0200 (CEST)
Received: (from alex@localhost)
	by cichlids.cichlids.com (8.9.3/8.9.3) id AAA06982;
	Mon, 22 May 2000 00:31:23 +0200 (CEST)
	(envelope-from alex)
Message-Id: <200005212231.AAA06982@cichlids.cichlids.com>
Date: Mon, 22 May 2000 00:31:23 +0200 (CEST)
From: Alexander Langer <alex@cichlids.com>
Reply-To: alex@cichlids.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: add checksum.sh for the Tools dir
X-Send-Pr-Version: 3.2

>Number:         18723
>Category:       ports
>Synopsis:       add checksum.sh for the Tools dir
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 21 15:40:01 PDT 2000
>Closed-Date:    Mon May 22 03:02:44 PDT 2000
>Last-Modified:  Mon May 22 03:02:57 PDT 2000
>Originator:     Alexander Langer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
none
>Environment:


>Description:

Hello. I've always wanted to write it, now I had time.
Basic idea: bento only copies the files to the ftp.freebsd.org mastersite,
if the checksum succeeds.
That means, on ftp.freebsd.org there _should_ be always the distfile with
the old checksum.

Using that, next steps are easy:
Fetch new and old distfiles and compare them with diff -rNu

All checksum patches I sent over the last hour are verified with this
script.
I REALLY speeds up the work.

>How-To-Repeat:

>Fix:

--- snip ---
#!/bin/sh

if [ -z $1 ]; then
	echo "Usage: $0 <portname>"
	exit 1
fi

if [ -z $TMPDIR ]; then
	TMPDIR=/tmp
fi
if [ -z $PORTSDIR ]; then
	PORTSDIR=/usr/ports
fi

cd $PORTSDIR
DIR=`grep $1 INDEX| cut -f2 -d\|`
cd $DIR

make fetch
broken=`make checksum 2>&1 | grep "Checksum mismatch for" | awk '{print $5}' \
	| sed -e 's:\.$::'`

if [ -z $broken ]; then
	make checksum
	echo "Checksum ok, exiting..."
	exit 1
fi

rm -rf $TMPDIR/checksum
mkdir $TMPDIR/checksum
cd $TMPDIR/checksum
mkdir $TMPDIR/checksum/orig
mkdir $TMPDIR/checksum/new

echo Fetching $broken
fetch ftp://ftp.FreeBSD.ORG/pub/FreeBSD/distfiles/$broken

if [ ! -r $broken ]; then
	echo "File $broken not found, fetch error?"
	exit 1
fi

if file $broken | grep "gzip compressed data" >/dev/null; then
	cd orig
	tar -zxf ../$broken
	cd ../new
	tar -zxf $PORTSDIR/distfiles/$broken
	cd ..
elif file $broken | grep "zip archive file" >/dev/null ; then
	cd orig
	unzip ../$broken
	cd ../new
	unzip $PORTSDIR/distfiles/$broken
	cd ..
else
	cp $broken orig/
	cp $PORTSDIR/distfiles/$broken new/
fi

echo Diff follows:
diff -rNu orig new
---- snap ----

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: will 
State-Changed-When: Mon May 22 03:02:44 PDT 2000 
State-Changed-Why:  
Committed, thanks! 
>Unformatted:
