#!/bin/sh
# Copyright © 2016-2017  Jonas Smedegaard <dr@jones.dk>
# Description: helper script to update copyright_hints
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

set -eu

# fail if check fails
export DEB_MAINTAINER_MODE=1

# bootstrap if this is first ever copyright-check
test -f debian/copyright_hints | touch debian/copyright_hints

# these may both fail - we want its fallout for further analysis
debian/rules.copyright-check pre-build || true
debian/rules.copyright-check clean || true

# we use git so merging new check with old is safe
[ ! -f debian/copyright_newhints ] || mv -f debian/copyright_newhints debian/copyright_hints
