gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / syncthing.scm
index 857b8a8..e800aeb 100644 (file)
@@ -1,9 +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.
 ;;;
@@ -43,7 +44,9 @@
 (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"
@@ -189,57 +136,66 @@ Protocol.")
     (license mpl2.0)))
 
 (define-public syncthing-gtk
-  (package
-    (name "syncthing-gtk")
-    (version "0.9.4.4")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/syncthing/syncthing-gtk.git")
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0nc0wd7qvyri7841c3dd9in5d7367hys0isyw8znv5fj4c0a6v1f"))))
-    (build-system python-build-system)
-    (arguments
-     `(#:python ,python-2
-       #: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"))))
-             #t))
-         (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"))))
-               #t))))))
-    (inputs
-     `(("gtk+" ,gtk+)
-       ("libappindicator" ,libappindicator)
-       ("libnotify" ,libnotify)
-       ("python2-bcrypt" ,python2-bcrypt)
-       ("python2-dateutil" ,python2-dateutil)
-       ("python2-pycairo" ,python2-pycairo)
-       ("python2-pygobject" ,python2-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
+  ;; 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
@@ -249,7 +205,7 @@ notification area icon for Syncthing.  Supported Syncthing features:
 @item Restart, shutdown server
 @item Editing daemon settings
 @end itemize\n")
-    (license gpl2)))
+      (license gpl2))))
 
 (define-public go-github-com-jackpal-go-nat-pmp
   (package