diff mbox series

[v1,1/3] configure: add --target-list-exclude

Message ID 20190319124800.7454-2-alex.bennee@linaro.org
State Superseded
Headers show
Series reduce timeouts on Travis | expand

Commit Message

Alex Bennée March 19, 2019, 12:47 p.m. UTC
This is an inverse selection which excludes a selected set of targets
from the default target list. It will mostly be useful for CI
configurations but it might be useful for some users as well.

You cannot specify --target-list and --target-list-exclude at the same
time.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 configure | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

-- 
2.20.1

Comments

Thomas Huth March 21, 2019, 12:42 p.m. UTC | #1
On 19/03/2019 13.47, Alex Bennée wrote:
> This is an inverse selection which excludes a selected set of targets

> from the default target list. It will mostly be useful for CI

> configurations but it might be useful for some users as well.


This will be useful for me, too! For my local builds, I normally drop
some few targets (e.g. the "duplicated" endianess targets like
"armeb-linux-user", since I build "arm-linux-user" already), to speed up
the compilation process a little bit. This will be much easier with this
new option when I've got to re-run configure again...

> +if test -z "$target_list_exclude"; then

> +    echo "defaults: $target_list_exclude"


That echo line looks like a debug left-over. Remove it?

Apart from that:

Reviewed-by: Thomas Huth <thuth@redhat.com>
Alex Bennée March 21, 2019, 1:38 p.m. UTC | #2
Thomas Huth <thuth@redhat.com> writes:

> On 19/03/2019 13.47, Alex Bennée wrote:

>> This is an inverse selection which excludes a selected set of targets

>> from the default target list. It will mostly be useful for CI

>> configurations but it might be useful for some users as well.

>

> This will be useful for me, too! For my local builds, I normally drop

> some few targets (e.g. the "duplicated" endianess targets like

> "armeb-linux-user", since I build "arm-linux-user" already), to speed up

> the compilation process a little bit. This will be much easier with this

> new option when I've got to re-run configure again...

>

>> +if test -z "$target_list_exclude"; then

>> +    echo "defaults: $target_list_exclude"

>

> That echo line looks like a debug left-over. Remove it?


Oops, yes, will fix.

>

> Apart from that:

>

> Reviewed-by: Thomas Huth <thuth@redhat.com>


Thanks.

--
Alex Bennée
Wainer dos Santos Moschetta March 21, 2019, 2:44 p.m. UTC | #3
On 03/19/2019 09:47 AM, Alex Bennée wrote:
> This is an inverse selection which excludes a selected set of targets

> from the default target list. It will mostly be useful for CI

> configurations but it might be useful for some users as well.

>

> You cannot specify --target-list and --target-list-exclude at the same

> time.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>   configure | 34 +++++++++++++++++++++++++++++++---

>   1 file changed, 31 insertions(+), 3 deletions(-)


Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>


>

> diff --git a/configure b/configure

> index 7071f52584..c937aec851 100755

> --- a/configure

> +++ b/configure

> @@ -327,6 +327,7 @@ git="git"

>   

>   # Don't accept a target_list environment variable.

>   unset target_list

> +unset target_list_exclude

>   

>   # Default value for a variable defining feature "foo".

>   #  * foo="no"  feature will only be used if --enable-foo arg is given

> @@ -990,6 +991,14 @@ for opt do

>     --cpu=*)

>     ;;

>     --target-list=*) target_list="$optarg"

> +                   if test "$target_list_exclude"; then

> +                       error_exit "Can't mix --target-list with --target-list-exclude"

> +                   fi

> +  ;;

> +  --target-list-exclude=*) target_list_exclude="$optarg"

> +                   if test "$target_list"; then

> +                       error_exit "Can't mix --target-list-exclude with --target-list"

> +                   fi

>     ;;

>     --enable-trace-backends=*) trace_backends="$optarg"

>     ;;

> @@ -1601,9 +1610,27 @@ if [ "$bsd_user" = "yes" ]; then

>       mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"

>   fi

>   

> -for config in $mak_wilds; do

> -    default_target_list="${default_target_list} $(basename "$config" .mak)"

> -done

> +if test -z "$target_list_exclude"; then

> +    echo "defaults: $target_list_exclude"

> +    for config in $mak_wilds; do

> +        default_target_list="${default_target_list} $(basename "$config" .mak)"

> +    done

> +else

> +    exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')

> +    for config in $mak_wilds; do

> +        target="$(basename "$config" .mak)"

> +        exclude="no"

> +        for excl in $exclude_list; do

> +            if test "$excl" = "$target"; then

> +                exclude="yes"

> +                break;

> +            fi

> +        done

> +        if test "$exclude" = "no"; then

> +            default_target_list="${default_target_list} $target"

> +        fi

> +    done

> +fi

>   

>   # Enumerate public trace backends for --help output

>   trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))

> @@ -1622,6 +1649,7 @@ Standard options:

>     --target-list=LIST       set target list (default: build everything)

>   $(echo Available targets: $default_target_list | \

>     fold -s -w 53 | sed -e 's/^/                           /')

> +  --target-list-exclude=LIST exclude a set of targets from the default target-list

>   

>   Advanced options (experts only):

>     --source-path=PATH       path of source code [$source_path]
diff mbox series

Patch

diff --git a/configure b/configure
index 7071f52584..c937aec851 100755
--- a/configure
+++ b/configure
@@ -327,6 +327,7 @@  git="git"
 
 # Don't accept a target_list environment variable.
 unset target_list
+unset target_list_exclude
 
 # Default value for a variable defining feature "foo".
 #  * foo="no"  feature will only be used if --enable-foo arg is given
@@ -990,6 +991,14 @@  for opt do
   --cpu=*)
   ;;
   --target-list=*) target_list="$optarg"
+                   if test "$target_list_exclude"; then
+                       error_exit "Can't mix --target-list with --target-list-exclude"
+                   fi
+  ;;
+  --target-list-exclude=*) target_list_exclude="$optarg"
+                   if test "$target_list"; then
+                       error_exit "Can't mix --target-list-exclude with --target-list"
+                   fi
   ;;
   --enable-trace-backends=*) trace_backends="$optarg"
   ;;
@@ -1601,9 +1610,27 @@  if [ "$bsd_user" = "yes" ]; then
     mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
 fi
 
-for config in $mak_wilds; do
-    default_target_list="${default_target_list} $(basename "$config" .mak)"
-done
+if test -z "$target_list_exclude"; then
+    echo "defaults: $target_list_exclude"
+    for config in $mak_wilds; do
+        default_target_list="${default_target_list} $(basename "$config" .mak)"
+    done
+else
+    exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
+    for config in $mak_wilds; do
+        target="$(basename "$config" .mak)"
+        exclude="no"
+        for excl in $exclude_list; do
+            if test "$excl" = "$target"; then
+                exclude="yes"
+                break;
+            fi
+        done
+        if test "$exclude" = "no"; then
+            default_target_list="${default_target_list} $target"
+        fi
+    done
+fi
 
 # Enumerate public trace backends for --help output
 trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' "$source_path"/scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
@@ -1622,6 +1649,7 @@  Standard options:
   --target-list=LIST       set target list (default: build everything)
 $(echo Available targets: $default_target_list | \
   fold -s -w 53 | sed -e 's/^/                           /')
+  --target-list-exclude=LIST exclude a set of targets from the default target-list
 
 Advanced options (experts only):
   --source-path=PATH       path of source code [$source_path]