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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
#!/bin/sh
set -e
# Copyright (C) 2008 Neil Williams <codehelp@debian.org>
#
# This package 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# not intended to be packaged until the buildd.emdebian.org
# pseudo-package is available.
PROG=embug_report
. /usr/lib/emdebian-tools/empbuilderlib
function usagehelp () {
# print out help message
cat <<EOF
$PROG - emdebian target package bug helper
version $OURVERSION
Syntax: $PROG [OPTIONS] [COMMAND] -- [REPORTBUG_OPTIONS]
Commands:
--closes NUMBER: The bug number to close (if not already
specified in the changelog itself).
-?|-h|--help|--version: Print this help message and exit
Options:
-a|--arch: Override the default cross-build architecture
(from dpkg-cross).
Specify any options for reportbug after '--' (options only, package
selection is done by $PROG.)
$PROG parses debian/changelog to obtain basic data about
the package.
If the Emdebian changelog contains the normal (Closes: #12345) entry or
if the --closes command is given, a log file is prepared to help close
the bug. This log file needs to be sent on using your normal email
client - at least until certain changes are made in bugs.debian.org.
If no changes file exists, the build log is checked for a build failure
message and a log file is prepared with information on the build failure.
The log file is then passed to reportbug so that you can add extra
information and automatically include the data to either a new bug or
as a follow-up message to an existing bug.
$PROG takes care of the package selection.
$PROG also ensures that new bugs and follow-up messages
are only sent to the bug tracker and not to the maintainer - this will
be resolved once the buildd.emdebian.org pseudo-package is available.
EOF
}
ARCH=`perl -MDebian::DpkgCross -e '&read_config; print &get_architecture;'`
RBUG=0
while [ -n "$1" ]; do
case "$1" in
--help|-h|-\?|--version)
usagehelp
exit;
;;
-a|--arch)
shift
ARCH=$1
# chomp the argument to --arch
shift
;;
--closes)
shift
CLOSES=$1
shift
;;
-- )
shift
RBUG=1
continue
;;
*)
if [ $RBUG == 0 ]; then
echo "Unrecognised option: $1"
echo
usagehelp
exit;
else
RBUGOPTS="$RBUGOPTS $1"
shift
fi
;;
esac
done
check_pbuilder()
{
WORKDIR=`perl -e 'use Cwd; use Emdebian::Tools; use Config::Auto; use Debian::DpkgCross; \
&read_config; \
my $w = &get_workdir; \
$w = cwd if (! -d $w); \
print $w;';`
INIT=`echo $SRC | cut -b1`
BUILD="$WORKDIR/pbuilder/result/$INIT/$SRC/trunk/${SRC}_${VER}_${ARCH}.build"
if [ -f "$BUILD" ]; then
TAIL=`tail -20 $BUILD > ../emdebian-tail.log`
LOG="-i ../emdebian-tail.log --report-quiet"
fi
}
PWD=`pwd`
echo "Working in: $PWD"
VER=`parsechangelog | grep Version | cut -d' ' -f2`
if [ ! -f "debian/changelog" ]; then
echo "Please run $0 in an Emdebian package directory,"
echo "or run $PROG --help for help."
exit 1
fi
SRC=`parsechangelog | grep Source | cut -d' ' -f2`
BUILD="../${SRC}_${VER}_${ARCH}.build"
if [ -f "$BUILD" ]; then
TAIL=`tail -20 $BUILD > ../emdebian-tail.log`
LOG="-i ../emdebian-tail.log --report-quiet"
fi
if [ -z "$CLOSES" ]; then
CLOSES=`parsechangelog | grep "^Closes" | cut -d' ' -f2`
fi
DM=`parsechangelog | grep Maintainer | cut -d' ' -f2-`
TEXT="The new version of $SRC has been uploaded to Emdebian."
SUMMARY1="A summary of the changes between this version and"
SUMMARY2="the previous Emdebian one is attached."
CNGH="../${SRC}_${VER}_${ARCH}.changes"
if [ -f "$CNGH" ]; then
LOG="-i ../emdebian-close.log"
echo Source: buildd.emdebian.org > ../emdebian-close.log
echo >> ../emdebian-close.log
# don't send the report at this stage.
echo "Postponing closing the actual bug report until" >> ../emdebian-close.log
echo "the buildd.emdebian.org pseudo-package is available." >> ../emdebian-close.log
echo "Once re-assigned, send email to:" >> ../emdebian-close.log
echo "$CLOSES-done@bugs.debian.org" >> ../emdebian-close.log
echo >> ../emdebian-close.log
echo $TEXT >> ../emdebian-close.log
echo $SUMMARY1 >> ../emdebian-close.log
echo $SUMMARY2 >> ../emdebian-close.log
echo >> ../emdebian-close.log
cat $CNGH >> ../emdebian-close.log
echo "Now send ../emdebian-close.log to $CLOSES-quiet@bugs.debian.org"
exit
else
echo "Cannot find $CNGH - checking build-log instead $BUILD."
FAIL=`grep "dpkg-buildpackage: failure" $BUILD || true`
if [ -z "$FAIL" ]; then
echo "No changes file, no failed build log either - checking chroot build."
check_pbuilder
fi
fi
echo reportbug $RBUGOPTS $LOG general
reportbug $RBUGOPTS $LOG general
|