tests/guests: Fix RPM database in phony Fedora guest.

Fix the Name and Packages database so it looks enough like a modern
RPM database to fool inspection.  I'm not sure whether or not the old
version ever worked, but it doesn't work now.

The format is not documented, but in brief:

The Name database contains (Name, link) pairs.  The link is an
arbitrary 32 bit integer.

The Packages database contains (link, RPM-blob) pairs.

The RPM-blob is a binary blob formatted like this:

 * Number of fields               4 bytes, big endian
 * Size in bytes of the store     4 bytes, big endian
 * Field descriptions:
     list of (RPMTAG, 0, offset in store, 0)
                                  4 * 4 * nr_fields bytes, big endian
 * The store                      binary data containing ASCIIZ strings

For the values of RPMTAG_* that we understand, see src/inspect-apps.c.
This commit is contained in:
Richard W.M. Jones
2014-08-13 13:07:28 +01:00
parent f0b71818a6
commit 5b6a2e68b8
3 changed files with 29 additions and 10 deletions

View File

@@ -28,6 +28,25 @@
<uuid>01234567-0123-0123-0123-012345678901</uuid>
</filesystem>
</filesystems>
<applications/>
<applications>
<application>
<name>test1</name>
<version>1.0</version>
<release>1.fc14</release>
<arch>x86_64</arch>
</application>
<application>
<name>test2</name>
<version>2.0</version>
<release>2.fc14</release>
<arch>x86_64</arch>
</application>
<application>
<name>test3</name>
<version>3.0</version>
<release>3.fc14</release>
<arch>x86_64</arch>
</application>
</applications>
</operatingsystem>
</operatingsystems>

View File

@@ -5,9 +5,9 @@ h_nelem=3
db_pagesize=4096
HEADER=END
test1
!\0b\00\00\00\00\00\00
\01\00\00\00\00\00\00\00
test2
7\0b\00\00\00\00\00\00
\02\00\00\00\00\00\00\00
test3
\dd\0c\00\00\00\00\00\00
\03\00\00\00\00\00\00\00
DATA=END

View File

@@ -4,10 +4,10 @@ type=hash
h_nelem=3
db_pagesize=4096
HEADER=END
!\0b\00\00
\00test1\001.0\001.fc14\00
7\0b\00\00
\00test2\002.0\002.fc14\00
\dd\0c\00\00
\00test3\003.0\003.fc14\00
\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