1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

script for finding "size mismatch" and "size unknown" errors

This commit is contained in:
Trevor Johnson 2004-03-12 18:56:53 +00:00
parent ac3a2bcbe7
commit fc9fc69007
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=103804

58
Tools/scripts/checksize.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/sh
# checksize.sh: scan the ports collection for "size mismatch" and
# "size unknown" errors by attempting to fetch onto a full filesystem
#
# When called with a parameter that is the name of a category of
# ports, the script checks that category, then checks the whole
# ports collection, redoing the named category. When called with
# no parameter, it checks the whole collection.
#
# First do something like:
#
# dd if=/dev/zero of=/usr/ports/mfs.img bs=1k count=512
# mdconfig -a -t vnode -f /usr/ports/mfs.img -u 1
# newfs /dev/md1
# mount /dev/md1 /mnt
# dd if=/dev/zero of=/mnt/zero
#
# (for RELENG_4 use vnconfig instead of mdconfig). Then run this
# while logging with, for example, the "script" utility and look
# for "size mismatch" (indicating the server has a distfile with a
# different size than what is listed in the distinfo file) and "size
# unknown" (indicating that the server does not report file sizes)
# errors in the output. Pipe the output through:
#
# grep -w size | grep -1 -E "unknown|mismatch"
#
# By keeping the filesystem full, we avoid fetching entire distfiles.
# The script attempts to partially download each distfile from all
# master sites. Contacting all sites is desirable because sometimes
# a site which ostensibly mirrors another may contain corrupt files
# which are intact on the main site (or vice versa).
#
# bugs:
# - assumes ports tree is in /usr/ports/
# - doesn't provide for checking only particular categories or ports
# - support for multiple architectures is inefficient
# - output is messy
# - on my system, the first 20 kB of each distfile are fetched
# - needs manual setup of /mnt/
#
# placed in the public domain by Trevor Johnson
for category in $1 `grep ^SUBDIR /usr/ports/Makefile | cut -f3 -d\ `; do
cd /usr/ports/$category
for port in \
`grep -wc SIZE */distinfo* | grep -v :0 | cut -f1 -d\/`; do
cd /usr/ports/$category/$port
for arc in i386; do
echo checking $arc size data for $category/$port
make DISTDIR=/mnt \
ARCH=$arc \
BATCH=yes \
MACHINE_ARCH=$arc \
PACKAGE_BUILDING=yes \
TRYBROKEN=yes checksum
done
done
done