if not os.path.exists(opts.destdir):
os.makedirs(opts.destdir)
-zip_checksum = create_update_file(opts.patch, repo_dir, opts.destdir, patch_id)
+zip_checksum = create_update_file(opts.patch, repo_dir, opts.destdir, patch_id)
+extra_meta = {'checksum': zip_checksum,
+ 'build-id': opts.new}
-update_metadata(opts.destdir, tmp_dir, patch, zip_checksum)
+update_metadata(opts.destdir, tmp_dir, patch, extra_meta)
# store patch metadata in patch dir, too
shutil.copy2(os.path.join(repo_dir, patch_id), os.path.join(patch_dir, 'patch.yaml'))
def _get_notice(self, update_id):
return update_id in self.pids
- def add_update(self, update, location, checksum):
+ def add_update(self, update, location, extra_meta):
"""
Generate the extended metadata for a given update
"""
self._insert(root, 'title', text=update['Title'])
self._insert(root, 'type', text=update['Type'])
self._insert(root, 'location', attrs={'href': location})
- self._insert(root, 'checksum', text=checksum)
self._insert(root, 'version', text=update['Release'])
+ for key, val in extra_meta.iteritems():
+ self._insert(root, key, text=val)
times = str(time.time()).split(".")
issued_time = times[0]
self._insert(root, 'issued', attrs={ 'date' : issued_time })
zip_checksum = get_checksum("%s/%s.zip" % (destination, patch_id))
return zip_checksum
-def update_metadata(destination, root, patch, zip_checksum):
+def update_metadata(destination, root, patch, extra_metadata):
# creates updates.xml
patch_id = patch['ID']
for fname in old_updates:
os.unlink(fname)
- up.add_update(patch, "%s.zip" %patch_id, zip_checksum)
+ up.add_update(patch, "%s.zip" %patch_id, extra_metadata)
# save to file
updates_xml = up.doc.toxml()
f = open("%s/updates.xml" % root, "w")