Commit Graph

5922 Commits

Author SHA1 Message Date
Ludovic Courtès 92d99aa5dc
licenses: Remove 'cc-sampling-plus-1.0' export.
This is a followup to 65e1d39f9f.

* guix/licenses.scm (cc-sampling-plus-1.0): Remove export.
2021-08-02 18:11:32 +02:00
Ron Nazarov 65e1d39f9f
licenses: Remove CC-Sampling+-1.0.
* guix/licenses.scm (cc-sampling-plus-1.0): Remove variable.
2021-07-30 10:01:31 +02:00
Ludovic Courtès 78daf9e02e
derivations: Make 'coalesce-duplicate-inputs' linear in the number of inputs.
Partly fixes <https://issues.guix.gnu.org/49439>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

When running the command:

  guix environment pigx-scrnaseq --search-paths --no-grafts

this change reduces total heap allocations from 1.4GiB to 717MiB (49%)
and wall-clock time from 7.5s to 5.7s (24%).

Without '--no-grafts', heap allocations go from 2.1GiB to 1.4GiB (33%)
and wall-clock time from 12.1s to 10.9s (10%).

* guix/derivations.scm (coalesce-duplicate-inputs): Rewrite using a hash
table to make it O(N) rather than O(N²).
2021-07-27 18:26:08 +02:00
Maxim Cournoyer 4f51a4ac27
utils: Do not request block buffering in pretty-print-table.
Re-testing 'guix package -A' using the default line buffering set in (guix
ui), there doesn't seem to be a performance gain to use block buffering, so
remove this extraneous side effect.

* guix/utils.scm (pretty-print-table): Do not set buffering mode to block.

Reported-by: Ludovic Courtès <ludo@gnu.org>
2021-07-21 17:42:30 -04:00
itd 51157d474f
import/print: package->code: Fix license object.
* guix/import/print.scm (package->code)<license->code>: Update generated
licence object to match record constructor.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-07-19 19:57:51 +02:00
Charles 385c485c65
build: Update uglifyjs for minify-build-system.
* guix/build-system/minify.scm (default-uglify-js): Update uglifyjs package used.
* guix/build/minify-build-system.scm (minify): Use updated uglifyjs command name.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2021-07-19 14:46:28 +03:00
Maxim Cournoyer c170abba47
build: pack: Mute error output when checking if tar supports --sort.
* guix/build/pack.scm (tar-base-options) [tar-supports-sort?]: Redirect error
output to void.
2021-07-18 02:11:13 -04:00
Maxim Cournoyer 11f0698243
pack: Streamline how files are included in tarballs.
Thanks to Guillem Jover <guillem@debian.org> on the OFTC's #debian-dpkg
channel for helping with troubleshooting.

Letting GNU Tar recursively walk the complete files hierarchy side-steps the
risks associated with providing a list of file names:

1. Duplicated files in the archive (recorded as hard links by GNU Tar)
2. Missing parent directories.

The above would cause dpkg to malfunction, for example by aborting early and
skipping triggers when there were missing parent directories.

* guix/scripts/pack.scm (self-contained-tarball/builder): Do not call
POPULATE-SINGLE-PROFILE-DIRECTORY, which creates extraneous files such as
/root.  Instead, call POPULATE-STORE and INSTALL-DATABASE-AND-GC-ROOTS
individually to more precisely generate the file system.  Replace the list of
files by the current directory, "." and streamline the way options are passed.
* gnu/system/file-systems.scm (reduce-directories): Remove procedure.
* tests/file-systems.scm ("reduce-directories"): Remove test.
2021-07-18 02:10:49 -04:00
Maxim Cournoyer b019496fc3
pack/deb: Add default section and priority fields to the control file.
These fields, while optional per dpkg, are required by other tools such as
reprepro, commonly used to generate apt repositories.

* guix/scripts/pack.scm (debian-archive): Set the control file section field
to 'misc' and the priority field to 'optional'.
2021-07-18 02:02:34 -04:00
Maxim Cournoyer aeded14b83
pack: Allow embedding custom control files in deb packs.
* guix/scripts/pack.scm (self-contained-tarball/builder)
[extra-options]: New argument.
(self-contained-tarball, squashfs-image, docker-image)
(debian-archive): Likewise.  Remove two TODO comments.  Document
EXTRA-OPTIONS.  Use the custom control files when provided.
(%deb-format-options): New variable.
(show-deb-format-options, show-deb-format-options/detailed): New procedures.
(%options): Register new options.
(show-help): Augment with new usage.
(guix-pack): Validate and propagate new argument values.
* doc/guix.texi (Invoking guix pack)[deb]: Document how to list advanced
options.  Add an example.
* tests/pack.scm (deb archive...): Provide extra-options to the debian-archive
procedure, and validate that the provided files are embedded in the pack.
2021-07-18 02:02:34 -04:00
Maxim Cournoyer 15b4372b60
import: go: Fix indentation.
* guix/import/go.scm: Fix indentation.
2021-07-18 01:57:17 -04:00
Sarah Morgensen 793ba333c6
import: go: Upgrade go.mod parser.
Upgrade the go.mod parser to handle the full go.mod spec, and to gracefully
handle unexpected/malformed syntax.  Restructure parser usage, making the
parse tree available for other uses.

guix/import/go.scm (parse-go.mod): Parse using (ice-9 peg) instead of
regex matching for more robustness.  Return a list of directives.
(go.mod-directives): New procedure.
(go.mod-requirements): Likewise.
(go-module->guix-package): Use it.
(%go.mod-replace-directive-rx): Remove unused variable.
tests/go.scm (testing-parse-mod): Adjust accordingly.
(go.mod-requirements)
(fixture-go-mod-unparseable)
(fixture-go-mod-retract)
(fixture-go-mod-strings): New variables.
("parse-go.mod: simple")
("parse-go.mod: comments and unparseable lines")
("parse-go.mod: retract")
("parse-go.mod: raw strings and quoted strings")
("parse-go.mod: complete"): New tests.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-18 01:57:17 -04:00
Sarah Morgensen via Guix-patches via 5eba9c0960
import: go: Handle multiple go-import meta tags.
* guix/import/go.scm (fetch-module-meta-data): Parse all go-import meta
tags and return the first 'module-meta' with a matching import prefix.
[go-import->module-meta]: Extract parsing into new procedure.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-17 23:26:52 -04:00
Sarah Morgensen via Guix-patches via 59d20bcfcc
import: go: Fix parsing of pkg.go.dev licenses after site update.
* guix/import/go.scm (go-package-licenses): Find license names in
'h2 // div // *text*' elements rather than 'h2 // *text*' elements.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-17 22:13:39 -04:00
Hartmut Goebel 3ee0f170c8
ci: Properly construct URLs.
Implement a new function "api-url", which constructs URLs using relative URI
and "resolve-uri-reference" (which implements the algorithm specified in RFC
3986 section 5.2.2) for building the URL, instead of just appending
strings. This avoids issued if the server-url ends with a slash.

Since "api-url" uses URI-objects, it makes sense to also construct the
query-part of the URL here. For this "api-url" accepts optional
key-value-pairs.

New function "json-api-fetch" is a wrapper using "api-url".

* guix/ci.scm (api-url): New function. (build): Use it.
  (json-api-fetch): New function. (queued-builds, latest-builds,
  evaluation, latest-evaluations, evaluation-jobs: Use it.
2021-07-16 19:48:24 +02:00
Hartmut Goebel ccdf7b8006
substitutes: Properly construct URLs.
Use relative URIs and "resolve-uri-reference" (which implements the algorithm
specified in RFC 3986 section 5.2.2) for building the URL, instead of just
appending strings. This avoids issued if the cache-url ends with a slash.

* guix/substitutes.scm (narinfo-request): Use resolve-uri-reference for
  constructing the url.
2021-07-16 19:36:11 +02:00
Hartmut Goebel f3b20baa4d
substitute: Fix handling of short option "-h".
The short option was listed in the help-text, but not recognized.
2021-07-16 19:36:11 +02:00
Steve Sprang 423f5f867c
ui: Improve output appearance when listing generations.
* guix/ui.scm (display-profile-content-diff): Use pretty-print-table to format
output.
(display-profile-content): Likewise.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-15 16:11:47 -04:00
Steve Sprang 481d660527
package: Improve output appearance when listing packages.
* guix/scripts/package.scm (process-query): Use pretty-print-table when
listing installed and available packages.

Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-15 16:09:53 -04:00
Steve Sprang b73b9aae0d
utils: Add a procedure for pretty printing tabular data.
* guix/utils.scm (pretty-print-table): New procedure.

Co-authored-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-15 16:09:53 -04:00
Brice Waegeneire edb328ad83
lint: Check for leading whitespace in description.
* guix/lint.scm (check-description-style): Check for leading whitespace.
* tests/lint.scm: ("description: leading whitespace"): New test.
2021-07-13 07:25:05 +02:00
Ludovic Courtès cf88c967af
self: Remove stale comment about "mmap(PROT_NONE) failed" crash.
This crash was fixed by 0aef94e7bc, itself
a followup to 47d48f0c43.

* guix/self.scm (translate-texi-manuals)[build]: Remove reference to the
PROT_NONE bug.
2021-07-09 17:33:46 +02:00
Ludovic Courtès 609e66e45f
Revert "self: Build translated manuals with a single process."
This reverts commit af2d6ec092, which the
parent commit makes unnecessary.
2021-07-09 17:33:46 +02:00
Maxim Cournoyer af2d6ec092
self: Build translated manuals with a single process.
Works around <https://issues.guix.gnu.org/47428>.

* guix/self.scm (translate-texi-manuals): Set parallel-job-count to 1.
2021-07-07 14:45:59 -04:00
Tobias Geerinckx-Rice 0dd136bc36
Revert "syscalls: 'terminal-dimension' ignores EPERM."
This reverts commit 17a102332a.
See <https://github.com/koverstreet/bcachefs/pull/277>.
2021-07-07 13:56:16 +02:00
Maxime Devos eac82c0e0a
lint: Lint usages of 'wrap-program' without a "bash" input.
When using 'wrap-program', "bash" (or "bash-minimal") should be
in inputs.  Otherwise, when cross-compiling, 'wrap-program' will use
a native bash instead of the cross bash and the 'patch-shebangs' won't
be able to correct this.

Tobias Geerinckx-Rice is added to the copyright lines because
a part of the "straw-viewer" package definition is included.

This linter detects 365 problematic package definitions at time
of writing.

* guix/lint.scm
  (report-wrap-program-error): New procedure.
  (check-wrapper-inputs): New linter.
  (%local-checkers)[wrapper-inputs]: Add the new linter.
  ("explicit #:sh argument to 'wrap-program' is acceptable")
  ("'check-wrapper-inputs' detects 'wrap-program' without \"bash\" in inputs")
  ("'check-wrapper-inputs' detects 'wrap-qt-program' without \"bash\" in inputs")
  ("\"bash\" in 'inputs' satisfies 'check-wrapper-inputs'")
  ("\"bash-minimal\" in 'inputs' satisfies 'check-wrapper-inputs'")
  ("'cut' doesn't hide bad usages of 'wrap-program'")
  ("bogus phase specifications don't crash the linter"): New tests.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-07 10:00:52 +02:00
Maxime Devos a8e4c158f9
lint: Define some procedures for analysing code in phases.
* guix/lint.scm
  (check-optional-tests): Extract logic for extracting the phases from a
  package to ...
  (find-phase-deltas): ... here, and ...
  (report-bogus-phase-deltas): ... here.
  (check-optional-tests)[check-check-procedure]: Extract code for extracting
  the procedure body to ...
  (find-procedure-body) ... here.
  (find-phase-procedure): New procedure.
  (report-bogus-phase-procedure): New procedure.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-07 10:00:52 +02:00
Maxim Cournoyer 38bcef1c3b
guix: docker: Ensure repository name length limits are met.
* guix/docker.scm (canonicalize-repository-name): Fix typo in doc.  Capture
repository name length limits and ensure they are met, by either truncating or
padding the normalized name.

Reported-by: Ludovic Courtès <ludo@gnu.org>
2021-07-05 16:34:07 -04:00
Julien Lepiller 45940f59aa
guix: opam: Allow for whitespace at the start of an opam file.
* guix/import/opam.scm (records): Accept whitespace at the beginning.
2021-07-05 16:54:05 +02:00
Sarah Morgensen b1a419ea3f
import: go: Replace tildes with hyphens in package names.
Fixes <https://issues.guix.gnu.org/48111>.

* guix/import/go.scm (go-module->guix-package-name): Replace tildes with
hyphens.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
2021-07-05 09:54:12 +02:00
Ludovic Courtès b1e48b5b4e
status: Add missing newline after substitution completion message.
* guix/status.scm (print-build-event): Add newline after "substitution
of ~a complete" message.
2021-07-04 23:00:36 +02:00
Ludovic Courtès 073f198e34
ci: Add procedures to access jobs and builds.
* guix/ci.scm (<job>): New record type.
(evaluation-jobs, build, job-build): New procedures.
2021-07-04 23:00:36 +02:00
Ludovic Courtès 77dba2281f
ci: Represent build status as a symbol.
* guix/ci.scm (define-enumeration-mapping): New macro.
(integer->build-status): New procedure.
(<build>)[status]: Use it.
2021-07-04 23:00:36 +02:00
Tobias Geerinckx-Rice f7e1478202
cpio: Fix device number calculation.
“dev_t in glibc is a 64-bit quantity, with 32-bit major and minor
 numbers.”  — glibc's <bits/sysmacros.h>

The "tests/cpio.scm" was failing because (guix cpio) treated it as a
16-bit quantity instead, leading to header mismatches with the GNU cpio
reference output.

* guix/cpio.scm (device-number, device->major+minor): Use all the bits.
2021-07-04 04:35:35 +02:00
Maxim Cournoyer d5c9cc6d9d
build: qt-utils: Wrappers set 'QTWEBENGINEPROCESS_PATH' if needed.
This reinstate commit the reverted fed28a9632,
now rebased on top of conflicting changes.

* guix/build/qt-utils.scm:  Remove extraneous newlines.
(variables-for-wrapping): Add comments.  Define a file type entry for each
variable definition, and use it to determine if we should look for directories
versus plain files.
<QTWEBENGINEPROCESS_PATH>: New environment variable.
(wrap-all-qt-programs): Remove trailing #t.
2021-07-02 16:50:10 -04:00
Ludovic Courtès 20cf23e4f8
build: qt-utils: Refactor the code to filter XDG_DATA_DIRS.
This partially reinstate the reverted
c5fd1b0bd3.

* guix/build/qt-utils.scm (variables-for-wrapping)[collect-sub-dirs]:
Add 'selectors' parameter and honor it.  Change caller to handle selectors.

Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-07-02 16:50:10 -04:00
Jakub Kądziołka 86c9f5a5fa
guix: qt-utils: Don't include useless inputs in wrapped variables.
Include only those inputs into XDG_DATA_DIRS having
some subdirectory of /share which is typically used by Qt.

* guix/build/qt-utils.scm (variables-for-wrapping): Take the
  output directory as an argument for special handling. Check for
  subdirectories of /share used by Qt before including inputs in
  XDG_DATA_DIRS.
  (wrap-qt-program*): Pass the output directory to variables-for-wrapping.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2021-07-02 16:50:09 -04:00
Jakub Kądziołka 76174aa991
build-system: qt: Exclude useless inputs from wrapped variables.
* guix/build-system/qt.scm (qt-build)[qt-wrap-excluded-inputs]: New argument.
* guix/build/qt-utils.scm (%qt-wrap-excluded-inputs): New variable.
  (wrap-qt-program*)[qt-wrap-excluded-inputs]: New argument. Filter excluded
  inputs.
  (wrap-qt-program)[qt-wrap-excluded-inputs]: New argument.
  (wrap-all-qt-programs)[qt-wrap-excluded-inputs]: New argument.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2021-07-02 16:50:09 -04:00
Hartmut Goebel 30759c4aad
guix: qt-utils: Wrapped executables honor user's envvars.
Prior to this change, wrappers did set the specified environment variables to
a fixed value, overwriting any user settings. This inhibited propagating
e.g. XDG_DATA_DIRS from a profile to the application.

Now user environment variables are prefixed (if the variable defines some
"binary" search path, e.g. QT_PLUGIN_PATH) or suffixed (if the variable
defines some config or data search path, e.g. XDG_DATA_DIRS). The code could
also allow to overwrite, anyhow currently no variable is defined like this.

* guix/build/qt-utils.scm (variables-for-wrapping): For each env-var to
  be wrapped, specify whether it should prefix, suffix or overwrite the
  user's variable.
2021-07-02 16:50:09 -04:00
Hartmut Goebel 7e24e1e58d
guix: qt-build-system, qt-utils: Unify wrapping of qt-programs.
Unify (guix qt-build-system wrap-all-programs) and
(guix qt-utils wrap-qt-program), so both behave the same.
The functions now reside in qt-utils to make them easily available for
packages not using the qt-build-system.

* guix/build/qt-build-system.scm (variables-for-wrapping, wrap-all-programs):
  Move from here ...
* guix/build/qt-utils.scm (variables-for-wrapping, wrap-all-qt-programs):
  ... to here. Base the later on
  (wrap-qt-program*): New function, carved out from old wrap-all-programs.
  (wrap-qt-program): Base on wrap-qt-program*, change arguments in an
  incompatible way.
* gnu/packages/bittorrent.scm (qbittorrent)[arguments]<phases>{wrap-qt}:
  Adjust to new interface of wrap-qt-program.
* gnu/packages/finance.scm (electron-cash): Likewise.
* gnu/packages/geo.scm (qgis): Likewise.
* gnu/packages/password-utils.scm (qtpass): Likewise.
* gnu/packages/video.scm (openshot): Likewise.
* gnu/packages/web-browsers.scm (kristall): Likewise.
2021-07-02 16:50:09 -04:00
Maxim Cournoyer 1879b05f90
Revert "build-system/qt: Wrappers only include relevant directories to XDG_DATA_DIRS."
This reverts commit c5fd1b0bd3.  It will need to
be refactored on top of 2214b7b78d.
2021-07-02 16:50:09 -04:00
Maxim Cournoyer 15fd870c3f
Revert "build-system/qt: Wrappers set 'QTWEBENGINEPROCESS_PATH' if needed."
This reverts commit 06eb21856f.  It will need to
be refactored to fit on top of 2214b7b78d.
2021-07-02 16:50:09 -04:00
Maxim Cournoyer 3a94998f5e
Revert "build-system/qt: Fix wrapping with QTWEBENGINEPROCESS_PATH."
This reverts commit fed28a9632.  It will need to
be refactored to fit on top of 2214b7b78d.
2021-07-02 16:50:09 -04:00
Maxime Devos 5532371a3a
lint: Verify if #:tests? is respected in the 'check' phase.
There have been a few patches to the mailing list lately
not respecting this, and this linter detects 630 package
definitions that could be modified to support the --without-tests
package transformation.

* guix/lint.scm
  (check-optional-tests): New linter.
  (%local-checkers)[optional-tests]: Add it.
* tests/lint.scm
  (package-with-phase-changes): New procedure.
  ("optional-tests: no check phase")
  ("optional-tests: check hase respects #:tests?")
  ("optional-tests: check phase ignores #:tests?")
  ("optional-tests: do not crash when #:phases is invalid")
  ("optional-tests: allow G-exps (no warning)")
  ("optional-tests: allow G-exps (warning)")
  ("optional-tests: complicated 'check' phase")
  ("optional-tests: 'check' phase is not first phase"): New tests.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-06-30 13:53:00 +02:00
Maxime Devos d9e0ae07db
guix: gexp: Define gexp->approximate-sexp.
It will be used in the 'optional-tests' linter.

* guix/gexp.scm (gexp->approximate-sexp): New procedure.
* tests/gexp.scm
  ("no references", "unquoted gexp", "unquoted gexp (native)")
  ("spliced gexp", "unspliced gexp, approximated")
  ("unquoted gexp, approximated"): Test it.
* doc/gexp.scm ("G-Expressions"): Document it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-06-30 13:53:00 +02:00
Maxim Cournoyer 82daab4281
pack: Add support for the deb format.
* .dir-locals.el (scheme-mode)[gexp->derivation]: Define indentation rule.
* guix/scripts/pack.scm (debian-archive): New procedure.
(%formats): Register the new deb format.
(show-formats): Add it to the usage string.
* tests/pack.scm (%ar-bootstrap): New variable.
(deb archive with symlinks): New test.
* doc/guix.texi (Invoking guix pack): Document it.
* NEWS: Add news entry.
2021-06-29 14:53:21 -04:00
Maxim Cournoyer 4f3bdc8f21
pack: Prevent duplicate files in tar archives.
Tar translate duplicate files in the archive into hard links.  These can cause
problems, as not every tool support them; for example dpkg doesn't.

* gnu/system/file-systems.scm (reduce-directories): New procedure.
(file-prefix?): Lift the restriction on file prefix.  The procedure can be
useful for comparing relative file names.  Adjust doc.
(file-name-depth): New procedure, extracted from ...
(btrfs-store-subvolume-file-name): ... here.
* guix/scripts/pack.scm (self-contained-tarball/builder): Use
reduce-directories.
* tests/file-systems.scm ("reduce-directories"): New test.
2021-06-29 14:53:21 -04:00
Maxim Cournoyer 6b0e55cde9
pack: Improve naming of the packs store file names.
Instead of just naming them by their pack type, add information from the
package(s) they contain to make it easier to differentiate them.

* guix/scripts/pack.scm (define-with-source): New macro.
(manifest->friendly-name): Extract procedure from ...
(docker-image): ... here, now defined via the above macro.  Adjust REPOSITORY
argument value accordingly.
(guix-pack): Derive NAME using MANIFEST->FRIENDLY-NAME.
2021-06-29 14:53:21 -04:00
Maxim Cournoyer f72aa3834b
pack: Fix typo.
* guix/scripts/pack.scm (self-contained-tarball/builder): Fix typo.
2021-06-29 14:53:21 -04:00
Maxim Cournoyer 7708c0b5e3
pack: Factorize base tar options.
* guix/docker.scm (%tar-determinism-options): Move to a new module and rename
to `tar-base-options'.  Adjust references accordingly.
* guix/build/pack.scm: New file.
* Makefile.am (MODULES): Register it.
* guix/scripts/pack.scm (self-contained-tarball/builder): Use it.
2021-06-29 14:53:21 -04:00