diff options
| -rw-r--r-- | Makefile.am | 1 | ||||
| -rw-r--r-- | etc/manifests/ungraft.scm | 49 |
2 files changed, 50 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 1070d707c45..27ea69d8da3 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -751,6 +751,7 @@ EXTRA_DIST += \ | |||
| 751 | etc/manifests/source.scm \ | 751 | etc/manifests/source.scm \ |
| 752 | etc/manifests/system-tests.scm \ | 752 | etc/manifests/system-tests.scm \ |
| 753 | etc/manifests/time-travel.scm \ | 753 | etc/manifests/time-travel.scm \ |
| 754 | etc/manifests/ungraft.scm \ | ||
| 754 | etc/manifests/upgrade.scm \ | 755 | etc/manifests/upgrade.scm \ |
| 755 | scripts/guix.in \ | 756 | scripts/guix.in \ |
| 756 | tests/cve-sample.json \ | 757 | tests/cve-sample.json \ |
diff --git a/etc/manifests/ungraft.scm b/etc/manifests/ungraft.scm new file mode 100644 index 00000000000..3e42b98ece5 --- /dev/null +++ b/etc/manifests/ungraft.scm | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2024 Ludovic Courtès <ludo@gnu.org> | ||
| 3 | ;;; | ||
| 4 | ;;; This file is part of GNU Guix. | ||
| 5 | ;;; | ||
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | ;;; under the terms of the GNU General Public License as published by | ||
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | ;;; your option) any later version. | ||
| 10 | ;;; | ||
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | ;;; GNU General Public License for more details. | ||
| 15 | ;;; | ||
| 16 | ;;; You should have received a copy of the GNU General Public License | ||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | ;; This manifest "ungrafts" all the currently grafted packages and returns | ||
| 20 | ;; said packages and all their dependents. | ||
| 21 | |||
| 22 | (use-modules (guix diagnostics) | ||
| 23 | (guix i18n) | ||
| 24 | (guix packages) | ||
| 25 | (guix profiles) | ||
| 26 | (guix store) | ||
| 27 | ((guix scripts build) #:select (dependents)) | ||
| 28 | ((gnu packages) #:select (all-packages)) | ||
| 29 | (srfi srfi-1)) | ||
| 30 | |||
| 31 | (define (grafted-packages) | ||
| 32 | (info (G_ "enumerating grafted packages...~%")) | ||
| 33 | (let ((result (filter package-replacement (all-packages)))) | ||
| 34 | (info (G_ "found ~d grafted packages:~{ ~a~}~%") | ||
| 35 | (length result) (map package-full-name result)) | ||
| 36 | result)) | ||
| 37 | |||
| 38 | (manifest | ||
| 39 | (with-store store | ||
| 40 | (let* ((grafted (grafted-packages)) | ||
| 41 | (ungraft-all (package-input-rewriting | ||
| 42 | (map (lambda (package) | ||
| 43 | `(,package . ,(package-replacement package))) | ||
| 44 | grafted)))) | ||
| 45 | (map (lambda (package) | ||
| 46 | (manifest-entry | ||
| 47 | (inherit (package->manifest-entry (ungraft-all package))) | ||
| 48 | (name (string-append (package-name package) "-ungrafted")))) | ||
| 49 | (dependents store grafted))))) | ||
