#!/bin/sh

echo "Exporting a new version of the vocabulary data from SVN..."

if ! svn cat svn://svn.debian.org/debtags/vocabulary/trunk/debian-packages > vocabulary
then
	CACHED='/var/cache/debtags/debtags.alioth.debian.org_tags_vocabulary.gz'
	if [ -f $CACHED ]
	then
		echo "Falling back to locally cached copy in $CACHED"
		cp "$CACHED" vocabulary
	else
		echo "Cannot find a way to generate the file 'vocabulary'" >&2
		exit 1
	fi
fi

echo >> vocabulary

if ! svn cat svn://svn.debian.org/debtags/vocabulary/trunk/security-team >> vocabulary
then
	echo "Cannot fetch the security team tags to add to the vocabulary: skipping them" >&2
fi

exit 0
