* guix/utils.scm (package-name->name+version): Add optional 'delimiter'
parameter.
* guix/scripts/package.scm (store-item->manifest-entry): Pass #\- as the
delimiter for 'package-name->name+version'. Use "out" instead of #f for
the 'output' field.
* tests/guix-package.sh: Add test.
Commit 1af0860e8b added a mandatory
dependency on 'glibc-utf8-locales', which entails long rebuilds for
tests.
* guix/profiles.scm (profile-derivation): Add #:locales? parameter.
Add 'set-utf8-locale' variable. Use it when LOCALES? is true.
(link-to-empty-profile): Pass #:locales? #f.
* guix/scripts/environment.scm (inputs->profile-derivation): Pass
#:locales?.
* guix/scripts/package.scm (build-and-use-profile): Likewise.
* tests/packages.scm ("--search-paths with pattern"): Pass #:locales? #f.
* tests/profiles.scm ("profile-derivation")
("profile-derivation, inputs", "profile-manifest, search-paths")
("etc/profile", "etc/profile when etc/ already exists"):
("etc/profile when etc/ is a symlink"): Likewise.
* guix/profiles.scm (relative-generation-spec->number): New procedure.
* guix/scripts/package.scm (switch-generation-action): Use it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* guix/ui.scm (display-profile-content-diff): New variable.
* guix/scripts/package.scm (process-query): Use display-profile-content-diff.
In collaboration with Benz Schenk.
This provides a way to mark a package as superseded by another one.
Upgrades replace superseded packages with their replacement.
* guix/packages.scm (package-superseded, deprecated-package): New
procedures.
* gnu/packages.scm (%find-package): Check for 'package-superseded'.
* guix/scripts/package.scm (transaction-upgrade-entry)[supersede]: New
procedure. Call it when 'package-superseded' is true.
* tests/guix-build.sh: Add test for a superseded package.
* tests/packages.scm ("package-superseded")
("transaction-upgrade-entry, superseded package"): New tests.
* guix/scripts/package.scm (upgraded-manifest-entry): Rename to...
(transaction-upgrade-entry): ... this. Add 'transaction' parameter and
return a transaction.
(options->installable): Likewise.
[to-upgrade]: Rename to...
[upgraded]: ... this, and change to be a transaction. Return a
transaction.
(options->removable): Likewise.
(process-actions): Adjust accordingly.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades")
("transaction-upgrade-entry, one upgrade"): New tests.
* guix/scripts/package.scm (upgradeable?): Rename to...
(upgraded-manifest-entry): ... this. Change to take a <manifest-entry>
and to return a <manifest-entry>.
(options->installable)[to-upgrade]: Adjust accordingly.
* guix/scripts/archive.scm, guix/scripts/build.scm,
guix/scripts/environment.scm, guix/scripts/system.scm,
guix/scripts/package.scm: Disable grafting when a dry-run parameter is given.
Previously, 'guix package -i emacs --with-source=./emacs-42.tar.gz'
would fail to use "42" as the version number in the manifest entry.
Reported by piyo on #guix.
* guix/scripts/package.scm (process-actions)[transform-entry]: Inherit
the version number from the result of TRANSFORM when it's a package.
* tests/guix-package.sh: Test it.
* guix/scripts/package.scm (find-packages-by-description): Change 'rx'
parameter to 'regexps'.
[matches-all?, matches-one?]: New procedures.
Use them.
(process-query): Collect regexps from all 'search' queries, and pass
them to 'find-packages-by-description'.
* tests/guix-package.sh: Add tests.
* doc/guix.texi (Invoking guix package): Document it.
* guix/scripts/package.scm (options->upgrade-predicate)
(store-item->manifest-entry): New procedures.
* guix/scripts/package.scm (options->installable): Use them. Remove the
'packages-to-upgrade' and 'packages-to-install' variables by getting rid
of a level of indirection.
* guix/scripts/package.scm (build-and-use-profile): New procedure.
Adapted and moved from...
(guix-package)[process-actions]: ... here. Adjust call sites.
As measured with:
time sh -c 'for i in `seq 1 10` ; do guix package --search-paths ; done'
On my machine, when running:
strace -o ,,s guix package --search-paths
the number returned by:
grep -E '^(open|l?stat).*\.go' ,,s | wc -l
drops from 1610 to 837.
* guix/scripts/package.scm: Remove two unnecessary #:use-module forms.
Autoload (gnu packages ...) modules.
Partly fixes <http://bugs.gnu.org/20255>.
* guix/scripts/package.scm (search-path-environment-variables): Change
'profile' to 'profiles'; expect it to be a list.
(display-search-paths): Likewise.
(%default-options): Remove 'profile' entry.
(%options) <--profile>: Keep previous values associated with 'profile'
in RESULT.
(guix-package)[process-actions, process-query]: Handle the possible
lack of 'profile' pair in OPTS.
Fixes <http://bugs.gnu.org/21773>.
Reported by Jan Synáček <jan.synacek@gmail.com>.
* guix/ui.scm (make-regexp*): New procedure.
* guix/scripts/package.scm (options->installable, guix-package): Use it
when processing user-provided regexps.
* guix/scripts/package.scm (delete-generations): Use
'delete-generation*' instead of 'delete-generation'.
(guix-package)[process-actions]: Use 'roll-back*' instead of
'roll-back' and 'switch-to-generation*' instead of
'switch-to-generation'.
(link-to-empty-profile, switch-to-generation,
switch-to-previous-generation, roll-back, delete-generation): Move
to...
* guix/profiles.scm: ... here. Adjust to not print messages and to
return values that can be used by user interfaces.
* guix/ui.scm (display-generation-change, roll-back*,
switch-to-generation*, delete-generation*): New procedures.
* guix/scripts/package.scm (guix-package)[process-query](list-generations):
Move part of the body to 'delete-generation' and
'display-profile-content'.
* guix/ui.scm (display-generation, display-profile-content): New
procedures.
* guix/scripts/package.scm (show-help): Add help text for --install-from-file
option.
(%options): Add --install-from-file option.
* tests/guix-package.sh: Test it.
* doc/guix.texi ("invoking guix package"): Document it.
* doc/package-hello.scm: New file.
* doc.am (EXTRA_DIST): Add it.
* guix/scripts/import.scm (show-help): Add newline before a list of
importers.
* guix/scripts/lint.scm (show-help): Split a long description line.
* guix/scripts/package.scm (show-help): Improve docstrings for --install
and --remove options.
* guix/scripts/system.scm (show-help): Format actions the same way as
guix commands and importers are formatted.
* guix/scripts/package.scm (search-path-environment-variables): Add #:kind
parameter. Pass it to 'environment-variable-definition'.
(display-search-paths): Add #:kind parameter and pass it to
'search-path-environment-variables'.
(%options): Add an optional parameter for "--search-paths".
(guix-package)[process-query]: Handle it.
* tests/guix-package-net.sh: Adjust existing test.
* tests/guix-package.sh: Adjust existing tests and add new test.
* doc/guix.texi (Invoking guix package): Document it.
* guix/scripts/package.scm (evaluate-search-paths): New procedure, with
most of the code formerly in 'search-path-environment-variables'.
(search-path-environment-variables): Use it.
* guix/scripts/package.scm (user-friendly-profile): New procedure.
(search-path-environment-variables): Remove 'profile' local variable.
(display-search-paths): Explicitly call 'user-friendly-profile' for
the argument to 'search-path-environment-variables'.
(guix-package)[process-query]: Likewise.
Discussed in <http://bugs.gnu.org/20255>.
* guix/packages.scm (sexp->search-path-specification): New variable.
* guix/profiles.scm (<manifest-entry>)[search-paths]: New field.
(package->manifest-entry): Initialize it.
(manifest->gexp): Match it. Wrap #$deps in (propagated-inputs ...).
Emit (search-paths ...). Increment version.
(find-package): New procedure.
(sexp->manifest)[infer-search-paths]: New procedure.
Use it to initialize the 'search-paths' field for versions 0 and 1.
Add case for version 2.
* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
Remove.
Use 'manifest-entry-search-paths' instead of 'manifest-entry->package'
plus 'package-native-search-paths'.
* tests/profiles.scm ("profile-manifest, search-paths"): New test.
* guix/scripts/package.scm (%options): Add the '--do-not-upgrade' option.
(show-help): Document it.
(options->installable): Add 'do-not-upgrade-regexps' variable.
Use it in 'packages-to-upgrade'.
* doc/guix.texi (Invoking guix package): Document the '--do-not-upgrade'
option.
* guix/profiles.scm (ghc-package-cache-file): New procedure.
(profile-derivation): Add 'ghc-package-cache?' keyword argument. If true
(the default), add the result of 'ghc-package-cache-file' to 'inputs'.
* guix/scripts/package.scm (guix-package)[process-actions]: Pass
#:ghc-package-cache? to 'profile-generation'.
* tests/packages.scm ("--search-paths with pattern"): Likewise.
* tests/profiles.scm ("profile-derivation"): Likewise.
* guix/scripts/package.scm (delete-matching-generations): Remove call to
'exit' when PATTERN is "0". Call 'leave' instead of 'exit'
when (null-list? number).
Fixes <http://bugs.gnu.org/19978>.
Reported by taylanbayirli@gmail.com (Taylan Ulrich Bayırlı/Kammer).
* guix/scripts/package.scm (delete-matching-generations): Warn when
CURRENT is in NUMBERS, and always remove it before calling
'delete-generations'.
* tests/guix-package.sh: Add --switch-generation=2 invocation before
--delete-generations=3 invocation.
Add --delete-generations=1.. test case.
* guix/scripts/package.scm (delete-matching-generations): New procedure,
with code formerly found...
(guix-package)[process-actions]: ... here. Use it.
Remove 'current-generation-number'.
Before that it would sort them by name only, so the order in which two
packages with the same name but a different version would appear was
non-deterministic.
Reported by Tomáš Čech <sleep_walker@gnu.org>.
* guix/scripts/package.scm (find-packages-by-description)[version<?]:
New variable.
Change the 2nd argument to 'sort' to use 'string-compare' and resort
to 'version<?' when P1 and P2 have the same name.
Before that, 'guix package -s foobarbaz' would display only one package
when several match but they have the same location (which is common when
using 'inherit'.)
The original rationale was given at
<http://lists.gnu.org/archive/html/bug-guix/2013-01/msg00280.html> but
it was arguably misguided because it led to "real" packages being
hidden.
Reported by Tomáš Čech <sleep_walker@gnu.org>.
* guix/scripts/package.scm (find-packages-by-description)[same-location?]:
Remove.
Remove call to 'delete-duplicates'.
This fixes a regression introduced in commit 536c3ee.
* guix/profiles.scm (ca-certificate-bundle): When MANIFEST is empty,
make a trivial derivation.
* guix/scripts/package.scm (guix-package)[process-actions]: Pass
#:ca-certificate-bundle? to 'profile-generation'.
* tests/packages.scm ("--search-paths with pattern"): Likewise.
* tests/profiles.scm ("profile-derivation"): Likewise.
Before that, any profile generation built when '-p' is used would
effectively become a permanent GC root because the symlink in
/var/guix/gcroots/auto would point directly to /gnu/store/...-profile.
* guix/scripts/package.scm (maybe-register-gc-root): Rename to...
(register-gc-root): ... this. Remove conditional, and replace call to
'canonicalize-path' with (string-append (getcwd) "/" ...).
(guix-package): Call 'register-gc-root' only if PROFILE is different
from %CURRENT-PROFILE.
* tests/guix-package.sh: Add test case.
Reported by Andreas Enge <andreas@enge.fr>.
* guix/scripts/package.scm (with-null-error-port): New macro.
(search-path-environment-variables): Wrap 'search-path-as-list' call
in 'with-null-error-port'.
* guix/scripts/package.scm (search-path-environment-variables): Add
local 'files' variable.
* tests/packages.scm ("--search-paths with pattern"): New test.
This will handle the new 'file-type' and 'file-pattern' fields correctly.
* guix/scripts/package.scm (search-path-environment-variables)[search-path-definition]:
Rewrite in terms of 'search-path-as-list'.
Appending to "raw" args broke optional parameters in 'guix package -I'
and 'guix package -A', and possibly other places. Therefore, switch to
parsing each set of options on its own and append resulting alists
together afterwards.
* guix/scripts/archive.scm (parse-options-from): Rename from
(parse-options) and add explicit argument. New form of (parse-options)
using its old algorithm via -from function.
* guix/scripts/build.scm: Ditto.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/package.scm: Ditto.
* guix/scripts/system.scm: Ditto.
* tests/guix-package.sh: Add test.
* doc/guix.texi (Invoking guix build): Make it clear that the options
are parsed independently.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* guix/scripts/package.scm (switch-to-generation): New procedure.
(switch-to-previous-generation): Use it.
(guix-package): Adjust for '--switch-generation' option.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it.
Before that, 'guix package --search-paths' would not work if, say,
'foo-0.2' is installed but the distro provides 'foo-0.3'.
* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
Handle the case where 'find-best-packages-by-name' returns '().
Fixes <http://bugs.gnu.org/18305>.
Reported by Brandon Invergo <brandon@gnu.org>.
* guix/profiles.scm (manifest-inputs, info-dir-file): New procedures.
(profile-derivation): Use them. Add #:info-dir? parameter and honor
it.
* guix/scripts/package.scm (guix-package): Call 'profile-derivation'
with #:info-dir? #f when the 'bootstrap? option is set.
* tests/profiles.scm ("profile-derivation"): Pass #:info-dir? #f.
Suggested by Alex Kost <alezost@gmail.com>.
* guix/scripts/package.scm (options->installable)[package->manifest-entry]:
Move to (guix profiles).
[package->manifest-entry*]: New procedure.
Use it.
* guix/profiles.scm (package->manifest-entry): New procedure.
* tests/profiles.scm (guile-for-build): New variable.
Call '%guile-for-build'.
("profile-derivation"): New test.
* guix/profiles.scm (<manifest-entry>)[path]: Rename to...
[item]: ... this. Update users.
(manifest->sexp): Rename to...
(manifest->gexp): ... this. Return a gexp.
(lower-input): Remove.
(profile-derivation): Remove 'store' parameter, and turn into a
monadic procedure.
[inputs]: New variable.
[builder]: Turn into a gexp.
Replace call to 'build-expression->derivation' with call to
'gexp->derivation'.
* guix/scripts/package.scm (link-to-empty-profile): Adjust call to
'profile-derivation', and wrap it in 'run-with-store'.
(show-what-to-remove/install): Rename 'path' to 'item'. Check whether
ITEM is a package, and return its output path if it is.
(input->name+path): Remove.
(options->installable): Set 'item' to P.
(guix-package): Adjust call to 'profile-derivation'.
* tests/profiles.scm (guile-2.0.9): Change 'path' to 'item'.
* guix/profiles.scm (manifest=?): Remove.
* guix/scripts/package.scm (readlink*): New procedure.
(guix-package)[process-actions]: Use 'readlink*' and compare the
profile to be built, PROF, with PROFILE to determine whether there's
nothing to be done.
Fixes <http://bugs.gnu.org/17946>.
Notoriously, cron jobs may set LOGNAME only and not USER. See
e.g. crontab(5) under Debian 7 (wheezy).
* guix/scripts/package.scm (%profile-directory)
(guix-package): Also try LOGNAME if USER is unset.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Fixes <http://bugs.gnu.org/17939>.
Reported by Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>.
* guix/scripts/package.scm (canonicalize-profile): New procedure.
(%options): Use it for --profile.
* tests/guix-package.sh: Add test.
* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
Use 'find-best-packages-by-name' instead of 'find-packages-by-name'.
On a profile with 140 packages, this reduces execution time of this
procedure from 5.8 seconds to 2.9 seconds (50% improvement.)
* guix/scripts/package.scm (maybe-register-gc-root): New procedure.
* tests/guix-package.sh (profile): Grep the output of "guix gc
--list-live" in a couple of places.
* guix/scripts/package.scm (leave-on-EPIPE): New macro.
(guix-package): Use it for 'list-installed', 'list-available', and
'--list-generations'.
* tests/guix-package.sh: Add test.
* guix/scripts/package.scm (%options): Adapt option processors to accept and
return a second seed value: 'arg-handler', which handles bare arguments (if
not false). The install, remove, and upgrade option processors return an
arg-handler that repeat the same operation. All other option processors
return #f as the arg-handler. Make the arguments to install and remove
optional. The upgrade option processor deletes (upgrade . #f) from the
alist before adding a new entry.
(guix-package): Procedures passed to 'args-fold*' accept the new seed value
'arg-handler'. The 'operand-proc' uses 'arg-handler' (if not false).
* doc/guix.texi (Invoking guix package): Update docs.
* tests/guix-package.sh: Add test.