~ubuntu-branches/ubuntu/precise/devscripts/precise

« back to all changes in this revision

Viewing changes to scripts/what-patch.sh

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2011-05-25 09:46:30 UTC
  • Revision ID: james.westby@ubuntu.com-20110525094630-gsd820t94ib5u6kn
Tags: 2.11.0ubuntu1
* Merge from Debian unstable; remaining changes:
  - Demote Recommends to Suggests:
    + libcrypt-ssleay-perl: only needed for a corner case (uscan on SSL
      download sites), wasn't installed by default in previous releases
      either, and seems quite dead upstream; universe only.
    + debian-{keyring,maintainers}: not useful enough in Ubuntu; universe
      only.
    + equivs: too much of a hack to install by default; universe only.
    + libyaml-syck-perl: transition-check is fairly Debian-specific.
  - scripts/debchange.{pl,1}:
    + Adjust --security template for Ubuntu.
    + Add -U/--upstream flag that forces original "just increment
      the end" behaviour; Ubuntu is upstream for some pieces of software.
    + Add --distributor= and DEBCHANGE_DISTRIBUTOR to override lsb_release
      output.
    + Default to "oneiric" as distribution.
    + Add "ubuntu1" to version string for new versions, with tweaks for
      special cases.
    + Add -R/--rebuild flag for Ubuntu's no-change rebuilds.
    + Don't use the last distribution in debian/changelog when doing
      "dch -r" on Ubuntu. "Just because it was last uploaded to jaunty
      doesn't mean that's the right thing to do now." Thanks to Colin
      Watson. (LP: #429288)
  - Add test/debchange.pl, test/Makefile: debchange test suite.
  - Rename XS-Vcs-* to XS-Debian-Vcs-*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# Copyright 2006-2008 (C) Kees Cook <kees@ubuntu.com>
 
4
# Modified by Siegfried-A. Gevatter <rainct@ubuntu.com>
 
5
# Modified by Daniel Hahler <ubuntu@thequod.de>
 
6
#
 
7
# ##################################################################
 
8
#
 
9
# This program is free software; you can redistribute it and/or
 
10
# modify it under the terms of the GNU General Public License
 
11
# as published by the Free Software Foundation; either version 3
 
12
# of the License, or (at your option) any later version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
#
 
19
# See file /usr/share/common-licenses/GPL for more details.
 
20
#
 
21
# ##################################################################
 
22
#
 
23
# By default only the name of the patch system is printed.  Verbose mode can be
 
24
# enabled with -v.
 
25
 
 
26
if [ "$1" = "-h" ] || [ "$1" = "--help" ]
 
27
then
 
28
        cat <<EOM
 
29
Usage: $0 [-v]
 
30
 
 
31
Run this inside the source directory of a Debian package and it will detect
 
32
the patch system that it uses.
 
33
 
 
34
 -v: Enable verbose mode:
 
35
     - Print a list of all those files outside the debian/ directory that have
 
36
       been modified (if any).
 
37
     - Report additional details about patch systems, if available.
 
38
EOM
 
39
        exit 0
 
40
fi
 
41
 
 
42
while [ ! -r debian/rules ];
 
43
do
 
44
        if [ "$PWD" = "/" ]; then
 
45
                echo "Can't find debian/rules."
 
46
                exit 1
 
47
        fi
 
48
        cd ..
 
49
done
 
50
 
 
51
VERBOSE=0
 
52
if [ "$1" = "-v" ]
 
53
then
 
54
        VERBOSE=1
 
55
fi
 
56
 
 
57
if [ "$VERBOSE" -gt 0 ]; then
 
58
        files=`lsdiff -z ../$(dpkg-parsechangelog | grep ^Source: | sed -e "s/^Source: //")_$(dpkg-parsechangelog | grep ^Version: | sed -e "s/^Version: //").diff.gz 2>/dev/null | grep -v 'debian/'`
 
59
        if [ -n "$files" ]
 
60
        then
 
61
                echo "Following files were modified outside of the debian/ directory:"
 
62
                echo "$files"
 
63
                echo "--------------------"
 
64
                echo
 
65
                echo -n "Patch System: "
 
66
        fi
 
67
fi
 
68
 
 
69
if fgrep -q quilt debian/source/format 2>/dev/null; then
 
70
        echo "quilt"
 
71
        exit 0
 
72
fi
 
73
 
 
74
# Do not change the output of existing checks by default, as there are build
 
75
# tools that rely on the exisitng output.  If changes in reporting is needed,
 
76
# please check the "VERBOSE" flag (see below for examples).  Feel free
 
77
# to add new patchsystem detection and reporting.
 
78
for filename in $(echo "debian/rules"; grep ^include debian/rules | fgrep -v '$(' | awk '{print $2}')
 
79
do
 
80
        fgrep patchsys.mk "$filename" | grep -q -v "^#" && {
 
81
                if [ "$VERBOSE" -eq 0 ]; then
 
82
                        echo "cdbs"; exit 0;
 
83
                else
 
84
                        echo "cdbs (patchsys.mk: see 'cdbs-edit-patch')"; exit 0;
 
85
                fi
 
86
        }
 
87
        fgrep quilt "$filename" | grep -q -v "^#" && { echo "quilt"; exit 0; }
 
88
        fgrep dbs-build.mk "$filename" | grep -q -v "^#" && {
 
89
                if [ "$VERBOSE" -eq 0 ]; then
 
90
                        echo "dbs"; exit 0;
 
91
                else
 
92
                        echo "dbs (see 'dbs-edit-patch')"; exit 0;
 
93
                fi
 
94
        }
 
95
        fgrep dpatch "$filename" | grep -q -v "^#" && {
 
96
                if [ "$VERBOSE" -eq 0 ]; then
 
97
                        echo "dpatch"; exit 0;
 
98
                else
 
99
                        echo "dpatch (see 'patch-edit-patch')"; exit 0;
 
100
                fi
 
101
        }
 
102
        fgrep '*.diff' "$filename" | grep -q -v "^#" && {
 
103
                if [ "$VERBOSE" -eq 0 ]; then
 
104
                        echo "diff splash"; exit 0;
 
105
                else
 
106
                        echo "diff splash (check debian/rules)"; exit 0;
 
107
                fi
 
108
        }
 
109
done
 
110
[ -d debian/patches ] || {
 
111
        if [ "$VERBOSE" -eq 0 ]; then
 
112
                echo "patchless?"; exit 0;
 
113
        else
 
114
                echo "patchless? (did not find debian/patches/)"; exit 0;
 
115
        fi
 
116
}
 
117
if [ "$VERBOSE" -eq 0 ]; then
 
118
        echo "unknown patch system"
 
119
else
 
120
        echo "unknown patch system (see debian/patches/ and debian/rules)"
 
121
fi