-
Notifications
You must be signed in to change notification settings - Fork 12
/
submit-bug-report.lisp
87 lines (74 loc) · 3.09 KB
/
submit-bug-report.lisp
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
;;;; submit-bug-report.lisp
;;;;
;;;; Semiautomatically create bug reports to send to projects for
;;;; systems that fail.
;;;;
;;;; This is based around the data in a failing-system object, defined
;;;; in html-failure-report.lisp
;;;;
(in-package #:quicklisp-controller)
(defun github-source-p (source)
(search "/github.com/" (location source)))
(deftype github-source ()
`(satisfies github-source-p))
(defun github-owner (failing-system)
(nth-value 0 (github-owner-and-repo (location (source failing-system)))))
(defun github-repo (failing-system)
(nth-value 1 (github-owner-and-repo (location (source failing-system)))))
(defun submit-github-issue (owner repo title body)
(githappy::create-repo-issue
:owner owner
:repo repo
:body (githappy:js "title" title "body" body)))
(defun existing-bug-reports (source)
(multiple-value-bind (owner repo)
(github-owner-and-repo (location source))
(unless owner
(error "Not a github repo"))
(let* ((response (githappy:repo-issues :owner owner :repo repo :per-page 100))
(json (githappy:json response)))
(mapcan
(lambda (issue)
(when (equal "quicklisp" (githappy:jref issue '("user" "login")))
(list (list :number (githappy:jref issue "number")
:title (githappy:jref issue "title")))))
json))))
(defun blameless-for-failure-p (failing-source)
(null (remove-if #'broken-by (failure-data failing-source))))
(defun bug-report-body (failing-source &key log-link)
(with-output-to-string (s)
(format s "Building with ~A for quicklisp dist creation.~%~%"
(versions-and-such))
(format s "Trying to build commit id ~A~%~%" (commit-id (source failing-source)))
(dolist (system (failure-data failing-source))
(format s "*~A* fails to build" (system-name system))
(if (broken-by system)
(format s " because of a failure in _~A_.~%~%"
(system-name (broken-by system)))
(format s " with the following error:~%~%```~%~A~&```~%~%"
(failure-snippet system))))
(when log-link
(format s "[Full log here](~A)~%~%" log-link))))
(defun report-bug-stuff (source)
(setf source (source-designator source))
(let* ((failing-source (find-failing-source source))
(log-link (publish-source-failure source))
(body (bug-report-body failing-source :log-link log-link))
(title "Some systems failed to build for Quicklisp dist"))
(list :title title
:body body)))
(defun report-bug-in (source)
(setf source (source-designator source))
(let* ((failing-source (find-failing-source source))
(log-link (publish-source-failure source))
(body (bug-report-body failing-source :log-link log-link)))
(multiple-value-bind (owner repo)
(github-owner-and-repo (location source))
(format t "Posting bug report for ~A~%~%" source)
(format t "~A" body)
(let ((existing (existing-bug-reports (source failing-source))))
(when existing
(format t "WARNING: BUGS ALREADY SUBMITTED BY quicklisp:~%~{ ~A~%~}~%"
existing)))
(when (ql-util:press-enter-to-continue)
(submit-github-issue owner repo "Some systems failed to build for Quicklisp dist" body)))))