system-config/modules/jenkins/files/slave_scripts/check_projects_yaml_alphabetized.sh
Andreas Jaeger cc5c802da7 Fix check_projects_yaml_alphabetized.sh
The previous patch moved " PROJECTS_LIST=$OLDPWD/modules/..." before
the pushd call. But pushd changes the path and thus OLDPWD as well.

So, there are two possible fixes: Either remove the OLDPWD variable from
the if and set PROJECTS_LIST in another way with a full path or
move the pushd call before the if.

Change-Id: If47ab0cfb0078d5e570057c974e3d1f0367d4e0a
2014-01-26 15:00:43 +01:00

31 lines
827 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
if [ -f $OLDPWD/modules/openstack_project/templates/review.projects.yaml.erb ]
then
PROJECTS_LIST=$OLDPWD/modules/openstack_project/templates/review.projects.yaml.erb
else
PROJECTS_LIST=$OLDPWD/modules/openstack_project/files/review.projects.yaml
fi
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