Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/generate-bug-report
blob: f388a13414c693c6dde4ba3b5d2e191ec40be0f5 (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
49
50
51
52
53
#!/bin/bash

git pull --ff-only

if ! diff -u PKGBUILD ../../trunk/PKGBUILD; then
  >&2 echo "trunk differs - say something and I won't create a bug report."
  read -r s
  if [ -n "$s" ]; then
    exit
  fi
fi

if makepkg --verifysource; then
  >&2 echo 'nothing wrong upstream.'
  exit
fi

makepkg_info=$(
  makepkg --verifysource 2>&1
)
git_revision=$(
  git rev-parse HEAD
)

printf 'Bug report:\n\n'
printf 'Description:\n\n'
printf '%s\n' \
  "${makepkg_info}"
printf '\n'
printf 'Additional info:\n'
printf '* package version(s)\n'
printf '%s\n' \
  "${makepkg_info}" | \
  sed -n '
    s/^==> Making package: \(\S\+ \S\+\) (.*$/\1/
    T
    p
  ' | \
  tr -d '\n'
printf ' (git revision %s)\n' \
  "${git_revision}"
printf '\n'
printf 'Steps to reproduce:\n'
printf '> git checkout %s\n' \
  "${git_revision}"
printf '> cd %s\n' \
  "$(
    pwd | \
      sed '
        s,^.*/\([^/]\+/repos/[^/]\+\)$,\1,
      '
  )"
printf '> makepkg --verifysource\n'