Bug 552718

Summary: virt-inspector has non-standard/non-complete format for applications
Product: [Fedora] Fedora Reporter: James Antill <james.antill>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-01-06 04:43:51 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
virt-inspector description from a CentOS 5.4 guest none

Description James Antill 2010-01-05 17:45:19 EST
Description of problem:
 For the applications part of the virt-inspector dump, you print data like (from example2.xml):

1770       <application>
1771         <name>libguestfs</name>
1772         <version>1.0.68</version>
1773       </application>

...but this isn't enough information to specify which package of libguestfs you have. You need at least something like:

    $xml->startTag("applications");
    my @apps =  @{$os->{apps}};
    foreach (@apps) {
        $xml->startTag("application");
        $xml->dataElement("name", $_->{name});
        $xml->dataElement("epoch", $_->{epoch});
        $xml->dataElement("version", $_->{version});
        $xml->dataElement("release", $_->{release});
        $xml->dataElement("arch", $_->{arch});
        $xml->endTag("application");
    }
    $xml->endTag("applications");

...to be 100% you also want the checksums (and the yum version for the system would be nice), but you have a slight problem there in that you'd need to get it in _check_for_applications() first.
 Also: *cough* Calling rpm -qa --qf and using regexps to get the package list *cough*
Comment 1 James Antill 2010-01-05 17:48:51 EST
Also storing epoch internally as '' instead of '0' is a bad idea IMO, but for sure you want to either dump:

<name>blah</name>
<epoch>0</epoch>
<version>1</version>
<release>2</release>
<arch>2</arch>

...or:

<name>blah</name>
<version>1</version>
<release>2</release>
<arch>2</arch>
Comment 2 Richard W.M. Jones 2010-01-05 18:10:12 EST
Created attachment 381874 [details]
virt-inspector description from a CentOS 5.4 guest

James, can you check if the follow patch fixes this bug?

http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=a59dcdbd1b0a28c960e3792165a13f2daf4f6c35

Attached is an example of the virt-inspector XML output with
this patch applied.
Comment 3 James Antill 2010-01-05 18:55:12 EST
Looks great, thanks.
Comment 4 Richard W.M. Jones 2010-01-06 04:43:51 EST
Fixed upstream.