From 03ea66cf33b77caf766d74e7b7038aec10be0322 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 7 Oct 2020 18:51:30 +0100 Subject: Use the git repository fetch with authentication value --- guix-data-service/jobs/load-new-guix-revision.scm | 34 +++++++++++++++-------- tests/jobs-load-new-guix-revision.scm | 4 +-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index 5ff7be4..1a29add 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -857,7 +857,8 @@ WHERE job_id = $1" (build-derivations store (list derivation))) (derivation->output-path derivation))) -(define (channel->derivation-file-names-by-system conn store channel) +(define (channel->derivation-file-names-by-system conn store channel + fetch-with-authentication?) (define use-container? (defined? 'open-inferior/container (resolve-module '(guix inferior)))) @@ -967,7 +968,9 @@ WHERE job_id = $1" (lambda () (first (latest-channel-instances store - (list channel))))))) + (list channel) + #:authenticate? + fetch-with-authentication?)))))) (inferior-eval '(use-modules (srfi srfi-1) (guix channels) (guix grafts) @@ -1007,10 +1010,14 @@ WHERE job_id = $1" (close-inferior inferior) #f)))) -(define (channel->derivations-by-system conn store channel) - (let* ((derivation-file-names-by-system - (with-time-logging "computing the channel derivation" - (channel->derivation-file-names-by-system conn store channel)))) +(define (channel->derivations-by-system conn store channel + fetch-with-authentication?) + (let ((derivation-file-names-by-system + (with-time-logging "computing the channel derivation" + (channel->derivation-file-names-by-system conn + store + channel + fetch-with-authentication?)))) (for-each (match-lambda ((system . derivation-file-name) @@ -1255,16 +1262,21 @@ WHERE job_id = $1" (prevent-inlining-for-tests extract-information-from) (define (load-new-guix-revision conn store git-repository-id commit) - (let* ((channel-for-commit + (let* ((git-repository-fields + (select-git-repository conn git-repository-id)) + (git-repository-url + (second git-repository-fields)) + (fetch-with-authentication? + (fourth git-repository-fields)) + (channel-for-commit (channel (name 'guix) - (url (git-repository-id->url - conn - git-repository-id)) + (url git-repository-url) (commit commit))) (channel-derivations-by-system (channel->derivations-by-system conn store - channel-for-commit)) + channel-for-commit + fetch-with-authentication?)) (store-item (channel-derivations-by-system->guix-store-item store diff --git a/tests/jobs-load-new-guix-revision.scm b/tests/jobs-load-new-guix-revision.scm index 08dd6f1..99acfa7 100644 --- a/tests/jobs-load-new-guix-revision.scm +++ b/tests/jobs-load-new-guix-revision.scm @@ -38,7 +38,7 @@ (mock ((guix-data-service jobs load-new-guix-revision) channel->derivations-by-system - (lambda (conn store channel) + (lambda (conn store channel fetch-with-authentication?) '((x86_64-linux . ((manifest-entry-item . /gnu/store/foo.drv) @@ -96,7 +96,7 @@ (mock ((guix-data-service jobs load-new-guix-revision) channel->derivations-by-system - (lambda (conn store channel) + (lambda (conn store channel fetch-with-authentication?) '(x86_64-linux . ((manifest-entry-item . /gnu/store/foo.drv) -- cgit v1.2.3