From e38829eec1f9795f1613b94a711d61575286591d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 18 Mar 2021 12:26:27 +0000 Subject: [PATCH] Drop dependency on perl(Sys::Virt). --- ...-tests-Remove-dependency-on-Sys-Virt.patch | 180 ++++++++++++++++++ libguestfs.spec | 13 +- 2 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 0001-tests-Remove-dependency-on-Sys-Virt.patch diff --git a/0001-tests-Remove-dependency-on-Sys-Virt.patch b/0001-tests-Remove-dependency-on-Sys-Virt.patch new file mode 100644 index 0000000..d8e3dab --- /dev/null +++ b/0001-tests-Remove-dependency-on-Sys-Virt.patch @@ -0,0 +1,180 @@ +From 061be6bb84b83ecfac9f647dccab847a7937fbcf Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 18 Mar 2021 12:15:01 +0000 +Subject: [PATCH] tests: Remove dependency on Sys::Virt. + +This was only used for a single rule (check-valgrind-local-guests) +which ran "make check-valgrind" on local guests. This was never +really used by me and was fairly inadvisable anyway, so we can easily +remove it and thus remove the dependency on perl Sys::Virt. +--- + .gitignore | 1 - + Makefile.am | 11 ------- + configure.ac | 2 -- + docs/guestfs-building.pod | 4 --- + m4/guestfs-perl.m4 | 2 +- + pick-guests.pl.in | 63 --------------------------------------- + 6 files changed, 1 insertion(+), 82 deletions(-) + delete mode 100755 pick-guests.pl.in + +diff --git a/.gitignore b/.gitignore +index 2c8bd36dc..b81b4317c 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -365,7 +365,6 @@ Makefile.in + /php/extension/tests/guestfs_*.sh + /php/extension/tests/guestfs_090_bindtests.phpt + /php/extension/tmp-php.ini +-/pick-guests.pl + /po-docs/*/*.1 + /po-docs/*/*.3 + /po-docs/*/*.5 +diff --git a/Makefile.am b/Makefile.am +index 91f33e8d7..d4424af1e 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -368,7 +368,6 @@ check-all: + $(MAKE) -j1 \ + check \ + check-valgrind \ +- check-valgrind-local-guests \ + check-direct \ + check-valgrind-direct \ + check-uml \ +@@ -394,15 +393,6 @@ check-valgrind: build-test-guests + done; \ + exit $$(( $$errors ? 1 : 0 )) + +-check-valgrind-local-guests: +- @GUESTS=`$(top_builddir)/run ./pick-guests.pl 5`; \ +- errors=0; \ +- for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \ +- echo $(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@; \ +- $(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || (( errors++ )); \ +- done; \ +- exit $$(( $$errors ? 1 : 0 )) +- + check-direct: + @backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \ + if [ "$$backend" != "direct" ]; then \ +@@ -576,7 +566,6 @@ help: + @echo "make -k check ... and display all errors at once." + @echo + @echo "make check-valgrind Run a subset of the tests under valgrind." +- @echo "make check-valgrind-local-guests Test under valgrind using local guests." + @echo "make check-direct Test using direct backend." + @echo "make check-valgrind-direct Test valgrind + direct backend." + @echo "make check-uml Test using User-Mode Linux." +diff --git a/configure.ac b/configure.ac +index 66f29aa23..165bb4c43 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -205,8 +205,6 @@ AC_CONFIG_FILES([ocaml-link.sh], + [chmod +x,-w ocaml-link.sh]) + AC_CONFIG_FILES([php/extension/php-for-tests.sh], + [chmod +x,-w php/extension/php-for-tests.sh]) +-AC_CONFIG_FILES([pick-guests.pl], +- [chmod +x,-w pick-guests.pl]) + AC_CONFIG_FILES([podwrapper.pl], + [chmod +x,-w podwrapper.pl]) + AC_CONFIG_FILES([run], +diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod +index b83aea280..5870ed74b 100644 +--- a/docs/guestfs-building.pod ++++ b/docs/guestfs-building.pod +@@ -372,10 +372,6 @@ Optional. Used to build the Go bindings. + + Optional. For testing memory problems. + +-=item Perl C +- +-Optional. +- + =item libvirt-python + + Optional. For testing Python libvirt/libguestfs interactions. +diff --git a/m4/guestfs-perl.m4 b/m4/guestfs-perl.m4 +index 4c889d843..c8337ed9b 100644 +--- a/m4/guestfs-perl.m4 ++++ b/m4/guestfs-perl.m4 +@@ -66,7 +66,7 @@ AM_CONDITIONAL([HAVE_PERL], + dnl Check for Perl modules needed by Perl virt tools (virt-df, etc.) + AS_IF([test "x$PERL" != "xno"],[ + missing_perl_modules=no +- for pm in Pod::Usage Getopt::Long Sys::Virt Locale::TextDomain Win::Hivex Win::Hivex::Regedit ; do ++ for pm in Pod::Usage Getopt::Long Locale::TextDomain Win::Hivex Win::Hivex::Regedit ; do + AC_MSG_CHECKING([for $pm]) + if ! $PERL -M$pm -e1 >&AS_MESSAGE_LOG_FD 2>&1; then + AC_MSG_RESULT([no]) +diff --git a/pick-guests.pl.in b/pick-guests.pl.in +deleted file mode 100755 +index e96e33a9c..000000000 +--- a/pick-guests.pl.in ++++ /dev/null +@@ -1,63 +0,0 @@ +-#!/usr/bin/env perl +-# @configure_input@ +-# Copyright (C) 2009-2020 Red Hat Inc. +-# +-# This program is free software; you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation; either version 2 of the License, or +-# (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +- +-# Pick guests at random on the local machine which are accessible. +-# This is used by 'make check-valgrind-local-guests'. +- +-use strict; +-use warnings; +- +-use Sys::Guestfs; +-use Sys::Virt; +-use List::Util qw(shuffle); +- +-die "$0 nr-guests\n" unless @ARGV == 1; +-my $n = $ARGV[0]; +- +-my $vmm = Sys::Virt->new (uri => '@libvirt_ro_uri@'); +-my @domains = ($vmm->list_domains, $vmm->list_defined_domains); +- +-# Only guests which are accessible by the current (non-root) user. On +-# the machine where I run these tests, I have added my user account to +-# the 'disk' group, so that most guests are accessible. However +-# because libvirt changes the permissions on guest disks, a guest +-# which has been run on the machine becomes inaccessible, hence the +-# need for this code - RWMJ. +-my @accessible; +-foreach my $dom (@domains) { +- my $name = $dom->get_name; +- my $g = Sys::Guestfs->new; +- eval { +- $g->add_domain ($name, readonly => 1, +- libvirturi => '@libvirt_ro_uri@'); +- # $g->launch (); - don't actually need to do this +- }; +- push @accessible, $name unless $@; +-} +- +-# Randomize the list of guests. +-@accessible = shuffle (@accessible); +- +-$n = @accessible if @accessible < $n; +- +-# Return the first n guests from the list. +-for (my $i = 0; $i < $n; ++$i) { +- print " " if $i > 0; +- print $accessible[$i]; +-} +-print "\n"; +-- +2.29.0.rc2 + diff --git a/libguestfs.spec b/libguestfs.spec index 0c609d8..788be61 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -41,7 +41,7 @@ %global verify_tarball_signature 1 # If there are patches which touch autotools files, set this to 1. -%global patches_touch_autotools %{nil} +%global patches_touch_autotools 1 # The source directory. %global source_directory 1.45-development @@ -56,7 +56,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.45.1 -Release: 4%{?dist} +Release: 5%{?dist} License: LGPLv2+ # Build only for architectures that have a kernel @@ -86,9 +86,12 @@ Source7: libguestfs.keyring # Maintainer script which helps with handling patches. Source8: copy-patches.sh -# Trivial fix for PHP 8 +# Trivial fix for PHP 8 (upstream in libguestfs >= 1.45.2) Patch0: %{name}-php8.patch +# Remove dependency on perl(Sys::Virt) (upstream in libguestfs >= 1.45.2) +Patch1: 0001-tests-Remove-dependency-on-Sys-Virt.patch + %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool, gettext-devel %endif @@ -166,7 +169,6 @@ BuildRequires: lua-devel BuildRequires: perl-devel BuildRequires: perl-generators BuildRequires: perl-macros -BuildRequires: perl(Sys::Virt) BuildRequires: perl(Test::More) BuildRequires: perl(Test::Pod) >= 1.00 BuildRequires: perl(Test::Pod::Coverage) >= 1.00 @@ -1308,6 +1310,9 @@ rm ocaml/html/.gitignore %changelog +* Thu Mar 18 2021 Richard W.M. Jones - 1:1.45.1-5 +- Drop dependency on perl(Sys::Virt). + * Wed Mar 10 2021 Richard W.M. Jones - 1:1.45.1-4 - Drop Requires: libvirt-daemon-kvm, pulls in the whole of qemu and subpkgs.