Commit Graph

5278 Commits

Author SHA1 Message Date
Ludovic Courtès
49a1203d67
gremlin: Add 'set-file-runpath', 'file-runpath', and 'file-needed'.
* guix/build/gremlin.scm (file-dynamic-info, file-runpath, file-needed):
New procedures.
(&missing-runpath-error, &runpath-too-long-error): New condition types.
(set-file-runpath): New procedure.
* tests/gremlin.scm ("set-file-runpath + file-runpath"): New test.
2020-09-19 17:28:46 +02:00
Jakub Kądziołka
e0f31baacc
build-system/gnu: strip with --strip-unneeded [v2]
[Accidentally pushed patch v1, this commit contains the rest of the
changes. Revised commit message follows.]

Apart from debug information, one can also strip some symbols. This can
be a significant difference, the closure of gcc-toolchain@7 got reduced
by 15 MB in my tests.

As per [1], --strip-debug is included in --strip-unneeded, and
the debug files created also contain a copy of the information removed
by --strip-unneeded.

Linux From Scratch suggests that this option shouldn't be used on static
libraries [2], however other sources [3] indicate otherwise. Building a
toolchain with this patch succeeds, and the result works fine for
'gcc -static hello-world.c'.

[1]: https://stackoverflow.com/a/52555093
[2]: http://www.linuxfromscratch.org/lfs/view/9.1/chapter05/stripping.html
[3]: https://www.technovelty.org/linux/stripping-shared-libraries.html

* guix/build/gnu-build-system.scm (strip): Use --strip-unneeded.
* guix/build-system/gnu.scm (static-package, gnu-build, gnu-cross-build): Likewise.
2020-09-19 15:43:03 +02:00
Jakub Kądziołka
f32a6055a5
build-system/gnu: strip with --strip-unneeded
Apart from debug information, one can also strip some symbols. This can
be a significant difference, qtbase:out consists of about 5 MB of those
symbols. As per [1], --strip-debug is included in --strip-unneeded, and
the debug files created also contain a copy of the information removed
by --strip-unneeded.

Linux From Scratch suggests that this option shouldn't be used on static
libraries [2], however other sources [3] indicate otherwise. Building a
toolchain with this patch succeeds, and the result works fine for
'gcc -static hello-world.c'.

[1]: https://stackoverflow.com/a/52555093
[2]: http://www.linuxfromscratch.org/lfs/view/9.1/chapter05/stripping.html
[3]: https://www.technovelty.org/linux/stripping-shared-libraries.html

* guix/build/gnu-build-system.scm (strip): Use --strip-unneeded.
2020-09-19 15:37:07 +02:00
Maxim Cournoyer
fa8fe90edb
Merge remote-tracking branch 'origin/master' into core-updates 2020-09-14 16:17:19 -04:00
Ludovic Courtès
846403ef62
ui: 'show-what-to-build' displays download estimate more prominently.
* guix/ui.scm (show-what-to-build): When VERBOSITY is 1, add a newline
before the "would/will be downloaded" line, and wrap that message in
'highlight'.
2020-09-14 15:42:56 +02:00
Ludovic Courtès
7d516c17da
authenticate: Cache the ACL and key pairs.
In practice we're always using the same key pair,
/etc/guix/signing-key.{pub,sec}.  Keeping them in cache allows us to
avoid redundant I/O and parsing when signing multiple store items in a
row.

* guix/scripts/authenticate.scm (load-key-pair): New procedure.
(sign-with-key): Remove 'key-file' parameter and add 'public-key' and
'secret-key'.  Adjust accordingly.
(validate-signature): Add 'acl' parameter and pass it to
'authorized-key?'.
(guix-authenticate)[call-with-reply]: New procedure.
[with-reply]: New macro.
Call 'current-acl' upfront and cache its result.  Add 'key-pairs' as an
argument to 'loop' and use it as a cache of key pairs.
2020-09-14 15:42:55 +02:00
Ludovic Courtès
64cf660f87
daemon: Spawn 'guix authenticate' once for all.
Previously, we'd spawn 'guix authenticate' once for each item that has
to be signed (when exporting) or authenticated (when importing).  Now,
we spawn it once for all and then follow a request/reply protocol.  This
reduces the wall-clock time of:

  guix archive --export -r $(guix build coreutils -d)

from 30s to 2s.

* guix/scripts/authenticate.scm (sign-with-key): Return the signature
instead of displaying it.  Raise a &formatted-message instead of calling
'leave'.
(validate-signature): Likewise.
(read-command): New procedure.
(define-enumerate-type, reply-code): New macros.
(guix-authenticate)[send-reply]: New procedure.
Change to read commands from current-input-port.
* nix/libstore/local-store.cc (runAuthenticationProgram): Remove.
(authenticationAgent, readInteger, readAuthenticateReply): New
functions.
(signHash, verifySignature): Rewrite in terms of the agent.
* tests/store.scm ("import not signed"): Remove 'pk' call.
("import signed by unauthorized key"): Check the error message of C.
* tests/guix-authenticate.sh: Rewrite using the new protocol.

fixlet
2020-09-14 15:42:55 +02:00
Paul Garlick
735808b12c
guix: Fix download-svn-to-store.
* guix/svn-download.scm (download-svn-to-store): Add a subdirectory to
the download path.  The subdirectory is used as the target for the 'svn
export' command, avoiding a 'directory exists' error when attempting to
use the parent directory directly.
2020-09-14 14:24:29 +01:00
Christopher Baines
2932591b8a
database: register-items: reduce transaction scope.
It was made transactional in a4678c6ba1, with
the reasoning to prevent broken intermediate states from being visible. I
think this means something like an entry being in ValidPaths, but the Refs not
being inserted.

Using a transaction for this makes sense, but I think using one single
transaction for the whole register-items call is unnecessary to avoid broken
states from being visible, and could block other writes to the store database
while register-items is running. Because the deduplication and resetting
timestamps happens within the transaction as well, even though these things
don't involve the database, writes to the database will still be blocked while
this is happening.

To reduce the potential for register-items to block other writers to the
database for extended periods, this commit moves the transaction to just wrap
the call to sqlite-register. This is the one place where writes occur, so that
should prevent the broken intermediate states issue above. The one difference
this will make is some of the registered items will be visible to other
connections while others may be still being added. I think this is OK, as it's
equivalent to just registering different items.

* guix/store/database.scm (register-items): Reduce transaction scope.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-09-14 10:51:26 +02:00
Caleb Ristvedt
a05c31ab30
database: document extra registration requirements.
It's necessary that store items be locked and protected from garbage
collection while they are being registered.  This documents that.

* guix/store/database.scm (register-path, register-items): document GC
  protection and locking requirements.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-09-14 10:51:26 +02:00
Caleb Ristvedt
14c422c12c
deduplication: pass store directory to replace-with-link.
This causes with-writable-file to take into consideration the actual store
being used, as passed to 'deduplicate', rather than
whatever (%store-directory) may return.

* guix/store/deduplication.scm (replace-with-link): new keyword argument
  'store'.  Pass to with-writable-file.
  (with-writable-file, call-with-writable-file): new store argument.
  (deduplicate): pass store to replace-with-link.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-09-14 10:51:26 +02:00
Danny Milosavljevic
2be5c2652a
build-system: linux-module: Delete some huge items that we probably don't need.
* guix/build-system/linux-module.scm (make-linux-module-builder): Delete
some huge items that we probably don't need.
2020-09-14 10:15:43 +02:00
Maxim Cournoyer
140da556be
ui: Lexicographically sort transaction entries based on their package name.
* guix/ui.scm (show-manifest-transaction): Sort entries to be displayed in a
tabulated view.
2020-09-12 02:08:14 -04:00
Maxim Cournoyer
7d3eb5e6b7
ui: Refactor the package-strings helper in show-manifest-transaction.
* guix/ui.scm (show-manifest-transaction)[package-strings]: Add an
OLD-VERSIONS keyword parameter.  Absorb the code path previously found in the
upgrade-string.  Remove upgrade-string.
(show-manifest-transaction): Adjust to the above changes.
2020-09-12 02:08:14 -04:00
Ludovic Courtès
6dd8ffc574
daemon: Simplify interface with 'guix authenticate'.
There's no reason at this point to mimic the calling convention of the
'openssl' command.

* nix/libstore/local-store.cc (LocalStore::exportPath): Add only "sign"
and HASH to ARGS.  Remove 'tmpDir' and 'hashFile'.
(LocalStore::importPath): Add only "verify" and SIGNATURE to
* guix/scripts/authenticate.scm (guix-authenticate): Adjust
accordingly; remove the OpenSSL-style clauses.
(read-hash-data): Remove.
(sign-with-key): Replace 'port' with 'sha256' and adjust accordingly.
(validate-signature): Export SIGNATURE to be a canonical sexp.
* tests/guix-authenticate.sh: Adjust tests accordingly.
2020-09-11 17:53:58 +02:00
Ludovic Courtès
7a68d3ccad
doc: Distinguish the "nar bundle" format from "nar".
* doc/guix.texi (Invoking guix archive): Introduce the term "nar bundle"
and clarify what the output of "guix archive --export" really is.
* guix/nar.scm (restore-one-item, restore-file-set): Use the term "nar
bundle" in docstrings.
2020-09-11 17:53:58 +02:00
Ludovic Courtès
3794ce93be
scripts: Use 'define-command' and have 'guix help' use that.
This changes 'guix help' to print a short synopsis for each command and
to group commands by category.

* guix/scripts.scm (synopsis, category): New variables.
(define-command-categories, define-command): New macros.
(%command-categories): New variable.
* guix/ui.scm (<command>): New record type.
(source-file-command): New procedure.
(command-files): Return absolute file names.
(commands): Return a list of <command> records.
(show-guix-help)[display-commands, category-predicate]: New procedures.
Display commands grouped in three categories.
* guix/scripts/archive.scm (guix-archive): Use 'define-command'.
* guix/scripts/authenticate.scm (guix-authenticate): Likewise.
* guix/scripts/build.scm (guix-build): Likewise.
* guix/scripts/challenge.scm (guix-challenge): Likewise.
* guix/scripts/container.scm (guix-container): Likewise.
* guix/scripts/copy.scm (guix-copy): Likewise.
* guix/scripts/deploy.scm (guix-deploy): Likewise.
* guix/scripts/describe.scm (guix-describe): Likewise.
* guix/scripts/download.scm (guix-download): Likewise.
* guix/scripts/edit.scm (guix-edit): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/gc.scm (guix-gc): Likewise.
* guix/scripts/git.scm (guix-git): Likewise.
* guix/scripts/graph.scm (guix-graph): Likewise.
* guix/scripts/hash.scm (guix-hash): Likewise.
* guix/scripts/import.scm (guix-import): Likewise.
* guix/scripts/install.scm (guix-install): Likewise.
* guix/scripts/lint.scm (guix-lint): Likewise.
* guix/scripts/offload.scm (guix-offload): Likewise.
* guix/scripts/pack.scm (guix-pack): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/perform-download.scm (guix-perform-download): Likewise.
* guix/scripts/processes.scm (guix-processes): Likewise.
* guix/scripts/publish.scm (guix-publish): Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/refresh.scm (guix-refresh): Likewise.
* guix/scripts/remove.scm (guix-remove): Likewise.
* guix/scripts/repl.scm (guix-repl): Likewise.
* guix/scripts/search.scm (guix-search): Likewise.
* guix/scripts/show.scm (guix-show): Likewise.
* guix/scripts/size.scm (guix-size): Likewise.
* guix/scripts/substitute.scm (guix-substitute): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* guix/scripts/time-machine.scm (guix-time-machine): Likewise.
* guix/scripts/upgrade.scm (guix-upgrade): Likewise.
* guix/scripts/weather.scm (guix-weather): Likewise.
2020-09-10 12:27:24 +02:00
Ludovic Courtès
991fdb0d64
ui: '--help' output links to <https://guix.gnu.org/help/>.
* guix/ui.scm (show-bug-report-information): Link to
<https://guix.gnu.org/help/> instead of <https://www.gnu.org/gethelp/>.
The former is much more useful and includes links to GNU manuals.
2020-09-10 12:27:24 +02:00
Ludovic Courtès
24ce6e27bf
utils: 'dump-port' has an optional 'len' parameter.
* guix/build/utils.scm (dump-port): Add optional 'len' parameter and
honor it.
2020-09-10 11:57:11 +02:00
Ludovic Courtès
b5eb901ab5
Remove (guix json) and require Guile-JSON 4.3.0+.
This is a followup to 4071879c86.

* guix/json.scm: Remove.
* Makefile.am (MODULES): Adjust accordingly.
* m4/guix.m4 (GUIX_CHECK_GUILE_JSON): Check for 'define-json-mapping'.
* doc/guix.texi (Requirements): Require Guile-JSON 4.3.0+.
* guix/ci.scm, guix/cve.scm, guix/import/cpan.scm,
guix/import/crate.scm, guix/swh.scm: Remove (guix json) import.
* guix/import/gem.scm, guix/import/pypi.scm: Likewise, and import (json).
* guix/self.scm (specification->package): Switch to GUILE-JSON-4.
* guix/git-download.scm (git-fetch): Likewise.
2020-09-08 00:47:35 +02:00
Ludovic Courtès
d15c7974a2
android-repo-download: Remove unnecessary use of Guile-JSON.
* guix/android-repo-download.scm (android-repo-fetch)[guile-json]: Remove.
[build]: Remove GUILE-JSON from 'with-extensions'.
2020-09-08 00:47:35 +02:00
Mathieu Othacehe
2fbbfe6ff1
git: Export url-cache-directory.
* guix/git.scm (url-cache-directory): Export it.
2020-09-06 15:40:54 +02:00
Efraim Flashner
da09b47b94
scripts: system: Expand some help messages.
* guix/scripts/system.scm (show-help): Add to '--share=SPEC' and
'--expose=SPEC' that it also works for containers.
2020-09-05 22:24:39 +03:00
Danny Milosavljevic
4ff0fed778
android-repo-download: Use parallel-job-count instead of hard-coding job
count.

* guix/build/android-repo.scm (android-repo-fetch): Use parallel-job-count
instead of hard-coding job count.
2020-09-03 00:09:38 +02:00
Danny Milosavljevic
eb924a97bd
android-repo-download: Clean up typos; remove unused imports.
Follow-up to 3feb846420.

* guix/android-repo-download.scm (android-repo-fetch): Fix docstring.
2020-09-03 00:09:38 +02:00
Ludovic Courtès
44c6e6f590
ssh: Fix progress bar crash when there are zero items to send.
* guix/ssh.scm (notify-transfer-progress): Do nothing when TOTAL is
zero.
2020-09-02 23:59:24 +02:00
Ludovic Courtès
de83660dd3
ssh: Fix regression in 'send-files'.
Regression introduced in b03267df6d.
The (take files 20) is a leftover from testing session.

* guix/ssh.scm (send-files): Fix value for 'missing'.
2020-09-02 23:59:24 +02:00
Ludovic Courtès
fe4e770fc1
ui: Attempt to fall back to "en_US.utf8" rather than "C".
* guix/ui.scm (install-locale): Add call to 'setlocale' in 'catch' handler.
2020-09-02 17:17:37 +02:00
Ludovic Courtès
739f630947
store: 'set-build-options' sends LC_MESSAGES, not LC_ALL.
* guix/store.scm (set-build-options): Change #:locale default value
to (setlocale LC_MESSAGES).
2020-09-02 17:17:37 +02:00
Ludovic Courtès
aba8def46d
substitute: Set LC_MESSAGES to the client's locale, not LC_ALL.
Fixes <https://bugs.gnu.org/43039>.
Reported by Adam Griffiths <adam.lw.griffiths@gmail.com>.

Previously, a client could lead 'guix substitute' to run in a non-UTF-8
locale, such as the "C" locale.  Consequently, 'guix substitute' would
now fail to decode UTF-8 file names such as those that appear in the
'nss-certs' package.

* guix/scripts/substitute.scm (guix-substitute): Set LC_MESSAGES, not LC_ALL.
2020-09-02 17:17:36 +02:00
Danny Milosavljevic
3feb846420
Add (guix android-repo-download).
* guix/build/android-repo.scm: New file.
* guix/android-repo-download.scm: New file.
* Makefile.am (MODULES): Add them.
2020-09-02 13:51:38 +02:00
Maxim Cournoyer
89fbca9de6
build: ruby-build-system: Remove an extraneous binding.
* guix/build/ruby-build-system.scm (install): Remove the RUBY-VERSION binding,
no longer used.  Fix the indentation of a comment.
2020-09-01 13:19:08 -04:00
Arun Isaac
4546c0dd2f
import: launchpad: Recognize more URLs.
* guix/import/launchpad.scm (updated-launchpad-url): Recognize more URLs.
2020-09-01 22:45:16 +05:30
Arun Isaac
4322561243
import: launchpad: Recognize the .orig.tar.gz extension.
* guix/import/launchpad.scm (find-extension): Recognize the .orig.tar.gz
extension.
2020-09-01 22:45:16 +05:30
Arun Isaac
8b9b5a7f58
import: launchpad: Handle list of source URLs correctly.
* guix/import/launchpad.scm (updated-launchpad-url): Return updated URL when
package has a list of URLs, not the old URL.
2020-09-01 22:45:02 +05:30
Maxim Cournoyer
a02ad4592c
gexp: computed-file: Prevent mistakenly overriding default option values.
In order to do so, default to an empty options list, and expose options whose
default values are sensitive directly as keyword arguments.

* guix/gexp.scm (computed-file): Extract the LOCAL-BUILD? parameter from the
OPTIONS parameter to make it a stand-alone keyword argument.  Introduce an
OPTIONS* binding which is obtained by combining the LOCAL-BUILD? keyword and
its value with OPTIONS.
* doc/guix.texi (G-Expressions): Adjust doc.

Suggested-by: Ludovic Courtès <ludo@gnu.org>
2020-09-01 00:48:11 -04:00
Julien Lepiller
036f23f053
guix: system: Add `--label' option.
* guix/scripts/system.scm (%options): Add `--label'.
(system-derivation-for-action): Take a #:label key to set volume ID.
(perform-action): Take a #:label key.
(%default-options): Add default label value.
(process-action): Pass label value from command-line to perform-action.
* gnu/system/image.scm (image-with-label): New procedure.
2020-08-31 16:12:16 +02:00
Ludovic Courtès
7e90e28a15
guix system: Clarify what happens where service upgrade fails.
* guix/scripts/system.scm (report-shepherd-error): Use 'warning' instead
of 'report-error'.  Add extra 'warning' and 'display-hint' calls.
2020-08-31 15:50:35 +02:00
Ludovic Courtès
a4e81ff325
guix system: reconfigure: Tell users about 'herd status'.
* guix/scripts/system.scm (perform-action): Mention 'herd status' when
'upgrade-shepherd-services' completes.
2020-08-31 15:50:35 +02:00
Ludovic Courtès
83ec969cc7
packages: <content-hash> printer gracefully handle #f values.
Suggested by Robin Green <greenrd@greenrd.org>.

* guix/packages.scm (print-content-hash): Gracefully deal with cases
with 'content-hash-value' returns #f, as is the case for 'linux-libre'.
2020-08-31 15:50:35 +02:00
Ludovic Courtès
b03267df6d
ssh: 'send-files' displays a progress bar.
* guix/store.scm (export-paths): Add #:start, #:progress, and #:finish
parameters and honor them.
* guix/ssh.scm (prepare-to-send, notify-transfer-progress)
(notify-transfer-completion): New procedures.
(send-files): Pass #:start, #:progress, and #:finish to 'export-paths'.
2020-08-31 15:50:31 +02:00
Lars-Dominik Braun
bc8be17c4d
environment: Set USER and LOGNAME in container
* guix/scripts/environment.scm (launch-environment/container): Set
  username environment variables.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-08-30 23:51:03 +02:00
Ludovic Courtès
61fe9ced7d
copy, offload: Explicitly close SSH channels and sessions.
Fixes <https://bugs.gnu.org/42740>.

* guix/scripts/copy.scm (send-to-remote-host): Keep the result of
'connect-to-remote-daemon' in scope, and explicitly close it after the
call to 'send-files'.
(retrieve-from-remote-host): Explicitly close REMOTE and disconnect
SESSION.
* guix/scripts/offload.scm (transfer-and-offload): Explicitly close
STORE and disconnect SESSION upon completion.
2020-08-29 16:24:17 +02:00
Ludovic Courtès
4ec66950f0
derivations: Avoid uses of 'write' in 'write-derivation'.
This leads a 4% improvement on the wall-clock time of:

  guix build -e '(@@ (gnu packages libreoffice) libreoffice)' --no-grafts -d

* guix/derivations.scm (escaped-string): New procedure.
(write-derivation)[write-escaped-string]: New procedure.
[write-string-list, write-output, write-env-var]: Use it.
2020-08-28 23:29:07 +02:00
Ludovic Courtès
3e339c4410
derivations: Avoid uses of 'display' in 'write-derivation'.
This yields a 4% improvement on the wall-clock time of:

  guix build -e '(@@ (gnu packages libreoffice) libreoffice)' --no-grafts -d

* guix/derivations.scm (write-sequence, write-list, write-tuple): Use
'put-char' instead of 'display'.
(write-derivation): Use 'put-string' and 'put-char', and remove unused
'format' binding.
2020-08-28 23:28:56 +02:00
Ludovic Courtès
3d9ea605c8
store: 'with-store' returns as many values as its body.
Fixes <https://bugs.gnu.org/42912>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/store.scm (call-with-store)[thunk]: Wrap call to PROC in
'call-with-values'.
* tests/store.scm ("with-store, multiple values"): New test.
2020-08-28 23:27:53 +02:00
Maxim Cournoyer
a7b1cc333e
build: ruby-build-system: Adjust replace-git-ls-files.
The file names returned by `find ...` instead of `git ls-files...` contains
leading './' characters, which can cause problems when the file lists is
further processed with regexps, for example, as was discovered while updating
the ruby-asciidoctor package in commit
5df1126c3a.

* guix/build/ruby-build-system.scm (replace-git-ls-files): Strip the first two
characters ("./") of the file names returned by the 'find' command.  Fix typo
in doc.  Simplify '(when (not ...' into '(unless ...'.
2020-08-28 01:21:02 -04:00
Ludovic Courtès
0c9d22c13f
pull: Avoid "Migrating profile" message on the first run.
* guix/scripts/pull.scm (ensure-default-profile): Do not call
'migrate-generations' when
%USER-PROFILE-DIRECTORY (~/.config/guix/current) does not exist.  This
avoids a confusing "Migrating profile" message when the user runs 'guix
pull' for the first time.
2020-08-27 19:58:16 +02:00
Mathieu Othacehe
17dddeeee5
Merge remote-tracking branch 'origin/master' into core-updates 2020-08-26 18:35:14 +02:00
Ludovic Courtès
331a09654e
gexp: 'compiled-modules' defaults to '-O1'.
* guix/gexp.scm (compiled-modules): Add #:optimization-level.
[build](optimizations-for-level): New variable.
(process-entry): Use it.
2020-08-26 16:02:38 +02:00