unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: jeremy@korwin-zmijowski.fr
To: Josselin Poiret <dev@jpoiret.xyz>
Cc: 28510@debbugs.gnu.org, Maxime Devos <maximedevos@telenet.be>,
	zimoun <zimon.toutoune@gmail.com>
Subject: bug#28510: crash: guix build -S foo --with-source=bla
Date: Fri, 07 Oct 2022 10:41:50 +0200	[thread overview]
Message-ID: <565ee080af7ef230e1c769bcfed440c2@korwin-zmijowski.fr> (raw)
In-Reply-To: <87h7113k9a.fsf@jpoiret.xyz>

[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]

Le 2022-09-20 21:42, Josselin Poiret a écrit :
> Hi Simon,
> 
> zimoun <zimon.toutoune@gmail.com> writes:
> 
>> Well, I would add an error handler; as proposed [1]. :-)  Because does
>> “guix build foo --source --with-source=bla” make sense?  What is the
>> use-case for such command?
> 
> My bad, I didn't see the previous discussion on the subject.  To me, 
> the
> lack of generality would be unexpected: if I have a package with a
> source, I expect to be able to get that source, whatever the source may
> be.  Maxime's minimal example shows that it could happen for a variety
> of different reasons, not just a --with-source= flag.  I don't know 
> what
> a proper fix for it would be though, since we're passing things around
> that we pretend are derivations but are not, and in many places.
> 
> Best,

Hi !

I feel not able to take decision about the proper way right now.
So as a step forward I wrote a test to capture the behavior expected.
Please have a look at it as it's the starting point for me.
Next, I can implement the error handler, making the previous test to 
pass.
As the test checks the behaviour, it will let enough space to change 
implementation later without invalitating the test.

Cheers,
Jérémy

[-- Attachment #2: guix-scripts.scm --]
[-- Type: text/plain, Size: 930 bytes --]

(define-module (tests scripts build)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 exceptions)
  #:use-module (guix scripts build)
  #:use-module (srfi srfi-34))

(test-begin "scripts")

(define DUMMY_DEFINITION_PATH "/tmp/a.scm")

(define (create-dummy-definition)
  (call-with-output-file DUMMY_DEFINITION_PATH
    (lambda (port)
      (format port
              "(use-modules (gnu packages) (guix packages) (guix gexp)) (package (inherit (specification->package \"hello\")) (source (local-file \"a.scm\")))"))))

(define (delete-dummy-definition)
  (delete-file DUMMY_DEFINITION_PATH))

(test-group-with-cleanup "build"

  (create-dummy-definition)

  (test-equal "package definition as only source"
    "/gnu/store/7mnkrg9bmybgyf1dn5n67di6ng6qvhkz-a.scm"
    (guard
        (ex
         ((exception? ex) #f))
      (guix-build "-f" DUMMY_DEFINITION_PATH "--source")))

  (delete-dummy-definition))

(test-end "scripts")

  reply	other threads:[~2022-10-07  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 12:09 bug#28510: crash: guix build -S foo --with-source=bla Ricardo Wurmus
2021-02-25  0:34 ` zimoun
2022-09-19 17:38 ` Jérémy Korwin-Zmijowski
2022-09-19 18:44   ` Maxime Devos
2022-09-20  9:19     ` Josselin Poiret via Bug reports for GNU Guix
2022-09-20 17:25       ` zimoun
2022-09-20 19:42         ` Josselin Poiret via Bug reports for GNU Guix
2022-10-07  8:41           ` jeremy [this message]
2022-10-08 13:52             ` zimoun

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=565ee080af7ef230e1c769bcfed440c2@korwin-zmijowski.fr \
    --to=jeremy@korwin-zmijowski.fr \
    --cc=28510@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=maximedevos@telenet.be \
    --cc=zimon.toutoune@gmail.com \
    /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).