system-config/tools/check_projects_yaml_alphabetized.sh
Monty Taylor bc794da31e Split config from projects list
The projects list is a common list for devs to interact with. The config
in the list is not, but the config in the list means the file needs to
be in an erb template.

Split the two concerns, similar to zuul. Put the config in a config file
and the project data in a yaml file.

Change-Id: I708b8655b4b1ce377f3b7369e987418c1d72d977
2014-01-28 09:32:09 -08:00

25 lines
643 B
Bash
Executable File

#!/bin/bash -xe
# It checks that projects.yaml alphabetized and prints list of projects that
# should be sorted.
export TMPDIR=`/bin/mktemp -d`
trap "rm -rf $TMPDIR" EXIT
pushd $TMPDIR
PROJECTS_LIST=$OLDPWD/modules/openstack_project/files/review.projects.yaml
sed -e '/^- project: /!d' -e 's/^- project: //' $PROJECTS_LIST > projects_list
LC_ALL=C sort --ignore-case projects_list -o projects_list.sorted
if ! diff projects_list projects_list.sorted > projects_list.diff; then
echo "The following projects should be alphabetized: "
cat projects_list.diff | grep -e '> '
exit 1
else
echo "Projects alphabetized."
fi
popd