gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / syncthing.scm
index dfc2220..e800aeb 100644 (file)
@@ -1,8 +1,10 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Petter <petter@mykolab.ch>
-;;; Copyright © 2016, 2017, 2018, 2019, 2020 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages syncthing)
   #:use-module (guix build-system go)
+  #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix licenses)
   #:use-module (gnu packages)
-  #:use-module (gnu packages golang))
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages gnome)
+  #:use-module (gnu packages golang)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages time))
 
 (define-public syncthing
   (package
     (name "syncthing")
-    (version "1.5.0")
+    (version "1.15.1")
+    ; XXX After the go-build-system can use "Go modules", stop using bundled
+    ; dependenices for Syncthing.
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/syncthing/syncthing"
                                   "/syncthing-source-v" version ".tar.gz"))
               (sha256
                (base32
-                "1394b8y4nllihnjngc0kjpdy7pvyh6v1h09hkn8rdmwxpsdkqkjb"))
-              (modules '((guix build utils)))
-              ;; Delete bundled ("vendored") free software source code.
-              (snippet '(begin
-                          (delete-file-recursively "vendor")
-                          #t))))
+                "04b90zwinl7frxrpjliq41mkbhpnkszmhdc5j2vbqwyhd82warxq"))))
     (build-system go-build-system)
     ;; The primary Syncthing executable goes to "out", while the auxiliary
     ;; server programs and utility tools go to "utils".  This reduces the size
     ;; of "out" by ~80 MiB.
     (outputs '("out" "utils"))
-    ;; When updating Syncthing, check 'go.mod' in the source distribution to
-    ;; ensure we are using the correct versions of these dependencies.
-    (inputs
-     `(("go-github-com-jackpal-go-nat-pmp"
-        ,go-github-com-jackpal-go-nat-pmp)
-       ("go-github-com-bkaradzic-go-lz4" ,go-github-com-bkaradzic-go-lz4)
-       ("go-github-com-calmh-xdr" ,go-github-com-calmh-xdr)
-       ("go-github-com-chmduquesne-rollinghash"
-        ,go-github-com-chmduquesne-rollinghash)
-       ("go-github-com-gobwas-glob" ,go-github-com-gobwas-glob)
-       ("go-github-com-golang-groupcache-lru"
-        ,go-github-com-golang-groupcache-lru)
-       ("go-github-com-jackpal-gateway" ,go-github-com-jackpal-gateway)
-       ("go-github-com-kballard-go-shellquote"
-        ,go-github-com-kballard-go-shellquote)
-       ("go-github-com-lib-pq" ,go-github-com-lib-pq)
-       ("go-github-com-minio-sha256-simd" ,go-github-com-minio-sha256-simd)
-       ("go-github-com-oschwald-geoip2-golang"
-        ,go-github-com-oschwald-geoip2-golang)
-       ("go-github-com-pkg-errors" ,go-github-com-pkg-errors)
-       ("go-github-com-rcrowley-go-metrics" ,go-github-com-rcrowley-go-metrics)
-       ("go-github-com-sasha-s-go-deadlock" ,go-github-com-sasha-s-go-deadlock)
-       ("go-github-com-syncthing-notify" ,go-github-com-syncthing-notify)
-       ("go-github-com-syndtr-goleveldb" ,go-github-com-syndtr-goleveldb)
-       ("go-github-com-thejerf-suture" ,go-github-com-thejerf-suture)
-       ("go-golang-org-x-time" ,go-golang-org-x-time)
-       ("go-github-com-go-ldap-ldap" ,go-github-com-go-ldap-ldap)
-       ("go-github-com-gogo-protobuf" ,go-github-com-gogo-protobuf)
-       ("go-github-com-shirou-gopsutil" ,go-github-com-shirou-gopsutil)
-       ("go-github-com-prometheus-client-golang"
-        ,go-github-com-prometheus-client-golang)
-       ("go-golang-org-x-net" ,go-golang-org-x-net)
-       ("go-golang-org-x-text" ,go-golang-org-x-text)
-       ("go-github-com-audriusbutkevicius-recli"
-        ,go-github-com-audriusbutkevicius-recli)
-       ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)
-       ("go-github-com-vitrun-qart" ,go-github-com-vitrun-qart)
-       ("go-github-com-mattn-go-isatty" ,go-github-com-mattn-go-isatty)
-       ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
-       ("go-github-com-flynn-archive-go-shlex"
-        ,go-github-com-flynn-archive-go-shlex)
-       ("go-github-com-getsentry-raven-go" ,go-github-com-getsentry-raven-go)
-       ("go-github-com-maruel-panicparse" ,go-github-com-maruel-panicparse)
-       ("go-github-com-ccding-go-stun" ,go-github-com-ccding-go-stun)
-       ("go-github-com-audriusbutkevicius-pfilter" ,go-github-com-audriusbutkevicius-pfilter)
-       ("go-github-com-lucas-clemente-quic-go" ,go-github-com-lucas-clemente-quic-go)
-       ("go-github-com-willf-bloom" ,go-github-com-willf-bloom)
-
-       ;; For tests.
-       ("go-github-com-d4l3k-messagediff" ,go-github-com-d4l3k-messagediff)))
-
     (arguments
      `(#:modules ((srfi srfi-26) ; for cut
                   (guix build utils)
                ;; updater and to build the utilities is to "build all" and then
                ;; "build syncthing" again with -no-upgrade.
                ;; https://github.com/syncthing/syncthing/issues/6118
-               (invoke "go" "run" "build.go" "build" "all")
-               (delete-file "syncthing")
+               (invoke "go" "run" "build.go")
+               (delete-file "bin/syncthing")
                (invoke "go" "run" "build.go" "-no-upgrade" "build" "syncthing"))))
 
          (replace 'check
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
                    (utils (assoc-ref outputs "utils")))
-               (with-directory-excursion "src/github.com/syncthing/syncthing"
-                 (install-file "syncthing" (string-append out "/bin"))
+               (with-directory-excursion "src/github.com/syncthing/syncthing/bin"
+                 (install-file "../syncthing" (string-append out "/bin"))
                  (for-each (cut install-file <> (string-append utils "/bin/"))
-                           '("stcli" "stcompdirs" "stcrashreceiver"
+                           '("stcompdirs" "stcrashreceiver"
                              "stdisco" "stdiscosrv" "stevents" "stfileinfo"
                              "stfinddevice" "stfindignored" "stgenfiles"
                              "stindex" "strelaypoolsrv" "strelaysrv" "stsigtool"
@@ -177,6 +135,78 @@ Protocol.")
     (home-page "https://github.com/syncthing/syncthing")
     (license mpl2.0)))
 
+(define-public syncthing-gtk
+  ;; The commit used below corresponds to the latest commit of the
+  ;; python3-port branch maintained by Debian.  Upstream hasn't bothered
+  ;; porting to Python 3 (see:
+  ;; https://github.com/kozec/syncthing-gtk/issues/487).
+  (let ((revision "1")
+        (commit "c46fbd8ad1d12d409da8942702a2f119cf45514a"))
+    (package
+      (name "syncthing-gtk")
+      (version (git-version "0.9.4.4" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://salsa.debian.org/debian/syncthing-gtk.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1x1c8snf0jpgjmyyidjw0015ksk5ishqn817wx8vs9i0lfgnnbbg"))))
+      (build-system python-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'hardcode-dependencies
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((psmisc (assoc-ref inputs "psmisc"))
+                     (syncthing (assoc-ref inputs "syncthing")))
+                 ;; Hardcode dependencies paths to avoid propagation.
+                 (substitute* "syncthing_gtk/tools.py"
+                   (("killall") (string-append psmisc "/bin/killall")))
+                 (substitute* "syncthing_gtk/configuration.py"
+                   (("/usr/bin/syncthing") (string-append syncthing
+                                                          "/bin/syncthing"))))))
+           (add-after 'unpack 'remove-windows.py
+             (lambda _
+               ;; A Windows-specific module that fails to load with
+               ;; "ModuleNotFoundError: No module named 'msvcrt'.
+               (delete-file "syncthing_gtk/windows.py")))
+           (add-after 'wrap 'wrap-libs
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (wrap-program (string-append out "/bin/syncthing-gtk")
+                   `("GI_TYPELIB_PATH" ":" prefix
+                     (,(getenv "GI_TYPELIB_PATH"))))))))))
+      (inputs
+       `(("gtk+" ,gtk+)
+         ("libappindicator" ,libappindicator)
+         ("libnotify" ,libnotify)
+         ("librsvg" ,librsvg)
+         ("python-bcrypt" ,python-bcrypt)
+         ("python-dateutil" ,python-dateutil)
+         ("python-pycairo" ,python-pycairo)
+         ("python-pygobject" ,python-pygobject)
+         ("python-nautilus" ,python-nautilus)
+         ("psmisc" ,psmisc)
+         ("syncthing" ,syncthing)))
+      ;; (native-inputs
+      ;;  `(("python2-setuptools" ,python2-setuptools)))
+      (home-page "https://github.com/syncthing/syncthing-gtk")
+      (synopsis "GTK3 based GUI and notification area icon for Syncthing")
+      (description "@code{syncthing-gtk} is a GTK3 Python based GUI and
+notification area icon for Syncthing.  Supported Syncthing features:
+
+@itemize
+@item Everything that WebUI can display
+@item Adding, editing and deleting nodes
+@item Adding, editing and deleting repositories
+@item Restart, shutdown server
+@item Editing daemon settings
+@end itemize\n")
+      (license gpl2))))
+
 (define-public go-github-com-jackpal-go-nat-pmp
   (package
     (name "go-github-com-jackpal-go-nat-pmp")
@@ -663,7 +693,7 @@ inherent errors.")
         (origin
           (method git-fetch)
           (uri (git-reference
-                 (url "https://github.com/chmduquesne/rollinghash.git")
+                 (url "https://github.com/chmduquesne/rollinghash")
                  (commit commit)))
           (file-name (git-file-name name version))
           (sha256
@@ -687,7 +717,7 @@ hashes.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/petermattis/goid.git")
+                       (url "https://github.com/petermattis/goid")
                        (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
@@ -711,7 +741,7 @@ the current goroutine's ID.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/kballard/go-shellquote.git")
+                       (url "https://github.com/kballard/go-shellquote")
                        (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
@@ -761,7 +791,7 @@ notification library in Go.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/beorn7/perks.git")
+                       (url "https://github.com/beorn7/perks")
                        (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
@@ -787,7 +817,7 @@ bounds.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/prometheus/client_model.git")
+                       (url "https://github.com/prometheus/client_model")
                        (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
@@ -820,7 +850,7 @@ bounds.")
           (method git-fetch)
           (uri
             (git-reference
-              (url "https://github.com/matttproud/golang_protobuf_extensions.git")
+              (url "https://github.com/matttproud/golang_protobuf_extensions")
               (commit commit)))
           (file-name (git-file-name name version))
           (sha256
@@ -847,7 +877,7 @@ message streaming.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/prometheus/common.git")
+                       (url "https://github.com/prometheus/common")
                        (commit (string-append "v" version))))
                 (file-name (git-file-name name version))
                 (sha256
@@ -890,7 +920,7 @@ Prometheus metrics.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/prometheus/procfs.git")
+                       (url "https://github.com/prometheus/procfs")
                        (commit (string-append "v" version))))
                 (file-name (git-file-name name version))
                 (sha256
@@ -915,7 +945,7 @@ system, kernel, and process metrics from the @file{/proc} pseudo file system.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/prometheus/client_golang.git")
+                       (url "https://github.com/prometheus/client_golang")
                        (commit (string-append "v" version))))
                 (file-name (git-file-name name version))
                 (sha256
@@ -1002,7 +1032,7 @@ language.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                       (url "https://github.com/flynn-archive/go-shlex.git")
+                       (url "https://github.com/flynn-archive/go-shlex")
                        (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
@@ -1025,7 +1055,7 @@ quoting, commenting, and escaping.")
       (origin
         (method git-fetch)
         (uri (git-reference
-               (url "https://github.com/AudriusButkevicius/pfilter.git")
+               (url "https://github.com/AudriusButkevicius/pfilter")
                (commit version)))
         (file-name (git-file-name name version))
         (sha256
@@ -1050,7 +1080,7 @@ virtual connections from a single physical connection.")
         (origin
           (method git-fetch)
           (uri (git-reference
-                 (url "https://github.com/ccding/go-stun.git")
+                 (url "https://github.com/ccding/go-stun")
                  (commit commit)))
           (file-name (git-file-name name version))
           (sha256