about summary refs log tree commit diff
path: root/release-email.scm
blob: 98748c9c47852180f02e1b13e91aeadd76d1c434 (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
#! /usr/bin/env guile
!#

;;; guile-xapian --- Guile bindings for Xapian
;;; Copyright © 2026 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of guile-xapian.
;;;
;;; guile-xapian 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 2 of the
;;; License, or (at your option) any later version.
;;;
;;; guile-xapian 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 guile-xapian.  If not, see
;;; <https://www.gnu.org/licenses/>.

(use-modules (rnrs io ports)
             (srfi srfi-1)
             (srfi srfi-26)
             (srfi srfi-28)
             (srfi srfi-171)
             (ice-9 match)
             (ice-9 popen)
             (web uri))

(define (call-with-input-pipe command proc)
  "Call @var{proc} with input pipe to @var{command}. @var{command} is a
list of program arguments."
  (match command
    ((prog args ...)
     (let ((port #f))
       (dynamic-wind
         (lambda ()
           (set! port (apply open-pipe* OPEN_READ prog args)))
         (cut proc port)
         (lambda ()
           (unless (zero? (close-pipe port))
             (error "Command invocation failed" command))))))))

(let* ((version
        (match (call-with-input-pipe (list "git" "tag")
                 (cut port-transduce
                      (tmap identity)
                      rcons
                      get-line
                      <>))
          (()
           (error "No git tags found"))
          (tags
           (string-trim (last tags) #\v))))
       (body (format "
Hi all,

guile-xapian ~a has been released.

guile-xapian provides Guile bindings for Xapian[1], a search engine
library used in popular applications such as the notmuch email
system. Xapian is a highly adaptable toolkit which allows developers to
easily add advanced indexing and search facilities to their own
applications. It has built-in support for several families of weighting
models and also supports a rich set of boolean query operators.

[1]: https://xapian.org/

Please find links to the project home page and tarball below. The
changes in this release are described in the NEWS file in the tarball.

https://guile-xapian.systemreboot.net/
https://guile-xapian.systemreboot.net/releases/guile-xapian-~a.tar.lz
https://guile-xapian.systemreboot.net/releases/guile-xapian-~a.tar.lz.asc

Cheers!
"
                     version version version)))
  (system* "xdg-open"
           (string-append "mailto:guile-xapian@systemreboot.net?"
                          (string-join
                           (map (match-lambda
                                  ((key . value)
                                   (string-append key "=" (uri-encode value))))
                                `(("to" . "guile-user@gnu.org")
                                  ("subject" . ,(format "guile-xapian ~a released"
                                                        version))
                                  ("body" . ,body)))
                           "&"))))