Extract out some functions from update-package-derivations-table
To allow these to be used independently.
This commit is contained in:
parent
639f24bb22
commit
69d95b133f
1 changed files with 49 additions and 28 deletions
|
|
@ -29,24 +29,10 @@
|
|||
action time-taken)
|
||||
result))
|
||||
|
||||
(define (update-package-derivations-table conn
|
||||
(define (delete-guix-revision-package-derivation-entries conn
|
||||
git-repository-id
|
||||
guix-revision-id
|
||||
commit)
|
||||
;; Lock the table to wait for other transactions to commit before updating
|
||||
;; the table
|
||||
(exec-query
|
||||
conn
|
||||
"
|
||||
LOCK TABLE ONLY package_derivations_by_guix_revision_range
|
||||
IN SHARE ROW EXCLUSIVE MODE")
|
||||
|
||||
(for-each
|
||||
(match-lambda
|
||||
((branch-name)
|
||||
(log-time
|
||||
(simple-format #f "deleting package derivation entries for ~A" branch-name)
|
||||
(lambda ()
|
||||
branch-name)
|
||||
(exec-query
|
||||
conn
|
||||
"
|
||||
|
|
@ -62,10 +48,13 @@ WHERE git_repository_id = $1 AND
|
|||
)"
|
||||
(list git-repository-id
|
||||
branch-name
|
||||
guix-revision-id))))
|
||||
(log-time
|
||||
(simple-format #f "inserting package derivation entries for ~A" branch-name)
|
||||
(lambda ()
|
||||
guix-revision-id
|
||||
branch-name)))
|
||||
|
||||
(define (insert-guix-revision-package-derivation-entries conn
|
||||
git-repository-id
|
||||
guix-revision-id
|
||||
branch-name)
|
||||
(exec-query
|
||||
conn
|
||||
"
|
||||
|
|
@ -109,7 +98,39 @@ WINDOW package_version AS (
|
|||
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
|
||||
)
|
||||
ORDER BY packages.name, packages.version"
|
||||
(list git-repository-id branch-name guix-revision-id))))))
|
||||
(list git-repository-id
|
||||
branch-name
|
||||
guix-revision-id)))
|
||||
|
||||
(define (update-package-derivations-table conn
|
||||
git-repository-id
|
||||
guix-revision-id
|
||||
commit)
|
||||
;; Lock the table to wait for other transactions to commit before updating
|
||||
;; the table
|
||||
(exec-query
|
||||
conn
|
||||
"
|
||||
LOCK TABLE ONLY package_derivations_by_guix_revision_range
|
||||
IN SHARE ROW EXCLUSIVE MODE")
|
||||
|
||||
(for-each
|
||||
(match-lambda
|
||||
((branch-name)
|
||||
(log-time
|
||||
(simple-format #f "deleting package derivation entries for ~A" branch-name)
|
||||
(lambda ()
|
||||
(delete-guix-revision-package-derivation-entries conn
|
||||
git-repository-id
|
||||
guix-revision-id
|
||||
branch-name)))
|
||||
(log-time
|
||||
(simple-format #f "inserting package derivation entries for ~A" branch-name)
|
||||
(lambda ()
|
||||
(insert-guix-revision-package-derivation-entries conn
|
||||
git-repository-id
|
||||
guix-revision-id
|
||||
branch-name)))))
|
||||
(exec-query
|
||||
conn
|
||||
"SELECT name FROM git_branches WHERE commit = $1 AND git_repository_id = $2"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue