prettify xml output of modifyrepo

Christoph Thiel <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
Hi folks,

please commit the attached modifyrepo-prettyxml.patch


Thanks,
Christoph
-- 
Christoph Thiel, Tech. Project Management, Research & Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)

_______________________________________________
Rpm-metadata mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
modifyrepo-prettyxml.patch (text/x-patch, 1.5 KB)
--- modifyrepo.py
+++ modifyrepo.py
@@ -92,16 +92,25 @@
 
         ## Build the metadata
         root = self.doc.firstChild
+        root.appendChild(self.doc.createTextNode("  "))
         data = self._insert_element(root, 'data', attrs={ 'type' : mdtype })
+        data.appendChild(self.doc.createTextNode("\n    "))
+
         self._insert_element(data, 'location',
                              attrs={ 'href' : 'repodata/' + mdname })
+        data.appendChild(self.doc.createTextNode("\n    "))
         self._insert_element(data, 'checksum', attrs={ 'type' : 'sha' },
                              text=sha.new(newmd).hexdigest())
+        data.appendChild(self.doc.createTextNode("\n    "))
         self._insert_element(data, 'timestamp',
                              text=str(os.stat(destmd).st_mtime))
+        data.appendChild(self.doc.createTextNode("\n    "))
         self._insert_element(data, 'open-checksum', attrs={ 'type' : 'sha' },
                              text=sha.new(md).hexdigest())
 
+        data.appendChild(self.doc.createTextNode("\n  "))
+        root.appendChild(self.doc.createTextNode("\n"))
+
         print "           type =", mdtype 
         print "       location =", 'repodata/' + mdname
         print "       checksum =", sha.new(newmd).hexdigest()
@@ -111,6 +120,7 @@
         ## Write the updated repomd.xml
         outmd = file(self.repomdxml, 'w')
         self.doc.writexml(outmd)
+        outmd.write("\n")
         outmd.close()
         print "Wrote:", self.repomdxml
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.