aboutsummaryrefslogtreecommitdiff
path: root/gnu/installer/dump.scm
blob: f91cbae0215fbd48581ea0650a541499fe6f08a1 (about) (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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Mathieu Othacehe <othacehe@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix 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 General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu installer dump)
  #:use-module (gnu installer utils)
  #:use-module (guix build utils)
  #:use-module (srfi srfi-11)
  #:use-module (ice-9 iconv)
  #:use-module (ice-9 match)
  #:use-module (ice-9 popen)
  #:use-module (ice-9 textual-ports)
  #:use-module (web client)
  #:use-module (web http)
  #:use-module (web response)
  #:use-module (webutils multipart)
  #:export (%core-dump
            prepare-dump
            make-dump
            send-dump-report))

;; The installer crash dump type.
(define %dump-type "installer-dump")

;; The core dump file.
(define %core-dump "/tmp/installer-core-dump")

(define (result->list result)
  "Return the alist for the given RESULT."
  (hash-map->list (lambda (k v)
                    (cons k v))
                  result))

(define* (prepare-dump key args #:key result)
  "Create a crash dump directory.  KEY and ARGS represent the thrown error.
RESULT is the installer result hash table.  Returns the created directory path."
  (define now (localtime (current-time)))
  (define dump-dir
    (format #f "/tmp/dump.~a"
            (strftime "%F.%H.%M.%S" now)))
  (mkdir-p dump-dir)
  (with-directory-excursion dump-dir
    ;; backtrace
    (call-with-output-file "installer-backtrace"
      (lambda (port)
        (display-backtrace (make-stack #t) port)
        (print-exception port
                         (stack-ref (make-stack #t) 1)
                         key args)))

    ;; installer result
    (call-with-output-file "installer-result"
      (lambda (port)
        (write (result->list result) port)))

    ;; syslog
    (copy-file "/var/log/messages" "syslog")

    ;; core dump
    (when (file-exists? %core-dump)
      (copy-file %core-dump "core-dump"))

    ;; dmesg
    (let ((pipe (open-pipe* OPEN_READ "dmesg")))
      (call-with-output-file "dmesg"
        (lambda (port)
          (dump-port pipe port)
          (close-pipe pipe)))))
  dump-dir)

(define* (make-dump dump-dir file-choices)
  "Create a crash dump archive from DUMP-DIR containing FILE-CHOICES.
Returns the archive path."
  (define output (string-append (basename dump-dir) ".tar.gz"))
  (with-directory-excursion (dirname dump-dir)
    (apply system* "tar" "-zcf" output
           (map (lambda (f)
                  (string-append (basename dump-dir) "/" f))
                file-choices)))
  (canonicalize-path (string-append (dirname dump-dir) "/" output)))

(define* (send-dump-report dump
                           #:key
                           (url "https://dump.guix.gnu.org"))
  "Turn the DUMP archive into a multipart body and send it to the Guix crash
dump server at URL."
  (define (match-boundary kont)
    (match-lambda
      (('boundary . (? string? b))
       (kont b))
      (x #f)))

  (define (response->string response)
    (bytevector->string
     (read-response-body response)
     "UTF-8"))

  (let-values (((body boundary)
                (call-with-input-file dump
                  (lambda (port)
                    (format-multipart-body
                     `((,%dump-type . ,port)))))))
    (false-if-exception
     (response->string
      (http-post
       (string-append url "/upload")
       #:keep-alive? #t
       #:streaming? #t
       #:headers `((content-type
                    . (multipart/form-data
                       (boundary . ,boundary))))
       #:body body)))))
2-11gnu: icecat: Update to 68.5.0-guix0-preview1....* gnu/packages/gnuzilla.scm (%icecat-version, %icecat-build-id): Update. (icecat-source): Update gnuzilla commit, base version, and hashes. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to new version. Mark H Weaver 2020-01-18gnu: Add firefox-decrypt....* gnu/packages/gnuzilla.scm (firefox-decrypt): New variable. Oleg Pykhalov 2020-01-16gnu: icecat: Fix support for ffmpeg codecs....Fixes <https://bugs.gnu.org/38045>. Thanks to Jakub Kądziołka <kuba@kadziolka.net> and Amin Bandali <bandali@gnu.org> for their helpful observations and suggestions. This is a followup to commit 8e5567195f5d29301d571612085b5afdb460619d. * gnu/packages/gnuzilla.scm (icecat)[inputs]: Add shared-mime-info. [arguments]: Add elf and binary I/O modules to #:modules. Add code to the 'fix-ffmpeg-runtime-linker' phase that sets the sandbox read-path whitelist to include libavcodec's RUNPATH, as well as shared-mime-info. Mark H Weaver 2020-01-09gnu: icecat: Update to 68.4.1-guix0-preview1 [fixes CVE-2019-17026]....* gnu/packages/gnuzilla.scm (%icecat-version, %icecat-build-id): Update. (icecat-source): Update hash of upstream firefox source tarball, 'upstream-icecat-base-version', and commit and hash of gnuzilla checkout. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to upstream changes. Mark H Weaver 2020-01-07gnu: icecat: Update to 68.4.0-guix0-preview1 [security fixes]....Includes fixes for CVE-2019-17015, CVE-2019-17016, CVE-2019-17017, CVE-2019-17021, CVE-2019-17022, and CVE-2019-17024. * gnu/packages/gnuzilla.scm (%icecat-version, %icecat-build-id): Update. (icecat-source): Update hash of upstream firefox source tarball, 'upstream-icecat-base-version', and commit and hash of gnuzilla checkout. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to upstream changes. Mark H Weaver 2020-01-02gnu: rust-cbindgen: Move to rust-apps.scm...* gnu/packages/rust-cbindgen.scm (rust-cbindgen): Move to ... * gnu/packages/rust-apps.scm: ... here. * gnu/local.mk (GNU_SYSTEM_MODULES): Remove it. Efraim Flashner 2019-12-23gnu: icecat: Fix linking with ffmpeg....* gnu/packages/gnuzilla.scm (icecat)[arguments]: Add 'fix-ffmpeg-runtime-linker' phase. Co-authored-by: Mark H Weaver <mhw@netris.org>. Julien Lepiller 2019-12-04Merge branch 'staging'Marius Bakke 2019-12-04gnu: icecat: Update to 68.3.0-guix0-preview1 [security fixes]....Includes fixes for CVE-2019-11745, CVE-2019-17005, CVE-2019-17008, CVE-2019-17009, CVE-2019-17010, CVE-2019-17011, and CVE-2019-17012. * gnu/packages/patches/icecat-gnuzilla-fixes.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/gnuzilla.scm (%icecat-version, %icecat-build-id): Update. (icecat-source): Update hash for the firefox source tarball. Update to the latest from gnuzilla.git. Don't apply icecat-gnuzilla-fixes.patch. Remove determinism fix in makeicecat that is now upstream. Tweak a status message. (icecat)[arguments]: Add "--with-unsigned-addon-scopes=app" configure flag. * gnu/packages/patches/icecat-makeicecat.patch: Adapt. Mark H Weaver 2019-11-15Merge branch 'master' into stagingMarius Bakke 2019-10-31gnu: icecat: Update to 68.2.0-guix0-preview3....* gnu/packages/gnuzilla.scm (%icecat-version, %icecat-build-id): Update. (icecat-source): Update to the latest upstream commit on '68' branch. * gnu/packages/patches/icecat-gnuzilla-fixes.patch: Remove changes that have been incorporated upstream, and add new pending changes, notably the addition of several IceCat-specific preferences. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to changes in icecat-gnuzilla-fixes.patch. Mark H Weaver 2019-10-30Merge branch 'master' into stagingMarius Bakke 2019-10-29gnu: icecat: Update to 68.2.0-guix0-preview2....* gnu/packages/gnuzilla.scm (%icecat-version): Update. (%icecat-build-id): New variable. (icecat-source): Update gnuzilla repo commit and hash. (icecat)[arguments]: In the custom 'configure' phase, set the MOZ_BUILD_DATE environment variable to the value of %icecat-build-id. * gnu/packages/patches/icecat-gnuzilla-fixes.patch: Remove changes that are now in the upstream repository. Add more pending changes, including disabling the MOZ_SERVICES_HEALTHREPORT and MOZ_BLOCK_PROFILE_DOWNGRADE build flags, fixing a problem that prevented MOZ_DATA_REPORTING from being disabled, and fixes to the branding. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to upstream changes, and changes in icecat-gnuzilla-fixes.patch. Remove a hunk that disabled rewrites to aboutRights.dtd in the l10n directory. Mark H Weaver 2019-10-29gnu: icecat: Include generally-useful fixes in the source tarball....This commit moves some important fixes into a patch applied to the upstream gnuzilla git repository, whereas previously they were applied in such a way that only benefitted Guix users. * gnu/packages/patches/icecat-default-search-ddg.patch, gnu/packages/patches/icecat-disable-sync.patch: Delete files. * gnu/packages/patches/icecat-gnuzilla-fixes.patch: New file. * gnu/local.mk (dist_patch_DATA): Adapt accordingly. * gnu/packages/gnuzilla.scm (icecat-source): Apply the new patch to the gnuzilla checkout. (icecat)[native-inputs]: Remove deleted patches. [arguments]: In the 'wrap-program' phase, remove MOZ_LEGACY_PROFILES=1 from the wrapper. Mark H Weaver 2019-10-27Merge branch 'master' into stagingMarius Bakke 2019-10-26gnu: icecat: Update to 68.2.0-guix0-preview1 [security fixes]....Fixes CVE-2019-11757, CVE-2019-11759, CVE-2019-11760, CVE-2019-11761, CVE-2019-11762, CVE-2019-11763, CVE-2019-11764, and CVE-2019-15903. Note: IceCat 68 has not yet been released by the IceCat project. This is a work-in-progress, and does not currently meet the privacy-respecting standards of the IceCat project. * gnu/packages/patches/icecat-default-search-ddg.patch, gnu/packages/patches/icecat-disable-sync.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/gnuzilla.scm (%icecat-version): Update. (mozilla-compare-locales, all-mozilla-locales): New variables. (mozilla-locale): New procedure. (mozilla-locales): New macro. (icecat-source): Add code to populate the l10n directory. Remove the code that copied the l10n directory from an older IceCat source tarball. (icecat)[inputs]: Remove hunspell. [native-inputs]: Comment out previous Guix-specific patches for now. Use the newest rust, cargo, llvm, and clang. Add rust-cbindgen, node, nasm, python 3, icecat-default-search-ddg.patch and icecat-disable-sync.patch. [arguments]: In configure flags: remove "--disable-maintenance-service" and "--enable-system-hunspell", and comment out flags to use system libraries instead of bundled libraries for libevent, libogg, libvorbis, libvpx, harfbuzz, graphite2, and sqlite. Add srfi-34 and srfi-35 to modules. Delete fewer bundled libraries. Adapt the 'patch-source-shebangs' phase. Add a custom 'build' phase that tries the standard 'build' phase up to 5 times. In the 'wrap-program' phase, set MOZ_LEGACY_PROFILES=1 in the environment, and add 'pulseaudio' to the front of LD_LIBRARY_PATH. [description]: Add a warning that this is only a preview release. * gnu/packages/patches/icecat-makeicecat.patch: Adapt. Mark H Weaver 2019-10-08Merge branch 'master' into stagingMarius Bakke 2019-09-06Merge branch 'master' into core-updatesMark H Weaver 2019-09-02gnu: icecat: Update to 60.9.0-guix1....* gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.9.0-guix1. (icecat-source)[upstream-firefox-source]: Update hash. Mark H Weaver 2019-08-12gnu: gnuzilla: Use 'generate-all-checksums'....* gnu/packages/gnuzilla.scm (icecat)[arguments]: During custom 'patch-cargo-checksums phase, replace call to 'generate-checksums' with call to 'generate-all-checksums'. Efraim Flashner 2019-07-12Merge branch 'master' into core-updates... Conflicts: gnu/local.mk gnu/packages/python-xyz.scm gnu/packages/xml.scm guix/gexp.scm po/guix/POTFILES.in Marius Bakke 2019-07-09gnu: icecat: Update to 60.8.0-guix1 [security fixes]....Includes fixes for CVE-2019-9811, CVE-2019-11709, CVE-2019-11711, CVE-2019-11712, CVE-2019-11713, CVE-2019-11715, CVE-2019-11717, CVE-2019-11719, CVE-2019-11729, and CVE-2019-11730. * gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.8.0-guix1. (icecat-source)[upstream-firefox-source]: Update hash. (icecat): Refresh some stale comments. Mark H Weaver 2019-07-04gnu: icecat: Fix FTBFS with GCC7....* gnu/packages/gnuzilla.scm (icecat)[arguments]: In the 'augment-CPATH' phase, do not attempt to read CPLUS_INCLUDE_PATH, which is no longer set. Marius Bakke 2019-06-21gnu: icecat: Update to 60.7.2-guix1 [security fixes]....Includes fixes for CVE-2019-11707 and CVE-2019-11708. * gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.7.2-guix1. (icecat-source)[upstream-firefox-source]: Update hash. Mark H Weaver 2019-06-04gnu: icecat: Update to 60.7.0-guix2....This includes updates to bundled extensions from the upstream GNU IceCat 60.7.0-gnu1 release. * gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.7.0-guix2. (icecat-source)[upstream-icecat-base-version]: Update to 60.7.0. [upstream-icecat-source, gnuzilla-source]: Update hashes. [origin]: Remove the substitutions that dealt with debian-specific package code in the makeicecat script, since that code has been removed upstream. (icecat)[arguments]: Adapt the 'install-desktop-entry' phase to avoid using the Debian desktop file, which is no longer included in the IceCat sources. * gnu/packages/patches/icecat-makeicecat.patch: Adapt to upstream changes. Mark H Weaver 2019-05-22gnu: icecat: Update to 60.7.0-guix1 [security fixes]....Includes fixes for CVE-2018-18511, CVE-2019-5798, CVE-2019-7317, CVE-2019-9797, CVE-2019-9800, CVE-2019-9815, CVE-2019-9816, CVE-2019-9817, CVE-2019-9818, CVE-2019-9819, CVE-2019-9820, CVE-2019-11691, CVE-2019-11692, CVE-2019-11693, CVE-2019-11694, and CVE-2019-11698. * gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.7.0-guix1. (icecat-source)[upstream-firefox-source]: Update hash. Mark H Weaver 2019-05-16gnu: icecat: Update to 60.6.3-guix1....* gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.6.3-guix1. (icecat-source)[upstream-firefox-source]: Update hash. Mark H Weaver 2019-05-10build/cargo-utils: Remove "src-name" parameter....* gnu/packages/gnuzilla.scm (icecat)[arguments]<#:phases> [patch-cargo-checksums]: Delete "null-file" variable. * gnu/packages/rust.scm (%cargo-reference-project-file): Delete variable. * gnu/packages/rust.scm (rust-1.19): Remove reference to "%cargo-reference-project-file". * guix/build/cargo-utils.scm (generate-checksums): Remove "src-name" parameter. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Ivan Petkov 2019-05-06gnu: icecat: Move the snippet and patches out of the 'source'....This commit changes the 'source' field of the 'icecat' package to simply be 'icecat-source', which aims to be suitable for use on any system that IceCat supports. * gnu/packages/gnuzilla.scm (icecat)[source]: Change to simply be 'icecat-source'. [native-inputs]: Add 'patch', along with the Guix-specific patches that were previously applied within 'source'. [arguments]: Remove the 'ensure-no-mtimes-pre-1980' phase. Add 'apply-guix-specific-patches' and 'remove-bundled-libraries' phases. Touch 'configure' in the bootstrap phase. Return #t from the 'augment-CPLUS_INCLUDE_PATH' phase. Reindent. Mark H Weaver 2019-05-06gnu: icecat-source: Make sure 'makeicecat' is the right version....* gnu/packages/gnuzilla.scm (icecat-source): Check to make sure the value of FFMAJOR in the 'makeicecat' script matches the major version of IceCat being generated. Mark H Weaver 2019-05-06gnu: icecat: Update to 60.6.2-guix1....* gnu/packages/gnuzilla.scm (%icecat-version): Update to 60.6.2-guix1. (icecat-source)[upstream-firefox-source]: Update hash. Mark H Weaver 2019-04-27gnu: mozjs-38: Fix URI....* gnu/packages/gnuzilla.scm (mozjs-38): Fix URI. Clément Lassieur 2019-04-04gnu: Move nss & co. to nss.scm....* gnu/packages/gnuzilla.scm (nspr, nss): Move to... * gnu/packages/nss.scm: ... here. New file. * gnu/packages/chromium.scm, gnu/packages/disk.scm, gnu/packages/freedesktop.scm, gnu/packages/gnome.scm, gnu/packages/gnunet.scm, gnu/packages/java.scm, gnu/packages/libreoffice.scm, gnu/packages/linux.scm, gnu/packages/mate.scm, gnu/packages/openldap.scm, gnu/packages/package-management.scm, gnu/packages/password-utils.scm, gnu/packages/polkit.scm, gnu/packages/qt.scm, gnu/packages/sssd.scm, gnu/packages/storage.scm, gnu/packages/vpn.scm, gnu/packages/web.scm, gnu/packages/xml.scm: Adjust accordingly. * gnu/local.mk (GNU_SYSTEM_MODULES): Add nss.scm. Ludovic Courtès