Commit Graph

2148 Commits

Author SHA1 Message Date
Ludovic Courtès
89413a1162
Revert "import: crate: Emit new-style package inputs."
This reverts commit b8af6694b9, which led
‘guix import crate’ to produce invalid code (missing quasiquote) and
triggered a failure of ‘tests/crate.scm’.

Fixes <https://issues.guix.gnu.org/72939>.

Reported-by: Aleksandr Vityazev <avityazev@disroot.org>
Change-Id: If309caaa594f912788e20007bfa1f55b7d581a93
2024-09-19 12:41:54 +02:00
Ludovic Courtès
7979001c58
tests: Adjust ‘elm’ importer test to expect inputs without labels.
This is a followup af85c38b01.

* tests/elm.scm ("(guix import elm)"): Expect new-style inputs.

Change-Id: If3c6b17b5a5d17ad443c3ddb05f94dc2458ba182
2024-09-17 17:34:58 +02:00
Ludovic Courtès
a7bb45b39d
gexp: ‘imported-files’ does not create symlinks.
Fixes <https://issues.guix.gnu.org/73275>.

This is presumably what e529d46828 meant
to do, except that it wrongfully pass #:symlink? a true value instead,
most likely due to a typo.

* guix/gexp.scm (imported-files): Pass #:symlink? #f.
* tests/gexp.scm ("imported-files does not create symlinks"): New test.

Change-Id: Ic31be56a2adf4dfa55e1ec390c53cc9ba5f8a96c
2024-09-16 00:16:20 +02:00
Richard Sent
f3ea876895
gexp: Add ‘assume-source-relative-file-name’.
* guix/gexp.scm (assume-source-relative-file-name): New macro.
(local-file): Use assume-source-relative-file-name to look up a non-literal
file relative to the current source directory.
* doc/guix.texi (G-expressions): Document it.
* tests/gexp.scm ("local-file, non-literal source relative file name"):
New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Change-Id: I18573c8c7a6c87e8351b34412f9d26bb23b068b4
2024-09-04 19:17:00 +02:00
Herman Rimm
c4ce313052
scripts: style: Add 'alphabetical-sort' option.
* guix/scripts/style.scm (show-help): Describe option.
(order-packages): Add procedure.
(format-whole-file): Add 'order?' argument.
(%options): Add 'alphabetical-sort' option.
(guix-style): Alphabetically order packages in files.
* tests/guix-style.sh: Test alphabetical ordering.
* doc/guix.texi (Invoking guix style): Document option.

Change-Id: I4aa7c0bd0b6d42529ae7d304587ffb10bf5f4006
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-09-03 13:59:33 +02:00
Nicolas Goaziou
4ab789d441
guix: import texlive: Add UPSTREAM-NAME property when necessary.
* guix/import/texlive.scm (tlpdb->package): Add UPSTREAM-NAME property when necessary.
* tests/texlive.scm ("texlive->guix-package, with upstream-name property"):
Add new test.

Change-Id: I134a065cbe0a7f0ff4d72b0929dba4e4d46cfaeb
2024-08-31 10:45:37 +02:00
Nicolas Goaziou
415ed34860
guix: import texlive: Adjust to generate new source format.
* guix/import/texlive.scm (tlpdb->package): Adjust source according to new format.
* tests/texlive.scm (%fake-tlpdb): Add database revision.
("texlive->guix-package, no docfiles"):
("texlive->guix-package"):
("texlive->guix-package, with catalogue entry, no inputs"):
("texlive->guix-package, multiple licenses"):
("texlive->guix-package, with TeX format"): Update checks.

Change-Id: I60d5fe0f5f8db194c679dcb262f64c824cd19909
2024-08-31 10:45:33 +02:00
Nicolas Goaziou
416b196d74
gnu: TeX Live packages built from TEXLIVE-SOURCE use same version.
* gnu/packages/tex.scm (%texlive-version): New variable.
(texlive-source):
(texlive-libkpathsea)[version]:
(texlive-libptexenc)[version]:
(texlive-bin)[version]:
(texlive-scheme-basic)[version]:
(texlive-scheme-bookpub)[version]:
(texlive-scheme-context)[version]:
(texlive-scheme-full)[version]:
(texlive-scheme-gust)[version]:
(texlive-scheme-medium)[version]:
(texlive-scheme-minimal)[version]:
(texlive-scheme-small)[version]:
(texlive-scheme-tetex)[version]:
(texlive-collection-basic)[version]:
(texlive-collection-bibtexextra)[version]:
(texlive-collection-binextra)[version]:
(texlive-collection-context)[version]:
(texlive-collection-fontsextra)[version]:
(texlive-collection-fontsrecommended)[version]:
(texlive-collection-fontutils)[version]:
(texlive-collection-formatsextra)[version]:
(texlive-collection-games)[version]:
(texlive-collection-humanities)[version]:
(texlive-collection-langarabic)[version]:
(texlive-collection-langchinese)[version]:
(texlive-collection-langcjk)[version]:
(texlive-collection-langcyrillic)[version]:
(texlive-collection-langczechslovak)[version]:
(texlive-collection-langenglish)[version]:
(texlive-collection-langeuropean)[version]:
(texlive-collection-langfrench)[version]:
(texlive-collection-langgerman)[version]:
(texlive-collection-langgreek)[version]:
(texlive-collection-langitalian)[version]:
(texlive-collection-langjapanese)[version]:
(texlive-collection-langkorean)[version]:
(texlive-collection-langother)[version]:
(texlive-collection-langpolish)[version]:
(texlive-collection-langportuguese)[version]:
(texlive-collection-langspanish)[version]:
(texlive-collection-latex)[version]:
(texlive-collection-latexextra)[version]:
(texlive-collection-latexrecommended)[version]:
(texlive-collection-luatex)[version]:
(texlive-collection-mathscience)[version]:
(texlive-collection-metapost)[version]:
(texlive-collection-music)[version]:
(texlive-collection-pictures)[version]:
(texlive-collection-plaingeneric)[version]:
(texlive-collection-pstricks)[version]:
(texlive-collection-publishers)[version]:
(texlive-collection-xetex)[version]: Use new variable.
* guix/import/texlive.scm (tlpdb->package): Always use version from
%TEXLIVE-VERSION.
* tests/texlive.scm ("texlive->guix-package, meta-package"): Test change to
importer.

Since meta-packages are empty, they are not going through an updater.  This
change makes sure they always refer to an up-to-date version when the rest of
TeX Live is updated.

Change-Id: I55445e3337c1dea22158103d9ed952f75c3c4964

texlive-source

Change-Id: I198a361fd6df3c5dd2b4fa376e1ad623937f08cc
2024-08-31 10:45:32 +02:00
Nicolas Goaziou
9dc279e2fd
guix: import texlive: Handle versions.
* guix/import/texlive.scm (texlive-repository):
(texlive-repository-location):
(svn-command):
(version->revision):
(current-day):
(latest-texlive-tag):
(texlive->svn-multi-reference): New variables.
(tlpdb-file) Remove function.
(tlpdb): Add VERSION argument.
* guix/import/texlive.scm (list-upstream-inputs): Add VERSION and DATABASE
arguments.
(tlpdb->package): Do not use fixed version.  Instead, make use of the version
provided as an argument.  Add DATABASE argument for testing.
(texlive->guix-package): Do not memoize.  Allow providing any TeX Live release
tag as version.  Default to latest tag.  Add DATABASE argument for testing.
Improve docstring.

* tests/texlive.scm ("texlive->guix-package, no docfiles"):
("texlive->guix-package"):
("texlive->guix-package, with METAFONT files"):
("texlive->guix-package, with catalogue entry, no inputs"):
("texlive->guix-package, multiple licenses"):
("texlive->guix-package, meta-package"):
("texlive->guix-package, with TeX format"):
("texlive->guix-package, execute but no TeX format"):
("texlive->guix-package, translate dependencies"):
("texlive->guix-package, lonely `hyphen-base' dependency and ARCH"):
("texlive->guix-package, single script, no extension"):
("texlive->guix-package, multiple scripts, with extensions"):
("texlive->guix-package, script with associated input"):
("texlive->guix-package, propagated binaries, no script"):
("texlive->guix-package, propagated binaries and scripts"):
("texlive->guix-package, with skipped propagated binaries"): Update tests.

Change-Id: I7576b6e31e9ec3ff84258b71d0c4dd180d2b5c38
2024-08-31 10:45:32 +02:00
Nicolas Goaziou
b4ce7359fb
guix: import texlive: Propagate binaries when necessary.
* guix/import/texlive.scm (no-bin-propagation-packages): New variable.
(list-binfiles): New function.
(linked-scripts): Renamed to...
(list-linked-scripts): ... this.  Now always return a list.
(tlpdb->package): Handle binary propagation.
* tests/texlive.scm (%fake-tlpdb): Add data for new tests.
("texlive->guix-package, propagated binaries, no script"):
("texlive->guix-package, propagated binaries and scripts"):
("texlive->guix-package, with skipped propagated binaries"): New tests.

Change-Id: I707ba33a10aa98ad27151724d3ecc4158db6b7cc
2024-08-31 10:45:30 +02:00
Sarah Morgensen
af85c38b01
import: go: Emit new-style package inputs.
Since PACKAGE-NAMES->PACKAGE-INPUTS is used by both the go and crate
importers, give the crate importer a copy of the original so it
continues to use old-style inputs until it is updated.

* guix/import/utils.scm (package-names->package-inputs)[make-input]:
Return new-style package inputs.
(maybe-inputs): Wrap PACKAGE-INPUTS in 'list' instead of 'quasiquote'.
* guix/import/crate.scm (package-names->package-inputs): New variable.
* tests/go.scm ("go-module->guix-package"): Adjust to new-style package
inputs.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2024-08-31 10:44:36 +02:00
Sarah Morgensen
b8af6694b9
import: crate: Emit new-style package inputs.
* guix/import/crate.scm (maybe-cargo-development-inputs)
(maybe-cargo-inputs): Wrap PACKAGE-INPUTS in unquoted 'list'.
* tests/crate.scm ("crate->guix-package")
("cargo-recursive-import")
("cargo-recursive-import-honors-existing-packages"): Adjust accordingly.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I4dfb745272ecbc893926446872514fb815c07236
2024-08-31 10:44:36 +02:00
Ludovic Courtès
949ee85019
profiles: Use C.UTF-8 instead of ‘glibc-utf8-locales’ where possible.
This is a followup to 1cebc334a77030c0c94955981652f4df7608c9e3.

* guix/profiles.scm (ca-certificate-bundle)[libc-utf8-locales-for-target]:
Remove.
[build]: Use “C.UTF-8” instead of “en_US.utf8”.
(profile-derivation)[libc-utf8-locales-for-target]: Remove.
[set-utf8-locale]: Rewrite to a gexp that calls ‘setlocale’ for “C.UTF-8”.
* tests/profiles.scm ("profile-derivation, cross-compilation"): Remove
‘locales’ variable and related check.

Change-Id: I7cb148b9149fe5fbe5b9b1b25fdce1002ad1f37e
2024-08-31 10:42:49 +02:00
Maxim Cournoyer
f59df1aa3c
build-systems: gnu: Export %default-gnu-imported-modules and %default-gnu-modules.
Until now users would have to cargo cult or inspect the private
%default-modules variable of (guix build-systems gnu) to discover which
modules to include when extending the used modules via the #:modules argument.

The renaming was automated via the command:

  $ git grep -l %gnu-build-system-modules
    | xargs sed 's/%gnu-build-system-modules/%default-gnu-imported-modules/' -i

* guix/build-system/gnu.scm (%gnu-build-system-modules): Rename to...
(%default-gnu-imported-modules): ... this.
(%default-modules): Rename to...
(%default-gnu-modules): ... this.  Export.
(dist-package, gnu-build, gnu-cross-build): Adjust accordingly.

Change-Id: Idef307fff13cb76f3182d782b26e1cd3a5c757ee
2024-08-31 10:42:16 +02:00
Carlo Zancanaro
994fbc0ac6
build: utils: Raise error in modify-phases upon missing key.
* guix/build/utils.scm (alist-cons-before)
(alist-cons-after): Error with a match failure if the
reference is not found, instead of appending to the alist.
* tests/build-utils.scm: Update tests to match the new behavior.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I3044b101bd06231d5cd55a544ac1009e6ce6f9a0
2024-08-31 10:42:06 +02:00
Ludovic Courtès
d921c742b7
cache: Avoid cache cleanup storms from concurrent processes.
Reported by Christopher Baines <guix@cbaines.net>.

* guix/cache.scm (maybe-remove-expired-cache-entries): Define
‘expiry-port’; create it with ‘lock-file’.  Change ‘last-expiry-date’
accordingly.  Write timestamp straight to ‘expiry-port’.
* tests/cache.scm ("maybe-remove-expired-cache-entries, cleanup needed
but lock taken"): New test.

Change-Id: I22441d9d2c4a339d3d3878de131864db5a0ae826
2024-08-21 00:52:39 +02:00
Ludovic Courtès
96cd163c14
syscalls: Add ‘mode’ parameter to ‘lock-file’.
* guix/build/syscalls.scm (lock-file): Add ‘mode’ parameter and honor it.
* tests/syscalls.scm ("lock-file + unlock-file"): New test.

Change-Id: I113fb4a8b35dd8782b9c0991574e39a4b4393333
2024-08-21 00:52:38 +02:00
Christopher Baines
f4aec15f47
tests: gexp: Handle incorrect guile-bootstrap version for riscv.
The tests currently fail when run on riscv-linux (affecting the guix package)
because Guile 3 is used as the bootstrap guile.  Correcting the package
version seems hard, so I'm just tweaking the tests to use the right effective
version for riscv64-linux.

* tests/gexp.scm (bootstrap-guile-effective-version): New procedure.
("gexp->derivation & with-extensions", "lower-gexp", "lower-gexp,
raw-derivation-file"): Use bootstrap-guile-effective-version.

Change-Id: I3995e1f6b58ada1baf38a8ec55b0173059dd0079
2024-08-01 10:32:31 +01:00
Ludovic Courtès
e3dfed59d3
modules: ‘file-name->module-name’ strips leading “./”.
Fixes <https://issues.guix.gnu.org/71979>.

* guix/modules.scm (file-name->module-name): Strip leading “.” component
from FILE.
* tests/modules.scm ("file-name->module-name")
("file-name->module-name, leading dot"): New tests.

Reported-by: Tomas Volf <~@wolfsden.cz>
Change-Id: I3d1b9f3f21448050cac4f3b1aed5f8f03758d4c9
2024-07-18 17:31:19 +02:00
Ludovic Courtès
58e268c2e3
git: Remove untracked files from cached checkouts.
Cached checkouts could end up with stale untracked files, for example
because the checkout was interrupted.  As a result, when this happens
for the Guix checkout, users would not get substitutes for ‘guix pull’.

* guix/git.scm (delete-untracked-files): New procedure.
(switch-to-ref): Use it.
* tests/git.scm ("update-cached-checkout, untracked files removed"): New
test.

Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
Change-Id: Iccbe644ade396ad27a037db7e0ef1c2a68ef91ce
2024-07-18 17:31:19 +02:00
Ludovic Courtès
0553c44471
guix build: Take ‘--system’ into account together with ‘-S’.
* guix/scripts/build.scm (options->derivations)[compute-derivation]:
Pass ‘system’ to ‘package-source-derivation’.
* tests/guix-build.sh: Test ‘-S’ together with ‘-s’.

Change-Id: If35f116285dd9caaf939221163ad0ba831eea993
2024-07-18 17:31:18 +02:00
Lars Bilke
7893b32ef6
pack: Create /tmp in Apptainer images.
Related to <https://bugs.gnu.org/37161> and
<https://git.savannah.gnu.org/cgit/guix.git/commit/?id=7979a287f8eb84cbbfa44629951572408939a756>.

* guix/scripts/pack.scm (squashfs-image)[build]: Add /tmp to the set of
directories created.
* tests/pack.scm ("squashfs-image + localstatedir"): Check for /tmp.

Change-Id: I576aaa6ba8cb8478acf4c3144d492ae5caf411ca
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-07-10 16:00:36 +02:00
Ludovic Courtès
af2ca0226f
tests: Adjust ‘guix system’ test for EFI bootloader.
This is a followup to e5078ff321, which
broke this test:

  $ guix system disk-image -n gnu/system/examples/desktop.tmpl
  guix system: warning: 'disk-image' is deprecated: use 'image' instead
  guix system: error: EFI bootloader required with GPT partitioning

* tests/guix-system.sh: Use ‘guix system image’ instead of ‘guix system
disk-image’.  Pass ‘-t efi-raw’ for ‘desktop.tmpl’.

Change-Id: I6877085ab33d9e8b471315b806fed22a7d1241a3
2024-06-13 22:34:00 +02:00
Ludovic Courtès
8355756d1a
tests: Fix ‘beautify-description’ test.
This is a followup to 510ad5d93c.

* tests/import-utils.scm ("beautify-description: transform fragment into
sentence"): Fix.

Change-Id: I331cb38a3460a024a789846772a074ba0b6c857c
2024-06-13 21:47:38 +02:00
Herman Rimm
510ad5d93c
import: utils: End package descriptions with period.
* guix/import/utils.scm (beautify-description): Append period to last
words which do not end with one.
* tests/crate.scm: Append period to descriptions.
* tests/elm.scm: Append period to descriptions.
* tests/gem.scm: Append period to descriptions.
* tests/hexpm.scm: Append period to descriptions.
* tests/minetest.scm: Append period to descriptions.
* tests/pypi.scm: Append period to descriptions.
* tests/import-utils.scm ("beautify-description: transform fragment into
sentence"): Likewise.

Change-Id: I0b12c4d94cb26cf62fab5b7cbf7885e66ff6c10f
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-06-03 22:58:53 +02:00
Herman Rimm
e62fd9004b
import: crate: Include a main verb in crate importer descriptions.
* guix/import/crate.scm (make-crate-sexp): Start description with
'This package provides '.
* tests/crate.scm: Set descriptions to "This package provides summary".

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Change-Id: If0f47a68f986b9e878fd5caa3e365c5ad863089a
2024-06-03 22:58:53 +02:00
Ludovic Courtès
e8ab4ccaa7
style: Fix conversion of ‘unquote-splicing’ by ‘-S arguments’.
* guix/scripts/style.scm (unquote->ungexp): Add missing comma for
‘ungexp-splicing’.
* tests/style.scm ("gexpify arguments, substitute-keyword-arguments +
unquote-splicing"): New test.

Change-Id: I17dcdd9b4812d54ddba1137e369360706b137bb4
2024-06-03 22:58:52 +02:00
Ludovic Courtès
5a7cb59648
deduplication: Detect holes and create sparse files.
This reduces disk usage of sparse files that are substituted such as
Guile object files (ELF files).  As of Guile 3.0.9, .go files are sparse
due to ELF sections being aligned on 64 KiB boundaries.

This reduces disk usage reported by “du -sh” by 9% for the ‘guix’
package, by 23% for ‘guile’, and by 35% for ‘guile-git’.

* guix/store/deduplication.scm (hole-size, find-holes): New procedures.
(tee)[seekable?]: New variable.
[read!]: Add case when SEEKABLE? is true.
* tests/store-deduplication.scm (cartesian-product): New procedure.
("copy-file/deduplicate, sparse files (holes: ~a/~a/~a)"): New test set.

Change-Id: Iad2ab7830dcb1220e2026f4a127a6c718afa8964
2024-05-25 16:44:42 +02:00
Jelle Licht
0685042c46
import: Add binary npm importer.
* guix/scripts/import.scm: (importers): Add "npm-binary".
* doc/guix.texi (Invoking guix import): Document npm-binary importer.
* guix/import/npm-binary.scm: New file.
* guix/scripts/import/npm-binary.scm: New file.
* tests/npm-binary.scm: New file.
* Makefile.am: Add them.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
Co-authored-by: Lars-Dominik Braun <lars@6xq.net>

Change-Id: I98a45068cf5b9c42790664cc743feaa7ac76f807
2024-05-19 16:05:00 +02:00
Ludovic Courtès
7ca9809cdb
tests: Skip ‘terminal-string-width’ test on encodings other than UTF-8.
* tests/syscalls.scm ("terminal-string-width Japanese"): Skip when the
encoding of (current-output-port) is not UTF-8.

Reported-by: Ashvith Shetty <ashvithshetty10@gmail.com>
Change-Id: Ic284dd088d6b148d6fcb457290a28fdb0838b83d
2024-05-13 16:31:35 +02:00
Ludovic Courtès
723d45866f
tests: Remove interference from the user’s Git config.
* tests/guix-download.sh: Set ‘GIT_CONFIG_GLOBAL’ and
‘GIT_CONFIG_SYSTEM’.

Reported-by: Ashvith Shetty <ashvithshetty10@gmail.com>
Change-Id: Ibe14d23db2e8af58b85c78248997c6dde78e11e0
2024-05-13 16:31:35 +02:00
Ludovic Courtès
7b4bf4ee88
git authenticate: Record introduction and keyring in ‘.git/config’.
* guix/scripts/git/authenticate.scm (%default-options): Remove
‘keyring-reference’.
(config-value, configured-introduction, configured-keyring-reference)
(configured?, record-configuration, current-branch): New procedures.
(guix-git-authenticate)[missing-arguments]: New procedure.
Use ‘configured-introduction’ when zero arguments are given.
Use ‘configured-keyring-reference’ when ‘-k’ is not passed.  Add call to
‘record-configuration’.
* doc/guix.texi (Invoking guix git authenticate): Document it.

Change-Id: I66e111a83f50407b52da71662629947f83a78bbc
2024-05-01 17:26:18 +02:00
Ludovic Courtès
54be7795b5
utils: Don’t re-export ‘call-with-temporary-output-file’.
* guix/utils.scm: Remove re-export of ‘call-with-temporary-output-file’.
Autoload a number of modules.
* guix/download.scm, guix/import/hackage.scm,
guix/import/hexpm.scm, guix/import/opam.scm,
guix/import/pypi.scm, tests/cpio.scm, tests/egg.scm,
tests/opam.scm, tests/publish.scm, tests/store-database.scm,
tests/utils.scm: Adjust imports accordingly.

Change-Id: I3f5e94631397996a30be2ea4ff8b50a3371e8ee7
2024-04-15 22:36:42 +02:00
Ludovic Courtès
b30b838d50
gexp: Add #:guile parameter to ‘gexp->file’ and ‘scheme-file’.
This brings ‘gexp->file’ in line with its documentation and mirrors
what’s done for ‘gexp->script’ and ‘program-file’.

Fixes <https://issues.guix.gnu.org/69401>.

* guix/gexp.scm (gexp->file): Add #:guile, as was already documented.
(<scheme-file>)[guile]: New field.
(scheme-file): Add #:guile.
(scheme-file-compiler): Honor ‘guile’ field.
* tests/gexp.scm ("gexp->file")
("gexp->file + file-append", "gexp->file + #:splice?")
("gexp->file, cross-compilation")
("gexp->file, cross-compilation with default target")
Add #:guile to ‘gexp->file’ calls.
("gexp-modules deletes duplicates")
("gexp->derivation & with-imported-module & computed module")
("gexp->derivation & with-extensions", "scheme-file"): Likewise for
‘scheme-file’ calls.

Change-Id: I47536063d5e411e561ec321e535267e92dd06044

Reported-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: I58d653c7fbe65c665bafcbd332ac9b264ddeab64
2024-04-08 00:05:48 +02:00
Christopher Baines
c9cd16c630
store: database: Rename a couple of procedures.
These names should be more descriptive.

* guix/store/database.scm (path-id): Rename to select-valid-path-id.
(sqlite-register): Rename to register-valid-path.
(register-items): Update accordingly.

Change-Id: I6d4a14d4cde9d71ab34d6ffdbfbfde51b2c0e1db
2024-04-03 17:30:53 +01:00
Ludovic Courtès
a26bce55e6
time-machine: Allow time travels to v0.16.0.
* guix/scripts/time-machine.scm (%oldest-possible-commit): Change to
v0.16.0.
* tests/guix-time-machine.sh: Adjust comment.

Change-Id: I9ad82bd45fee0d172b5348a8ae16e990338a3a97
2024-03-11 22:12:34 +01:00
Ludovic Courtès
ddd455c0dd
swh: ‘lookup-origin-revision’ handles branches pointing to directories.
Fixes <https://issues.guix.gnu.org/69070>.

* guix/swh.scm (branch-target): Add clause for 'directory and 'alias.
(lookup-origin-revision): Iterate over all the visits of ORIGIN instead
of just the first one.  Handle the case where ‘branch-target’ returns
something other than a release or revision.
* tests/swh.scm ("lookup-origin-revision"): New test.

Change-Id: I7f636739a719908763bca1d3e7376341dd62e816
2024-03-09 18:55:49 +01:00
Ludovic Courtès
47a0e5d9fb
lint: archival: Trigger “Save Code Now” for VCSes other than Git.
Until now, ‘save-origin’ would be called only when given a
<git-reference>.  With this change, ‘save-origin’ gets called for other
version control systems as well.

* guix/lint.scm (swh-response->warning): New procedure, formerly in
‘check-archival’.
(vcs-origin, save-package-source): New procedures.
(check-archival)[response->warning]: Remove.
Call ‘save-package-source’ in both the Git and the non-Git cases.
* tests/lint.scm ("archival: missing svn revision"): New test.

Change-Id: I535e4ec89488faf83bfa544d5e4935fa73ef54fb
2024-03-09 18:55:49 +01:00
Herman Rimm
50e514c1bc
utils: Add find-definition-insertion-location procedure.
* guix/utils.scm (find-definition-insertion-location): Add and export
procedure.
* tests/utils.scm ("find-definition-insertion-location"): Add test.

Change-Id: Ie17e1b4a94790f58518ce121411a38d357f49feb
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-02-23 19:02:16 +01:00
Herman Rimm
babd39e843
utils: Add insert-expression procedure.
* guix/utils.scm (define-module): Use (guix read-print) and export
(insert-expression).
(insert-expression): Add procedure.
* tests/utils.scm ("insert-expression"): Add test.

Change-Id: I971a43a78aa6ecaaef33c1a7a0db4b287eb85036
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-02-23 19:01:55 +01:00
Ludovic Courtès
29f3089c84
lint: archival: Check with ‘lookup-directory-by-nar-hash’.
While this method is new and nar-sha256 ExtIDs are currently available
only for new visits, it is fundamentally more reliable than the other
methods, which is why it comes first.

* guix/lint.scm (check-archival)[lookup-by-nar-hash]: New procedure.
Call ‘lookup-by-nar-hash’ before the other lookup methods.
* tests/lint.scm ("archival: content available")
("archival: content unavailable but disarchive available")
("archival: missing revision")
("archival: revision available"): Add a 404 response corresponding to
the ‘lookup-external-id’ request.
* tests/lint.scm ("archival: nar-sha256 extid available"): New test.

Change-Id: I4a81d6e022a3b72e6484726549d7fbae627f8e73
2024-02-12 12:03:53 +01:00
Ludovic Courtès
be773bd192
swh: Add bindings for the “ExtID” API.
This interface was deployed at archive.softwareheritage.org a few days
ago.  Our main use case will be looking up directories by “nar-sha256”
hashes.

* guix/swh.scm (<external-id>): New JSON-mapped record type.
(lookup-external-id, lookup-directory-by-nar-hash): New procedures.
* tests/swh.scm (%external-id): New variable.
("lookup-directory-by-nar-hash"): New test.

Change-Id: Ib671c7798aeb6f8132ac78f2b06b9285da8e7bd5
2024-02-12 12:03:53 +01:00
Ludovic Courtès
323b58ac18
channels: ‘latest-channel-instances’ traverses user-provided channels first.
Previously, ‘latest-channel-instances’ would perform a depth-first
traversal of channels.  Since dependencies specified in ‘.guix-channel’
are usually less specific that those provided by the user, this would
lead to the use of instances corresponding to those less specific specs,
which in turn might declare dependencies that do not exist for the more
specific instances.

This commit changes ‘latest-channel-instances’ to perform a
breadth-first traversal, thereby giving user-supplied channels higher
precedence over dependencies found via ‘.guix-channel’.

Fixes <https://issues.guix.gnu.org/68822>.

* guix/channels.scm (latest-channel-instances)[ignore?]: Remove.
[instance-name, same-named?, more-specific?]: New procedures.
Rewrite as a breadth-first traversal using a regular loop.
* tests/channels.scm ("latest-channel-instances reads dependencies from most-specific instance"):
New test.

Change-Id: Iba518145cfd209f04293a56246dbfee3b714650b
2024-01-31 09:07:25 +01:00
Ludovic Courtès
36d654fa54
channels: Tweak test.
* tests/channels.scm ("latest-channel-instances excludes duplicate channel dependencies"):
Use ‘equal?’ rather than ‘string=?’ since we can get #f.

Change-Id: I437b9d7e23200cf0c98b1593e68b1d355bc2de01
2024-01-31 09:07:25 +01:00
Romain GARBAGE
916fb5347a
guix: download: Add support for git repositories.
* guix/scripts/download.scm (git-download-to-store*): Add new variable.
(copy-recursively-without-dot-git): New variable.
(git-download-to-file): Add new variable.
(show-help): Add 'git', 'commit', 'branch' and 'recursive'options
help message.
(%default-options): Add default value for 'git-reference' and
'recursive' options.
(%options): Add 'git', 'commit', 'branch' and 'recursive' command
line options.
(guix-download) [hash]: Compute hash with 'file-hash*' instead of
'port-hash' from (gcrypt hash) module. This allows us to compute
hashes for directories.
* doc/guix.texi (Invoking guix-download): Add @item entries for
`git', `commit', `branch' and `recursive' options. Add a paragraph in
the introduction.
* tests/guix-download.sh: New tests. Move variables and trap definition
to the top of the file.

Change-Id: Ic2c428dca4cfcb0d4714ed361a4c46609339140a
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2024-01-22 10:02:28 -05:00
David Elsing
b26926189e
guix: import: Optionally import necessary yanked crates.
* doc/guix.texi (Invoking guix import): Mention '--allow-yanked'.
* guix/import/crate.scm (make-crate-sexp): Add yanked? argument. For
yanked packages, use the full version suffixed by "-yanked" for
generated variable names and add a comment and package property.
(crate->guix-package): Add allow-yanked? argument and if it is set to #t,
allow importing yanked crates if no other version matching the
requirements exists.
[find-package-version]: Packages previously marked as yanked are only
included if allow-yanked? is #t and then take the lowest priority.
[find-crate-version]: If allow-yanked? is #t, also consider yanked
versions with the lowest priority.
[dependency-name+version]: Rename to ...
[dependency-name+version+yanked] ...this. Honor allow-yanked? and choose
between an existing package and an upstream package.  Exit with an error
message if no version fulfilling the requirement is found.
[version*]: Exit with an error message if the crate version is not found.
(cargo-recursive-import): Add allow-yanked? argument.
* guix/read-print.scm: Export <comment>.
* guix/scripts/import/crate.scm: Add "--allow-yanked".
* tests/crate.scm: Add test 'crate-recursive-import-only-yanked-available'.
[sort-map-dependencies]: Adjust accordingly.
[remove-yanked-info]: New variable.
Adjust test 'crate-recursive-import-honors-existing-packages'.
(test-bar-dependencies): Add yanked dev-dependencies.
(test-leaf-bob-crate): Add yanked versions.
(rust-leaf-bob-3.0.2-yanked): New variable.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: I175d89b39774e6b57dcd1f05bf68718d23866bb7
2024-01-09 09:38:38 +02:00
David Elsing
53add91be6
tests: Mock find-packages-by-name in crate importer test.
* tests/crate.scm: Import only sha256 from (gcrypt hash) as gcrypt-sha256 to
prevent a name collision. Rename test 'cargo-recursive-import' to
'crate-recursive-import' and 'cargo-recursive-import-hoors-existing-packages'
to 'crate-recursive-import-honors-existing-packages'. Mock
find-packages-by-name from (gnu packages). Adjust test to import fake 'bar'
crate instead of doctool.
(test-bar-crate): New variable.
(test-bar-dependencies): New variable.
(test-root-crate): Adjust sha256 -> gcrypt-sha256.
(test-doctool-crate,test-doctool-dependencies): Remove variables.
(rust-leaf-bob-3): New variable.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2024-01-09 09:38:38 +02:00
David Elsing
9f44ff2bb4
import: crate: Optionally import dev-dependencies recursively.
If --recursive-dev-dependencies is specified, development dependencies
are also included for all recursively imported packages.

* doc/guix.texi (Invoking guix import): Mention --recursive-dev-dependencies.
* guix/import/crate.scm (crate-recursive-import): Add
recursive-dev-dependencies? argument.
* guix/scripts/import/crate.scm (show-help, guix-import-crate): Add
"--recursive-dev-dependencies".
* tests/crate.scm: Test both #f and #t for #:recursive-dev-dependencies?
in the 'cargo-recursive-import' test.
(test-root-dependencies): Add intermediate-c as dev-dependency.
(test-intermediate-c-crate, test-intermediate-c-dependencies): New
variables.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Change-Id: Iae89794681155d77f128733120e60f03bc297717
2024-01-09 09:38:38 +02:00
Oleg Pykhalov
0cf75c9b2f
guix: pack: Build layered images.
* guix/scripts/pack.scm (docker-image, guix-pack, %default-options,
%docker-format-options, show-docker-format-options/detailed): Handle
'--max-layers' option.
* doc/guix.texi (Invoking guix pack): Document this.

Change-Id: I90660b2421fcdde891f003469fe2e2edaac7da41
2024-01-08 21:04:44 +03:00
Ludovic Courtès
11a454f9da
gexp: #:references-graphs accepts and honors <gexp-input> records.
* guix/gexp.scm (lower-reference-graphs)[tuple->gexp-input]: Add
‘gexp-input?’ case.
(gexp->derivation): Update docstring.
* doc/guix.texi (G-Expressions): Adjust accordingly.
* tests/gexp.scm ("references-file, non-default output"): New test.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I595cb75da0867ab8ab44552887dc06ed1d23315e
2023-12-22 00:31:40 +01:00