[Rpm-metadata] Branch 'maintenance' - dumpMetadata.py modifyrepo.py
Seth Vidal
skvidal at linux.duke.edu
Wed Dec 5 20:05:00 UTC 2007
dumpMetadata.py | 20 ++++++++++++++------
modifyrepo.py | 10 ++++++++++
2 files changed, 24 insertions(+), 6 deletions(-)
New commits:
commit 3277ad57a11302a461b3aae3c2ded4b9b3520464
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Dec 5 15:04:29 2007 -0500
merge patches from christoph thiel and florian laroche:
christoph: make modifyrepo modifications be pretty xml
florian: sort file and deps so multiple runs can be more easily diff'd
diff --git a/dumpMetadata.py b/dumpMetadata.py
index 723bb6d..84df6a1 100644
--- a/dumpMetadata.py
+++ b/dumpMetadata.py
@@ -406,7 +406,9 @@ class RpmMetaData:
except TypeError:
del u # move on to the next method
else:
- return u.keys()
+ ret = u.keys()
+ ret.sort()
+ return ret
# We can't hash all the elements. Second fastest is to sort,
# which brings the equal elements together; then duplicates are
@@ -503,7 +505,7 @@ class RpmMetaData:
for glob in self.filerc:
if glob.match(item):
returns[item] = 1
- return returns
+ return returns.keys()
def usefulGhosts(self):
"""search for useful ghost file names"""
@@ -514,7 +516,7 @@ class RpmMetaData:
for glob in self.filerc:
if glob.match(item):
returns[item] = 1
- return returns
+ return returns.keys()
def usefulDirs(self):
@@ -712,16 +714,22 @@ def generateXML(doc, node, formatns, rpmObj, sumtype):
if prereq == 1:
entry.newProp('pre', str(prereq))
- for file in rpmObj.usefulFiles():
+ ff = rpmObj.usefulFiles()
+ ff.sort()
+ for file in ff:
files = format.newChild(None, 'file', None)
file = utf8String(file)
files.addContent(file)
- for directory in rpmObj.usefulDirs():
+ ff = rpmObj.usefulDirs()
+ ff.sort()
+ for directory in ff:
files = format.newChild(None, 'file', None)
directory = utf8String(directory)
files.addContent(directory)
files.newProp('type', 'dir')
- for directory in rpmObj.usefulGhosts():
+ ff = rpmObj.usefulGhosts()
+ ff.sort()
+ for directory in ff:
files = format.newChild(None, 'file', None)
directory = utf8String(directory)
files.addContent(directory)
diff --git a/modifyrepo.py b/modifyrepo.py
index 30abe1c..e00da18 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -92,16 +92,25 @@ class RepoMetadata:
## 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 @@ class RepoMetadata:
## Write the updated repomd.xml
outmd = file(self.repomdxml, 'w')
self.doc.writexml(outmd)
+ outmd.write("\n")
outmd.close()
print "Wrote:", self.repomdxml
More information about the Rpm-metadata
mailing list