Skip to content

Commit

Permalink
Compress sqlite repodata files. Prepend file checksum to the filename.
Browse files Browse the repository at this point in the history
  • Loading branch information
ipanova committed Mar 25, 2019
1 parent 10e8067 commit 7419371
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions pulp_rpm/app/tasks/publishing.py
Expand Up @@ -158,21 +158,32 @@ def publish(publisher_pk, repository_version_pk):
("other_db", oth_db_path, None),
("updateinfo", upd_xml_path, None))

sqlite_files = ("primary_db", "filelists_db", "other_db")
for name, path, db_to_update in repomdrecords:
record = cr.RepomdRecord(name, path)
record.fill(cr.SHA256)
if (db_to_update):
db_to_update.dbinfo_update(record.checksum)
db_to_update.close()
repomd.set_record(record)
if name in sqlite_files:
record_bz = record.compress_and_fill(cr.SHA256, cr.BZ2)
record_bz.type = name
record_bz.rename_file()
path = record_bz.location_href.split('/')[-1]
repomd.set_record(record_bz)
else:
record.fill(cr.SHA256)
if (db_to_update):
db_to_update.dbinfo_update(record.checksum)
db_to_update.close()
record.rename_file()
path = record.location_href.split('/')[-1]
repomd.set_record(record)
metadata = PublishedMetadata(
relative_path=os.path.join(REPODATA_PATH, os.path.basename(path)),
publication=publication,
file=File(open(os.path.basename(path), 'rb'))
)
metadata.save()

open(repomd_path, "w").write(repomd.xml_dump())
with open(repomd_path, "w") as repomd_f:
repomd_f.write(repomd.xml_dump())

metadata = PublishedMetadata(
relative_path=os.path.join(REPODATA_PATH, os.path.basename(repomd_path)),
Expand Down

0 comments on commit 7419371

Please sign in to comment.