From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
To: 73876@debbugs.gnu.org
Cc: Nicolas Graves <ngraves@ngraves.fr>
Subject: [bug#73876] [PATCH 3/3] gnu: Add postgresql-libversion.
Date: Sat, 19 Oct 2024 11:09:15 +0200 [thread overview]
Message-ID: <20241019090928.21158-3-ngraves@ngraves.fr> (raw)
In-Reply-To: <20241019090928.21158-1-ngraves@ngraves.fr>
* gnu/packages/version-control.scm (postgresql-libversion): New variable.
---
gnu/packages/version-control.scm | 85 ++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index b14ec77ff5..b70db7a022 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1570,6 +1570,91 @@ (define-public python-git-multimail
repository")
(license license:gpl2)))
+(define postgresql-libversion-bootstrap
+ (package
+ (name "postgresql-libversion")
+ (version "2.0.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/repology/postgresql-libversion")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0g28dbj0zad62irzv051m4acby974f1ya605xfl48i8g3il9fyny"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:tests? #f
+ #:make-flags #~(list (string-append "DESTDIR=" (getcwd) "/tmp-out"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'install)
+ (add-after 'build 'pre-install
+ (lambda args
+ (mkdir "tmp-out")
+ (apply (assoc-ref %standard-phases 'install) args)))
+ (add-after 'pre-install 'install
+ (lambda _
+ (let ((tmp-out (string-append (dirname (getcwd)) "/tmp-out")))
+ (copy-recursively
+ (dirname
+ (dirname (car (find-files tmp-out "libversion.so"))))
+ #$output))))
+ (add-after 'build 'start-postgresql
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (let ((dbdir (string-append (dirname (getcwd)) "/pgdir")))
+ (invoke "initdb" "-D" dbdir)
+ (invoke "pg_ctl" "-D" dbdir
+ "-o" (string-append "-k " dbdir)
+ "-l" (string-append dbdir "/db.log")
+ "start")
+ (invoke "psql" "-h" dbdir "-d" "postgres"
+ "-c" "CREATE DATABASE nixbld;")
+ (setenv "PGHOST" dbdir)))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (if tests?
+ (invoke "make" "installcheck")
+ (format #t "test suite not run~%")))))))
+ (inputs (list libversion postgresql))
+ (native-inputs (list pkg-config))
+ (home-page "https://github.com/repology/postgresql-libversion")
+ (synopsis "PostgreSQL extension for version string comparison")
+ (description "This package provides a PostgreSQL extension with support
+for version string comparison through @code{libversion}. It is used to
+experiment with @url{https://repology.org, Repology} database dumps.")
+ (license license:expat)))
+
+;; A postgresql extension needs extend-postgresql with itself to test.
+;; This is because CREATE EXTENSION needs the extension to be in the
+;; postgresql package.
+(define-public postgresql-libversion
+ (package
+ (inherit postgresql-libversion-bootstrap)
+ (arguments
+ (substitute-keyword-arguments
+ (package-arguments postgresql-libversion-bootstrap)
+ ((#:tests? _) #t)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (delete 'build)
+ (delete 'pre-install)
+ (delete 'install-license-files)
+ (replace 'install
+ (lambda _
+ (copy-recursively
+ #$(this-package-native-input "postgresql-libversion")
+ #$output)))))))
+ (native-inputs (list pkg-config
+ postgresql-libversion-bootstrap
+ (extend-postgresql
+ postgresql
+ (list postgresql-libversion-bootstrap))))))
+
(define-public python-ghp-import
(package
(name "python-ghp-import")
--
2.46.0
next prev parent reply other threads:[~2024-10-19 9:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-19 8:49 [bug#73876] [PATCH 0/3] Add postgresql-libversion Nicolas Graves via Guix-patches via
2024-10-19 9:09 ` [bug#73876] [PATCH 1/3] gnu: Add libversion Nicolas Graves via Guix-patches via
2024-10-19 9:09 ` [bug#73876] [PATCH 2/3] gnu: final-postgresql: Move to (gnu packages databases) Nicolas Graves via Guix-patches via
2024-10-19 9:09 ` Nicolas Graves via Guix-patches via [this message]
2024-10-20 14:21 ` [bug#73876] [PATCH v2 1/3] gnu: Add libversion Nicolas Graves via Guix-patches via
2024-10-20 14:21 ` [bug#73876] [PATCH v2 2/3] gnu: Add postgresql-libversion Nicolas Graves via Guix-patches via
2024-10-20 14:21 ` [bug#73876] [PATCH v2 3/3] gnu: databases: Rewrite final-postgresql for postgresql-service Nicolas Graves via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241019090928.21158-3-ngraves@ngraves.fr \
--to=guix-patches@gnu.org \
--cc=73876@debbugs.gnu.org \
--cc=ngraves@ngraves.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).