Commit Graph

256 Commits

Author SHA1 Message Date
Christopher Baines a8448da0f4
Merge branch 'master' into core-updates 2021-03-06 00:18:30 +00:00
Leo Famulari 56733080c4
packages: Improve the docstring of PACKAGE/INHERIT.
* guix/packages.scm (package/inherit): Try to clarify the docstring.
2021-02-23 14:12:34 -05:00
Ludovic Courtès 66c9bc35ef
packages: 'package-field-location' preserves the original file name.
This fixes a regression introduced in
9a38bed2cf.

* guix/packages.scm (package-field-location): Do not shadow the 'file'
variable.
2021-02-22 23:42:08 +01:00
Ludovic Courtès 9a38bed2cf
packages: 'package-field-location' handles 'search-path' returning #f.
Fixes <https://bugs.gnu.org/46390>.
Reported by zimoun <zimon.toutoune@gmail.com>.

This is similar to the fix in d10474c38d.

* guix/packages.scm (package-field-location): Handle FILE not in %LOAD-PATH.
* tests/guix-lint.sh: Add test.
2021-02-22 12:07:45 +01:00
Maxim Cournoyer cfcead2e51
build-systems/gnu: Allow unpacking/repacking more kind of files.
Before this change, only plain directories, tar or zip archives were supported
as the source of a package for the GNU build system; anything else would cause
the unpack phase to fail.  Origins relying on snippets would suffer from the
same problem.

This change adds the support to use files of the following extensions: .gz,
.Z, .bz2, .lz, and .xz, even when they are not tarballs.  Files of unknown
extensions are treated as uncompressed files and supported as well.

* guix/packages.scm (patch-and-repack): Only add the compressor utility to the
PATH when the file is compressed.  Bind more inputs in the mlet, and use them
for decompressing single files.  Adjust the decompression and compression
routines.
[decompression-type]: Remove nested variable.
* guix/build/utils.scm (compressor, tarball?): New procedures.  Move
%xz-parallel-args to the new 'compression helpers' section.
* tests/packages.scm: Add tests.  Add missing copyright year for Jan.
* guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no
sub-directory was found.
(unpack): Support more file types, including uncompressed plain files.
2021-01-26 22:48:35 -05:00
Ludovic Courtès f41ff53293
packages: 'patch-and-repack' returns a directory when given a directory.
Previously, 'patch-and-repack' would always create a tar.xz archive as a
result, even if the input was a directory (a checkout).  This change
reduces gratuitous CPU and storage overhead.

* guix/packages.scm (patch-and-repack)[tarxz-name]: Remove 'checkout?' case.
[build](repack): New procedure, with "tar" invocation formerly at the
top level.
If SOURCE is a directory, call 'copy-recursively'; otherwise, call
'repack'.
Change NAME to ORIGINAL-FILE-NAME when it matches 'checkout?'.
2021-01-18 15:55:14 +01:00
Maxim Cournoyer 8152fd1af5
packages: Fix 'base32' used before definition warning.
Before this change, compiling the module would emit the following message:
"guix/packages.scm:213:25: warning: macro `base32' used before definition".

* guix/packages.scm (define-compile-time-decoder)
(base32, base64): Move definitions to the top of the module.
2021-01-11 08:15:08 -05:00
Maxim Cournoyer 31ebecf73d
packages: Fix 'base32' used before definition warning.
Before this change, compiling the module would emit the following message:
"guix/packages.scm:213:25: warning: macro `base32' used before definition".

* guix/packages.scm (define-compile-time-decoder)
(base32, base64): Move definitions to the top of the module.
2021-01-10 17:12:22 -05:00
Christopher Baines ff01206345
Merge remote-tracking branch 'origin/master' into core-updates 2020-11-29 17:34:18 +00:00
Ludovic Courtès 325d00e619
packages: Ignore return value of origin snippets.
* guix/packages.scm (patch-and-repack): Ignore return value of SNIPPET
and remove warning about non #t return value.
2020-11-25 00:02:30 +01:00
Ludovic Courtès 8db4ebb0cd
packages: Better preserve object identity when rewriting.
Fixes a bug whereby the presence of propagated inputs could lead to two
non-eq? but actually equal packages in a bag's inputs.  The problem
would manifest itself when running, for instance:

  guix build inkscape -d --with-graft=glib=glib-networking --no-grafts

The resulting derivation would differ due from that without
'--with-graft'.  This was due to the fact that glib propagates libffi;
this instance of libffi was not rewritten even though other instances in
the graph were rewritten.  Thus, glib would end up with two non-eq?
libffi instances, which in turn would lead to duplicate entries in its
'%build-inputs' variable.

Fixes <https://bugs.gnu.org/43890>.

* guix/packages.scm (package-mapping)[rewrite]: Remove call to 'cut?'
and call 'replace' unconditionally.
[replace]: Add 'cut?' case.
* tests/guix-build.sh: Add test combining '--no-grafts' and
'--with-graft'.
* tests/packages.scm ("package-input-rewriting/spec, identity")
("package-input-rewriting, identity"): New tests.
2020-10-20 16:30:15 +02:00
Maxim Cournoyer 5e2140511c
Merge branch 'staging'
Conflicts:
	gnu/packages/admin.scm
	gnu/packages/commencement.scm
	gnu/packages/gdb.scm
	gnu/packages/llvm.scm
	gnu/packages/package-management.scm
	gnu/packages/tls.scm
2020-10-19 13:11:40 -04:00
Ludovic Courtès 6b4663363c
packages: Delete duplicate inputs when lowering bags.
This is a followup to 18fa433bf5 and
<https://issues.guix.gnu.org/43508>.

* guix/packages.scm (derivation=?, input=?): New procedures.
(bag->derivation, bag->cross-derivation): Add calls to
'delete-duplicates'.
* tests/packages.scm ("package-derivation, inputs deduplicated"): New
test.
2020-10-15 23:05:32 +02:00
Ludovic Courtès 46135ce4ce
packages: Add 'package-with-c-toolchain'.
* guix/build-system.scm (build-system-with-c-toolchain): New procedure.
* guix/packages.scm (package-with-c-toolchain): New procedure.
* tests/packages.scm ("package-with-c-toolchain"): New test.
* doc/guix.texi (package Reference): Document 'package-with-c-toolchain'.
(Build Systems): Mention it.
2020-10-12 18:23:47 +02:00
Maxim Cournoyer 5a0997ef7f
packages, scripts, utils: Enable multi-threaded xz compression.
xz compression is slow; using the multi-thread mode of xz can make it more
than 6 times faster, for example when compressing the large linux-libre
source.

* guix/build/utils.scm (%xz-parallel-args): New procedure.
* guix/packages.scm (patch-and-repack): Specify the required above xz
arguments by setting the XZ_DEFAULTS environment variable.
* guix/scripts/pack.scm (%compressors, bootstrap-xz): Modify the commands
Gexps so they do not need to be quoted.  This allows lazily evaluating the
arguments on the builder's side.  Specify the required xz arguments.
(self-contained-tarball): Do not quote the compressor command value.
(docker-image): Likewise.
* guix/utils.scm (decompressed-port, compressed-port)
(compressed-output-port): Specify the required above xz arguments.
2020-10-08 12:27:02 -04:00
Ludovic Courtès 8819551c8d
packages: 'package-input-rewriting' has a #:deep? parameter.
* guix/packages.scm (package-input-rewriting): Add #:deep? and pass it
to 'package-mapping'.
[replacement-property]: New variable.
[rewrite]: Check it.
[cut?]: New procedure.
* tests/packages.scm ("package-input-rewriting"): Pass #:deep? #f and
ensure implicit inputs were not rewritten.  Avoid 'eq?' comparisons.
("package-input-rewriting, deep"): New test.
* gnu/packages/guile.scm (package-for-guile-2.0, package-for-guile-3.0):
Pass #:deep? #f.
2020-09-27 21:41:15 +02:00
Ludovic Courtès b3fc03ee26
packages: 'package-mapping' correctly recurses into 'replacement'.
Previously, something like:

  guix build glib --with-graft=glibc=glibc@2.29

would produce a result showing that rewriting rules were not applied to
libx11@1.6.A (a replacement).

* guix/packages.scm (package-mapping): Call REPLACE instead of PROC to
'replacement'.
* tests/packages.scm ("package-input-rewriting/spec, graft"): New test.
2020-09-27 21:41:11 +02:00
Ludovic Courtès 2bf6f962b9
packages: 'package-input-rewriting/spec' can rewrite implicit dependencies.
With this change, '--with-input', '--with-graft', etc. also apply to
implicit dependencies.  Thus, it's now possible to do:

  guix build python-itsdangerous --with-input=python-wrapper=python@2

or:

  guix build hello --with-graft=glibc=glibc@2.29

Additionally, before, implicit inputs were not rewritten, which could
lead to duplicates in the output of 'bag-transitive-inputs' (packages
that are not 'eq?' but lead to the same derivation).  This in turn would
lead to unnecessary rebuilds when using '--with-input' & co.  This
change fixes it by ensuring even implicit inputs are rewritten.

Fixes <https://bugs.gnu.org/42156>.

* guix/packages.scm (package-input-rewriting/spec): Add #:deep?
defaulting to #true, and pass it to 'package-mapping'.
[replacement-property]: New variable.
[rewrite]: Check that property and set it on the result of PROC.
[cut?]: New procedure.
* tests/packages.scm ("package-input-rewriting/spec"): Ensure implicit
inputs were unchanged.
("package-input-rewriting/spec, partial match"): Pass #:deep? #f.
("package-input-rewriting/spec, deep")
("package-input-rewriting/spec, no duplicates"): New tests.
(package/inherit): Move before use.
* tests/guix-build.sh: Add tests.
* tests/scripts-build.scm ("options->transformation, with-graft"):
Compare dependencies by package name or derivation file name.
* doc/guix.texi (Defining Packages): Adjust accordingly.
2020-09-27 21:41:08 +02:00
Ludovic Courtès ff39361c80
packages: 'package-mapping' can recurse on implicit inputs.
* guix/packages.scm (build-system-with-package-mapping): New procedure.
(package-mapping): Add #:deep? and honor it.
* tests/packages.scm ("package-mapping"): Compare the direct inputs of
the bag of P0 and that of P1.
("package-mapping, deep"): New test.
2020-09-27 21:41:05 +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 efb10f175f
packages: Ensure bags are insensitive to '%current-system'.
Fixes <https://bugs.gnu.org/42327>.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.

This is a followup to f52fbf7094.

* guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs)
(bag-transitive-host-inputs, bag-transitive-target-inputs): Parameterize
%CURRENT-SYSTEM in addition to %CURRENT-TARGET-SYSTEM.
* tests/packages.scm ("package->bag, sensitivity to %current-system"):
New test.
2020-07-13 16:49:12 +02:00
Ludovic Courtès 0505eda9c7
packages: Recognize SHA3 and BLAKE2s for 'content-hash'.
* guix/packages.scm (build-content-hash): Add 'sha3-256', 'sha3-512',
and 'blake2s-256'.
* tests/packages.scm ("package-source-derivation, origin, sha3-512"):
New test.
2020-06-27 23:42:20 +02:00
Ludovic Courtès 03a70e4c19
packages: 'package-grafts' returns grafts for all the relevant outputs.
Fixes <https://bugs.gnu.org/41796>.
Reported by Jakub Kądziołka <kuba@kadziolka.net>.

* guix/packages.scm (input-graft): Add 'output' parameter and honor it.
Add OUTPUT to the cache key.
(input-cross-graft): Likewise.
(fold-bag-dependencies): Operate on inputs instead of nodes.  Turn
VISITED into a vhash instead of a set.  Pass PROC HEAD and OUTPUT
instead of just HEAD.
(bag-grafts): Adjust accordingly.
* tests/packages.scm ("package-grafts, dependency on several outputs"):
New test.
2020-06-11 19:05:05 +02:00
Ludovic Courtès b49caaa2b7
packages: Make 'bag-grafts' insensitive to '%current-target-system'.
Fixes <https://bugs.gnu.org/41713>.
Reported by Mathieu Othacehe.

* guix/packages.scm (bag-grafts): Wrap 'fold-bag-dependencies' calls in
'parameterize'.
* tests/packages.scm ("package->bag, sensitivity to
%current-target-system"): New test.
2020-06-06 23:28:48 +02:00
Ludovic Courtès ce0be5675b
packages: Introduce <content-hash> and use it in <origin>.
* guix/packages.scm (<content-hash>): New record type.
(define-content-hash-constructor, build-content-hash)
(content-hash): New macros.
(print-content-hash): New procedure.
(<origin>): Rename constructor to '%origin'.
[sha256]: Remove field.
[hash]: New field.  Adjust users.
(origin-compatibility-helper, origin): New macros.
(origin-sha256): New deprecated procedure.
(origin->derivation): Adjust accordingly.
* tests/packages.scm ("package-source-derivation, origin, sha512"): New
test.
* guix/tests.scm: Hide (gcrypt hash) 'sha256' for proper syntax
matching.
* tests/challenge.scm: Add #:prefix for (gcrypt hash) and adjust users.
* tests/derivations.scm: Likewise.
* tests/store.scm: Likewise.
* tests/graph.scm ("bag DAG, including origins"): Provide 'sha256' field
with the right length.
* gnu/packages/aspell.scm (aspell-dictionary)
(aspell-dict-ca, aspell-dict-it): Use 'hash' and 'content-hash' for
proper syntax matching.
* gnu/packages/bash.scm (bash-patch): Rename 'sha256' to 'sha256-bv'.
* gnu/packages/bootstrap.scm (bootstrap-executable): Rename 'sha256' to 'bv'.
* gnu/packages/readline.scm (readline-patch): Likewise.
* gnu/packages/virtualization.scm (qemu-patch): Rename 'sha256' to
'sha256-bv'.
* guix/import/utils.scm: Hide (gcrypt hash) 'sha256'.
2020-05-22 01:29:39 +02:00
Ludovic Courtès 56f7ca6e7c
packages: Add 'base64' macro.
* guix/packages.scm (define-compile-time-decoder): New macro.
(base32): Redefine in terms of it.
(base64): New macro.
2020-05-22 00:35:24 +02:00
Ludovic Courtès f52fbf7094
packages: Ensure bags are insensitive to '%current-target-system'.
Fixes a bug whereby a bag's transitive dependencies would depend on the
global '%current-target-system' value.

Partly fixes <https://issues.guix.gnu.org/41182>.

* guix/packages.scm (bag-transitive-inputs)
(bag-transitive-build-inputs, bag-transitive-target-inputs):
Parameterize '%current-target-system'.
* tests/packages.scm ("package->bag, sensitivity to %current-target-system"):
New test.
2020-05-14 17:21:27 +02:00
Marius Bakke 030f6f489f
Merge branch 'master' into core-updates
Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/bootloaders.scm
	gnu/packages/linphone.scm
	gnu/packages/linux.scm
	gnu/packages/tls.scm
	gnu/system.scm
2020-04-23 13:33:09 +02:00
Ludovic Courtès c8d8f6160e
packages: Recommend against the use of 'package-file'.
* guix/packages.scm (package-file): Recommend against its use in the
docstring.
* doc/guix.texi (The Store Monad): Likewise.
2020-04-21 00:06:40 +02:00
Marius Bakke 2778302399
Merge branch 'master' into core-updates
Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/check.scm
	gnu/packages/cross-base.scm
	gnu/packages/gimp.scm
	gnu/packages/java.scm
	gnu/packages/mail.scm
	gnu/packages/sdl.scm
	gnu/packages/texinfo.scm
	gnu/packages/tls.scm
	gnu/packages/version-control.scm
2020-04-08 13:00:50 +02:00
Carl Dong b066c25026
gnu: Move PACKAGES-WITH-*PATCHES to (guix packages)
* gnu/packages/cross-base.scm (package-with-extra-patches,
package-with-patches): Move procedures from here...
* guix/packages.scm (package-with-extra-patches, package-with-patches):
...to here, and export.
2020-04-06 14:02:42 -04:00
Marius Bakke ae0badf5bb
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/admin.scm
	gnu/packages/commencement.scm
	gnu/packages/guile.scm
	gnu/packages/linux.scm
	gnu/packages/package-management.scm
	gnu/packages/pulseaudio.scm
	gnu/packages/web.scm
2020-03-30 12:17:33 +02:00
Ludovic Courtès 9f78552996
packages: 'package->bag' keys cache by replacement.
* guix/packages.scm (package->bag): When GRAFT? is true, use PACKAGE's
replacement as the cache key.  Remove GRAFT? from the list of
secondary cache keys.
2020-03-29 23:14:28 +02:00
Ludovic Courtès 033df23680
packages: Change 'guile-for-grafts' back to 2.0.
This reverts 2b6fe60599, due to reports of
segfaults of Guile 3.0.2 during grafting.

* guix/packages.scm (guile-for-grafts): Change back to GUILE-2.0.
2020-03-29 15:35:47 +02:00
Ludovic Courtès 2b6fe60599
packages: Use Guile 3.0 for grafts.
* guix/packages.scm (guile-2.0): Rename to...
(guile-for-grafts): ... this, and adjust callers.  Refer to 'guile-3.0'
instead of 'guile-2.0'.
2020-03-27 19:09:30 +01:00
Marius Bakke 18af687037
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/icu4c.scm
	gnu/packages/man.scm
	gnu/packages/python-xyz.scm
	guix/scripts/environment.scm
	guix/scripts/pack.scm
	guix/scripts/package.scm
	guix/scripts/pull.scm
	guix/store.scm
2020-03-27 00:12:15 +01:00
Efraim Flashner 6741f543e6
gnu: bootstrap: Add support for the Hurd.
On 3342a1182b
   gnu: make-bootstrap: Use _IOLBF on Guile 2.0 only.

Run
    ./pre-inst-env guix build --target=i586-pc-gnu bootstrap-tarballs --verbosity=1

Producing

    /gnu/store/lhca65c997pvic5cfrpm0dasniwqlg2a-bootstrap-tarballs-0

With guix hash -rx /gnu/store/lhca65c997pvic5cfrpm0dasniwqlg2a-bootstrap-tarballs-0

    07jnq2by98f2a45k8wd2gj62iazvwfa4z7p3w3id4m1g0fdsvc3b

* gnu/packages/bootstrap.scm (%bootstrap-executables): Add entries for the
Hurd.
(bootstrap-executable-url): Use lilypond url for the Hurd.
(bootstrap-guile-url-path): Likewise.
(bootstrap-guile-hash): Add entry for the Hurd.
(%bootstrap-coreutils&co): Likewise.
(%bootstrap-binutils): Likewise.
(%bootstrap-glibc): Likewise.
(%bootstrap-gcc): Likewise.
* guix/packages.scm (%supported-systems): Add i586-gnu.

Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org>
2020-03-26 12:58:51 +01:00
Ludovic Courtès 91601790d0
packages: 'package-field-location' handles missing source properties.
This is a followup to f2b24f01f4.

* guix/packages.scm (package-field-location): Check whether
'source-properties->location' returns #f.  This fixes the case where
'source-properties' returns the empty list.
2020-03-22 12:42:52 +01:00
Marius Bakke d19b14c834
Merge branch 'master' into core-updates 2020-03-21 22:16:02 +01:00
Ludovic Courtès f2b24f01f4
packages: 'package-field-location' preserves the original file name.
Fixes <https://bugs.gnu.org/39425>.
Reported by Alex ter Weele <alex.ter.weele@gmail.com>.

* guix/packages.scm (package-field-location): Remove 'with-fluids' for
'%file-port-name-canonicalization'.  Change the 'file' field of the
resulting location to FILE.
2020-03-20 23:59:31 +01:00
Ludovic Courtès 36930b2463
packages: 'patch-and-repack' sets the mtime to 1, not 0.
* guix/packages.scm (patch-and-repack)[build]: Pass "--mtime=@1" instead
of "--mtime=@0".
2020-01-17 21:21:07 +01:00
Efraim Flashner 003fcf23d9
guix: Fix %hurd-systems list.
* guix/packages.scm (%hurd-systems): Replace i585-gnu with i586-gnu.
2019-12-19 10:37:20 +02:00
Ludovic Courtès d04285647d
packages: Add "aarch64-linux" to '%hydra-supported-systems'.
* guix/packages.scm (%hydra-supported-systems): Keep "aarch64-linux".
2019-10-20 23:26:50 +02:00
Ludovic Courtès 9ff87bb996
Merge branch 'master' into core-updates 2019-09-17 16:27:15 +02:00
Ludovic Courtès 36eef80d45
packages: 'package-field-location' really catches 'system-error.
This had been wrong since forever (i.e., 2013).

* guix/packages.scm (package-field-location): Catch 'system-error, not
'system.
2019-09-10 00:34:40 +02:00
Ludovic Courtès bc60349b5b
packages: 'supported-package?' binds '%current-system' for graph traversal.
Previously, (supported-package? coreutils "armhf-linux")
with (%current-system) = "x86_64-linux" would return false.  That's
because 'supported-package?' would traverse the x86_64 dependency graph,
which contains 'tcc-boot0', which supports x86 only.

Consequently, 'supported-package?' would match only 53 packages for
"armhf-linux" when running on x86, as is the case during continuous
integration.

* guix/packages.scm (package-transitive-supported-systems): Add an
optional 'system' parameter.  Use 'mlambda' instead of 'mlambdaq' for
memoization.
(supported-package?): Pass 'system' to 'package-transitive-supported-systems'.
* tests/packages.scm ("package-transitive-supported-systems, implicit inputs")
("package-transitive-supported-systems: reduced binary seed, implicit inputs"):
Remove calls to 'invalidate-memoization!', which no longer work and were
presumably introduced to work around the bug we're fixing (see commit
0db65c168f).
* tests/packages.scm ("supported-package?"): Rewrite test to use only
existing system name since otherwise 'bootstrap-executable' raises an
exception.
("supported-package? vs. system-dependent graph"): New test.
2019-09-06 14:41:58 +02:00
Mark H Weaver 0481289cbc
Merge branch 'master' into core-updates 2019-08-29 17:19:18 -04:00
David Thompson 6cef554be8
packages: Apply target triplet in bag-transitive-host-inputs.
Fixes a bug where propagated inputs that should be cross-compiled are instead
compiled for the host system.

* guix/packages.scm (bag-transitive-host-inputs): Call transitive-inputs in
  the context of the bag's target system triplet.
2019-08-26 09:40:17 -04:00
Marius Bakke 814e12dc87
packages: Retain version in file name when repacking source checkouts.
Fixes <https://bugs.gnu.org/34066>.

* guix/packages.scm (patch-and-repack)<tarxz-name>: If FILE-NAME is a source
checkout, reuse the name without the '-checkout' part.
2019-06-20 23:56:57 +02:00
Ludovic Courtès 25c639e2a3
packages: 'patch-and-repack' no longer uses #:deprecation-warnings.
* guix/packages.scm (patch-and-repack): Remove #:deprecation-warnings
argument passed to 'gexp->derivation'.
2019-06-17 15:55:36 +02:00