diff options
author | Christopher Baines <mail@cbaines.net> | 2023-02-15 16:31:20 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-02-15 16:31:20 +0000 |
commit | 8b888de4cff44b42b8215afac5dcdadba9b7394d (patch) | |
tree | 25163de7c77da9ccb27dd9fb319b366cad0ccdd0 | |
parent | f62a2b3b48ecebf01b0cbd8ddd11e1a45cb27804 (diff) | |
download | nar-herder-8b888de4cff44b42b8215afac5dcdadba9b7394d.tar nar-herder-8b888de4cff44b42b8215afac5dcdadba9b7394d.tar.gz |
Handle self references when doing checks on narinfo imports
-rw-r--r-- | scripts/nar-herder.in | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in index 9e70b77..c8726b8 100644 --- a/scripts/nar-herder.in +++ b/scripts/nar-herder.in @@ -51,6 +51,7 @@ (fibers conditions) (fibers web server) ((guix ui) #:select (read/eval string->duration)) + (guix store) (guix progress) (guix narinfo) (guix derivations) @@ -321,16 +322,23 @@ "https://narherderdummyvalue"))))) (when (assq-ref opts 'ensure-references-exist) - (for-each - (lambda (reference) - (unless (database-select-narinfo-by-hash - database - (string-take reference 32)) - (error - (simple-format (current-error-port) - "missing reference to ~A\n" - reference)))) - (narinfo-references narinfo))) + (let ((self-reference + (store-path-base + (narinfo-path narinfo)))) + (for-each + (lambda (reference) + (when (and + (not + (string=? reference self-reference)) + (not + (database-select-narinfo-by-hash + database + (string-take reference 32)))) + (error + (simple-format (current-error-port) + "missing reference to ~A\n" + reference)))) + (narinfo-references narinfo)))) (database-insert-narinfo database |