gnu: wgetpaste: Update bpaste URL & regular expressions.
[jackhill/guix/guix.git] / gnu / packages / wget.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2016, 2017, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
6 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages wget)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages documentation)
29 #:use-module (gnu packages gnunet)
30 #:use-module (gnu packages gnupg)
31 #:use-module (gnu packages libidn)
32 #:use-module (gnu packages pcre)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages tls)
37 #:use-module (gnu packages web)
38 #:use-module (gnu packages xdisorg)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix build-system gnu))
42
43 (define-public wget
44 (package
45 (name "wget")
46 (version "1.20.3")
47 (source
48 (origin
49 (method url-fetch)
50 (uri (string-append "mirror://gnu/wget/wget-"
51 version ".tar.lz"))
52 (sha256
53 (base32
54 "1frajd86ds8vz2hprq30wq8ya89z9dcxnwm8nwk12bbc47l7qq39"))))
55 (build-system gnu-build-system)
56 (inputs
57 `(("gnutls" ,gnutls)
58 ("libidn2" ,libidn2)
59 ("libpsl" ,libpsl)
60 ("lzip" ,lzip)))
61 (native-inputs
62 `(("pkg-config" ,pkg-config)
63 ("perl" ,perl)
64 ("python" ,python) ;for testenv suite
65 ("perl-http-daemon" ,perl-http-daemon)
66 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
67 (home-page "https://www.gnu.org/software/wget/")
68 (synopsis "Non-interactive command-line utility for downloading files")
69 (description
70 "GNU Wget is a non-interactive tool for fetching files using the HTTP,
71 HTTPS and FTP protocols. It can resume interrupted downloads, use file name
72 wild cards, supports proxies and cookies, and it can convert absolute links
73 in downloaded documents to relative links.")
74 (license license:gpl3+))) ; some files are under GPLv2+
75
76 (define-public wgetpaste
77 (package
78 (name "wgetpaste")
79 (version "2.30")
80 (source
81 (origin
82 (method url-fetch)
83 (uri (string-append "https://wgetpaste.zlin.dk/wgetpaste-"
84 version ".tar.bz2"))
85 (sha256
86 (base32 "14k5i6j6f34hcf9gdb9cnvfwscn0ys2dgd73ci421wj9zzqkbv73"))
87 (patches (search-patches "wgetpaste-update-bpaste.patch"))))
88 (build-system gnu-build-system)
89 (arguments
90 `(#:modules ((guix build gnu-build-system)
91 (guix build utils)
92 (srfi srfi-1))
93 #:phases
94 (modify-phases %standard-phases
95 (delete 'configure)
96 (delete 'build)
97 (add-after 'unpack 'change-unfriendly-default
98 (lambda _
99 (substitute* "wgetpaste"
100 ;; dpaste blocks Tor users. Use a better default.
101 (("DEFAULT_SERVICE:-dpaste")
102 "DEFAULT_SERVICE-bpaste"))
103 #t))
104 (replace 'install
105 (lambda* (#:key outputs #:allow-other-keys)
106 (let* ((out (assoc-ref outputs "out"))
107 (bin (string-append out "/bin"))
108 (zsh (string-append out "/share/zsh/site-functions"))
109 (doc (string-append out "/share/doc/" ,name "-" ,version)))
110 (install-file "wgetpaste" bin)
111 (install-file "_wgetpaste" zsh)
112 (install-file "LICENSE" doc)
113 #t)))
114 (add-after 'install 'wrap-program
115 ;; /bin/wgetpaste prides itself on relying only on the following
116 ;; inputs, and doesn't need to execute arbitrary commands, so
117 ;; override PATH completely to detect any new dependencies early.
118 (lambda* (#:key outputs #:allow-other-keys)
119 (let ((out (assoc-ref outputs "out")))
120 (wrap-program (string-append out "/bin/wgetpaste")
121 `("PATH" ":" =
122 ,(delete-duplicates
123 (map (lambda (command) (dirname (which command)))
124 (list "bash" "mktemp" "sed" "sort" "tee" "tr"
125 "wget" "xclip")))))
126 #t))))
127 #:tests? #f)) ; no test target
128 (inputs
129 `(("wget" ,wget)
130 ("xclip" ,xclip)))
131 (home-page "https://wgetpaste.zlin.dk/")
132 (synopsis "Script that automates pasting to a number of pastebin services")
133 (description
134 "@code{wgetpaste} is an extremely simple command-line interface to various
135 online pastebin services.")
136 (license license:expat)))
137
138 (define-public wget2
139 (package
140 (name "wget2")
141 (version "1.99.2")
142 (source
143 (origin
144 (method url-fetch)
145 (uri (string-append "mirror://gnu/wget/wget2-" version ".tar.gz"))
146 (sha256
147 (base32
148 "0qv55f4bablrlhc8bnic8g3mkk1kq44c4cphrk5jmv92z9aqzi6b"))))
149 (build-system gnu-build-system)
150 (arguments
151 `(#:phases
152 (modify-phases %standard-phases
153 (add-after 'unpack 'skip-network-tests
154 (lambda _
155 (substitute* "tests/Makefile.in"
156 (("test-gpg-verify-no-file\\$\\(EXEEXT)") "")
157 (("test-gpg-valid\\$\\(EXEEXT)") "")
158 (("test-gpg-styles\\$\\(EXEEXT)") ""))
159 #t)))
160 #:configure-flags '("--enable-static=no")))
161 (inputs
162 `(("bzip2" ,bzip2)
163 ("gnutls" ,gnutls/dane)
164 ("gpgme" ,gpgme)
165 ("libiconv" ,libiconv)
166 ("libidn2" ,libidn2)
167 ("libmicrohttpd" ,libmicrohttpd)
168 ("libpsl" ,libpsl)
169 ("pcre2" ,pcre2)
170 ("zlib" ,zlib)))
171 ;; TODO: Add libbrotlidec, libnghttp2.
172 (native-inputs
173 `(("pkg-config" ,pkg-config)))
174 (home-page "https://gitlab.com/gnuwget/wget2")
175 (synopsis "Successor of GNU Wget")
176 (description "GNU Wget2 is the successor of GNU Wget, a file and recursive
177 website downloader. Designed and written from scratch it wraps around libwget,
178 that provides the basic functions needed by a web client.")
179 (properties '((ftp-directory . "/gnu/wget")))
180 (license (list license:gpl3+ license:lgpl3+))))