Better way to this ?? Query database to xml
Valery Reznic
valery_reznic at yahoo.com
Sun Apr 5 10:57:50 UTC 2009
--- On Sun, 4/5/09, Michael A. Peters <mpeters at mac.com> wrote:
> From: Michael A. Peters <mpeters at mac.com>
> Subject: Better way to this ?? Query database to xml
> To: "General discussion about the RPM package manager" <rpm-list at lists.rpm.org>
> Date: Sunday, April 5, 2009, 1:40 PM
> The ugly string
>
> rpm -qa --qf '<package name="%{name}">\n \
> <epoch>%{epoch}</epoch>\n \
> <version>%{version}</version>\n \
> <release>%{release}</release>\n \
> <arch>%{arch}</arch> \
> <summary>%{summary}</summary>\n
> <vendor>%{vendor}</vendor>\n</package>\n'
>
> The issue - it can produce malformed xml because vendor
> string can and does sometimes contain < and >
>
> I'm thinking there probably is a better to do it with
> python straight from the database? Maybe even something
> already exists for this?
There is a --xml flag for rpm.
Or another option something like this (to make string even more ugly :)
rpm -qa --qf '@MY_SMALL at package name="%{name}"@MY_BIG@\n ...' |
sed -e 's/</</g' -e 's/>/>g' -e 's/@MY_SMALL@/</g' -e 's/@MY_BIG@/>/g'
Valery.
> _______________________________________________
> Rpm-list mailing list
> Rpm-list at lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-list
>
More information about the Rpm-list
mailing list