~ubuntu-branches/ubuntu/intrepid/awstats/intrepid-updates

« back to all changes in this revision

Viewing changes to debian/cdbs/1/rules/copyright-check.mk

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2007-08-27 17:52:52 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070827175252-g4kv9ufn3qoruqgb
Tags: 6.7.dfsg-1
* New upstream release. Closes: bug#436572, thanks to Daniel Baumann.
* Add XS-Vcs-Svn and XS-Vcs-Browser fields to debian/control.
* Fix standards-version in debian/control.in.
* Update CDBS tweaks:
  + Replace auto-update.mk with overloading buildcore.mk.
  + Check copyright strings in pre-build target (not clean target) to
    fix race condition.
  + Add upstream-tarball.mk to implement get-orig-source target.
  + Fix applying buildinfo only once.
  + Add debian/README.cdbs-tweaks and advertise it in debian/rules.
* Declare (and merge duplicate) build-dependencies in debian/rules.
  Declare all as Build-Depends (not Build-depends-Indep).
* Semi-auto-update debian/control:
    DEB_BUILD_OPTIONS=cdbs-autoupdate fakeroot debian/rules pre-build
* Update debian/copyright:
  + Include both copyright and licensing info verbatim.
  + Update to include the year 2007.
  + Refer explicitly to GPLv2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- mode: makefile; coding: utf-8 -*-
2
 
# Copyright © 2005-2006 Jonas Smedegaard <dr@jones.dk>
 
2
# Copyright © 2005-2007 Jonas Smedegaard <dr@jones.dk>
3
3
# Description: Check for changes to copyright notices in source
4
4
#
5
5
# This program is free software; you can redistribute it and/or
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18
18
# 02111-1307 USA.
19
19
 
20
 
ifndef _cdbs_bootstrap
 
20
# TODO: Save scan as "file: match" (needs rewrite of main loop in perl)
 
21
 
 
22
# TODO: Save scan as "file (license): match" (needs /usr/bin/licensecheck from kdesdk-scripts)
 
23
 
21
24
_cdbs_scripts_path ?= /usr/lib/cdbs
22
25
_cdbs_rules_path ?= /usr/share/cdbs/1/rules
23
26
_cdbs_class_path ?= /usr/share/cdbs/1/class
24
 
endif
25
27
 
26
28
ifndef _cdbs_rules_copyright-check
27
29
_cdbs_rules_copyright-check := 1
28
30
 
29
31
include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
30
32
 
31
 
cdbs_copyright-check_find_opts := -not -regex '\./debian/.*'
 
33
cdbs_copyright-check_find_opts := -not -regex 'debian/.*' -not -regex '\(.*/\)?config\.\(guess\|sub\|rpath\)\(\..*\)?'
32
34
cdbs_copyright-check_egrep_opts := --text -rih '(copyright|\(c\) ).*[0-9]{4}'
33
35
 
34
 
clean::
35
 
        @echo 'Scanning upstream source for new/changed copyright notices...'
36
 
        @echo '(the debian/ subdir is _not_ examined - do that manually!)'
37
 
        find . -type f $(cdbs_copyright-check_find_opts) -exec cat '{}' ';' \
 
36
pre-build:: debian/stamp-copyright-check
 
37
 
 
38
debian/stamp-copyright-check:
 
39
        @echo 'Scanning upstream source for new/changed copyright notices (except debian subdir!)...'
 
40
        find * -type f $(cdbs_copyright-check_find_opts) -exec cat '{}' ';' \
 
41
                | tr '\r' '\n' \
 
42
                | LC_ALL=C sed -e 's/[^[:print:]]//g' \
38
43
                | egrep $(cdbs_copyright-check_egrep_opts) \
39
44
                | sed -e 's/^[[:space:]*#]*//' -e 's/[[:space:]]*$$//' \
40
45
                | LC_ALL=C sort -u \
41
46
                > debian/copyright_newhints
42
 
        if [ ! -f debian/copyright_hints ]; then touch debian/copyright_hints; fi
43
 
        @echo "diff --normal debian/copyright_hints debian/copyright_newhints | egrep '^>'"
44
 
        @diff --normal debian/copyright_hints debian/copyright_newhints | egrep '^>'; \
45
 
                if [ "$$?" -eq "0" ]; then \
46
 
                        echo "New or changed copyright notices discovered! Do this:"; \
47
 
                        echo "  1) Search source for each of the above lines ('grep -r' is your friend)"; \
48
 
                        echo "  2) Update debian/copyright as needed"; \
49
 
                        echo "  3) Replace debian/copyright_hints with debian/copyright_newhints"; \
 
47
        @if [ ! -f debian/copyright_hints ]; then touch debian/copyright_hints; fi
 
48
        @newstrings=`diff -u debian/copyright_hints debian/copyright_newhints | sed '1,2d' | egrep '^\+' | sed 's/^\+//'`; \
 
49
                if [ -n "$$newstrings" ]; then \
 
50
                        echo "Error: The following new or changed copyright notices discovered:"; \
 
51
                        echo "$$newstrings"; \
 
52
                        echo "Trying to locate the files containing the new/changed copyright notices..."; \
 
53
                        echo "(Strings part of binary data you need to resolve yourself)"; \
 
54
                        find * -type f $(cdbs_copyright-check_find_opts) -exec grep -F -l -e "$$newstrings" '{}' ';'; \
 
55
                        echo; \
 
56
                        echo "To fix the situation please do the following:"; \
 
57
                        echo "  1) Investigate the above changes and update debian/copyright as needed"; \
 
58
                        echo "  2) Replace debian/copyright_hints with debian/copyright_newhints"; \
50
59
                        exit 1; \
51
60
                fi
52
61
        
53
62
        @echo 'No new copyright notices found - assuming no news is good news...'
54
63
        rm -f debian/copyright_newhints
 
64
        touch $@
 
65
 
 
66
clean::
 
67
        rm -f debian/stamp-copyright-check
55
68
 
56
69
endif