;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014-2022 Ludovic Courtès ;;; Copyright © 2016 Andreas Enge ;;; Copyright © 2017, 2018 Mark H Weaver ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz> ;;; ;;; 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 . (define-module (gnu system mapped-devices) #:use-module (guix gexp) #:use-module (guix
aboutsummaryrefslogtreecommitdiff
blob: 6c94a131148bf8fa46a81783a857b2991fcbf537 (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
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Robin Templeton <robin@igalia.com>
;;;
;;; 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 packages phabricator)
  #:use-module (gnu packages php)
  #:use-module (gnu packages version-control)
  #:use-module (guix build-system gnu)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

(define-public libphutil
  (let ((commit "b29d76e1709ef018cc5edc7c03033fd9fdebc578")
        (revision "1"))
    (package
      (name "libphutil")
      (version (git-version "0.0.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/phacility/libphutil.git")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "06j84721r9r8624fmil62b5crs2qs0v6rr3cvv2zvkvwhxwrwv1l"))))
      (build-system gnu-build-system)
      ;; TODO: Unbundle jsonlint and porter-stemmer.
      (arguments
       '(#:tests? #f
         #:phases
         (modify-phases %standard-phases
           (delete 'configure)
           (delete 'build)
           (replace 'install
             (lambda _
               (let ((lib (string-append %output "/lib/libphutil")))
                 (mkdir-p lib)
                 (copy-recursively "." lib))
               #t)))))
      (inputs
       `(("php" ,php)))
      (home-page "https://github.com/phacility/libphutil")
      (synopsis "PHP utility library")
      (description
       "@code{libphutil} is a collection of utility classes and functions for
PHP.")
      ;; Bundled libraries are expat-licensed.
      (license (list license:asl2.0 license:expat)))))

(define-public arcanist
  (let ((commit "45a8d22c74a62624e69f5cd6ce901c9ab2658904")
        (revision "1"))
    (package
      (name "arcanist")
      (version (git-version "0.0.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/phacility/arcanist.git")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "13vswhqy9sap6841y93j4mj71dl27vhcivcn3rzyi0cchkhg2ac9"))))
      (build-system gnu-build-system)
      (arguments
       '(#:tests? #f
         #:phases
         (modify-phases %standard-phases
           (delete 'configure)
           (delete 'build)
           (replace 'install
             (lambda _
               (let ((bin (string-append %output "/bin"))
                     (lib (string-append %output "/lib/arcanist")))
                 (mkdir-p lib)
                 (copy-recursively "." lib)
                 (mkdir-p bin)
                 (symlink (string-append lib "/bin/arc")
                          (string-append bin "/arc"))
                 (wrap-program (string-append bin "/arc")
                   `("ARC_PHUTIL_PATH" =
                     (,(string-append (assoc-ref %build-inputs "libphutil")
                                      "/lib/libphutil")))
                   `("PATH" ":" prefix
                     (,@(map (lambda (i)
                               (string-append (assoc-ref %build-inputs i) "/bin"))
                             '("git" "mercurial" "subversion"))))))
               #t))
           (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
             (lambda _
               (for-each make-file-writable
                         (find-files %output ".*\\.t?gz$"))
               #t)))))
      (inputs
       `(("php" ,php)
         ("libphutil" ,libphutil)
         ("git" ,git)
         ("mercurial" ,mercurial)
         ("subversion" ,subversion)))
      (home-page "https://github.com/phacility/arcanist")
      (synopsis "Command-line interface for Phabricator")
      (description
       "Arcanist is the command-line tool for the Phabricator software
development service.  It allows you to interact with Phabricator installs to
send code for review, download patches, transfer files, view status, make API
calls, and various other things.")
      (license license:asl2.0))))
;; code is eval'd, like the Shepherd does. (every (@ (srfi srfi-1) every)) (format (@ (ice-9 format) format))) (let loop ((attempts 0)) (unless (every file-exists? sources) (when (> attempts 20) (error "RAID devices did not show up; bailing out" sources)) (format #t "waiting for RAID source devices~{ ~a~}...~%" sources) (sleep 1) (loop (+ 1 attempts)))) ;; Use 'mdadm-static' rather than 'mdadm' to avoid pulling its whole ;; closure (80 MiB) in the initrd when a RAID device is needed for boot. (zero? (apply system* #$(file-append mdadm-static "/sbin/mdadm") "--assemble" #$target sources)))))) (define (close-raid-device sources targets) "Return a gexp that stops the RAID device TARGET." (match targets ((target) #~(zero? (system* #$(file-append mdadm-static "/sbin/mdadm") "--stop" #$target))))) (define raid-device-mapping ;; The type of RAID mapped devices. (mapped-device-kind (open open-raid-device) (close close-raid-device))) (define (open-lvm-device source targets) #~(and (zero? (system* #$(file-append lvm2-static "/sbin/lvm") "vgchange" "--activate" "ay" #$source)) ; /dev/mapper nodes are usually created by udev, but udev may be unavailable at the time we run this. So we create them here. (zero? (system* #$(file-append lvm2-static "/sbin/lvm") "vgscan" "--mknodes")) (every file-exists? (map (lambda (file) (string-append "/dev/mapper/" file)) '#$targets)))) (define (close-lvm-device source targets) #~(zero? (system* #$(file-append lvm2-static "/sbin/lvm") "vgchange" "--activate" "n" #$source))) (define lvm-device-mapping (mapped-device-kind (open open-lvm-device) (close close-lvm-device))) ;;; mapped-devices.scm ends here