[libvirt] [PATCH 1/9] conf: eliminate hardcoded indent from all xml

Eric Blake eblake at redhat.com
Thu Mar 6 20:32:21 UTC 2014


On 03/06/2014 08:24 AM, Laine Stump wrote:

[0/9 in the subject line]

> Many of the domain xml format functions (including all of the device
> format functions) had hard-coded spaces, which made for incorrect
> indentation when those functions were called in a different context
> (for example, commit 2122cf39 added <interface> XML into the document
> provided to a network hook script, and in this case it should have
> been indented by 2 spaces, but was instead indented by 6 spaces).
> 
> In that patch I mentioned doing a followup patch to make the device
> xml formatters more consistent. After doing that patch, it felt
> incomplete to not give the same treatment to the entire directory.
> 
> The one downside to this series is that it may create merge conflicts
> during backports, but fortunately the conflicts should all be fairly
> easy to resolve.

Missing from this series:

qemuDomainObjPrivateXMLFormat in qemu_domain.c
qemuMigrationCookieGraphicsXMLFormat in qemu_migration.c

probably others.  Also, it would be a good idea to add a syntax check to
cfg.mk.  I'd suggest a rule something like:

sc_forbid_manual_xml_indent:
	@prohibit='virBuffer.*" +<'			\
	halt='use virBufferIndent when indenting xml'	\
	  $(_sc_search_regexp)

As I mentioned in the real 1/9, using local indentation is more compact
than using virBufferIndent, but makes it harder to enforce - so if we go
with your patches, a syntax check rule that enforces things will make it
so we don't slip into old habits.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140306/3a831a64/attachment-0001.sig>


More information about the libvir-list mailing list