[metadata] Simplify writing media.repo

This commit also removes the ability to generate timestamp. It must now
always be passed explicitly. The feature was not used anywhere and it
actually did not work.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-05-04 15:41:46 +02:00
parent 5d849cd050
commit 17bb3d2122

View File

@ -70,16 +70,11 @@ def read_discinfo(file_path):
return result return result
def write_media_repo(file_path, description, timestamp=None): def write_media_repo(file_path, description, timestamp):
""" """
Write media.repo file for the disc to be used on installed system. Write media.repo file for the disc to be used on installed system.
PackageKit uses this. PackageKit uses this.
""" """
if not timestamp:
raise
timestamp = "%f" % time.time()
data = [ data = [
"[InstallMedia]", "[InstallMedia]",
"name=%s" % description, "name=%s" % description,
@ -90,7 +85,6 @@ def write_media_repo(file_path, description, timestamp=None):
"", "",
] ]
repo_file = open(file_path, "w") with open(file_path, "w") as repo_file:
repo_file.write("\n".join(data)) repo_file.write("\n".join(data))
repo_file.close()
return timestamp return timestamp