summaryrefslogtreecommitdiffstats
path: root/scripts/dbg_mkrpm
blob: 0149b2157d4e4f678020538c781fd20a8437a731 (plain)
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
#!/bin/sh

#set -e

#git clone git://git.fedorahosted.org/git/abrt.git
#SRCDIR="abrt"
#BUILDDIR="abrt"

SRCDIR="."
BUILDDIR="../`basename "$PWD"`.builddir"

if ! test -f "$SRCDIR/configure"; then
        echo "Autogenerating configure"
        (cd "$SRCDIR" && ./autogen.sh) || { rm -f "$SRCDIR/configure"; exit 1; }
fi

test -f "$SRCDIR/abrt.spec" || exit 1
ABRTVER=`grep ^Version: "$SRCDIR/abrt.spec" | head -n1 | sed 's/.* //'`

rm -rf "$BUILDDIR"
mkdir "$BUILDDIR" 2>/dev/null

cp -a "$SRCDIR" "$BUILDDIR"/abrt-$ABRTVER

cd "$BUILDDIR" || exit 1

tar -czf abrt-$ABRTVER.tar.gz abrt-$ABRTVER
cp abrt-$ABRTVER/abrt.spec .
cp abrt-$ABRTVER/abrt.init .
cp abrt-$ABRTVER/abrt-ccpp.init .
#cp abrt-$ABRTVER/dbg_* .
rm -rf abrt-$ABRTVER

# Less ugly way to pass exitcode (without bashisms)?
{ nice -n10 rpmbuild \
  --define "_topdir $PWD" \
  --define "_builddir $PWD" \
  --define "_rpmdir $PWD" \
  --define "_sourcedir $PWD" \
  --define "_specdir $PWD" \
  --define "_srcrpmdir $PWD" \
  --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
  -bb abrt.spec 2>&1
echo $? >"EXITCODE"
} | tee -a "$0.log"
ret=`cat EXITCODE`
rm EXITCODE
exit "$ret"