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