diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2024-12-02 16:20:04 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2024-12-12 23:23:34 +0100 |
| commit | 5e2daf4b10cdbb7b5b3a7b1a49b0dfdba4346748 (patch) | |
| tree | a7fdcef82ec471287f32e92ad4f03badecf25304 /etc | |
| parent | 46a8922105a8162a7ecabfb66b4242e072e22ef3 (diff) | |
maint: Add ungrafting manifest.
* etc/manifests/ungraft.scm: New file.
* Makefile.am (EXTRA_DIST): Add it.
Change-Id: If4aa7649721b93d3297ecd967d5db4a6b71ec6eb
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/manifests/ungraft.scm | 49 |
1 files changed, 49 insertions, 0 deletions
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))))) | ||
