diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/nar-herder.in | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in index 2f4d6d1..32b467d 100644 --- a/scripts/nar-herder.in +++ b/scripts/nar-herder.in @@ -114,7 +114,10 @@ (cons key value))) (or (assq-ref result 'tags) '())) - (alist-delete 'tags result)))))) + (alist-delete 'tags result)))) + (option '("ensure-references-exist") #f #f + (lambda (opt name _ result) + (alist-cons 'ensure-references-exist #t result))))) (define %import-options-defaults '()) @@ -316,6 +319,19 @@ ;; matter (read-narinfo port "https://narherderdummyvalue"))))) + + (when (assq-ref opts 'ensure-references-exist) + (for-each + (lambda (reference) + (unless (database-select-narinfo-by-hash + database + (string-take (basename narinfo-file) 32)) + (error + (simple-format (current-error-port) + "missing reference to ~A\n" + reference)))) + (narinfo-references narinfo))) + (database-insert-narinfo database narinfo |