]> xenbits.xensource.com Git - people/dariof/osstest.git/commitdiff
ts-libvirt-build: use Osstest::BuildSupport::submodulefixup
authorIan Campbell <ian.campbell@citrix.com>
Mon, 5 Jan 2015 12:57:08 +0000 (12:57 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 5 Jan 2015 15:52:10 +0000 (15:52 +0000)
Instead of cloning gnulib manually which can break if upstream gnulib
gets ahead of libvirt.git (which applies patches on the fly etc). By
using submodulefixup we automatically DTRT and use the version of
gnulib specified by the libvirt.git submodule metadata, but with a
runvar override if necessary.

This also removes a whole bunch of faffing in ap-*, cr-daily-branch
and mfi-common to get the version of gnulib to use, which was always a
bit of a wart (ungated for one thing...).

We continue to use --no-git and GNULIB_SRCDIR because otherwise
autogen.sh (via bootstrap) will force its own version, overwriting
what submodulefixup has done. For this we need a way to get the hash
representing the module, so introduce submodule_find (and rework
submodule_have in terms of it).

Tested in standalone mode with build-amd64-libvirt and
build-amd64-rumpuserxen (because I touched submodule_have, AFAICT the
bodges were not run). The libvirt build was tested both with the
automatic revisions and with:
    revision_libvirt=2360fe5d24175835d3f5fd1c7e8e6e13addab629
    revision_libvirt_gnulib=16518d9ed8f25d3e53931dd1aa343072933e4604
(used in successful libvirt flight 32648), in both cases confirming
that the build used the desired versions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@citrix.com>
---
v2: Honour revision_libvirt_gnulib.
v3: Fix submodule_have, defined(&sub) is always true because defined
    is special wrt &sub.

Osstest/BuildSupport.pm
ap-common
ap-fetch-version
ap-fetch-version-old
ap-print-url
ap-push
cr-daily-branch
mfi-common
ts-libvirt-build

index 874e27e39abd495dfe9bd0f5c4741f9b2ebe15b8..933f6e13b70b014e70c0571f7ca997462d80092b 100644 (file)
@@ -43,7 +43,7 @@ BEGIN {
                       xendist
                       $xendist
 
-                      submodulefixup submodule_have
+                      submodulefixup submodule_have submodule_find
 
                       );
     %EXPORT_TAGS = ( );
@@ -145,9 +145,16 @@ sub submodulefixup ($$$$) {
     return \@submodules;
 }
 
-sub submodule_have ($$) {
+sub submodule_find ($$) {
     my ($submodules, $ourname) = @_;
-    return !!grep { $_->{OurName} eq $ourname } @$submodules;
+    my @submods = grep { $_->{OurName} eq $ourname } @$submodules;
+    return undef unless @submods;
+    die "more than one $ourname?" if @submods ne 1;
+    return $submods[0];
+}
+
+sub submodule_have ($$) {
+    return !!&submodule_find;
 }
 
 1;
index ff50754e3180f84c4de1bd6c0062250284cb598c..96cbd14573306d4f11b5a0655f82f0ac7308edda 100644 (file)
--- a/ap-common
+++ b/ap-common
@@ -37,8 +37,6 @@
 : ${PUSH_TREE_LIBVIRT:=$XENBITS:/home/xen/git/libvirt.git}
 : ${BASE_TREE_LIBVIRT:=git://xenbits.xen.org/libvirt.git}
 
-: ${TREE_GNULIB_LIBVIRT:=$(besteffort_repo git://git.sv.gnu.org/gnulib.git)}
-
 : ${TREE_RUMPUSERXEN:=https://github.com/rumpkernel/rumprun-xen}
 : ${TREEVCS_RUMPUSERXEN:=git}
 : ${BASE_TREE_RUMPUSERXEN:=git://xenbits.xen.org/rumpuser-xen.git}
@@ -77,7 +75,6 @@ fi
 : ${LOCALREV_XEN:=daily-cron.$branch}
 : ${LOCALREV_LINUX:=daily-cron.$branch}
 : ${LOCALREV_LIBVIRT:=daily-cron.$branch}
-: ${LOCALREV_GNULIB_LIBVIRT:=daily-cron.$branch}
 : ${LOCALREV_RUMPUSERXEN:=daily-cron.$branch}
 : ${LOCALREV_SEABIOS:=daily-cron.$branch}
 
index 9c189b47fc43035cf512f3151383fc8185a69af3..f6c65d8f18aaecb61083e858825e0695da2bb074 100755 (executable)
@@ -77,10 +77,6 @@ libvirt)
        repo_tree_rev_fetch_git libvirt \
                $TREE_LIBVIRT master $LOCALREV_LIBVIRT
        ;;
-gnulib-libvirt)
-       repo_tree_rev_fetch_git gnulib-libvirt \
-               $TREE_GNULIB_LIBVIRT master $LOCALREV_GNULIB_LIBVIRT
-       ;;
 rumpuserxen)
        repo_tree_rev_fetch_git rumpuserxen \
                $TREE_RUMPUSERXEN master $LOCALREV_RUMPUSERXEN
index f3cf339baf1046ed49ebc7a2896b64b429b68a92..43c997c0bf826080e77e7c807be24278e19b4bad 100755 (executable)
@@ -88,10 +88,6 @@ rumpuserxen)
        repo_tree_rev_fetch_git rumpuserxen \
                $BASE_TREE_RUMPUSERXEN xen-tested-master $BASE_LOCALREV_RUMPUSERXEN
        ;;
-gnulib-libvirt)
-       # No push gate, same as ap-fetch-version
-       ./ap-fetch-version $branch
-       ;;
 seabios)
        repo_tree_rev_fetch_git seabios \
                $BASE_TREE_SEABIOS xen-tested-master $BASE_LOCALREV_SEABIOS
index a14d2a60a42d00d7d3d88afa2b279be47d7df932..7b27e1ef36b343f050d3b5b7f92317c14faccb4b 100755 (executable)
@@ -52,9 +52,6 @@ linuxfirmware)
 libvirt)
        echo $TREE_LIBVIRT
        ;;
-gnulib-libvirt)
-       echo $TREE_GNULIB_LIBVIRT
-       ;;
 rumpuserxen)
        echo $TREE_RUMPUSERXEN
        ;;
diff --git a/ap-push b/ap-push
index 9df900a1d0f5083ee5d5c8bbbf4ba6f181ac112c..a2aa7473bffd749d4e94fc4621a8a820e35b20ac 100755 (executable)
--- a/ap-push
+++ b/ap-push
@@ -88,11 +88,6 @@ rumpuserxen)
        cd $repos/rumpuserxen
        git push $TREE_RUMPUSERXEN $revision:xen-tested-master
        ;;
-gnulib-libvirt)
-       # No gate
-       echo "gnulib-libvirt has not push gate, refusing to push" >&2
-       exit 1
-       ;;
 seabios)
        cd $repos/seabios
        git push $TREE_SEABIOS $revision:refs/heads/xen-tested-master
index 17bb2c9bf65110a09c728dff5acb1c53214decd8..fc663cebb567753f4cdbf35afdb0b619164828e7 100755 (executable)
@@ -150,10 +150,6 @@ if [ "x$REVISION_LIBVIRT" = x ]; then
        determine_version REVISION_LIBVIRT libvirt LIBVIRT
        export REVISION_LIBVIRT
 fi
-if [ "x$REVISION_GNULIB_LIBVIRT" = x ]; then
-       determine_version REVISION_GNULIB_LIBVIRT gnulib-libvirt GNULIB_LIBVIRT
-       export REVISION_GNULIB_LIBVIRT
-fi
 if [ "x$REVISION_RUMPUSERXEN" = x ]; then
        determine_version REVISION_RUMPUSERXEN rumpuserxen RUMPUSERXEN
        export REVISION_RUMPUSERXEN
index 5c4f5d5192611321e00a6742f3b0636a65a2f7ef..e16760649879338eaef709d52a5d4b7c0211dbb3 100644 (file)
@@ -187,7 +187,6 @@ create_build_jobs () {
                 host_hostflags=$build_hostflags                              \
                 buildjob=${bfi}build-$arch                                   \
                 tree_libvirt=$TREE_LIBVIRT revision_libvirt=$REVISION_LIBVIRT\
-                tree_gnulib_libvirt=$TREE_GNULIB_LIBVIRT revision_gnulib_libvirt=$REVISION_GNULIB_LIBVIRT\
 
     fi
 
index 940c0341e1229640a20e03d09966774cb3271507..8c5d1fcbd2c1f18df50f402b14ded05633f4e211 100755 (executable)
@@ -25,6 +25,9 @@ tsreadconfig();
 selectbuildhost(\@ARGV);
 builddirsprops();
 
+our %submodmap = qw(gnulib gnulib);
+our $submodules;
+
 sub libvirtd_init ();
 
 sub checkout () {
@@ -32,7 +35,7 @@ sub checkout () {
     xendist();
 
     build_clone($ho, 'libvirt', $builddir, 'libvirt');
-    build_clone($ho, 'gnulib_libvirt', $builddir, 'gnulib-libvirt');
+    $submodules = submodulefixup($ho, 'libvirt', 'libvirt', \%submodmap);
 }
 
 sub config() {
@@ -45,13 +48,17 @@ sub config() {
     }
     die "no xen prefix" unless $xenprefix;
 
-    # Uses $GNULIB_SRCDIR because ./autogen.sh doesn't propagate
-    # --gnulib-srcdir to ./bootstap.
+    # Uses --no-git because otherwise autogen.sh will undo
+    # submodulefixup's attempts to honour
+    # revision_libvirt_gnulib. This in turn requires that we specify
+    # --gnulib-srcdir, but ./autogen.sh doesn't propagate
+    # --gnulib-srcdir to ./bootstap so we use GNULIB_SRCDIR directly.
+    my $gnulib = submodule_find($submodules, "gnulib");
     target_cmd_build($ho, 3600, $builddir, <<END);
         cd libvirt
         CFLAGS="-I$xenprefix/include/" \\
         LDFLAGS="-L$xenprefix/lib/ -Wl,-rpath-link=$xenprefix/lib/" \\
-       GNULIB_SRCDIR=$builddir/gnulib-libvirt \\
+        GNULIB_SRCDIR=$builddir/libvirt/$gnulib->{Path} \\
             ./autogen.sh --no-git \\
                          --with-libxl --without-xen --without-xenapi --without-selinux \\
                          --without-lxc --without-vbox --without-uml \\
@@ -83,15 +90,10 @@ END
 END
 }
 
-sub collectversion_gnulib () {
-    store_revision($ho, 'gnulib_libvirt', "$builddir/gnulib-libvirt", 1);
-}
-
 checkout();
 config();
 build();
 install();
-collectversion_gnulib();
 built_stash($ho, $builddir, 'dist', 'libvirtdist');
 
 sub libvirtd_init () {