debbugs: Add bug-id->summary-file.
authorRicardo Wurmus <rekado@elephly.net>
Sun, 10 May 2020 11:25:56 +0000 (13:25 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Sun, 10 May 2020 11:30:39 +0000 (13:30 +0200)
* mumi/debbugs.scm (bug-id->summary-file): New procedure.
* tests/debbugs.scm: New file.
* tests/data/spool/archive/95/26095.{report,status,summary}: New
files.
* Makefile.am (SCM_TESTS): Add tests/debbugs.scm.
(EXTRA_DIST): Include test data.

Makefile.am
mumi/debbugs.scm
tests/data/spool/archive/95/26095.report [new file with mode: 0644]
tests/data/spool/archive/95/26095.status [new file with mode: 0644]
tests/data/spool/archive/95/26095.summary [new file with mode: 0644]
tests/debbugs.scm [new file with mode: 0644]

index 61ab603..f1319a1 100644 (file)
@@ -55,11 +55,13 @@ SOURCES =                                                   \
 TEST_EXTENSIONS = .scm
 
 SCM_TESTS = \
+  tests/debbugs.scm \
   tests/xapian.scm
 
 TESTS = $(SCM_TESTS)
 
-EXTRA_DIST += $(TESTS)
+EXTRA_DIST += $(TESTS) \
+  $(wildcard tests/data/*)
 
 AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" GUILE_AUTO_COMPILE=0
 
index 4e0666f..f292ecc 100644 (file)
@@ -27,7 +27,8 @@
   #:export (read-emails-from-bug-log
             extract-bug-numbers
             forgotten-bug-numbers
-            bug-id->log-file))
+            bug-id->log-file
+            bug-id->summary-file))
 
 (define* (read-emails-from-bug-log port
                                    #:optional (keep '(incoming-recv)))
@@ -190,3 +191,16 @@ defaults to 30 days."
                                  bug-id
                                  (number->string bug-id)) 2)
           bug-id))
+
+(define (bug-id->summary-file bug-id)
+  (let ((candidate (lambda (archived?)
+                     (format #f "~a/spool/~a/~a/~a.summary"
+                             (%config 'data-dir)
+                             (if archived? "archive" "db-h")
+                             (string-take-right (if (string? bug-id)
+                                                    bug-id
+                                                    (number->string bug-id)) 2)
+                             bug-id))))
+    (find file-exists?
+          (list (candidate #f)
+                (candidate #t)))))
diff --git a/tests/data/spool/archive/95/26095.report b/tests/data/spool/archive/95/26095.report
new file mode 100644 (file)
index 0000000..9c0ec05
--- /dev/null
@@ -0,0 +1,95 @@
+Received: (at submit) by debbugs.gnu.org; 14 Mar 2017 08:29:19 +0000
+From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 14 04:29:18 2017
+Received: from localhost ([127.0.0.1]:54721 helo=debbugs.gnu.org)
+       by debbugs.gnu.org with esmtp (Exim 4.84_2)
+       (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
+       id 1cnhpW-0000Ig-O5
+       for submit@debbugs.gnu.org; Tue, 14 Mar 2017 04:29:18 -0400
+Received: from eggs.gnu.org ([208.118.235.92]:54571)
+ by debbugs.gnu.org with esmtp (Exim 4.84_2)
+ (envelope-from <rekado@example.com>) id 1cnhpV-0000IT-2c
+ for submit@debbugs.gnu.org; Tue, 14 Mar 2017 04:29:17 -0400
+Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
+ (envelope-from <rekado@example.com>) id 1cnhpO-00014S-RV
+ for submit@debbugs.gnu.org; Tue, 14 Mar 2017 04:29:11 -0400
+X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled
+ version=3.3.2
+Received: from lists.gnu.org ([2001:4830:134:3::11]:46586)
+ by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
+ (Exim 4.71) (envelope-from <rekado@example.com>) id 1cnhpO-00014O-PH
+ for submit@debbugs.gnu.org; Tue, 14 Mar 2017 04:29:10 -0400
+Received: from eggs.gnu.org ([2001:4830:134:3::10]:45510)
+ by lists.gnu.org with esmtp (Exim 4.71)
+ (envelope-from <rekado@example.com>) id 1cnhpM-0005M2-GH
+ for guix-patches@gnu.org; Tue, 14 Mar 2017 04:29:10 -0400
+Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
+ (envelope-from <rekado@example.com>) id 1cnhpH-00011R-KO
+ for guix-patches@gnu.org; Tue, 14 Mar 2017 04:29:08 -0400
+Received: from sender-of-o51.zoho.com ([135.84.80.216]:21020)
+ by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
+ (Exim 4.71) (envelope-from <rekado@example.com>) id 1cnhpH-00010f-E4
+ for guix-patches@gnu.org; Tue, 14 Mar 2017 04:29:03 -0400
+Received: from localhost (xd933fe09.dyn.telefonica.de [217.51.254.9]) by
+ mx.zohomail.com with SMTPS id 1489480138371144.2514938811363;
+ Tue, 14 Mar 2017 01:28:58 -0700 (PDT)
+User-agent: mu4e 0.9.18; emacs 25.1.1
+From: Ricardo Wurmus <rekado@example.com>
+To: guix-patches@gnu.org
+Subject: R: do not build recommended packages
+X-URL: https://example.com
+X-PGP-Key: https://example.com/rekado.pubkey
+X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
+Date: Tue, 14 Mar 2017 09:28:55 +0100
+Message-ID: <87h92w1cu0.fsf@example.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
+X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
+X-Received-From: 2001:4830:134:3::11
+X-Spam-Score: -4.0 (----)
+X-Debbugs-Envelope-To: submit
+X-BeenThere: debbugs-submit@debbugs.gnu.org
+X-Mailman-Version: 2.1.18
+Precedence: list
+List-Id: <debbugs-submit.debbugs.gnu.org>
+List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
+ <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
+List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
+List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
+List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
+List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
+ <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
+Errors-To: debbugs-submit-bounces@debbugs.gnu.org
+Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
+X-Spam-Score: -4.0 (----)
+
+This relates to bug 25598 “R packages are not bit-reproducible”.  R
+itself does not build reproducibly.  One of the reasons is that it
+includes recommended packages that are built in a random temporary
+directory.  The build paths for each of these packages is then embedded
+in the packages’ “paths.rds” files.
+
+We don’t have this problem when building the packages with the
+“r-build-system” like any other R package.
+
+This patch set adds package expressions for each of the recommended
+packages, disables building of recommended packages, and adds some of
+these packages to those R packages that need them.
+
+I’ve successfully rebuilt all R packages to make sure that these changes
+don’t break anything.
+
+I also have an unpolished patch to fix bug 25598, but it depends on this
+patch set.
+
+--
+Ricardo
+
+GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
+https://example.com
+
+
+
diff --git a/tests/data/spool/archive/95/26095.status b/tests/data/spool/archive/95/26095.status
new file mode 100644 (file)
index 0000000..7bc7355
--- /dev/null
@@ -0,0 +1,10 @@
+Ricardo Wurmus <rekado@example.com>
+1489480202
+R: do not build recommended packages
+<87h92w1cu0.fsf@example.com>
+guix-patches
+
+Ricardo Wurmus <rekado@example.com>
+
+
+normal
diff --git a/tests/data/spool/archive/95/26095.summary b/tests/data/spool/archive/95/26095.summary
new file mode 100644 (file)
index 0000000..670be3c
--- /dev/null
@@ -0,0 +1,8 @@
+Format-Version: 2
+Package: guix-patches
+Submitter: Ricardo Wurmus <rekado@example.com>
+Subject: R: do not build recommended packages
+Message-Id: <87h92w1cu0.fsf@example.com>
+Date: 1489480202
+Severity: normal
+Done: Ricardo Wurmus <rekado@example.com>
diff --git a/tests/debbugs.scm b/tests/debbugs.scm
new file mode 100644 (file)
index 0000000..6631b9f
--- /dev/null
@@ -0,0 +1,46 @@
+;;; mumi -- Mediocre, uh, mail interface
+;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;;
+;;; This program is free software: you can redistribute it and/or
+;;; modify it under the terms of the GNU Affero 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
+;;; Affero General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Affero General Public
+;;; License along with this program.  If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+(define-module (test-debbugs)
+  #:use-module (mumi config)
+  #:use-module (mumi debbugs)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-64))
+
+(define-syntax-rule (mock (module proc replacement) body ...)
+  "Within BODY, replace the definition of PROC from MODULE with the definition
+given by REPLACEMENT."
+  (let* ((m (resolve-module 'module))
+         (original (module-ref m 'proc)))
+    (dynamic-wind
+      (lambda () (module-set! m 'proc replacement))
+      (lambda () body ...)
+      (lambda () (module-set! m 'proc original)))))
+
+(test-begin "debbugs")
+
+(define data-dir
+  (string-append (getenv "abs_top_srcdir") "/tests/data"))
+
+(test-equal "bug-id->summary-file: return archive summary file"
+  (format #f "~a/spool/archive/95/26095.summary" data-dir)
+  (mock ((mumi config) %config
+         (match-lambda
+           ('data-dir data-dir)))
+        ((@@ (mumi debbugs) bug-id->summary-file) 26095)))
+
+(test-end "debbugs")