From 1ccc0f807d3f22fa9ade1c607c112e04df833a72 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 2 Apr 2019 10:57:24 +0200 Subject: environment: '-C' creates namespaces where the user is not root. * guix/scripts/environment.scm (launch-environment/container): Add UID and GID. Use them in PASSWD and GROUPS. Pass them as #:guest-uid and #:guest-gid to 'call-with-container'. * tests/guix-environment-container.sh: Test the inner UID. In '--user' test, replace hard-coded 0 with 1000. * doc/guix.texi (Invoking guix environment): Adjust accordingly. --- guix/scripts/environment.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index c27edc798..2d1ba4c93 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -459,17 +459,19 @@ will be used for the passwd entry. LINK-PROFILE? creates a symbolic link from (return (let* ((cwd (getcwd)) (home (getenv "HOME")) + (uid (if user 1000 (getuid))) + (gid (if user 1000 (getgid))) (passwd (let ((pwd (getpwuid (getuid)))) (password-entry (name (or user (passwd:name pwd))) (real-name (if user "" (passwd:gecos pwd))) - (uid 0) (gid 0) (shell bash) + (uid uid) (gid gid) (shell bash) (directory (if user (string-append "/home/" user) (passwd:dir pwd)))))) - (groups (list (group-entry (name "users") (gid 0)) + (groups (list (group-entry (name "users") (gid gid)) (group-entry (gid 65534) ;the overflow GID (name "overflow")))) (home-dir (password-entry-directory passwd)) @@ -541,6 +543,8 @@ will be used for the passwd entry. LINK-PROFILE? creates a symbolic link from ;; A container's environment is already purified, so no need to ;; request it be purified again. (launch-environment command profile manifest #:pure? #f))) + #:guest-uid uid + #:guest-gid gid #:namespaces (if network? (delq 'net %namespaces) ; share host network %namespaces))))))) -- cgit v1.3 From c1ef50ac79ff56bebe81a173a858d83a1bee6a36 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 4 Apr 2019 17:28:00 +0200 Subject: gexp: Remove workarounds for . * gnu/services/base.scm (hydra-key-authorization)[aaa]: Remove. [default-acl]: Don't import it. * guix/scripts/pack.scm (store-database)[build]: Don't import (gnu build install). --- gnu/services/base.scm | 10 ---------- guix/scripts/pack.scm | 6 +----- 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'guix/scripts') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 04b123b83..246932e5c 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1515,19 +1515,9 @@ GID." (define (hydra-key-authorization keys guix) "Return a gexp with code to register KEYS, a list of files containing 'guix archive' public keys, with GUIX." - (define aaa - ;; XXX: Terrible hack to work around : this - ;; forces (guix config) and (guix utils) to be loaded upfront, so that - ;; their run-time symbols are defined. - (scheme-file "aaa.scm" - #~(define-module (guix aaa) - #:use-module (guix config) - #:use-module (guix memoization)))) - (define default-acl (with-extensions (list guile-gcrypt) (with-imported-modules `(((guix config) => ,(make-config.scm)) - ((guix aaa) => ,aaa) ,@(source-module-closure '((guix pki)) #:select? not-config?)) (computed-file "acl" diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index e5502ef9c..d2ef68d15 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -126,13 +126,9 @@ dependencies are registered." (define build (with-extensions gcrypt-sqlite3&co - ;; XXX: Adding (gnu build install) just to work around - ;; : that way, (guix build store-copy) is - ;; copied last and the 'store-info-XXX' macros are correctly expanded. (with-imported-modules (source-module-closure '((guix build store-copy) - (guix store database) - (gnu build install))) + (guix store database))) #~(begin (use-modules (guix store database) (guix build store-copy) -- cgit v1.3 From 985730c1afac6b5077df9ca8a871db9750ac3a9d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 4 Apr 2019 17:32:37 +0200 Subject: scripts: More commands default to verbosity level 1. * guix/scripts/environment.scm (%default-options): Change 'verbosity' to 1. * guix/scripts/pack.scm (%default-options): Likewise. * guix/scripts/system.scm (guix-system): Likewise, except for the 'build' command. --- guix/scripts/environment.scm | 2 +- guix/scripts/pack.scm | 2 +- guix/scripts/system.scm | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 2d1ba4c93..99c351ae4 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -192,7 +192,7 @@ COMMAND or an interactive shell in that environment.\n")) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) (debug . 0) - (verbosity . 2))) + (verbosity . 1))) (define (tag-package-arg opts arg) "Return a two-element list with the form (TAG ARG) that tags ARG with either diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index d2ef68d15..b1d1e87c5 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -629,7 +629,7 @@ please email '~a'~%") (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) (debug . 0) - (verbosity . 2) + (verbosity . 1) (symlinks . ()) (compressor . ,(first %compressors)))) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 97508f4bd..78aa6cf64 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1299,8 +1299,7 @@ argument list and OPTS is the option alist." (command (assoc-ref opts 'action))) (parameterize ((%graft? (assoc-ref opts 'graft?))) (with-status-verbosity (or (assoc-ref opts 'verbosity) - (if (memq command '(init reconfigure)) - 1 2)) + (if (eq? command 'build) 2 1)) (process-command command args opts)))))) ;;; Local Variables: -- cgit v1.3 From 1199da08aa76f7bba57692b4b8e9272fd305e9f2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 6 Apr 2019 14:52:56 +0200 Subject: size: Optimize dependency size computation. This reduces 'guix size' run time by ~4% here: items="$(guix build icecat inkscape emacs libreoffice)" guix size $items * guix/scripts/size.scm (store-profile): Define 'size-table' and use it to lookup the size of ITEM in 'dependency-size'. --- guix/scripts/size.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index 25218a294..f549ce05b 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -34,6 +34,7 @@ #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (ice-9 vlist) #:export (profile? profile-file profile-self-size @@ -142,11 +143,20 @@ profile of ITEMS and their requisites." (lambda (size) (return (cons item size))))) refs))) + (define size-table + (fold (lambda (pair result) + (match pair + ((item . size) + (vhash-cons item size result)))) + vlist-null sizes)) + (define (dependency-size item) (mlet %store-monad ((deps (requisites* (list item)))) (foldm %store-monad (lambda (item total) - (return (+ (assoc-ref sizes item) total))) + (return (+ (match (vhash-assoc item size-table) + ((_ . size) size)) + total))) 0 (delete-duplicates (cons item deps))))) -- cgit v1.3