It seems that this problem is simply caused by not clearing out the build directory before upgrading to a new version. Files that were part of previous versions remain in the build directory and are put in the resulting package, even though they shouldn’t be there.
One should therefore always run makepkg --clean
before upgrading.