From c10120cea2b1d71a42dc1c1bcb148c4853536e15 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Sat, 28 May 2022 14:38:49 -0400 Subject: [PATCH] Fix: splitter.py to put in hack from 2020 to deal with CentOS Stream using xz compression versus gz --- roles/grobisplitter/files/splitter.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/roles/grobisplitter/files/splitter.py b/roles/grobisplitter/files/splitter.py index afebbd4bb1..6ed920ba7b 100755 --- a/roles/grobisplitter/files/splitter.py +++ b/roles/grobisplitter/files/splitter.py @@ -83,9 +83,17 @@ def _get_modulemd(directory=None, repo_info=None): _idx = mmd.ModuleIndex.new() - with gzip.GzipFile(filename=repo_info['modules'], mode='r') as gzf: - mmdcts = gzf.read().decode('utf-8') - res, failures = _idx.update_from_string(mmdcts, True) + myfile=repo_info['modules'] + if myfile.endswith(".gz"): + openfunc=gzip.Gzipfile + elif myfile.endswith(".xz"): + openfunc=lzma.LZMAFile + else: + print("This file type is not fixed in this hack. Please fix code. (2021-05-20)"); + sys.exit(1) + with openfunc(filename=myfile, mode='r') as zipf: + mmdcts = zipf.read().decode('utf-8') + res, failures = idx.update_from_string(mmdcts, True) if len(failures) != 0: raise Exception("YAML FAILURE: FAILURES: %s" % failures) if not res: