aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-11-15 23:39:01 +0000
committerChristopher Baines <mail@cbaines.net>2019-11-21 19:56:19 +0000
commit66d726f1fd92bd2cdd953d4e8d05a4dc5e44e732 (patch)
tree560e15adb2a04efe32da83151fb2049ca0f73304
parent7c611402a0f7444322fc4e4c48fecd4b6dbd5efa (diff)
downloaddata-service-66d726f1fd92bd2cdd953d4e8d05a4dc5e44e732.tar
data-service-66d726f1fd92bd2cdd953d4e8d05a4dc5e44e732.tar.gz
Refactor channel handling in the load-new-guix-revision module
To allow for passing the channel to channel-news-for-commit.
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm33
-rw-r--r--tests/jobs-load-new-guix-revision.scm12
2 files changed, 21 insertions, 24 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index 643df0a..a374a6e 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -897,21 +897,6 @@ WHERE job_id = $1"
(lambda (key . args)
(display-backtrace (make-stack #t) (current-error-port)))))))
-
-(define (store-item-for-git-repository-id-and-commit
- conn git-repository-id commit)
- (with-store store
- (set-build-options store
- #:fallback? #t)
- (channel->guix-store-item
- conn
- store
- (channel (name 'guix)
- (url (git-repository-id->url
- conn
- git-repository-id))
- (commit commit)))))
-
(define (update-package-versions-table conn git-repository-id commit)
;; Lock the table to wait for other transactions to commit before updating
;; the table
@@ -1044,10 +1029,22 @@ ORDER BY packages.name, packages.version"
#t)
+(define (store-item-for-channel conn channel)
+ (with-store store
+ (set-build-options store #:fallback? #t)
+ (channel->guix-store-item conn
+ store
+ channel)))
+
(define (load-new-guix-revision conn git-repository-id commit)
- (let ((store-item
- (store-item-for-git-repository-id-and-commit
- conn git-repository-id commit)))
+ (let* ((channel-for-commit
+ (channel (name 'guix)
+ (url (git-repository-id->url
+ conn
+ git-repository-id))
+ (commit commit)))
+ (store-item
+ (store-item-for-channel conn channel-for-commit)))
(if store-item
(and
(extract-information-from conn git-repository-id
diff --git a/tests/jobs-load-new-guix-revision.scm b/tests/jobs-load-new-guix-revision.scm
index cbd9adc..8f82e10 100644
--- a/tests/jobs-load-new-guix-revision.scm
+++ b/tests/jobs-load-new-guix-revision.scm
@@ -22,8 +22,8 @@
#t
(mock
((guix-data-service jobs load-new-guix-revision)
- store-item-for-git-repository-id-and-commit
- (lambda (conn git-repository-id commit)
+ store-item-for-channel
+ (lambda (conn channel)
"/gnu/store/test"))
(mock
@@ -46,8 +46,8 @@
#f
(mock
((guix-data-service jobs load-new-guix-revision)
- store-item-for-git-repository-id-and-commit
- (lambda (conn git-repository-id commit)
+ store-item-for-channel
+ (lambda (conn channel)
#f))
(match (enqueue-load-new-guix-revision-job
@@ -64,8 +64,8 @@
#f
(mock
((guix-data-service jobs load-new-guix-revision)
- store-item-for-git-repository-id-and-commit
- (lambda (conn git-repository-id commit)
+ store-item-for-channel
+ (lambda (conn channel)
"/gnu/store/test"))
(mock