Detect if network is available.

- libguestfs_buildnet macro no longer needed.
This commit is contained in:
Richard W.M. Jones 2013-04-02 14:30:45 +01:00
parent ae9c6c49db
commit e198455d64

View File

@ -1,15 +1,3 @@
# If you have trouble building locally ('make local') try adding
# %libguestfs_buildnet 1
# to your ~/.rpmmacros file.
# Enable to build using a network repo
# Default is disabled
%if %{defined libguestfs_buildnet}
%global buildnet %{libguestfs_buildnet}
%else
%global buildnet 0
%endif
# Enable to run tests during check # Enable to run tests during check
# Default is enabled # Default is enabled
%if %{defined libguestfs_runtests} %if %{defined libguestfs_runtests}
@ -217,6 +205,7 @@ Requires: zfs-fuse
# These are only required if you want to build the bindings for # These are only required if you want to build the bindings for
# different languages: # different languages:
BuildRequires: /usr/bin/ping
BuildRequires: perl-devel BuildRequires: perl-devel
BuildRequires: perl(Test::More) BuildRequires: perl(Test::More)
BuildRequires: perl(Test::Pod) >= 1.00 BuildRequires: perl(Test::Pod) >= 1.00
@ -687,39 +676,39 @@ grep -Ev '\budev\b' < appliance/packagelist.in.orig > appliance/packagelist.in
%build %build
%if %{buildnet} # Test if network is available.
%define extra %{nil} if ping -c 3 -w 20 8.8.8.8; then
%else extra=
mkdir repo else
find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 cp -t repo mkdir repo
createrepo repo find /var/cache/yum -type f -name '*.rpm' -print0 | xargs -0 cp -t repo
cat > yum.conf <<EOF createrepo repo
[main] cat > yum.conf <<EOF
cachedir=/var/cache/yum [main]
debuglevel=1 cachedir=/var/cache/yum
logfile=/var/log/yum.log debuglevel=1
retries=20 logfile=/var/log/yum.log
obsoletes=1 retries=20
gpgcheck=0 obsoletes=1
assumeyes=1 gpgcheck=0
reposdir=/dev/null assumeyes=1
reposdir=/dev/null
[local] [local]
name=local name=local
baseurl=file://$(pwd)/repo baseurl=file://$(pwd)/repo
failovermethod=priority failovermethod=priority
enabled=1 enabled=1
gpgcheck=0 gpgcheck=0
EOF EOF
%define extra --with-supermin-packager-config=$(pwd)/yum.conf extra=--with-supermin-packager-config=$(pwd)/yum.conf
%endif fi
%{configure} \ %{configure} \
--with-default-attach-method=libvirt \ --with-default-attach-method=libvirt \
--with-extra="fedora=%{fedora},release=%{release},libvirt" \ --with-extra="fedora=%{fedora},release=%{release},libvirt" \
--with-qemu="qemu-kvm qemu-system-%{_build_arch} qemu" \ --with-qemu="qemu-kvm qemu-system-%{_build_arch} qemu" \
--enable-install-daemon \ --enable-install-daemon \
%{extra} $extra
# 'INSTALLDIRS' ensures that Perl and Ruby libs are installed in the # 'INSTALLDIRS' ensures that Perl and Ruby libs are installed in the
# vendor dir not the site dir. # vendor dir not the site dir.