From patchwork Mon Oct 21 06:00:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 15784 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A47F3175F7; Mon, 21 Oct 2019 07:01:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 5D7E41757F for ; Mon, 21 Oct 2019 07:01:20 +0100 (BST) Received: from localhost ([::1]:33902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMQkp-0003PR-Pi for patchwork@mira.cbaines.net; Mon, 21 Oct 2019 02:01:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39252) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMQkZ-0003PE-KY for guix-patches@gnu.org; Mon, 21 Oct 2019 02:01:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMQkY-0004O6-9w for guix-patches@gnu.org; Mon, 21 Oct 2019 02:01:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46775) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMQkY-0004O2-6m for guix-patches@gnu.org; Mon, 21 Oct 2019 02:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iMQkY-0003QQ-42 for guix-patches@gnu.org; Mon, 21 Oct 2019 02:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37845] [PATCH] gnu: Add ephemeralpg. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 21 Oct 2019 06:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37845 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37845@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.157163765513144 (code B ref -1); Mon, 21 Oct 2019 06:01:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Oct 2019 06:00:55 +0000 Received: from localhost ([127.0.0.1]:55596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMQkQ-0003Pv-8r for submit@debbugs.gnu.org; Mon, 21 Oct 2019 02:00:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:60163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMQkO-0003Pn-7D for submit@debbugs.gnu.org; Mon, 21 Oct 2019 02:00:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39222) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMQkL-0003Ok-8R for guix-patches@gnu.org; Mon, 21 Oct 2019 02:00:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMQkI-0004KN-TB for guix-patches@gnu.org; Mon, 21 Oct 2019 02:00:48 -0400 Received: from mira.cbaines.net ([2a01:7e00::f03c:91ff:fe69:8da9]:44306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iMQkI-0004K5-LE for guix-patches@gnu.org; Mon, 21 Oct 2019 02:00:46 -0400 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id D858C1757E for ; Mon, 21 Oct 2019 07:00:44 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id b3f1529d for ; Mon, 21 Oct 2019 06:00:44 +0000 (UTC) From: Christopher Baines Date: Mon, 21 Oct 2019 07:00:44 +0100 Message-Id: <20191021060044.9696-1-mail@cbaines.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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(+) 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")