Re: [libvirt PATCH 04/33] ci: build.sh: Add a wrapper function over meson's setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 31, 2023 at 05:37:47PM +0100, Daniel P. Berrangé wrote:
> On Fri, Aug 25, 2023 at 07:55:12PM +0200, Erik Skultety wrote:
> > The reason for this wrapper is that all job functions introduced in
> > future patches will refer to this one instead of open-coding the same
> > 'meson setup' invocation N times. It also prevents 'setup' to be called
> > multiple times as some future job functions might actually do just that
> > in a transitive manner.
> > 
> > Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
> > ---
> >  ci/build.sh | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/ci/build.sh b/ci/build.sh
> > index 82016ba29c..02ff1a8388 100644
> > --- a/ci/build.sh
> > +++ b/ci/build.sh
> > @@ -24,3 +24,20 @@ meson setup build --werror -Dsystem=true $MESON_ARGS || \
> >  (cat build/meson-logs/meson-log.txt && exit 1)
> >  
> >  ninja -C build $NINJA_ARGS
> > +
> > +run_meson_setup() {
> > +    if [ -d "${GIT_ROOT}/build/meson-private" ]; then
> > +        return
> > +    fi
> 
> This isn't as accurate as meson's own check. I interrupted meson
> part way through, and this directry exists, but meson had written
> out sufficient files todo a build.  Re-running 'meson setup build'
> directly happily runs, but this run_meson_setup command becomes
> a no-op which is kinda annoying.

Perhaps we can just push the test into the caller. eg

   test -d $GIT_ROOT/build || run_meson_setup

so commands like 'run_build' "just work", but if someone explicitly
invokes 'run_meson_setup' we just let meson detect a pre-created
build dir using its native logic.

> 
> > +
> > +    local DUMP_ERR_CMD="cat ${GIT_ROOT}/build/meson-logs/meson-log.txt"
> > +    local SETUP_CMD="meson \
> > +                     setup \
> > +                     build \
> > +                     --werror \
> > +                     -Dsystem=true $MESON_OPTS $MESON_ARGS"
> > +
> > +    local CMD="$SETUP_CMD || ($DUMP_ERR_CMD && exit 1)"
> > +
> > +    run_cmd "$CMD"
> > +}
> > -- 
> > 2.41.0
> > 
> 
> With 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 :|
> 

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux