inspector: Make RPM application data more specific (RHBZ#552718).
authorRichard Jones <rjones@redhat.com>
Tue, 5 Jan 2010 23:04:57 +0000 (23:04 +0000)
committerRichard Jones <rjones@redhat.com>
Tue, 5 Jan 2010 23:04:57 +0000 (23:04 +0000)
List applications with epoch, release and arch data.

If epoch is 0, don't store this as an empty string, but as
undefined, and don't output empty <epoch/> element in the XML.

inspector/virt-inspector
perl/lib/Sys/Guestfs/Lib.pm

index d000510..cb892c0 100755 (executable)
@@ -519,7 +519,10 @@ sub output_xml_os
     foreach (@apps) {
         $xml->startTag("application");
         $xml->dataElement("name", $_->{name});
+        $xml->dataElement("epoch", $_->{epoch}) if defined $_->{epoch};
         $xml->dataElement("version", $_->{version});
+        $xml->dataElement("release", $_->{release});
+        $xml->dataElement("arch", $_->{arch});
         $xml->endTag("application");
     }
     $xml->endTag("applications");
index c97fae3..49c08b3 100644 (file)
@@ -1426,7 +1426,7 @@ sub _check_for_applications
             foreach (@lines) {
                 if (m/^(.*) (.*) (.*) (.*) (.*)$/) {
                     my $epoch = $2;
-                    $epoch = "" if $epoch eq "(none)";
+                    undef $epoch if $epoch eq "(none)";
                     my $app = {
                         name => $1,
                         epoch => $epoch,