diff options
| -rw-r--r-- | guix/nar.scm | 3 | ||||
| -rw-r--r-- | guix/scripts/system.scm | 1 | ||||
| -rw-r--r-- | guix/store.scm | 29 | ||||
| -rw-r--r-- | tests/store-database.scm | 2 | ||||
| -rw-r--r-- | tests/store.scm | 22 |
5 files changed, 5 insertions, 52 deletions
diff --git a/guix/nar.scm b/guix/nar.scm index 9b4c608238e..3556de13796 100644 --- a/guix/nar.scm +++ b/guix/nar.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> | 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| @@ -23,6 +23,7 @@ | |||
| 23 | #:use-module ((guix build utils) | 23 | #:use-module ((guix build utils) |
| 24 | #:select (delete-file-recursively with-directory-excursion)) | 24 | #:select (delete-file-recursively with-directory-excursion)) |
| 25 | #:use-module (guix store) | 25 | #:use-module (guix store) |
| 26 | #:use-module (guix store database) | ||
| 26 | #:use-module (guix ui) ; for '_' | 27 | #:use-module (guix ui) ; for '_' |
| 27 | #:use-module (guix hash) | 28 | #:use-module (guix hash) |
| 28 | #:use-module (guix pki) | 29 | #:use-module (guix pki) |
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 14be8ff8cfd..9112177bfb3 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #:use-module (guix config) | 23 | #:use-module (guix config) |
| 24 | #:use-module (guix ui) | 24 | #:use-module (guix ui) |
| 25 | #:use-module (guix store) | 25 | #:use-module (guix store) |
| 26 | #:autoload (guix store database) (register-path) | ||
| 26 | #:use-module (guix grafts) | 27 | #:use-module (guix grafts) |
| 27 | #:use-module (guix gexp) | 28 | #:use-module (guix gexp) |
| 28 | #:use-module (guix derivations) | 29 | #:use-module (guix derivations) |
diff --git a/guix/store.scm b/guix/store.scm index 6742611c6f8..773d53e82b6 100644 --- a/guix/store.scm +++ b/guix/store.scm | |||
| @@ -122,8 +122,6 @@ | |||
| 122 | 122 | ||
| 123 | current-build-output-port | 123 | current-build-output-port |
| 124 | 124 | ||
| 125 | register-path | ||
| 126 | |||
| 127 | %store-monad | 125 | %store-monad |
| 128 | store-bind | 126 | store-bind |
| 129 | store-return | 127 | store-return |
| @@ -1301,33 +1299,6 @@ The result is always the empty list unless the daemon was started with | |||
| 1301 | This makes sense only when the daemon was started with '--cache-failures'." | 1299 | This makes sense only when the daemon was started with '--cache-failures'." |
| 1302 | boolean) | 1300 | boolean) |
| 1303 | 1301 | ||
| 1304 | (define* (register-path path | ||
| 1305 | #:key (references '()) deriver prefix | ||
| 1306 | state-directory) | ||
| 1307 | "Register PATH as a valid store file, with REFERENCES as its list of | ||
| 1308 | references, and DERIVER as its deriver (.drv that led to it.) If PREFIX is | ||
| 1309 | not #f, it must be the name of the directory containing the new store to | ||
| 1310 | initialize; if STATE-DIRECTORY is not #f, it must be a string containing the | ||
| 1311 | absolute file name to the state directory of the store being initialized. | ||
| 1312 | Return #t on success. | ||
| 1313 | |||
| 1314 | Use with care as it directly modifies the store! This is primarily meant to | ||
| 1315 | be used internally by the daemon's build hook." | ||
| 1316 | ;; Currently this is implemented by calling out to the fine C++ blob. | ||
| 1317 | (let ((pipe (apply open-pipe* OPEN_WRITE %guix-register-program | ||
| 1318 | `(,@(if prefix | ||
| 1319 | `("--prefix" ,prefix) | ||
| 1320 | '()) | ||
| 1321 | ,@(if state-directory | ||
| 1322 | `("--state-directory" ,state-directory) | ||
| 1323 | '()))))) | ||
| 1324 | (and pipe | ||
| 1325 | (begin | ||
| 1326 | (format pipe "~a~%~a~%~a~%" | ||
| 1327 | path (or deriver "") (length references)) | ||
| 1328 | (for-each (cut format pipe "~a~%" <>) references) | ||
| 1329 | (zero? (close-pipe pipe)))))) | ||
| 1330 | |||
| 1331 | 1302 | ||
| 1332 | ;;; | 1303 | ;;; |
| 1333 | ;;; Store monad. | 1304 | ;;; Store monad. |
diff --git a/tests/store-database.scm b/tests/store-database.scm index 22c356679bc..fcae66e2de9 100644 --- a/tests/store-database.scm +++ b/tests/store-database.scm | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | (define-module (test-store-database) | 19 | (define-module (test-store-database) |
| 20 | #:use-module (guix tests) | 20 | #:use-module (guix tests) |
| 21 | #:use-module ((guix store) #:hide (register-path)) | 21 | #:use-module (guix store) |
| 22 | #:use-module (guix store database) | 22 | #:use-module (guix store database) |
| 23 | #:use-module ((guix utils) #:select (call-with-temporary-output-file)) | 23 | #:use-module ((guix utils) #:select (call-with-temporary-output-file)) |
| 24 | #:use-module (srfi srfi-26) | 24 | #:use-module (srfi srfi-26) |
diff --git a/tests/store.scm b/tests/store.scm index fdf3be33f60..afecec940ad 100644 --- a/tests/store.scm +++ b/tests/store.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -777,26 +777,6 @@ | |||
| 777 | (pk 'corrupt-imported imported) | 777 | (pk 'corrupt-imported imported) |
| 778 | #f))))) | 778 | #f))))) |
| 779 | 779 | ||
| 780 | (test-assert "register-path" | ||
| 781 | (let ((file (string-append (%store-prefix) "/" (make-string 32 #\f) | ||
| 782 | "-fake"))) | ||
| 783 | (when (valid-path? %store file) | ||
| 784 | (delete-paths %store (list file))) | ||
| 785 | (false-if-exception (delete-file file)) | ||
| 786 | |||
| 787 | (let ((ref (add-text-to-store %store "ref-of-fake" (random-text))) | ||
| 788 | (drv (string-append file ".drv"))) | ||
| 789 | (call-with-output-file file | ||
| 790 | (cut display "This is a fake store item.\n" <>)) | ||
| 791 | (register-path file | ||
| 792 | #:references (list ref) | ||
| 793 | #:deriver drv) | ||
| 794 | |||
| 795 | (and (valid-path? %store file) | ||
| 796 | (equal? (references %store file) (list ref)) | ||
| 797 | (null? (valid-derivers %store file)) | ||
| 798 | (null? (referrers %store file)))))) | ||
| 799 | |||
| 800 | (test-assert "verify-store" | 780 | (test-assert "verify-store" |
| 801 | (let* ((text (random-text)) | 781 | (let* ((text (random-text)) |
| 802 | (file1 (add-text-to-store %store "foo" text)) | 782 | (file1 (add-text-to-store %store "foo" text)) |
