#!/bin/sh
# Copyright 2016-2018  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.

set -eu

# extract metadata from graphics files before copyright check
# - and skip compiled localizations, and graphics unlikely to embed ICCs.
export DEB_COPYRIGHT_EXTRACT_EXTS="gif pdf png svg xcf"
export DEB_COPYRIGHT_EXTRACT_PATHS_EXIF="share/ValDocumentOriginalSource.ai"
export DEB_COPYRIGHT_CHECK_IGNORE_EXTS="icns ico ts val vit"

make -f /usr/share/cdbs/1/rules/utils.mk pre-build || true
make -f /usr/share/cdbs/1/rules/utils.mk clean DEB_COPYRIGHT_CHECK_STRICT=1

# unconditionally merge changes - safe to do with git-tracked package
[ ! -f debian/copyright_newhints ] || mv -f debian/copyright_newhints debian/copyright_hints
