Commit Graph

31 Commits

Author SHA1 Message Date
Ludovic Courtès
993023a28e
lint: Add 'check-for-collisions' checker.
Suggested by Edouard Klein <edk@beaver-labs.com>.

* guix/profiles.scm (check-for-collisions): Export.
* guix/lint.scm (check-profile-collisions): New procedure.
(%local-checkers): Add 'profile-collisions' checker.
* tests/lint.scm ("profile-collisions: no warnings")
("profile-collisions: propagated inputs collide")
("profile-collisions: propagated inputs collide, store items"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
2020-06-14 15:34:42 +02:00
Christopher Baines
db6290af7c
lint: check-patch-file-names: Use origin-actual-file-name.
This avoids crashes for the patch-file-names checker where a <origin> is used
for a patch, but without a value for the file-name field. This is currently
the case with the bash package.

* guix/lint.scm (check-patch-file-names): Change origin-file-name to
origin-actual-file-name.
2020-06-12 22:26:47 +01:00
Chris Marusich
21887021b9
guix: lint: Support origins in check-patch-file-names.
* guix/lint.scm (check-patch-file-names)[starts-with-package-name?]: New
procedure, extracted from the existing logic.  Using it, add a clause to
the match-lambda to handle origin records.
2020-06-11 22:30:14 -07:00
Ludovic Courtès
feea1d0e62
lint: archival: Use 'origin-hash'.
* guix/lint.scm (check-archival): Use 'origin-hash' instead of
'origin-sha256', removing hard-coded "sha256".
2020-05-22 01:30:09 +02:00
Ludovic Courtès
92587f8ed6
lint: 'check-patch-file-names' restricts to shorter file names.
* guix/lint.scm (check-patch-file-names): Increase MARGIN.
2020-04-10 16:02:51 +02:00
Efraim Flashner
d95252baf9
lint: Check for inappropriate inputs in propagated-inputs too.
* guix/lint.scm (check-inputs-should-be-native): Also check the
propagated inputs of the package.
2020-04-10 00:45:59 +03:00
Marius Bakke
9ac6d3785f
lint: 'm4' is a native input.
* guix/lint.scm (check-inputs-should-be-native): Add "m4".
2020-04-07 17:59:00 +02:00
Christopher Baines
7826fbc02b
lint: Add a #:store argument to check-derivation
This can then be used to avoid opening up a store connection each time a
package needs checking.

* guix/lint.scm (check-derivation): Add a #:store argument, and pull the
handling of the store connection out of the try function.
2020-03-24 19:47:46 +00:00
Christopher Baines
d84ad6a24e
lint: Mark the derivation checker as requiring a store connection.
* guix/lint.scm (%local-checkers): Mark the derivation checker as requiring a
store connection.
2020-03-24 19:47:46 +00:00
Christopher Baines
3874dc5ef2
lint: Add a requires-store? field to the checker record.
This can then be used to mark checkers that require a store connection, which
will enable passing a connection in, avoiding the overhead of establishing a
connection inside the check function when it's run for lots of different
packages.

* guix/lint.scm (<lint-checker>): Add requires-store? to the record type.
2020-03-24 19:47:43 +00:00
Brendan Tildesley
3e000955cd
guix: lint: Ad scdoc as a suggested native input.
* guix/lint.scm (check-inputs-should-be-native): Add scdoc.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2020-03-19 21:10:21 +01:00
Ludovic Courtès
fcb2318e51
lint: vulnerabilities: Avoid 'mock' in test.
* guix/lint.scm (check-vulnerabilities): Add 'package-vulnerabilities'
optional parameter.
* tests/lint.scm ("cve: one vulnerability"): Use it instead of 'mock'.
2020-01-17 14:22:07 +01:00
Ludovic Courtès
fd4c832bdb
lint: derivation: Adjust exception handling for Guile 3.
This makes sure the "derivation: invalid arguments" test passes on
Guile 3.0.0.  Without this change, the lint warning would only include
the format string instead of the key and arguments.

* guix/lint.scm (exception-with-kind-and-args?): New procedure.
(check-derivation): Use it.
2020-01-17 14:22:07 +01:00
Danny Milosavljevic
1e44ae6fe7
lint: Check for more packages which should be native.
* guix/lint.scm (check-inputs-should-be-native): Add gtk-doc.
2020-01-12 23:21:59 +01:00
Danny Milosavljevic
bbd9063afc
lint: Check for more packages which should be native.
* guix/lint.scm (check-inputs-should-be-native): Add autoconf, automake,
bison, dejagnu, desktop-file-utils, doxygen, flex, gettext,
gobject-introspection, googletest-source, groff, help2man, libtool, swig,
qmake, qttools, texinfo, xorg-server-for-tests, yelp-tools.
2020-01-09 23:15:04 +01:00
Ludovic Courtès
6a7c4636d4
Adjust module autoloads.
In Guile < 2.9.7, autoloading a module would give you access to all its
bindings.  In future versions, autoloading a module gives access only to
the listed bindings, as per #:select (see <https://bugs.gnu.org/38895>).

This commit adjusts autoloads to the new semantics, allowing Guix to be
built with Guile 2.9.7/2.9.8.

* guix/build/download.scm <top level>: Remove call to 'module-autoload!'.
(load-gnutls): New procedure.
(tls-wrap): Call it.
* guix/git.scm <top level>: Remove call to 'module-autoload!'.
(load-git-submodules): New procedure.
(update-submodules): Call it instead of 'resolve-interface'.
* gnu/bootloader/grub.scm: Replace #:autoload with #:use-module.
* gnu/packages.scm: Likewise.
* gnu/packages/ssh.scm: Likewise.
* gnu/packages/tex.scm: Likewise.
* gnu/services/cuirass.scm: Likewise.
* gnu/services/mcron.scm: Likewise.
* guix/lint.scm: Augment list of bindings in #:autoload.
* guix/scripts/build.scm: Likewise.
* guix/scripts/gc.scm: Likewise.
* guix/scripts/pack.scm: Likewise.
* guix/scripts/publish.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/utils.scm: Remove unnecessary #:autoload clauses; replace one
of them with #:use-module.
2020-01-06 16:31:54 +01:00
Ludovic Courtès
f4cde9ac4a
download: Do not leak file descriptors on TLS ports.
Fixes <https://bugs.gnu.org/20145>.

* guix/build/download.scm (%tls-ports, register-tls-record-port): Remove.
(tls-wrap): Remove call to 'register-tls-record-port'.  Return a custom
binary input/output port instead.  This is a backport of what Guile
2.2's (web client) module has been doing.
(close-connection): Define as an alias for 'close-port'.
* guix/http-client.scm (http-fetch): Remove #:keep-alive? parameter,
which was ignored and unused.
Pass #:keep-alive? #f to 'http-get'.
* guix/lint.scm (probe-uri): Use 'close-port' instead of 'close-connection'.
* guix/scripts/substitute.scm (http-multiple-get): Likewise.
2020-01-03 16:06:26 +01:00
Ludovic Courtès
c2b2c8e9e7
lint: archival: Gracefully handle network failures.
* guix/lint.scm (check-archival): Wrap re-throw in 'with-networking-fail-safe'.
2019-12-02 12:24:56 +01:00
Efraim Flashner
e8c6644af1
lint: Check for more packages which should be native.
* guix/lint.scm (check-inputs-should-be-native): Add yasm, nasm, fasm.
2019-11-28 12:30:42 +02:00
Ludovic Courtès
9efa2c28a4
lint: Re-enable CVE checker.
This reverts d7fcd9c565812919109ae88049f5d8bf4c56f9bd.

* guix/lint.scm (%network-dependent-checkers): Re-enable 'cve checker.
2019-10-23 16:40:17 +02:00
Ludovic Courtès
d7fcd9c565
lint: Comment out 'cve' checker.
* guix/lint.scm (%network-dependent-checkers): Comment out 'cve' checker.
2019-10-18 12:02:52 +02:00
Vagrant Cascadian
7f69414927
lint: Fix typo.
* guix/lint: Fix spelling of "mentioning".
2019-09-23 12:00:03 -07:00
Ludovic Courtès
55549c7b9b
lint: Add 'archival' checker.
* guix/lint.scm (check-archival): New procedure.
(%network-dependent-checkers): Add 'archival' checker.
* tests/lint.scm ("archival: missing content")
("archival: content available")
("archival: missing revision")
("archival: revision available")
("archival: rate limit reached"): New tests.
* doc/guix.texi (Invoking guix lint): Document it.
2019-09-02 15:25:01 +02:00
Ludovic Courtès
900e0fbcc4
lint: Gracefully handle errors from 'connect' & co.
* guix/lint.scm (call-with-networking-fail-safe): Add case for
'system-error' as typically raised by 'connect' & co.
2019-08-31 21:04:09 +02:00
Ludovic Courtès
7d09f2e85f
lint: formatting: Reporters return #f or a warning.
* guix/lint.scm (report-tabulations, report-trailing-white-space)
(report-long-line, report-lone-parentheses): Return #f instead
of *unspecified* when there are no warnings.
(report-formatting-issues): Use 'filter-map' instead of 'map' + 'filter'.
2019-08-30 01:33:45 +02:00
Ludovic Courtès
58d5f280a3
lint: Correct use of 'with-networking-fail-safe'.
Fixes <https://bugs.gnu.org/37160>.
Reported by Jonathan Brielmaier <jonathan.brielmaier@web.de>.

* guix/lint.scm (check-for-updates): Make sure the first argument to
'with-networking-fail-safe' is the whole error message.
2019-08-28 00:27:14 +02:00
Ludovic Courtès
674b9df37d
lint: source: Stop as soon as a valid URL is found.
This restores the behavior of 'guix lint' prior to commit
50fc2384feb3bb2677d074f8f0deb5ae3c56b4d8.

* guix/lint.scm (check-source)[warnings-for-uris]: Rewrite to stop as
soon as one of URIS is valid.
2019-07-20 01:32:18 +02:00
Ludovic Courtès
6dc28adf72
lint: Remove unused imports.
* guix/lint.scm: Remove now unused (gnu packages) and (guix monads)
imports.
2019-07-20 01:32:17 +02:00
Ludovic Courtès
848ae71ea7
lint: 'source' check no longer complains about unavailable mirrors.
Fixes a regression introduced in
50fc2384feb3bb2677d074f8f0deb5ae3c56b4d8.

Previously, 'guix lint -c source coreutils' would complain if one of the
mirrors was unavailable.  This is no longer the case.

* guix/lint.scm (check-source)[warnings-for-uris]: Use 'filter-map'.
Remove 'append-map' call.
Use 'append-map' here so that we can meaningfull compare the length or
URIS and that of WARNINGS.
Use '=' to compare lengths.
2019-07-20 01:32:17 +02:00
Christopher Baines
38f3176a57
lint: Separate checkers by dependence on the internet.
I think there are a couple of potential uses for this. It's somewhat a
separation in to what checkers are just checking the contents of the
repository (line length for example), and other checkers which are bringing in
external information which could change.

I'm thinking particularly, about treating network dependent checkers
differently when automatically running them, but this commit also adds a
--no-network flag to guix lint, which selects the checkers that don't access
the network, which could be useful if no network access is available.

* guix/lint.scm (%checkers): Rename to %all-checkers.
(%local-checkers, %network-dependent-checkers): New variables.
* guix/scripts/lint.scm (run-checkers): Make the checkers argument mandatory.
(list-checkers-and-exit): Handle the checkers as an argument.
(%options): Adjust for changes to %checkers, add a --no-network option, and
change how the --list-checkers option is handled.
(guix-lint): Adjust indentation, and update how the checkers are handled.
2019-07-15 22:32:19 +01:00
Christopher Baines
f363c836e0
lint: Move the linting code to a different module.
To try and move towards making programatic access to the linting code easier,
this commit separates out the linting script, from the linting functionality
that it uses.

* guix/scripts/lint.scm (emit-warnings): Alter to to not use match-lambda, as
<lint-warning> isn't accessible.
(<lint-warning>, lint-warning, make-lint-warning, lint-warning?,
lint-warning-message, lint-warning-message-text, lint-warning-message-data,
lint-warning-location, package-file, %make-warning make-warning,
<lint-checker>, lint-checker, make-lint-checker, lint-checker?,
lint-checker-name, lint-checker-description, lint-checker-check,
properly-starts-sentance?, starts-with-abbreviation?, %quoted-identifier-rx,
check-description-style, package-input-intersection,
check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all,
package-name-regexp, check-synopsis-style, probe-uri,
tls-certificate-error-string, validate-uri, check-home-page,
%distro-directory, check-patch-file-names, escape-quotes,
official-gnu-packages*, check-gnu-synopsis+description, origin-uris,
check-source, check-source-file-name, check-source-unstable-tarball,
check-mirror-url, check-github-url, check-derivation, check-license,
call-with-networking-fail-safe, with-networking-fail-safe,
current-vulnerabilities*, package-vulnerabilities, check-vulnerabilities,
check-for-updates, report-tabulations, report-trailing-white-space,
report-long-line, %hanging-paren-rx, report-lone-parantheses,
%formatting-reporters, report-formatting-issues, check-formatting, %checkers):
Move to…
* guix/lint.scm: … here
* po/guix/POTFILES.in: Add guix/lint.scm.
* Makefile.am: Add guix/lint.scm.
* tests/lint.scm: Change to import (guix lint), rather than (guix scripts lint).
2019-07-15 22:32:19 +01:00