Browse Source

repository_checker: support --validate-incoming

If files are present in an incoming directory than usually something
went wrong.
merge-requests/109/head
Michael Prokop 10 years ago
parent
commit
3b1e604142
  1. 40
      scripts/repository_checker

40
scripts/repository_checker

@ -45,6 +45,7 @@ Configuration options:
Validation options:
--validate-source-bin-versions Make sure source packages match with binary package versions.
--validate-incoming Make sure there are no leftover files in incoming repositories.
Misc options:
@ -53,6 +54,34 @@ Misc options:
"
}
validate-incoming() {
rc=0
if ! [ -r "${REPOSITORY}/conf/incoming" ] ; then
echo "No incoming repository in ${REPOSITORY} found. Nothing to be done."
return 0
fi
for directory in $(awk '/IncomingDir: / {print $2}' "${REPOSITORY}/conf/incoming") ; do
incoming="${REPOSITORY}/${directory}"
if ! [ -d "$incoming" ] ; then
echo "Directory $incoming of registered incoming repository does not exist, skipping."
continue
fi
echo "Checking for leftover files in incoming directory ${incoming}:"
if find "${incoming}" -type f | grep '.' ; then
echo "Leftover files found. Needs investigation."
rc=1
else
echo "Nothing found. Good."
fi
done
return $rc
}
validate-source-bin-versions() {
rc=0
@ -91,7 +120,7 @@ validate-source-bin-versions() {
trap bailout 1 2 3 6 9 14 15
# command line handling
CMDLINE_OPTS=list-package:,list-binary-package:,list-binary-repos:,list-repos:,list-source-package:,list-source-repos:,repository:,,help,validate-source-bin-versions,version
CMDLINE_OPTS=list-package:,list-binary-package:,list-binary-repos:,list-repos:,list-source-package:,list-source-repos:,repository:,,help,validate-incoming,validate-source-bin-versions,version
_opt_temp=$(getopt --name repository_checker -o +vhV --long $CMDLINE_OPTS -- "$@")
if [ $? -ne 0 ]; then
@ -108,6 +137,7 @@ _opt_list_repos=false
_opt_list_source_package=false
_opt_list_source_repos=false
_opt_validate_source_bin_versions=false
_opt_validate_incoming=false
while :; do
case "$1" in
@ -135,6 +165,9 @@ while :; do
--help)
usage ; exit 0;
;;
--validate-incoming)
_opt_validate_incoming=true
;;
--validate-source-bin-versions)
_opt_validate_source_bin_versions=true
;;
@ -194,6 +227,11 @@ if $_opt_validate_source_bin_versions ; then
bailout $?
fi
if $_opt_validate_incoming ; then
validate-incoming
bailout $?
fi
usage >&2
bailout 1

Loading…
Cancel
Save