[libvirt] [jenkins-ci PATCH 4/5] jobs: Define $OSINFO_SYSTEM_DIR in default make_env

Andrea Bolognani posted 5 patches 7 years, 6 months ago
There is a newer version of this series
[libvirt] [jenkins-ci PATCH 4/5] jobs: Define $OSINFO_SYSTEM_DIR in default make_env
Posted by Andrea Bolognani 7 years, 6 months ago
Althought the environment variable is only used when building
libosinfo, there is no harm in having it set in the environment
at all times; moreover, hoisting it to the default make_env
allows us to remove duplicated code used to set $MAKE in the
libosinfo project.

$OSINFO_SYSTEM_DIR itself depends on $VIRT_PREFIX, which along
with a bunch of other environment variables is defined not at
the job level but rather at the machine level, making it opaque
to anyone except the Jenkins administrator: the plan is to move
even more environment variables to the default make_env over
time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 jobs/defaults.yaml      | 1 +
 projects/libosinfo.yaml | 7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/jobs/defaults.yaml b/jobs/defaults.yaml
index a403d0e..7aa5a30 100644
--- a/jobs/defaults.yaml
+++ b/jobs/defaults.yaml
@@ -9,6 +9,7 @@
       if [ "$unamestr" = 'FreeBSD' ]; then
           MAKE='gmake'
       fi
+      export OSINFO_SYSTEM_DIR=$VIRT_PREFIX/share/osinfo
     check_env: |
       export VIR_TEST_EXPENSIVE=1
       export VIR_TEST_DEBUG=2
diff --git a/projects/libosinfo.yaml b/projects/libosinfo.yaml
index 77c0414..7fa5b48 100644
--- a/projects/libosinfo.yaml
+++ b/projects/libosinfo.yaml
@@ -7,13 +7,6 @@
       - libvirt-fedora-26
       - libvirt-fedora-rawhide
     title: libosinfo
-    make_env: |
-      MAKE='make'
-      unamestr=`uname`
-      if [ "$unamestr" = 'FreeBSD' ]; then
-          MAKE='gmake'
-      fi
-      export OSINFO_SYSTEM_DIR=$VIRT_PREFIX/share/osinfo
     jobs:
       - autotools-build-job:
           parent_jobs: 'osinfo-db-master-build'
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 4/5] jobs: Define $OSINFO_SYSTEM_DIR in default make_env
Posted by Daniel P. Berrange 7 years, 6 months ago
On Fri, Oct 27, 2017 at 09:48:14AM +0200, Andrea Bolognani wrote:
> Althought the environment variable is only used when building
> libosinfo, there is no harm in having it set in the environment
> at all times; moreover, hoisting it to the default make_env
> allows us to remove duplicated code used to set $MAKE in the
> libosinfo project.
> 
> $OSINFO_SYSTEM_DIR itself depends on $VIRT_PREFIX, which along
> with a bunch of other environment variables is defined not at
> the job level but rather at the machine level, making it opaque
> to anyone except the Jenkins administrator: the plan is to move
> even more environment variables to the default make_env over
> time.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  jobs/defaults.yaml      | 1 +
>  projects/libosinfo.yaml | 7 -------
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/jobs/defaults.yaml b/jobs/defaults.yaml
> index a403d0e..7aa5a30 100644
> --- a/jobs/defaults.yaml
> +++ b/jobs/defaults.yaml
> @@ -9,6 +9,7 @@
>        if [ "$unamestr" = 'FreeBSD' ]; then
>            MAKE='gmake'
>        fi
> +      export OSINFO_SYSTEM_DIR=$VIRT_PREFIX/share/osinfo
>      check_env: |
>        export VIR_TEST_EXPENSIVE=1
>        export VIR_TEST_DEBUG=2
> diff --git a/projects/libosinfo.yaml b/projects/libosinfo.yaml
> index 77c0414..7fa5b48 100644
> --- a/projects/libosinfo.yaml
> +++ b/projects/libosinfo.yaml
> @@ -7,13 +7,6 @@
>        - libvirt-fedora-26
>        - libvirt-fedora-rawhide
>      title: libosinfo
> -    make_env: |
> -      MAKE='make'
> -      unamestr=`uname`
> -      if [ "$unamestr" = 'FreeBSD' ]; then
> -          MAKE='gmake'
> -      fi
> -      export OSINFO_SYSTEM_DIR=$VIRT_PREFIX/share/osinfo
>      jobs:
>        - autotools-build-job:
>            parent_jobs: 'osinfo-db-master-build'

Again, I don't really think this change is a benefit. Project specific env
vars should only be defined against the project rules.

If we want to eliminate the duplication, of the make variables, we should
change the variables we set. ie, stop overriding 'make_env' here, and instead
provide a general 'build_env' property that projects can set, that gets subs
into the autotools.yaml file.


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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 4/5] jobs: Define $OSINFO_SYSTEM_DIR in default make_env
Posted by Andrea Bolognani 7 years, 6 months ago
On Fri, 2017-10-27 at 09:20 +0100, Daniel P. Berrange wrote:
> >      title: libosinfo
> > -    make_env: |
> > -      MAKE='make'
> > -      unamestr=`uname`
> > -      if [ "$unamestr" = 'FreeBSD' ]; then
> > -          MAKE='gmake'
> > -      fi
> > -      export OSINFO_SYSTEM_DIR=$VIRT_PREFIX/share/osinfo
> >      jobs:
> >        - autotools-build-job:
> >            parent_jobs: 'osinfo-db-master-build'
> 
> Again, I don't really think this change is a benefit. Project specific env
> vars should only be defined against the project rules.
> 
> If we want to eliminate the duplication, of the make variables, we should
> change the variables we set. ie, stop overriding 'make_env' here, and instead
> provide a general 'build_env' property that projects can set, that gets subs
> into the autotools.yaml file.

Okay, I can do that. I'll post a v2 shortly.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list