test-data/phony-guests: Fix phony RPM database, fix virt-inspector test.

libguestfs 1.45.3 now reads the RPM database using librpm, which means
our old phony database created by db_dump can no longer work.  Instead
provide a real (but very minimal) sqlite database.

This commit also fixes the virt-inspector test since the RPM database
contents are now different.

(cherry picked from commit 42e5e7cfdb)
This commit is contained in:
Richard W.M. Jones
2021-03-29 12:22:12 +01:00
parent 3ce392c987
commit 87917f9bb9
7 changed files with 20 additions and 51 deletions

3
.gitignore vendored
View File

@@ -580,8 +580,7 @@ Makefile.in
/test-data/phony-guests/fedora-luks.img
/test-data/phony-guests/fedora-md1.img
/test-data/phony-guests/fedora-md2.img
/test-data/phony-guests/fedora-name.db
/test-data/phony-guests/fedora-packages.db
/test-data/phony-guests/fedora.db
/test-data/phony-guests/guests.xml
/test-data/phony-guests/guests-all-good.xml
/test-data/phony-guests/stamp-fedora-md.img

View File

@@ -63,6 +63,9 @@ AC_CHECK_PROG([PO4A_GETTEXTIZE],[po4a-gettextize],[po4a-gettextize],[no])
AC_CHECK_PROG([PO4A_TRANSLATE],[po4a-translate],[po4a-translate],[no])
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A_GETTEXTIZE" != "xno" && test "x$PO4A_TRANSLATE" != "xno"])
dnl Check for sqlite3 (optional).
AC_CHECK_PROG([SQLITE3],[sqlite3],[sqlite3],[no])
dnl Check for netpbm programs (optional).
AC_PATH_PROGS([PBMTEXT],[pbmtext],[no])
AC_PATH_PROGS([PNMTOPNG],[pnmtopng],[no])

View File

@@ -23,10 +23,8 @@ EXTRA_DIST = \
debian-syslog \
make-fedora-img.pl \
fedora-journal.tar.xz \
fedora-name.db.txt \
fedora-name.db \
fedora-packages.db.txt \
fedora-packages.db \
fedora-db.sql.xz \
fedora.db \
make-ubuntu-img.sh \
make-archlinux-img.sh \
archlinux-package \
@@ -78,8 +76,7 @@ blank-%.img:
# Make a (dummy) Fedora image.
fedora.img: make-fedora-img.pl \
fedora-journal.tar.xz \
fedora-name.db \
fedora-packages.db
fedora.db
SRCDIR=$(srcdir) LAYOUT=partitions $(top_builddir)/run --test ./$<
# Make a (dummy) Fedora image using md devices
@@ -87,8 +84,7 @@ fedora-md1.img fedora-md2.img: stamp-fedora-md.img
stamp-fedora-md.img: make-fedora-img.pl \
fedora-journal.tar.xz \
fedora-name.db \
fedora-packages.db
fedora.db
rm -f $@
SRCDIR=$(srcdir) LAYOUT=partitions-md $(top_builddir)/run --test ./$<
touch $@
@@ -97,15 +93,13 @@ stamp-fedora-md.img: make-fedora-img.pl \
# for root and home.
fedora-btrfs.img: make-fedora-img.pl \
fedora-journal.tar.xz \
fedora-name.db \
fedora-packages.db
fedora.db
SRCDIR=$(srcdir) LAYOUT=btrfs $(top_builddir)/run --test ./$<
# Make a (dummy) Fedora image with LVM encrypted with LUKS.
fedora-luks.img: make-fedora-img.pl \
fedora-journal.tar.xz \
fedora-name.db \
fedora-packages.db
fedora.db
SRCDIR=$(srcdir) LAYOUT=lvm-luks $(top_builddir)/run --test ./$<
# Make a (dummy) Debian image.
@@ -138,14 +132,9 @@ guests-all-good.xml: make-guests-all-good.pl $(disk_images)
# Since users might not have the tools needed to create this, we also
# distribute these files and they are only cleaned by 'make distclean'
# not regular 'make clean'.
fedora-name.db: fedora-name.db.txt
fedora.db: fedora-db.sql.xz
rm -f $@ $@-t
$(DB_LOAD) $@-t < $<
mv $@-t $@
fedora-packages.db: fedora-packages.db.txt
rm -f $@ $@-t
$(DB_LOAD) $@-t < $<
xzcat $< | $(SQLITE3) $@-t
mv $@-t $@
windows-software: windows-software.reg
@@ -161,8 +150,7 @@ windows-system: windows-system.reg
mv $@-t $@
DISTCLEANFILES += \
fedora-name.db \
fedora-packages.db \
fedora.db \
windows-software \
windows-system

Binary file not shown.

View File

@@ -1,13 +0,0 @@
VERSION=3
format=print
type=hash
h_nelem=3
db_pagesize=4096
HEADER=END
test1
\01\00\00\00\00\00\00\00
test2
\02\00\00\00\00\00\00\00
test3
\03\00\00\00\00\00\00\00
DATA=END

View File

@@ -1,13 +0,0 @@
VERSION=3
format=print
type=hash
h_nelem=3
db_pagesize=4096
HEADER=END
\01\00\00\00
\00\00\00\03\00\00\00\11\00\00\03\e9\00\00\00\00\00\00\00\00\00\00\00\00\00\00\03\ea\00\00\00\00\00\00\00\04\00\00\00\00\00\00\03\fe\00\00\00\00\00\00\00\0b\00\00\00\001.0\001.fc14\00x86_64\00
\02\00\00\00
\00\00\00\03\00\00\00\11\00\00\03\e9\00\00\00\00\00\00\00\00\00\00\00\00\00\00\03\ea\00\00\00\00\00\00\00\04\00\00\00\00\00\00\03\fe\00\00\00\00\00\00\00\0b\00\00\00\002.0\002.fc14\00x86_64\00
\03\00\00\00
\00\00\00\03\00\00\00\11\00\00\03\e9\00\00\00\00\00\00\00\00\00\00\00\00\00\00\03\ea\00\00\00\00\00\00\00\04\00\00\00\00\00\00\03\fe\00\00\00\00\00\00\00\0b\00\00\00\003.0\003.fc14\00x86_64\00
DATA=END

View File

@@ -246,6 +246,7 @@ $g->mkdir ('/usr/share/zoneinfo');
$g->mkdir ('/usr/share/zoneinfo/Europe');
$g->touch ('/usr/share/zoneinfo/Europe/London');
$g->mkdir_p ('/var/lib/rpm');
$g->mkdir_p ('/usr/lib/rpm');
$g->mkdir_p ('/var/log/journal');
$g->write ('/etc/shadow', "root::15440:0:99999:7:::\n");
@@ -264,8 +265,12 @@ if (-f "fedora.mdadm") {
unlink ("fedora.mdadm") or die;
}
$g->upload ($ENV{SRCDIR}.'/fedora-name.db', '/var/lib/rpm/Name');
$g->upload ($ENV{SRCDIR}.'/fedora-packages.db', '/var/lib/rpm/Packages');
$g->upload ($ENV{SRCDIR}.'/fedora.db', '/var/lib/rpm/rpmdb.sqlite');
$g->touch ('/usr/lib/rpm/rpmrc');
$g->write ('/usr/lib/rpm/macros', <<EOF);
%_dbpath /var/lib/rpm
%_db_backend sqlite
EOF
$g->upload ($ENV{SRCDIR}.'/../binaries/bin-x86_64-dynamic', '/bin/ls');