From 37742c886f4ab15b1d74331f399a0ca3d6412901 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 10 May 2020 13:25:56 +0200 Subject: debbugs: Add bug-id->summary-file. * 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 | 4 +- mumi/debbugs.scm | 16 +++++- tests/data/spool/archive/95/26095.report | 95 +++++++++++++++++++++++++++++++ tests/data/spool/archive/95/26095.status | 10 ++++ tests/data/spool/archive/95/26095.summary | 8 +++ tests/debbugs.scm | 46 +++++++++++++++ 6 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 tests/data/spool/archive/95/26095.report create mode 100644 tests/data/spool/archive/95/26095.status create mode 100644 tests/data/spool/archive/95/26095.summary create mode 100644 tests/debbugs.scm diff --git a/Makefile.am b/Makefile.am index 61ab603..f1319a1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/mumi/debbugs.scm b/mumi/debbugs.scm index 4e0666f..f292ecc 100644 --- a/mumi/debbugs.scm +++ b/mumi/debbugs.scm @@ -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 index 0000000..9c0ec05 --- /dev/null +++ b/tests/data/spool/archive/95/26095.report @@ -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 ) + 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 ) 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 ) 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 ) 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 ) 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 ) 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 ) 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 +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: +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +Errors-To: debbugs-submit-bounces@debbugs.gnu.org +Sender: "Debbugs-submit" +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 index 0000000..7bc7355 --- /dev/null +++ b/tests/data/spool/archive/95/26095.status @@ -0,0 +1,10 @@ +Ricardo Wurmus +1489480202 +R: do not build recommended packages +<87h92w1cu0.fsf@example.com> +guix-patches + +Ricardo Wurmus + + +normal diff --git a/tests/data/spool/archive/95/26095.summary b/tests/data/spool/archive/95/26095.summary new file mode 100644 index 0000000..670be3c --- /dev/null +++ b/tests/data/spool/archive/95/26095.summary @@ -0,0 +1,8 @@ +Format-Version: 2 +Package: guix-patches +Submitter: Ricardo Wurmus +Subject: R: do not build recommended packages +Message-Id: <87h92w1cu0.fsf@example.com> +Date: 1489480202 +Severity: normal +Done: Ricardo Wurmus diff --git a/tests/debbugs.scm b/tests/debbugs.scm new file mode 100644 index 0000000..6631b9f --- /dev/null +++ b/tests/debbugs.scm @@ -0,0 +1,46 @@ +;;; mumi -- Mediocre, uh, mail interface +;;; Copyright © 2020 Ricardo Wurmus +;;; +;;; 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 +;;; . + +(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") -- cgit v1.2.3