All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configure: warn if not using a separate build directory
@ 2020-03-31 10:37 Daniel P. Berrangé
  2020-03-31 11:11 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel P. Berrangé @ 2020-03-31 10:37 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Daniel P. Berrangé,
	Liviu Ionescu, Markus Armbruster, Stefan Hajnoczi, Paolo Bonzini,
	Michal Suchánek, Aleksandar Markovic

Running configure directly from the source directory is a build
configuration that will go away in future. It is also not currently
covered by any automated testing. Display a deprecation warning if
the user attempts to use an in-srcdir build setup, so that they are
aware that they're building QEMU in an undesirable manner.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 configure | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/configure b/configure
index e225a1e3ff..1ab7492ab5 100755
--- a/configure
+++ b/configure
@@ -3,6 +3,19 @@
 # qemu configure script (c) 2003 Fabrice Bellard
 #
 
+BUILDDIR=$(pwd)
+SRCDIR=$(dirname "$0")
+
+ABS_BUILDDIR=$(realpath $BUILDDIR)
+ABS_SRCDIR=$(realpath $SRCDIR)
+
+in_srcdir=no
+if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]
+then
+    in_srcdir=yes
+fi
+
+
 # Unset some variables known to interfere with behavior of common tools,
 # just as autoconf does.
 CLICOLOR_FORCE= GREP_OPTIONS=
@@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
     echo "us upstream at qemu-devel@nongnu.org."
 fi
 
+if test "$in_srcdir" = "yes"; then
+    echo
+    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
+    echo
+    echo "Support for running the 'configure' script directly from the"
+    echo "source directory is deprecated and will go away in a future"
+    echo "release. In source dir builds are not covered by automated"
+    echo "testing and are liable to break without warning. Users are"
+    echo "strongly recommended to switch to a separate build directory:"
+    echo
+    echo "  $ mkdir build"
+    echo "  $ cd build"
+    echo "  $ ../configure"
+    echo "  $ make"
+    echo
+fi
+
 config_host_mak="config-host.mak"
 
 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
-- 
2.24.1



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 10:37 [PATCH] configure: warn if not using a separate build directory Daniel P. Berrangé
@ 2020-03-31 11:11 ` Philippe Mathieu-Daudé
  2020-03-31 11:41   ` Daniel P. Berrangé
  2020-03-31 14:44 ` Eric Blake
  2020-04-01  3:03 ` Carlo Arenas
  2 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-31 11:11 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Stefan Hajnoczi, Markus Armbruster,
	Liviu Ionescu, Paolo Bonzini, Michal Suchánek,
	Aleksandar Markovic

On 3/31/20 12:37 PM, Daniel P. Berrangé wrote:
> Running configure directly from the source directory is a build
> configuration that will go away in future. It is also not currently
> covered by any automated testing. Display a deprecation warning if
> the user attempts to use an in-srcdir build setup, so that they are
> aware that they're building QEMU in an undesirable manner.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   configure | 30 ++++++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
> 
> diff --git a/configure b/configure
> index e225a1e3ff..1ab7492ab5 100755
> --- a/configure
> +++ b/configure
> @@ -3,6 +3,19 @@
>   # qemu configure script (c) 2003 Fabrice Bellard
>   #
>   
> +BUILDDIR=$(pwd)
> +SRCDIR=$(dirname "$0")

This duplicates $source_path.
Maybe you can rename it $source_path and remove the $source_path 
assignment later.

> +
> +ABS_BUILDDIR=$(realpath $BUILDDIR)
> +ABS_SRCDIR=$(realpath $SRCDIR)
> +
> +in_srcdir=no
> +if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]
> +then
> +    in_srcdir=yes
> +fi
> +
> +
>   # Unset some variables known to interfere with behavior of common tools,
>   # just as autoconf does.
>   CLICOLOR_FORCE= GREP_OPTIONS=
> @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
>       echo "us upstream at qemu-devel@nongnu.org."
>   fi
>   
> +if test "$in_srcdir" = "yes"; then
> +    echo
> +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
> +    echo
> +    echo "Support for running the 'configure' script directly from the"
> +    echo "source directory is deprecated and will go away in a future"
> +    echo "release. In source dir builds are not covered by automated"
> +    echo "testing and are liable to break without warning. Users are"
> +    echo "strongly recommended to switch to a separate build directory:"
> +    echo
> +    echo "  $ mkdir build"
> +    echo "  $ cd build"
> +    echo "  $ ../configure"
> +    echo "  $ make"
> +    echo
> +fi

I'd move it at the very end of the file, to be the last thing displayed.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +
>   config_host_mak="config-host.mak"
>   
>   echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
> 



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 11:11 ` Philippe Mathieu-Daudé
@ 2020-03-31 11:41   ` Daniel P. Berrangé
  2020-03-31 12:56     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel P. Berrangé @ 2020-03-31 11:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Peter Maydell, Stefan Hajnoczi, qemu-devel,
	Markus Armbruster, Liviu Ionescu, Paolo Bonzini,
	Michal Suchánek, Aleksandar Markovic

On Tue, Mar 31, 2020 at 01:11:45PM +0200, Philippe Mathieu-Daudé wrote:
> On 3/31/20 12:37 PM, Daniel P. Berrangé wrote:
> > Running configure directly from the source directory is a build
> > configuration that will go away in future. It is also not currently
> > covered by any automated testing. Display a deprecation warning if
> > the user attempts to use an in-srcdir build setup, so that they are
> > aware that they're building QEMU in an undesirable manner.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   configure | 30 ++++++++++++++++++++++++++++++
> >   1 file changed, 30 insertions(+)
> > 
> > diff --git a/configure b/configure
> > index e225a1e3ff..1ab7492ab5 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3,6 +3,19 @@
> >   # qemu configure script (c) 2003 Fabrice Bellard
> >   #
> > +BUILDDIR=$(pwd)
> > +SRCDIR=$(dirname "$0")
> 
> This duplicates $source_path.
> Maybe you can rename it $source_path and remove the $source_path assignment
> later.

Sure, could do that..

> 
> > +
> > +ABS_BUILDDIR=$(realpath $BUILDDIR)
> > +ABS_SRCDIR=$(realpath $SRCDIR)
> > +
> > +in_srcdir=no
> > +if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]
> > +then
> > +    in_srcdir=yes
> > +fi
> > +
> > +
> >   # Unset some variables known to interfere with behavior of common tools,
> >   # just as autoconf does.
> >   CLICOLOR_FORCE= GREP_OPTIONS=
> > @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
> >       echo "us upstream at qemu-devel@nongnu.org."
> >   fi
> > +if test "$in_srcdir" = "yes"; then
> > +    echo
> > +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
> > +    echo
> > +    echo "Support for running the 'configure' script directly from the"
> > +    echo "source directory is deprecated and will go away in a future"
> > +    echo "release. In source dir builds are not covered by automated"
> > +    echo "testing and are liable to break without warning. Users are"
> > +    echo "strongly recommended to switch to a separate build directory:"
> > +    echo
> > +    echo "  $ mkdir build"
> > +    echo "  $ cd build"
> > +    echo "  $ ../configure"
> > +    echo "  $ make"
> > +    echo
> > +fi
> 
> I'd move it at the very end of the file, to be the last thing displayed.

You can't see it from the diff, but immediately before here are a bunch
of other big warnings for users, so I figured it was a good idea to keep
them all together.

> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> > +
> >   config_host_mak="config-host.mak"
> >   echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
> > 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 11:41   ` Daniel P. Berrangé
@ 2020-03-31 12:56     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-31 12:56 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Kevin Wolf, Peter Maydell, Stefan Hajnoczi, qemu-devel,
	Markus Armbruster, Liviu Ionescu, Paolo Bonzini,
	Michal Suchánek, Aleksandar Markovic

On 3/31/20 1:41 PM, Daniel P. Berrangé wrote:
> On Tue, Mar 31, 2020 at 01:11:45PM +0200, Philippe Mathieu-Daudé wrote:
>> On 3/31/20 12:37 PM, Daniel P. Berrangé wrote:
>>> Running configure directly from the source directory is a build
>>> configuration that will go away in future. It is also not currently
>>> covered by any automated testing. Display a deprecation warning if
>>> the user attempts to use an in-srcdir build setup, so that they are
>>> aware that they're building QEMU in an undesirable manner.
>>>
>>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>>> ---
>>>    configure | 30 ++++++++++++++++++++++++++++++
>>>    1 file changed, 30 insertions(+)
>>>
>>> diff --git a/configure b/configure
>>> index e225a1e3ff..1ab7492ab5 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -3,6 +3,19 @@
>>>    # qemu configure script (c) 2003 Fabrice Bellard
>>>    #
>>> +BUILDDIR=$(pwd)
>>> +SRCDIR=$(dirname "$0")
>>
>> This duplicates $source_path.
>> Maybe you can rename it $source_path and remove the $source_path assignment
>> later.
> 
> Sure, could do that..
> 
>>
>>> +
>>> +ABS_BUILDDIR=$(realpath $BUILDDIR)
>>> +ABS_SRCDIR=$(realpath $SRCDIR)
>>> +
>>> +in_srcdir=no
>>> +if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]
>>> +then
>>> +    in_srcdir=yes
>>> +fi
>>> +
>>> +
>>>    # Unset some variables known to interfere with behavior of common tools,
>>>    # just as autoconf does.
>>>    CLICOLOR_FORCE= GREP_OPTIONS=
>>> @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
>>>        echo "us upstream at qemu-devel@nongnu.org."
>>>    fi
>>> +if test "$in_srcdir" = "yes"; then
>>> +    echo
>>> +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
>>> +    echo
>>> +    echo "Support for running the 'configure' script directly from the"
>>> +    echo "source directory is deprecated and will go away in a future"
>>> +    echo "release. In source dir builds are not covered by automated"
>>> +    echo "testing and are liable to break without warning. Users are"
>>> +    echo "strongly recommended to switch to a separate build directory:"
>>> +    echo
>>> +    echo "  $ mkdir build"
>>> +    echo "  $ cd build"
>>> +    echo "  $ ../configure"
>>> +    echo "  $ make"
>>> +    echo
>>> +fi
>>
>> I'd move it at the very end of the file, to be the last thing displayed.
> 
> You can't see it from the diff, but immediately before here are a bunch
> of other big warnings for users, so I figured it was a good idea to keep
> them all together.

IMO we should move them to the end too.

I'm getting this output:

$ ./configure
[...]
plugin support    no
fuzzing support   no
gdb               /usr/bin/gdb

WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED

Support for running the 'configure' script directly from the
source directory is deprecated and will go away in a future
release. In source dir builds are not covered by automated
testing and are liable to break without warning. Users are
strongly recommended to switch to a separate build directory:

   $ mkdir build
   $ cd build
   $ ../configure
   $ make

cross containers  docker

NOTE: guest cross-compilers enabled: cc cc
$

We might also move the cross-x messages earlier.
Anyway all my comments can be postponed to 5.1, so if other agree with 
your patch, let's KISS for 5.1-rc1.

> 
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>
>>> +
>>>    config_host_mak="config-host.mak"
>>>    echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
>>>
>>
> 
> Regards,
> Daniel
> 



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 10:37 [PATCH] configure: warn if not using a separate build directory Daniel P. Berrangé
  2020-03-31 11:11 ` Philippe Mathieu-Daudé
@ 2020-03-31 14:44 ` Eric Blake
  2020-03-31 14:56   ` Daniel P. Berrangé
  2020-03-31 15:10   ` BALATON Zoltan
  2020-04-01  3:03 ` Carlo Arenas
  2 siblings, 2 replies; 9+ messages in thread
From: Eric Blake @ 2020-03-31 14:44 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Liviu Ionescu, Markus Armbruster,
	Stefan Hajnoczi, Paolo Bonzini, Michal Suchánek,
	Aleksandar Markovic

On 3/31/20 5:37 AM, Daniel P. Berrangé wrote:
> Running configure directly from the source directory is a build
> configuration that will go away in future. It is also not currently
> covered by any automated testing. Display a deprecation warning if
> the user attempts to use an in-srcdir build setup, so that they are
> aware that they're building QEMU in an undesirable manner.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   configure | 30 ++++++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
> 

It sounds like you already have a v2 coming up to address Phillipe's 
comments, but I'd be happy to see this concept make it into v5.0.

> diff --git a/configure b/configure
> index e225a1e3ff..1ab7492ab5 100755
> --- a/configure
> +++ b/configure
> @@ -3,6 +3,19 @@
>   # qemu configure script (c) 2003 Fabrice Bellard
>   #
>   
> +BUILDDIR=$(pwd)

Why fork out to 'pwd', when we can rely on $PWD for the same answer? 
Note that both $(pwd) and $PWD $BUILDDIR always give an absolute (but no 
necessarily canonical) path, which means...

> +SRCDIR=$(dirname "$0")
> +
> +ABS_BUILDDIR=$(realpath $BUILDDIR)

...calling this ABS_BUILDDIR is a misnomer (it was already absolute). 
What it is really doing is chasing through symlinks to result in a 
canonical name, particularly since unless you have absolute names, using 
only string comparison to see if two filenames are equivalent will have 
false negatives (/tmp vs. /tmp/., for example).

> +ABS_SRCDIR=$(realpath $SRCDIR)

Not robust if there are spaces in the directory names.  Safer would be
ABS_BUILDDIR=$(realpath -- "$BUILDDIR")
and similarly for ABS_SRCDIR.

> +
> +in_srcdir=no
> +if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]

Bashism. You MUST spell this '=', not '==', since configure is run under 
/bin/sh which might be dash which does not understand ==.

> +then
> +    in_srcdir=yes
> +fi
> +
> +
>   # Unset some variables known to interfere with behavior of common tools,
>   # just as autoconf does.
>   CLICOLOR_FORCE= GREP_OPTIONS=
> @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
>       echo "us upstream at qemu-devel@nongnu.org."
>   fi
>   
> +if test "$in_srcdir" = "yes"; then
> +    echo
> +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
> +    echo
> +    echo "Support for running the 'configure' script directly from the"
> +    echo "source directory is deprecated and will go away in a future"
> +    echo "release. In source dir builds are not covered by automated"
> +    echo "testing and are liable to break without warning. Users are"
> +    echo "strongly recommended to switch to a separate build directory:"
> +    echo
> +    echo "  $ mkdir build"
> +    echo "  $ cd build"
> +    echo "  $ ../configure"
> +    echo "  $ make"
> +    echo
> +fi

You know, it WOULD be possible to further enhance this to actually 
create 'build' as well as a shim GNUmakefile that would auto-forward on 
to building directly in build, so that you maintain the illusion of an 
in-place build (other than all the build artifacts now living in a 
different location), and muscle memory for in-tree 'make' still works; 
I've posted elsewhere and will repeat here the contents of my GNUmakefile:

# Hack for redirecting while reminding myself to use distinct builddir
ifeq ($(MAKECMDGOALS),)
recurse: all
endif
%: force
	@echo 'changing directory to build...'
	@sleep 2
	@$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
force: ;
.PHONY: force
GNUmakefile: ;


But we could do that as a patch on top of yours.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 14:44 ` Eric Blake
@ 2020-03-31 14:56   ` Daniel P. Berrangé
  2020-03-31 15:51     ` Kevin Wolf
  2020-03-31 15:10   ` BALATON Zoltan
  1 sibling, 1 reply; 9+ messages in thread
From: Daniel P. Berrangé @ 2020-03-31 14:56 UTC (permalink / raw)
  To: Eric Blake
  Cc: Kevin Wolf, Peter Maydell, Liviu Ionescu, qemu-devel,
	Markus Armbruster, Stefan Hajnoczi, Paolo Bonzini,
	Michal Suchánek, Aleksandar Markovic

On Tue, Mar 31, 2020 at 09:44:37AM -0500, Eric Blake wrote:
> On 3/31/20 5:37 AM, Daniel P. Berrangé wrote:
> > Running configure directly from the source directory is a build
> > configuration that will go away in future. It is also not currently
> > covered by any automated testing. Display a deprecation warning if
> > the user attempts to use an in-srcdir build setup, so that they are
> > aware that they're building QEMU in an undesirable manner.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   configure | 30 ++++++++++++++++++++++++++++++
> >   1 file changed, 30 insertions(+)
> > 
> 
> It sounds like you already have a v2 coming up to address Phillipe's
> comments, but I'd be happy to see this concept make it into v5.0.
> 
> > diff --git a/configure b/configure
> > index e225a1e3ff..1ab7492ab5 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3,6 +3,19 @@
> >   # qemu configure script (c) 2003 Fabrice Bellard
> >   #
> > +BUILDDIR=$(pwd)
> 
> Why fork out to 'pwd', when we can rely on $PWD for the same answer? Note
> that both $(pwd) and $PWD $BUILDDIR always give an absolute (but no
> necessarily canonical) path, which means...
> 
> > +SRCDIR=$(dirname "$0")
> > +
> > +ABS_BUILDDIR=$(realpath $BUILDDIR)
> 
> ...calling this ABS_BUILDDIR is a misnomer (it was already absolute). What
> it is really doing is chasing through symlinks to result in a canonical
> name, particularly since unless you have absolute names, using only string
> comparison to see if two filenames are equivalent will have false negatives
> (/tmp vs. /tmp/., for example).
> 
> > +ABS_SRCDIR=$(realpath $SRCDIR)
> 
> Not robust if there are spaces in the directory names.  Safer would be
> ABS_BUILDDIR=$(realpath -- "$BUILDDIR")
> and similarly for ABS_SRCDIR.
> 
> > +
> > +in_srcdir=no
> > +if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]
> 
> Bashism. You MUST spell this '=', not '==', since configure is run under
> /bin/sh which might be dash which does not understand ==.

Ok, will address all of the above.

> > @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
> >       echo "us upstream at qemu-devel@nongnu.org."
> >   fi
> > +if test "$in_srcdir" = "yes"; then
> > +    echo
> > +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
> > +    echo
> > +    echo "Support for running the 'configure' script directly from the"
> > +    echo "source directory is deprecated and will go away in a future"
> > +    echo "release. In source dir builds are not covered by automated"
> > +    echo "testing and are liable to break without warning. Users are"
> > +    echo "strongly recommended to switch to a separate build directory:"
> > +    echo
> > +    echo "  $ mkdir build"
> > +    echo "  $ cd build"
> > +    echo "  $ ../configure"
> > +    echo "  $ make"
> > +    echo
> > +fi
> 
> You know, it WOULD be possible to further enhance this to actually create
> 'build' as well as a shim GNUmakefile that would auto-forward on to building
> directly in build, so that you maintain the illusion of an in-place build
> (other than all the build artifacts now living in a different location), and
> muscle memory for in-tree 'make' still works; I've posted elsewhere and will
> repeat here the contents of my GNUmakefile:

I wanted to focus strictly on the part that we have agreement on, namely
the deprecation. Any functional changes should be completely separate
to avoid holding up the merge of the warning message patch.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 14:44 ` Eric Blake
  2020-03-31 14:56   ` Daniel P. Berrangé
@ 2020-03-31 15:10   ` BALATON Zoltan
  1 sibling, 0 replies; 9+ messages in thread
From: BALATON Zoltan @ 2020-03-31 15:10 UTC (permalink / raw)
  To: Eric Blake
  Cc: Kevin Wolf, Peter Maydell, Daniel P. Berrangé,
	Liviu Ionescu, qemu-devel, Markus Armbruster, Stefan Hajnoczi,
	Paolo Bonzini, Michal Suchánek, Aleksandar Markovic

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

On Tue, 31 Mar 2020, Eric Blake wrote:
> On 3/31/20 5:37 AM, Daniel P. Berrangé wrote:
>> Running configure directly from the source directory is a build
>> configuration that will go away in future. It is also not currently
>> covered by any automated testing. Display a deprecation warning if
>> the user attempts to use an in-srcdir build setup, so that they are
>> aware that they're building QEMU in an undesirable manner.
>> 
>> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>> ---
>>   configure | 30 ++++++++++++++++++++++++++++++
>>   1 file changed, 30 insertions(+)
>> 
>
> It sounds like you already have a v2 coming up to address Phillipe's 
> comments, but I'd be happy to see this concept make it into v5.0.
>
>> diff --git a/configure b/configure
>> index e225a1e3ff..1ab7492ab5 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3,6 +3,19 @@
>>   # qemu configure script (c) 2003 Fabrice Bellard
>>   #
>>   +BUILDDIR=$(pwd)
>
> Why fork out to 'pwd', when we can rely on $PWD for the same answer? Note 
> that both $(pwd) and $PWD $BUILDDIR always give an absolute (but no 
> necessarily canonical) path, which means...
>
>> +SRCDIR=$(dirname "$0")
>> +
>> +ABS_BUILDDIR=$(realpath $BUILDDIR)
>
> ...calling this ABS_BUILDDIR is a misnomer (it was already absolute). What it 
> is really doing is chasing through symlinks to result in a canonical name, 
> particularly since unless you have absolute names, using only string 
> comparison to see if two filenames are equivalent will have false negatives 
> (/tmp vs. /tmp/., for example).
>
>> +ABS_SRCDIR=$(realpath $SRCDIR)
>
> Not robust if there are spaces in the directory names.  Safer would be
> ABS_BUILDDIR=$(realpath -- "$BUILDDIR")
> and similarly for ABS_SRCDIR.
>
>> +
>> +in_srcdir=no
>> +if [ "$ABS_SRCDIR" == "$ABS_BUILDDIR" ]
>
> Bashism. You MUST spell this '=', not '==', since configure is run under 
> /bin/sh which might be dash which does not understand ==.
>
>> +then
>> +    in_srcdir=yes
>> +fi
>> +
>> +
>>   # Unset some variables known to interfere with behavior of common tools,
>>   # just as autoconf does.
>>   CLICOLOR_FORCE= GREP_OPTIONS=
>> @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
>>       echo "us upstream at qemu-devel@nongnu.org."
>>   fi
>>   +if test "$in_srcdir" = "yes"; then
>> +    echo
>> +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
>> +    echo
>> +    echo "Support for running the 'configure' script directly from the"
>> +    echo "source directory is deprecated and will go away in a future"
>> +    echo "release. In source dir builds are not covered by automated"
>> +    echo "testing and are liable to break without warning. Users are"
>> +    echo "strongly recommended to switch to a separate build directory:"
>> +    echo
>> +    echo "  $ mkdir build"
>> +    echo "  $ cd build"
>> +    echo "  $ ../configure"
>> +    echo "  $ make"
>> +    echo
>> +fi
>
> You know, it WOULD be possible to further enhance this to actually create 
> 'build' as well as a shim GNUmakefile that would auto-forward on to building 
> directly in build, so that you maintain the illusion of an in-place build 
> (other than all the build artifacts now living in a different location), and 
> muscle memory for in-tree 'make' still works; I've posted elsewhere and will 
> repeat here the contents of my GNUmakefile:
>
> # Hack for redirecting while reminding myself to use distinct builddir
> ifeq ($(MAKECMDGOALS),)
> recurse: all
> endif
> %: force
> 	@echo 'changing directory to build...'
> 	@sleep 2

Right, just drop all the 14 line warning above, this one line here should 
be enough to remind people (maybe reworded to say that build results are 
found there and move it after the $(MAKE) so it's printed last and drop 
the sleep 2 and this should work.

Regards,
BALATON Zoltan

> 	@$(MAKE) -C build -f Makefile $(MAKECMDGOALS)
> force: ;
> .PHONY: force
> GNUmakefile: ;
>
>
> But we could do that as a patch on top of yours.
>
>

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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 14:56   ` Daniel P. Berrangé
@ 2020-03-31 15:51     ` Kevin Wolf
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Wolf @ 2020-03-31 15:51 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Peter Maydell, Stefan Hajnoczi, qemu-devel, Markus Armbruster,
	Liviu Ionescu, Paolo Bonzini, Michal Suchánek,
	Aleksandar Markovic

Am 31.03.2020 um 16:56 hat Daniel P. Berrangé geschrieben:
> On Tue, Mar 31, 2020 at 09:44:37AM -0500, Eric Blake wrote:
> > On 3/31/20 5:37 AM, Daniel P. Berrangé wrote:
> > > Running configure directly from the source directory is a build
> > > configuration that will go away in future. It is also not currently
> > > covered by any automated testing. Display a deprecation warning if
> > > the user attempts to use an in-srcdir build setup, so that they are
> > > aware that they're building QEMU in an undesirable manner.
> > > 
> > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

> > > @@ -6799,6 +6812,23 @@ if test "$supported_os" = "no"; then
> > >       echo "us upstream at qemu-devel@nongnu.org."
> > >   fi
> > > +if test "$in_srcdir" = "yes"; then
> > > +    echo
> > > +    echo "WARNING: SUPPORT FOR IN SOURCE DIR BUILDS IS DEPRECATED"
> > > +    echo
> > > +    echo "Support for running the 'configure' script directly from the"
> > > +    echo "source directory is deprecated and will go away in a future"
> > > +    echo "release. In source dir builds are not covered by automated"
> > > +    echo "testing and are liable to break without warning. Users are"
> > > +    echo "strongly recommended to switch to a separate build directory:"
> > > +    echo
> > > +    echo "  $ mkdir build"
> > > +    echo "  $ cd build"
> > > +    echo "  $ ../configure"
> > > +    echo "  $ make"
> > > +    echo
> > > +fi
> > 
> > You know, it WOULD be possible to further enhance this to actually create
> > 'build' as well as a shim GNUmakefile that would auto-forward on to building
> > directly in build, so that you maintain the illusion of an in-place build
> > (other than all the build artifacts now living in a different location), and
> > muscle memory for in-tree 'make' still works; I've posted elsewhere and will
> > repeat here the contents of my GNUmakefile:
> 
> I wanted to focus strictly on the part that we have agreement on, namely
> the deprecation. Any functional changes should be completely separate
> to avoid holding up the merge of the warning message patch.

We don't have agreement on the type of deprecation suggested by your
message, that is, that ./configure from the source directory will stop
working.

If we can agree on using Eric's approach, then the message should rather
tell users that the resulting binaries will move to a different place in
future versions.

Kevin



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

* Re: [PATCH] configure: warn if not using a separate build directory
  2020-03-31 10:37 [PATCH] configure: warn if not using a separate build directory Daniel P. Berrangé
  2020-03-31 11:11 ` Philippe Mathieu-Daudé
  2020-03-31 14:44 ` Eric Blake
@ 2020-04-01  3:03 ` Carlo Arenas
  2 siblings, 0 replies; 9+ messages in thread
From: Carlo Arenas @ 2020-04-01  3:03 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Kevin Wolf, Peter Maydell, Stefan Hajnoczi, qemu-devel,
	Markus Armbruster, Liviu Ionescu, Paolo Bonzini,
	Michal Suchánek, Aleksandar Markovic

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

On Tue, Mar 31, 2020 at 3:38 AM Daniel P. Berrangé <berrange@redhat.com>
wrote:

> Running configure directly from the source directory is a build
> configuration that will go away in future. It is also not currently
>

s/in future/in the future/g

Carlo

[-- Attachment #2: Type: text/html, Size: 562 bytes --]

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

end of thread, other threads:[~2020-04-01  3:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 10:37 [PATCH] configure: warn if not using a separate build directory Daniel P. Berrangé
2020-03-31 11:11 ` Philippe Mathieu-Daudé
2020-03-31 11:41   ` Daniel P. Berrangé
2020-03-31 12:56     ` Philippe Mathieu-Daudé
2020-03-31 14:44 ` Eric Blake
2020-03-31 14:56   ` Daniel P. Berrangé
2020-03-31 15:51     ` Kevin Wolf
2020-03-31 15:10   ` BALATON Zoltan
2020-04-01  3:03 ` Carlo Arenas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.