[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:
parent
5d849cd050
commit
17bb3d2122
@ -70,16 +70,11 @@ def read_discinfo(file_path):
|
||||
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.
|
||||
PackageKit uses this.
|
||||
"""
|
||||
|
||||
if not timestamp:
|
||||
raise
|
||||
timestamp = "%f" % time.time()
|
||||
|
||||
data = [
|
||||
"[InstallMedia]",
|
||||
"name=%s" % description,
|
||||
@ -90,7 +85,6 @@ def write_media_repo(file_path, description, timestamp=None):
|
||||
"",
|
||||
]
|
||||
|
||||
repo_file = open(file_path, "w")
|
||||
repo_file.write("\n".join(data))
|
||||
repo_file.close()
|
||||
with open(file_path, "w") as repo_file:
|
||||
repo_file.write("\n".join(data))
|
||||
return timestamp
|
||||
|
Loading…
Reference in New Issue
Block a user