Subject: Re: muhah
To: Bill Studenmund <wrstuden@zembu.com>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 03/27/2001 10:43:56
On Mon, Mar 26, 2001 at 09:35:31AM -0800, Bill Studenmund wrote:
> On Mon, 26 Mar 2001, Alistair Crooks wrote:
> 
> > Because there were/are about 3000 files in pkgsrc which have
> > information stored in the output format of md5(1) - all of the
> > files/md5 and files/patch-sum files.  I made the output of digest(1)
> > compatible with that, so that I wouldn't have to add yet more logic to
> > bsd.pkg.mk to work out whether I was dealing with an md5-style
> > checksum, or an openssl-style checksum.
> 
> I haven't looked at the patch checking logic. I gather it's more than
> just, is the line in the patch-sum file different from the file I get when
> I run the program?

Yes, there are 3 separate places the logic is used in calculating
checksums when distfiles are fetched and patches are checked.  The
files themselves are generated in another two places.

For one of the places, fetching with FAILOVER_FETCH set, the logic is
as follows:

                                if [ -n "${FAILOVER_FETCH}" -a -f ${DIGEST_FILE} -a -f ${_DISTDIR}/$$bfile ]; then \
                                        alg=`${AWK} 'NF == 4 && $$2 == "('$$file')" && $$3 == "=" {print $$1;}' ${DIGEST_FILE}`; \
                                        if [ -z "$$alg" ]; then         \
                                                alg=${DIGEST_ALGORITHM};\
                                        fi;                             \
                                        CKSUM=`${DIGEST} $$alg < ${_DISTDIR}/$$bfile`; \
                                        CKSUM2=`${AWK} '$$1 == "'$$alg'" && $$2 == "('$$file')" {print $$4;}' <${DIGEST_FILE}`; \
                                        if [ "$$CKSUM" = "$$CKSUM2" -o "$$CKSUM2" = "IGNORE" ]; then \
                                                continue 2;             \
                                        else                            \
                                                ${ECHO_MSG} "=> Checksum failure - trying next site."; \
                                        fi;                             \

Regards,
Alistair