working on sanitizing the line in the release file some more

This commit is contained in:
Brendan McDevitt 2022-08-21 22:08:11 -05:00
parent 90003f31f0
commit 3e141ad886

View file

@ -6,7 +6,7 @@ import json
from meta_release import SourceMetaRelease, MetaRelease from meta_release import SourceMetaRelease, MetaRelease
RELEASE_WORD_MATCHER = r'(^\Origin\:\s|Label:\s|Suite:\s|Version:\s|Codename:\s|Date:\s|Architecture:\s|Components:\s|Description:\s|MD5Sum:\s|SHA256:\s|Aquire\-By\-Hash:\s)' #RELEASE_WORD_MATCHER = r'(^\Origin\:\s|Label:\s|Suite:\s|Version:\s|Codename:\s|Date:\s|Architecture:\s|Components:\s|Description:\s|MD5Sum:\s|SHA256:\s|Aquire\-By\-Hash:\s)'
class Release: class Release:
def __init__(self, distro_codename): def __init__(self, distro_codename):
@ -33,8 +33,18 @@ class Release:
""" Use this method for cleaning the line, especially the one with the md5 """ Use this method for cleaning the line, especially the one with the md5
and shasums in them. """ and shasums in them. """
try: try:
data = {}
#cleaned_line = re.split(RELEASE_WORD_MATCHER, line) #cleaned_line = re.split(RELEASE_WORD_MATCHER, line)
cleaned_line = line split_line_arr = line.split(':')
if len(split_line_arr) == 3:
for checksum, filesize, filepath:
data['checksum'] = checksum
data['filesize'] = filesize
data['filepath'] = filepath
# if the the first element in the array regular expression matches
# RELEASE_WORD_MATCHER so we can detect if its a key: we need.
#elif len(split_line_arr)[0]
## TODO: LEFT OFF HERE
return cleaned_line return cleaned_line
except Exception as e: except Exception as e:
print('failed to clean') print('failed to clean')