[libvirt] [cim PATCH 0/3] autogen.sh improvements

These changes are a requirement for porting the libvirt-cim CI jobs to autotools-*-job. Andrea Bolognani (3): autogen: Better error handling autogen: Run configure automatically autogen: Support running out-of-tree autogen.sh | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) -- 2.14.3

Instead of making the execution of each command dependend on the success of the previous one, check return values explicitly. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- autogen.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/autogen.sh b/autogen.sh index e4b7adc..5b2e4dc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,20 +2,26 @@ # ============================================================================ # (C) Copyright IBM Corp. 2005 -echo "Running libtool ..." && -libtoolize --copy --force --automake && +die() +{ + test "$1" && echo "$1" >&2 + exit 1 +} -echo "Running aclocal ..." && -aclocal --force && +echo "Running libtool ..." +libtoolize --copy --force --automake || die -echo "Running autoheader ..." && -autoheader --force && +echo "Running aclocal ..." +aclocal --force || die -echo "Running automake ..." && -automake -i --add-missing --copy --foreign && +echo "Running autoheader ..." +autoheader --force || die -echo "Running autoconf ..." && -autoconf --force && +echo "Running automake ..." +automake -i --add-missing --copy --foreign || die + +echo "Running autoconf ..." +autoconf --force || die if test -x $(which git); then git rev-parse --short HEAD > .changeset -- 2.14.3

This is in line with pretty much all libvirt-related projects, is entirely compatible with the old behavior and will enable some simplifications in the CI setup. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- autogen.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 5b2e4dc..a04e4e6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -31,4 +31,14 @@ else echo "0" > .revision fi -echo "You may now run ./configure" +if test "$#" -eq 0; then + echo "Running configure without arguments ..." + echo "(If you want to pass any, specify them on the $0 command line)" +else + echo "Running configure with $@ ..." +fi + +"$srcdir/configure" "$@" || die + +echo +echo "You may now run make" -- 2.14.3

Instead of having to run autogen.sh inside the source directory first, before moving to a build directory and run configure there, it's now possible to run everything from the build directory. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- autogen.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/autogen.sh b/autogen.sh index a04e4e6..ebe6fe2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -8,6 +8,14 @@ die() exit 1 } +curdir=$(pwd) +test "$curdir" || curdir=. + +srcdir=$(dirname "$0") +test "$srcdir" || srcdir=. + +cd "$srcdir" || die "Failed to cd into $srcdir" + echo "Running libtool ..." libtoolize --copy --force --automake || die @@ -31,6 +39,8 @@ else echo "0" > .revision fi +cd "$curdir" || die "Failed to cd into $curdir" + if test "$#" -eq 0; then echo "Running configure without arguments ..." echo "(If you want to pass any, specify them on the $0 command line)" -- 2.14.3

On Thu, Nov 16, 2017 at 06:12:53PM +0100, Andrea Bolognani wrote:
These changes are a requirement for porting the libvirt-cim CI jobs to autotools-*-job.
Andrea Bolognani (3): autogen: Better error handling autogen: Run configure automatically autogen: Support running out-of-tree
autogen.sh | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-)
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> 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 :|
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrange