Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9ac03fe2e1
Fetching contributors…

Cannot retrieve contributors at this time

file 58 lines (46 sloc) 1.13 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#!/bin/sh
set -e
. rpg-sh-setup

ARGV="$@"
USAGE '${PROGNAME}
Verify integrity of the package db and release index.'

checking () {
    printf "checking %-35s" "$* ..."
}

diagnose () {
    if problems=$(command "$@" 2>&1)
    then ok
    else fail "$problems"
    fi
}


ok () {
    printf " OK"
    if test "$*"
    then printf " (%s)" "$*"
    fi
    printf "\n"
}

fail () { printf " FAIL\n[%s]\n" "$*"; }

checking "recent index readability"
diagnose test -r "$RPGINDEX/release-recent"

checking "index readability"
diagnose test -r "$RPGINDEX/release"

checking "recent index joinability"
diagnose sort -c -b -k 1,1 "$RPGINDEX/release-recent"

checking "index joinability"
diagnose sh -c "
cut -f 1 -d ' ' < '$RPGINDEX/release' |
sort -c -b -k 1,1
"

checking "recent index data"
if lines=$(wc -l "$RPGINDEX/release-recent" | sed 's/[^0-9]//g') &&
   test "$lines" -gt 0
then ok "$lines packages"
else fail "${lines:-no} packages"
fi

checking "index data"
if lines=$(wc -l "$RPGINDEX/release" | sed 's/[^0-9]//g') &&
   test "$lines" -gt 0
then ok "$lines package versions"
else fail "${lines:-no} packages"
fi
Something went wrong with that request. Please try again.