From: Maxime Devos <maximedevos@telenet.be>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 47221@debbugs.gnu.org
Subject: bug#47221: Guile not in native-inputs when it should
Date: Wed, 17 Mar 2021 22:58:57 +0100 [thread overview]
Message-ID: <c34c473b38b2c659947d684d357a31a2a3ece480.camel@telenet.be> (raw)
In-Reply-To: <87zgz1y030.fsf_-_@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1704 bytes --]
Hi Guix,
(In response to bug#47027, but opened as a new bug.)
On Wed, 2021-03-17 at 21:52 +0100, Ludovic Courtès wrote:
> Hi,
>
> Maxime Devos <maximedevos@telenet.be> skribis:
> [...]
> > Shouldn't the "guile" input be included in the native-inputs
> > as well (perhaps only native-inputs suffices), for cross-compilation?
>
> Yes it should, good point.
FWIW, I tried to write a linter to catch these kind of issues.
(If there's a "guile" input, then there usually should also be
a "guile" native-input.) Currently, it has too many false positives
for my taste. I most likely won't be working on it in the near future
though. (Preliminary patch attached)
> ./pre-int-env guix lint -t "check-inputs-should-also-be-native"
(Output attached)
Some suspicious things:
* guile-config & others are missing a "guile" in the native-inputs
* clipmenu & others use "wrap-script" to define wrapper scripts
(in this case "guile" does not have to be in native-inputs).
The "wrap-script" procedure from (guix build utils) uses the
"which" procedure to determine where guile is located ...
but this is incorrect when cross-compiling!
(It is possible to override the "guile" binary used with a
keyword argument).
(I assume inputs in "inputs" do not contribute to the $PATH
in a cross-compilation environment; only "native-inputs" should
contribute to $PATH)
idk if it is feasible or if there are complications, but
IMHO the inputs in "inputs" shouldn't contribute to $PATH
at all (not even when not cross-compilation), only inputs
in $PATH.
There seems to be plenty of low-hanging cross-compilation fruit here!
Greetings,
Maxime
[-- Attachment #1.2: 0001-lint-Check-whether-guile-should-be-in-native-inputs.patch --]
[-- Type: text/x-patch, Size: 3334 bytes --]
From c4798e6154275a2de41c1d5a35bc723091d4e1a4 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Wed, 17 Mar 2021 22:56:26 +0100
Subject: [PATCH] lint: Check whether guile should be in native-inputs.
TODO less false positives (or negatives?)
TODO proper message
* guix/lint.scm
(check-inputs-should-also-be-native): ???
(%local-checkers)[inputs-should-also-be-native]: New ???.
---
guix/lint.scm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/guix/lint.scm b/guix/lint.scm
index 311bc94cc3..d0cde23665 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -11,6 +11,7 @@
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -75,6 +76,7 @@
#:use-module (ice-9 rdelim)
#:export (check-description-style
check-inputs-should-be-native
+ check-inputs-should-also-be-native
check-inputs-should-not-be-an-input-at-all
check-patch-file-names
check-patch-headers
@@ -347,6 +349,36 @@ of a package, and INPUT-NAMES, a list of package specifications such as
#:field 'inputs))
(package-input-intersection inputs input-names))))
+#|
+(define (suspect-input->native-names package)
+ ;; Guile's compiled .go code is architecture
+ `(,@(if (string-prefix? "guile" (package-name package))
+ '("guile")
+ '()))
+|#
+
+(define (check-inputs-should-also-be-native package)
+ ;; Emit a warning if some inputs of PACKAGE are likely to belong to its
+ ;; native inputs as well.
+ (guard (c ((package-cross-build-system-error? c) '()))
+ (let ((inputs (package-inputs package))
+ (native-inputs
+ ;; Pretend we're cross-compiling,
+ ;; as some packages only add the "guile" input
+ ;; to native-inputs when %current-target-system is not #f.
+ (parameterize ((%current-target-system (%current-system)))
+ (package-native-inputs package)))
+ (input-names
+ '("guile")))
+ (filter-map (lambda (input)
+ (and (not (assoc input native-inputs))
+ (make-warning
+ package
+ (G_ "'~a' should probably also be a native input")
+ (list input)
+ #:field 'inputs)))
+ (package-input-intersection inputs input-names)))))
+
(define (check-inputs-should-not-be-an-input-at-all package)
;; Emit a warning if some inputs of PACKAGE are likely to should not be
;; an input at all.
@@ -1449,6 +1481,10 @@ them for PACKAGE."
(name 'description)
(description "Validate package descriptions")
(check check-description-style))
+ (lint-checker
+ (name 'inputs-should-also-be-native)
+ (description "Identify inputs that should aso be native inputs")
+ (check check-inputs-should-also-be-native))
(lint-checker
(name 'inputs-should-be-native)
(description "Identify inputs that should be native inputs")
--
2.30.2
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next parent reply other threads:[~2021-03-17 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87y2ewyv7o.fsf@ngyro.com>
[not found] ` <20210309193925.15447-1-samplet@ngyro.com>
[not found] ` <7a04ca46ee7f332e6a31cecbdf9ad4b4133a86f3.camel@telenet.be>
[not found] ` <87zgz1y030.fsf_-_@gnu.org>
2021-03-17 21:58 ` Maxime Devos [this message]
2021-03-18 7:18 ` bug#47221: Guile not in native-inputs when it should Maxime Devos
2021-03-18 9:29 ` Maxime Devos
2021-03-18 14:01 ` Maxime Devos
2021-03-18 19:08 ` Maxime Devos
2021-03-20 21:45 ` bug#47221: [PATCH v2]: Correct some inputs / native-inputs issues with guile Maxime Devos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c34c473b38b2c659947d684d357a31a2a3ece480.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=47221@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).