Add generation index-user

parent 1b14ed2802
commit 4a63656587

@ -223,7 +223,8 @@ class Builder(Update):
def update_http_meta(self, dn):
"""
Обновить индексный файл для lxc-download (meta/1.0/index-system)
Обновить индексные файлы для lxc-download (meta/1.0/index-user,
index-system)
:param dn:
:return:
"""
@ -260,57 +261,60 @@ class Builder(Update):
products_data = {}
filesize = lambda x: os.stat(x).st_size
with writeFile(path.join(dn, 'meta/1.0/index-system')) as f:
for k, grps in groupby(data, lambda x: (x['dist'],
x['release'],
x['arch'],
x['variant'])):
info = grps.next()
dist_key = "{dist}:{release}:{arch}:{variant}".format(**info)
try:
f.write("{dist};{release};{arch};"
"{variant};{build};{fn}\n".format(**info))
aliases = ("{dist}/{release}/{variant},"
"{dist}/{release}".format(**info))
root_tar_xz_rel = path.join(info["fn"], "rootfs.tar.xz")
root_tar_xz = path.join(path.dirname(dn), root_tar_xz_rel)
lxd_tar_xz_rel = path.join(info["fn"], "lxd.tar.xz")
lxd_tar_xz = path.join(path.dirname(dn), lxd_tar_xz_rel)
combined_sha256 = sha256sum(root_tar_xz, lxd_tar_xz)
product = {
"aliases": aliases,
"versions": {
info["build"]: {
"items": {
"root.tar.xz": {
"ftype": "root.tar.xz",
"sha256": sha256sum(root_tar_xz),
"size": filesize(root_tar_xz),
"path": root_tar_xz_rel,
},
"lxd.tar.xz": {
"ftype": "lxd.tar.xz",
"size": filesize(lxd_tar_xz),
"sha256": sha256sum(lxd_tar_xz),
"combined_sha256": combined_sha256,
"combined_rootxz_sha256":
combined_sha256,
"path": lxd_tar_xz_rel,
with writeFile(path.join(dn, 'meta/1.0/index-system')) as indexsystem:
with writeFile(path.join(dn, 'meta/1.0/index-user')) as indexuser:
for k, grps in groupby(data, lambda x: (x['dist'],
x['release'],
x['arch'],
x['variant'])):
info = grps.next()
dist_key = "{dist}:{release}:{arch}:{variant}".format(**info)
try:
indexsystem.write("{dist};{release};{arch};"
"{variant};{build};{fn}\n".format(**info))
indexuser.write("{dist};{release};{arch};"
"{variant};{build};{fn}\n".format(**info))
aliases = ("{dist}/{release}/{variant},"
"{dist}/{release}".format(**info))
root_tar_xz_rel = path.join(info["fn"], "rootfs.tar.xz")
root_tar_xz = path.join(path.dirname(dn), root_tar_xz_rel)
lxd_tar_xz_rel = path.join(info["fn"], "lxd.tar.xz")
lxd_tar_xz = path.join(path.dirname(dn), lxd_tar_xz_rel)
combined_sha256 = sha256sum(root_tar_xz, lxd_tar_xz)
product = {
"aliases": aliases,
"versions": {
info["build"]: {
"items": {
"root.tar.xz": {
"ftype": "root.tar.xz",
"sha256": sha256sum(root_tar_xz),
"size": filesize(root_tar_xz),
"path": root_tar_xz_rel,
},
"lxd.tar.xz": {
"ftype": "lxd.tar.xz",
"size": filesize(lxd_tar_xz),
"sha256": sha256sum(lxd_tar_xz),
"combined_sha256": combined_sha256,
"combined_rootxz_sha256":
combined_sha256,
"path": lxd_tar_xz_rel,
}
}
}
}
},
"release_title": info["release"],
"release": info["release"],
"os": info["name"],
"arch": info["arch"]
}
products_data[dist_key] = product
except BaseException as e:
if isinstance(e, KeyboardInterrupt):
raise
self.printWARNING(_("Failed to index %s") % dist_key)
self.printWARNING(str(e))
},
"release_title": info["release"],
"release": info["release"],
"os": info["name"],
"arch": info["arch"]
}
products_data[dist_key] = product
except BaseException as e:
if isinstance(e, KeyboardInterrupt):
raise
self.printWARNING(_("Failed to index %s") % dist_key)
self.printWARNING(str(e))
index_data = {
"format": "index:1.0",
"index": {

Loading…
Cancel
Save