diff options
author | Christopher Baines <mail@cbaines.net> | 2019-10-11 17:20:50 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-10-21 06:58:48 +0100 |
commit | d85e683e9bea149bc415726e4e8943c67dfaaf97 (patch) | |
tree | ba8f3266ba7722bc6f87d7165a1d0cb080cda029 /gnu | |
parent | f0bbf894a1f935c1e0109f35899acb6dfcb977f2 (diff) | |
download | guix-ephemeralpg.tar guix-ephemeralpg.tar.gz |
gnu: Add ephemeralpg.ephemeralpg
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.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/databases.scm | 62 |
1 files changed, 62 insertions, 0 deletions
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") |