diff options
author | Christopher Baines <mail@cbaines.net> | 2019-11-18 19:49:12 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-11-21 19:56:19 +0000 |
commit | f23ee71ea7efedd14843a474f87550d7d991cca7 (patch) | |
tree | 8cd28619404580417a83dd866aaf54f98dac0fac | |
parent | 2e8ca7f547800f1455214be24525ff64ea095e4a (diff) | |
download | data-service-f23ee71ea7efedd14843a474f87550d7d991cca7.tar data-service-f23ee71ea7efedd14843a474f87550d7d991cca7.tar.gz |
Insert channel news entries when loading new guix revisions
If the channel-news-for-commit function is present.
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 10 | ||||
-rw-r--r-- | tests/jobs-load-new-guix-revision.scm | 48 |
2 files changed, 41 insertions, 17 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index d5e1add..7615400 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -17,6 +17,7 @@ #:use-module (guix build utils) #:use-module (guix-data-service config) #:use-module (guix-data-service database) + #:use-module (guix-data-service model channel-news) #:use-module (guix-data-service model package) #:use-module (guix-data-service model git-repository) #:use-module (guix-data-service model guix-revision) @@ -1047,6 +1048,15 @@ ORDER BY packages.name, packages.version" commit store-item))) (and guix-revision-id + (if (defined? 'channel-news-for-commit) + (insert-channel-news-entries-for-guix-revision + conn + guix-revision-id + (channel-news-for-commit channel-for-commit commit)) + (begin + (simple-format #t "debug: importing channel news not supported\n") + #t)) + (extract-information-from conn guix-revision-id commit store-item) (update-package-versions-table conn git-repository-id commit) diff --git a/tests/jobs-load-new-guix-revision.scm b/tests/jobs-load-new-guix-revision.scm index 8f82e10..9f7b32f 100644 --- a/tests/jobs-load-new-guix-revision.scm +++ b/tests/jobs-load-new-guix-revision.scm @@ -14,6 +14,8 @@ (with-postgresql-connection "test-jobs-load-new-guix-revision" (lambda (conn) + (exec-query conn "TRUNCATE guix_revisions CASCADE") + (test-equal "select-job-for-commit works" '() (select-job-for-commit conn "does not exist")) @@ -29,17 +31,24 @@ (mock ((guix-data-service jobs load-new-guix-revision) extract-information-from - (lambda (conn git-repository-id commit store-path) + (lambda (conn guix-revision-id commit store-path) #t)) - (match (enqueue-load-new-guix-revision-job - conn - (git-repository-url->git-repository-id conn "test-url") - "test-commit" - "test-source") - ((id) - (process-load-new-guix-revision-job id)))))) - + (mock + ((guix channels) + channel-news-for-commit + (lambda (channel commit) + '())) + + (match (enqueue-load-new-guix-revision-job + conn + (git-repository-url->git-repository-id conn "test-url") + "test-commit" + "test-source") + ((id) + (process-load-new-guix-revision-job id))))))) + + (exec-query conn "TRUNCATE guix_revisions CASCADE") (exec-query conn "TRUNCATE load_new_guix_revision_jobs CASCADE") (test-equal "test build store item failure" @@ -74,13 +83,19 @@ (lambda (conn git-repository-id commit store-path) #f)) - (match (enqueue-load-new-guix-revision-job - conn - (git-repository-url->git-repository-id conn "test-url") - "test-commit" - "test-source") - ((id) - (process-load-new-guix-revision-job id)))))) + (mock + ((guix channels) + channel-news-for-commit + (lambda (channel commit) + '())) + + (match (enqueue-load-new-guix-revision-job + conn + (git-repository-url->git-repository-id conn "test-url") + "test-commit" + "test-source") + ((id) + (process-load-new-guix-revision-job id))))))) (exec-query conn "TRUNCATE load_new_guix_revision_jobs CASCADE") @@ -101,5 +116,4 @@ #t) #:always-rollback? #t)))) - (test-end) |