ostree/utils: Drop timestamps from generated repo names

Since we drop these files in a separate workdir each time,
there's no need to datestamp them.  Doing so is part of the
cause for invalidating's rpm-ostree input change hashing.

Issue: https://pagure.io/pungi/issue/811
Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters 2017-12-04 10:18:59 -05:00 committed by Lubomír Sedlář
parent 5cc612f966
commit b2bdc8a608

View File

@ -86,21 +86,17 @@ def tweak_treeconf(treeconf, source_repos=None, keep_original_sources=False, upd
Additionally, other values can be passed to method by 'update_dict' parameter to
update treefile content.
"""
# add this timestamp to repo name to get unique repo filename and repo name
# should be safe enough
time = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
treeconf_dir = os.path.dirname(treeconf)
with open(treeconf, 'r') as f:
treeconf_content = json.load(f)
# backup the old tree config
os.rename(treeconf, '%s.%s.bak' % (treeconf, time))
os.rename(treeconf, '{}.bak'.format(treeconf))
repos = []
if source_repos:
for repo in source_repos:
name = "%s-%s" % (repo['name'], time)
name = repo['name']
_write_repofile("%s/%s.repo" % (treeconf_dir, name), name, repo)
repos.append(name)