[PATCH] gnu: Add ephemeralpg.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Christopher Baines
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 21 Oct 2019 08:00
(address . guix-patches@gnu.org)
20191021060044.9696-1-mail@cbaines.net
This is a general utility, but I'm particularly interested in using this to
enable build time tests for the guix-data-service package.

* gnu/packages/databases.scm (ephemeralpg): New variable.
---
gnu/packages/databases.scm | 62 ++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)

Toggle diff (75 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index f8e72565a0..7e26e9ebbd 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -216,6 +216,68 @@ standard Go idioms.")
(home-page "http://labix.org/mgo")
(license license:bsd-2)))
+(define-public ephemeralpg
+ (package
+ (name "ephemeralpg")
+ (version "2.8")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "http://eradman.com/ephemeralpg/code/ephemeralpg-"
+ version ".tar.gz"))
+ (sha256
+ (base32 "1dpfxsd8a52psx3zlfbqkw53m35w28qwyb87a8anz143x6gnkkr4"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:make-flags (list "CC=gcc"
+ (string-append "PREFIX=" %output))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'check
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; The intention for one test is to test without PostgreSQL on
+ ;; the $PATH, so replace the test $PATH with just the util-linux
+ ;; bin, which contains getopt. It will hopefully be possible to
+ ;; remove this for releases after 2.8.
+ (substitute* "test.rb"
+ (("/bin:/usr/bin")
+ (string-append (assoc-ref inputs "util-linux")
+ "/bin")))
+ ;; Set the LC_ALL=C as some tests use sort, and the locale
+ ;; affects the order. It will hopefully be possible to remove
+ ;; this for releases after 2.8.
+ (setenv "LC_ALL" "C")
+ (invoke "ruby" "test.rb")
+ #t))
+ (add-after 'install 'wrap
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (wrap-program (string-append out "/bin/pg_tmp")
+ `("PATH" ":" prefix
+ (,(string-append (assoc-ref inputs "util-linux")
+ "/bin")
+ ,(string-append (assoc-ref inputs "postgresql")
+ "/bin")
+ ;; For getsocket
+ ,(string-append out "/bin")))))
+ #t)))))
+ (inputs
+ `(("postgresql" ,postgresql)
+ ("util-linux" ,util-linux)))
+ (native-inputs
+ `(("ruby" ,ruby)))
+ (home-page "http://eradman.com/ephemeralpg/")
+ (synopsis "Run temporary PostgreSQL databases")
+ (description
+ "@code{pg_tmp} creates temporary PostgreSQL databases, suitable for tasks
+like running software test suites. Temporary databases created with
+@code{pg_tmp} have a limited shared memory footprint and are automatically
+garbage-collected after a configurable number of seconds (the default is
+60).")
+ (license license:gpl2)))
+
(define-public es-dump-restore
(package
(name "es-dump-restore")
--
2.23.0
L
L
Ludovic Courtès wrote on 21 Oct 2019 15:44
(name . Christopher Baines)(address . mail@cbaines.net)(address . 37845@debbugs.gnu.org)
877e4y1ade.fsf@gnu.org
Hi Chris,

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (5 lines)
> This is a general utility, but I'm particularly interested in using this to
> enable build time tests for the guix-data-service package.
>
> * gnu/packages/databases.scm (ephemeralpg): New variable.

[...]

Toggle quote (2 lines)
> + (license license:gpl2)))

I think this is ISC, no?

Apart from that, it LGTM. Thanks!

Ludo’.
C
C
Christopher Baines wrote on 21 Oct 2019 19:29
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 37845-done@debbugs.gnu.org)
87eez6qa6i.fsf@cbaines.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (15 lines)
> Hi Chris,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> This is a general utility, but I'm particularly interested in using this to
>> enable build time tests for the guix-data-service package.
>>
>> * gnu/packages/databases.scm (ephemeralpg): New variable.
>
> [...]
>
>> + (license license:gpl2)))
>
> I think this is ISC, no?

Ah, yep, I probably didn't change that from whatever package definition
I copied... I've updated it now.

Toggle quote (2 lines)
> Apart from that, it LGTM. Thanks!

Great, with the above change, I've pushed this as
6fc03fccd41c1687933a0a70a40efcb5ed821995.
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl2t6vVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XepvRAAh3Z6sdjC0QxHSQzNAwHi9F/DfmASUWf2PiEO/5lwRtqTZLJVe3IU/s4H
BQoEvkMOrkGYAgRY0DI+6kTbR/tBe++XmJb/WkmnN/jkPcjjml9nD2GMUNaLIeMX
QLwof73+k4MOva2/rnsZzQB1Tb9vcP5ETteefRsM5tInibewKaMMq3Yn6AeolZRh
7mc9GklW1Muyv1DQD8UIjD+pi1VaLPXyK9Hm7QCxWa0+noq30rOafhbTkz0ENX4l
mIqIxrvPhjI1aeSzhU5yRzQJLdQupLxwAKh4Qo5EDqRplZIMuK7ktn/npuYunDsm
ih1jgBhrxGqmFPwLq0kSokAhrRM2RrX8doMMf1ElZH1at/cu8STODKu01Ay+sPmi
SOxihUmWokls/zitjN4UvAfUv8GogfayORlJJFyafCc/mj1mL6nD2ppjy3CXNqir
eHvQcXGrScKeGnkzRIQ6uBh2Mhq5y11BXsjcaPzsiOgbnYlgVXK1glUsmb1Dgv7w
XIYRl8voXXuGfituaaWxLWD8QDtbIj4KQUvflKSQtLnAyReOZI8ju00cxOv65ZVo
70P05RM4z9cOalsjW8aEVafKP5u/YoEU+zK0qBgTm6kBy2grg3lc7sFsqnmXxvq0
yLswPWi/zwN9AHefdAnj2hDAqofnmq2XW6TYfRxkRdVScHC5ru8=
=kaxJ
-----END PGP SIGNATURE-----

Closed
?