aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

;;; This file returns a manifest containing origins of all the packages.  The
;;; main purpose is to allow continuous integration services to keep upstream
;;; source code around.  It can also be passed to 'guix weather -m'.

(use-modules (srfi srfi-1) (srfi srfi-26)
             (ice-9 match) (ice-9 vlist)
             (guix packages) (guix profiles)
             (gnu packages))

(define (all-packages)
  "Return the list of all the packages, public or private, omitting only
superseded packages."
  (fold-packages (lambda (package lst)
                   (match (package-replacement package)
                     (#f (cons package lst))
                     (replacement
                      (append (list replacement package) lst))))
                 '()
                 #:select? (negate package-superseded)))

(define (upstream-origin source)
  "Return SOURCE without any patches or snippet."
  (origin (inherit source)
          (snippet #f) (patches '())))

(define (all-origins)
  "Return the list of origins referred to by all the packages."
  (let loop ((packages (all-packages))
             (origins  '())
             (visited   vlist-null))
    (match packages
      ((head . tail)
       (let ((new (remove (cut vhash-assq <> visited)
                          (package-direct-sources head))))
         (loop tail (append new origins)
               (fold (cut vhash-consq <> #t <>)
                     visited new))))
      (()
       origins))))

;; Return a manifest containing all the origins.
(manifest (map (lambda (origin)
                 (manifest-entry
                   (name (or (origin-actual-file-name origin)
                             "origin"))
                   (version "0")
                   (item (upstream-origin origin))))
               (all-origins)))
f8'>gnu: services: Revert to deleting and updating all matching servicesBrian Cully This patch reverts the behavior introduced in 181951207339508789b28ba7cb914f983319920f which caused ‘modify-services’ clauses to only match a single instance of a service. We will now match all service instances when doing a deletion or update, while still raising an exception when trying to match against a service that does not exist in the services list, or which was deleted explicitly by a ‘delete’ clause (or an update clause that returns ‘#f’ for the service). Fixes: #64106 * gnu/services.scm (%modify-services): New procedure. (modify-services): Use it. (apply-clauses): Add DELETED-SERVICES argument, change to modify one service at a time. * tests/services.scm ("modify-services: delete then modify") ("modify-services: modify then delete") ("modify-services: delete multiple services of the same type") ("modify-services: modify multiple services of the same type"): New tests. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> 2023-08-20services: Define 'for-home'.Ludovic Courtès * gnu/services.scm (remove-service-extensions): New procedure. (for-home?): New syntax parameter. (for-home): New macro. 2023-06-06services: Check if service is #f before applying clause.Josselin Poiret * gnu/services.scm (apply-clauses): Check if service is #f before trying to apply clause. Follow up of 181951207339508789b28ba7cb914f983319920f. 2023-06-06services: 'modify-services' preserves service ordering.Ludovic Courtès Fixes <https://issues.guix.gnu.org/63921>. The regression was introduced in dbbc7e946131ba257728f1d05b96c4339b7ee88b, which changed the order of services. As a result, someone using 'modify-services' could find themselves with incorrect ordering of expressions in the "boot" script, whereby the cleanup expressions would come after (execl ".../shepherd"). This, in turn, would lead shepherd to error out at boot with EADDRINUSE on /var/run/shepherd/socket. * gnu/services.scm (%delete-service, %apply-clauses): Remove. (clause-alist): New macro. (apply-clauses): New procedure. (modify-services): Use it. Adjust docstring. * tests/services.scm ("modify-services: do nothing"): Remove 'sort' call. ("modify-services: delete service"): Likewise, and add 't4' service. ("modify-services: change value"): Remove 'sort' call and fix expected value. 2023-06-02services: Error in MODIFY-SERVICES when services don't existBrian Cully This patch causes MODIFY-SERVICES to raise an error if a reference is made to a service which isn't in its service list. This it to help users notice if they have an invalid rule, which is currently silently ignored. * gnu/services.scm (%delete-service): new procedure (%apply-clauses): new syntax rule (%modify-service): remove syntax rule Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2023-05-16services: Add default values.Andrew Tropin * gnu/services.scm (boot-service-type, activation-service-type, etc-service-type, profile-service-type): Add default-value. * gnu/system/shadow.scm (account-service-type): Add default-value. 2023-03-16services: etc-service: Deprecate etc-service procedure.Bruno Victal * gnu/services.scm (etc-service): Deprecate procedure. * gnu/system.scm (operating-system-etc-service): Replace etc-service with etc-service-type. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2022-08-30services: provenance: Use 'current-channels' to obtain provenance data.Ludovic Courtès Previously, build-time metadata from (guix config) would be ignored when available--e.g., when running /run/current-system/profile/bin/guix. This is a followup to 316fc2acbb112bfa572ae30f95a93bcd56621234. * gnu/services.scm (provenance-entry): Use 'current-channels' instead of 'current-profile' + 'profile-channels'. 2022-05-29gnu: services: Update setuid service description.Tobias Geerinckx-Rice * gnu/services.scm (setuid-program-service-type)[description]: Remove ‘root’, add ‘setgid’.