unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Question related to outputs
@ 2017-03-14 15:14 Pjotr Prins
  2017-03-14 15:22 ` Pjotr Prins
  2017-03-15 16:24 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Pjotr Prins @ 2017-03-14 15:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

In a package I have targets for out and debug. Now I want to tell the
make file to build different targets

  make -f Makefile.guix build-with-checks

  make -f Makefile.guix build-without-checks

The latter would be the debug with built in bounds checking etc.

After an hour of searching I don't find any example. Packages like git
have multiple outputs, e.g. git:send-email but I it simply expands
paths. Is there a way to test for these targets?

  (if build-without-checks (do this) (do that))

In gnu/packages/python.scm:L268

 (let ((out (assoc-ref outputs "out"))
       (tk  (assoc-ref outputs "tk")))
  (when tk 
    (match (find-files out "tkinter.*\\.so")
    ...

looks faulty to me as tk always expands to an outputs path.

Pj.
-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question related to outputs
  2017-03-14 15:14 Question related to outputs Pjotr Prins
@ 2017-03-14 15:22 ` Pjotr Prins
  2017-03-15 16:24 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Pjotr Prins @ 2017-03-14 15:22 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

On Tue, Mar 14, 2017 at 03:14:02PM +0000, Pjotr Prins wrote:
> In a package I have targets for out and debug. Now I want to tell the
> make file to build different targets
> 
>   make -f Makefile.guix build-with-checks
> 
>   make -f Makefile.guix build-without-checks
> 
> The latter would be the debug with built in bounds checking etc.
> 
> After an hour of searching I don't find any example. Packages like git
> have multiple outputs, e.g. git:send-email but I it simply expands
> paths. Is there a way to test for these targets?
> 
>   (if build-without-checks (do this) (do that))

When I look in the bag for git, all outputs are always defined and they are all available at build time.

#<<bag> name: "git-2.11.0" system: "x86_64-linux" target: #f build-inputs: (("source" #<origin "mirror://kernel.org/software/scm/git/git-2.11.0.tar.xz" pz7i22oussesg45yoadwos7fqifexqpplfvacf6qh2rrneiz7ufq () 3ad8000>) ("native-perl" #<package perl@5.24.0 gnu/packages/perl.scm:48 1e46c00>) ("gettext" #<package gettext-minimal@0.19.8.1 gnu/packages/gettext.scm:38 31e4300>) ("git-manpages" #<origin "mirror://kernel.org/software/scm/git/git-manpages-2.11.0.tar.xz" wpj6pcbjyc3jw4t2vssap3h6eonenwz7gvhrmge7pj6bbl4vfdma () 3c0f480>) ("tar" #<package tar@1.29 gnu/packages/bootstrap.scm:146 3c3de40>) ("gzip" #<package gzip@1.8 gnu/packages/bootstrap.scm:146 3c3dcc0>) ("bzip2" #<package bzip2@1.0.6 gnu/packages/bootstrap.scm:146 3c3db40>) ("xz" #<package xz@5.2.2 gnu/packages/bootstrap.scm:146 3c3d9c0>) ("file" #<package file@5.28 gnu/packages/bootstrap.scm:146 3c3d840>) ("diffutils" #<package diffutils@3.5 gnu/packages/bootstrap.scm:146 3c3d6c0>) ("patch" #<package patch@2.7.5 gnu/packages/bootstrap.scm:146 3c3d540>) ("sed" #<package sed@4.2.2 gnu/packages/bootstrap.scm:146 3c3d3c0>) ("findutils" #<package findutils@4.6.0 gnu/packages/bootstrap.scm:146 3c3d240>) ("gawk" #<package gawk@4.1.4 gnu/packages/bootstrap.scm:146 3c3d0c0>) ("grep" #<package grep@2.25 gnu/packages/bootstrap.scm:146 3c39000>) ("coreutils" #<package coreutils@8.25 gnu/packages/bootstrap.scm:146 3c39240>) ("make" #<package make@4.2.1 gnu/packages/bootstrap.scm:146 3c393c0>) ("bash" #<package bash@4.4.0 gnu/packages/bootstrap.scm:146 3c39900>) ("ld-wrapper" #<package ld-wrapper@0 gnu/packages/commencement.scm:823 3c39540>) ("binutils" #<package binutils@2.27 gnu/packages/bootstrap.scm:146 3c37000>) ("gcc" #<package gcc@4.9.4 gnu/packages/commencement.scm:715 3c39b40>) ("libc" #<package glibc@2.24 gnu/packages/commencement.scm:618 3c37240>) ("locales" #<package glibc-utf8-locales@2.24 gnu/packages/commencement.scm:813 3c39600>)) host-inputs: (("curl" #<package curl@7.50.3 gnu/packages/curl.scm:41 294c300>) ("expat" #<package expat@2.2.0 gnu/packages/xml.scm:53 3ad4e40>) ("openssl" #<package openssl@1.0.2j gnu/packages/tls.scm:231 2840840>) ("perl" #<package perl@5.24.0 gnu/packages/perl.scm:48 1e46c00>) ("python" #<package python@2.7.12 gnu/packages/python.scm:115 34833c0>) ("zlib" #<package zlib@1.2.8 gnu/packages/compression.scm:52 2a83540>) ("perl-cgi" #<package perl-cgi@4.35 gnu/packages/web.scm:1750 3428900>) ("subversion" #<package subversion@1.8.17 gnu/packages/version-control.scm:685 3aec600>) ("perl-term-readkey" #<package perl-term-readkey@2.32 gnu/packages/perl.scm:5951 21c8e40>) ("perl-authen-sasl" #<package perl-authen-sasl@2.16 gnu/packages/web.scm:950 3411d80>) ("perl-net-smtp-ssl" #<package perl-net-smtp-ssl@1.03 gnu/packages/web.scm:2746 3447a80>) ("perl-io-socket-ssl" #<package perl-io-socket-ssl@2.038 gnu/packages/web.scm:2517 34370c0>) ("tcl" #<package tcl@8.6.4 gnu/packages/tcl.scm:38 38969c0>) ("tk" #<package tk@8.6.4 gnu/packages/tcl.scm:136 3896840>)) target-inputs: () outputs: ("out" "send-email" "svn" "gui") arguments: (#:system "x86_64-linux" #:make-flags (quasiquote ("V=1" "NO_INSTALL_HARDLINKS=indeed")) #:test-target "test" #:tests? #f #:configure-flags (list (string-append "--with-tcltk=" (assoc-ref %build-inputs "tk") "/bin/wish8.6")) #:modules ((srfi srfi-1) (guix build gnu-build-system) (guix build utils) (guix build gremlin) (guix elf)) #:phases (modify-phases %standard-phases (add-after (quote configure) (quote patch-makefile-shebangs) (lambda _ (substitute* "Makefile" (("/bin/sh") (which "sh")) (("/usr/bin/perl") (which "perl")) (("/usr/bin/python") (which "python"))))) (add-after (quote configure) (quote add-PM.stamp) (lambda _ (call-with-output-file "perl/PM.stamp" (const #t)) #t)) (add-after (quote install) (quote install-shell-completion) (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (completions (string-append out "/etc/bash_completion.d"))) (mkdir-p completions) (copy-file "contrib/completion/git-completion.bash" (string-append completions "/git")) #t))) (add-after (quote install) (quote split) (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (se (assoc-ref outputs "send-email")) (svn (assoc-ref outputs "svn")) (gui (assoc-ref outputs "gui")) (gitk (string-append out "/bin/gitk")) (gitk* (string-append gui "/bin/gitk")) (git-gui (string-append out "/libexec/git-core/git-gui")) (git-gui* (string-append gui "/libexec/git-core/git-gui")) (git-cit (string-append out "/libexec/git-core/git-citool")) (git-cit* (string-append gui "/libexec/git-core/git-citool")) (git-se (string-append out "/libexec/git-core/git-send-email")) (git-se* (string-append se "/libexec/git-core/git-send-email")) (git-svn (string-append out "/libexec/git-core/git-svn")) (git-svn* (string-append svn "/libexec/git-core/git-svn")) (git-sm (string-append out "/libexec/git-core/git-submodule"))) (mkdir-p (string-append gui "/bin")) (mkdir-p (string-append gui "/libexec/git-core")) (mkdir-p (string-append se "/libexec/git-core")) (mkdir-p (string-append svn "/libexec/git-core")) (for-each (lambda (old new) (copy-file old new) (delete-file old) (chmod new 365)) (list gitk git-gui git-cit git-se git-svn) (list gitk* git-gui* git-cit* git-se* git-svn*)) (wrap-program git-svn* (quasiquote ("PATH" ":" prefix ((unquote (string-append (assoc-ref inputs "subversion") "/bin"))))) (quasiquote ("PERL5LIB" ":" prefix (unquote (map (lambda (i) (string-append (assoc-ref inputs i) "/lib/perl5/site_perl")) (quote ("subversion" "perl-term-readkey")))))) (quasiquote ("LD_LIBRARY_PATH" ":" prefix ((unquote (string-append (assoc-ref inputs "subversion") "/lib")))))) (wrap-program git-se* (quasiquote ("PERL5LIB" ":" prefix (unquote (map (lambda (o) (string-append o "/lib/perl5/site_perl")) (list (assoc-ref inputs "perl-authen-sasl") (assoc-ref inputs "perl-net-smtp-ssl") (assoc-ref inputs "perl-io-socket-ssl") (assoc-ref inputs "perl-gssapi") (assoc-ref inputs "perl-digest-hmac") (assoc-ref inputs "perl-uri") (assoc-ref inputs "perl-net-ssleay"))))))) (wrap-program (string-append out "/share/gitweb/gitweb.cgi") (quasiquote ("PERL5LIB" ":" prefix (unquote (map (lambda (o) (string-append o "/lib/perl5/site_perl")) (list (assoc-ref inputs "perl-cgi") (assoc-ref inputs "perl-html-parser"))))))) (wrap-program git-sm (quasiquote ("PATH" ":" prefix ((unquote (string-append (assoc-ref inputs "perl") "/bin")))))) (wrap-program (string-append out "/bin/git") (quasiquote ("PATH" ":" prefix ("$HOME/.guix-profile/libexec/git-core"))))))) (add-after (quote split) (quote install-man-pages) (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (man (string-append out "/share/man")) (manpages (assoc-ref inputs "git-manpages"))) (mkdir-p man) (with-directory-excursion man (zero? (system* "tar" "xvf" manpages)))))))) build: #<procedure gnu-build (store name input-drvs #:key guile outputs search-paths configure-flags make-flags out-of-source? tests? test-target parallel-build? parallel-tests? patch-shebangs? strip-binaries? strip-flags strip-directories validate-runpath? phases locale system build imported-modules modules substitutable? allowed-references disallowed-references)>>


Pj.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question related to outputs
  2017-03-14 15:14 Question related to outputs Pjotr Prins
  2017-03-14 15:22 ` Pjotr Prins
@ 2017-03-15 16:24 ` Ludovic Courtès
  2017-03-15 20:32   ` Pjotr Prins
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2017-03-15 16:24 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

Hi Pjotr,

Pjotr Prins <pjotr.public12@thebird.nl> skribis:

> In a package I have targets for out and debug. Now I want to tell the
> make file to build different targets
>
>   make -f Makefile.guix build-with-checks
>
>   make -f Makefile.guix build-without-checks
>
> The latter would be the debug with built in bounds checking etc.
>
> After an hour of searching I don't find any example. Packages like git
> have multiple outputs, e.g. git:send-email but I it simply expands
> paths. Is there a way to test for these targets?
>
>   (if build-without-checks (do this) (do that))

Packages with multiple outputs map to derivations with multiple
outputs.  Outputs are unconditional.

So if your package declares “out” and “debug” as its outputs, it must
always produce both.  Then users can choose to install only one or both,
but that’s a different issue.

For instance, ‘glibc’ always produces both “out” and “debug”, but you
can choose which one to install.

> In gnu/packages/python.scm:L268
>
>  (let ((out (assoc-ref outputs "out"))
>        (tk  (assoc-ref outputs "tk")))
>   (when tk 
>     (match (find-files out "tkinter.*\\.so")
>     ...
>
> looks faulty to me as tk always expands to an outputs path.

It can also be #f in the case of python-minimal.

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question related to outputs
  2017-03-15 16:24 ` Ludovic Courtès
@ 2017-03-15 20:32   ` Pjotr Prins
  2017-03-16  9:02     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Pjotr Prins @ 2017-03-15 20:32 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Wed, Mar 15, 2017 at 05:24:47PM +0100, Ludovic Courtès wrote:
> So if your package declares “out” and “debug” as its outputs, it must
> always produce both.  Then users can choose to install only one or both,
> but that’s a different issue.

That clarifies that :). Both get built.

> For instance, ‘glibc’ always produces both “out” and “debug”, but you
> can choose which one to install.
> 
> > In gnu/packages/python.scm:L268
> >
> >  (let ((out (assoc-ref outputs "out"))
> >        (tk  (assoc-ref outputs "tk")))
> >   (when tk 
> >     (match (find-files out "tkinter.*\\.so")
> >     ...
> >
> > looks faulty to me as tk always expands to an outputs path.
> 
> It can also be #f in the case of python-minimal.

I'll check on that one.

So, to have different build procedures for the same package I best
define different packages and inherit? Rather than define different
outputs - it just appeared natural to me ;).

Pj.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question related to outputs
  2017-03-15 20:32   ` Pjotr Prins
@ 2017-03-16  9:02     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2017-03-16  9:02 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

Hi!

Pjotr Prins <pjotr.public12@thebird.nl> skribis:

> So, to have different build procedures for the same package I best
> define different packages and inherit? Rather than define different
> outputs - it just appeared natural to me ;).

Yeah it really depends.  For debugging info, it’s definitely better to
have a “debug” output; if you instead had two different packages, that
would make debugging much less convenient (you’d have to first remove
the package-without-debugging-info, then install the
package-with-debugging-info, rebuild your stuff, etc.)  In other cases,
the choice between an additional output and a separate package is less
obvious.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-16  9:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 15:14 Question related to outputs Pjotr Prins
2017-03-14 15:22 ` Pjotr Prins
2017-03-15 16:24 ` Ludovic Courtès
2017-03-15 20:32   ` Pjotr Prins
2017-03-16  9:02     ` Ludovic Courtès

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).