grml cleaned up, testing

This commit is contained in:
2021-01-21 11:34:06 -05:00
parent 7c8f25ea03
commit 0e8d460565
6 changed files with 300 additions and 25 deletions

View File

@@ -80,12 +80,14 @@ class Updater(_base.BaseUpdater):
self.do_update = True
self.force_update = True
self.old_ver = 0.00
self.variant = 'full'
return(None)
with open(self.dest_ver, 'rb') as fh:
ver_info = json.load(fh)
self.old_date = datetime.datetime.strptime(ver_info['date'], self._date_fmt)
self.old_ver = ver_info['ver']
self.old_hash = ver_info.get(self.hash_type, self._def_hash)
self.variant = ver_info.get('variant', self.variant)
self.new_hash = self.old_hash
self.new_ver = self.old_ver
self.new_date = self.old_date
@@ -122,6 +124,8 @@ class Updater(_base.BaseUpdater):
ver_info = fname_r.groupdict()
if ver_info['arch'] != self.arch:
continue
if ver_info['variant'] != self.variant:
continue
new_ver = float(ver_info.get('version', self.old_ver))
iso_url = os.path.join(self.dl_base, link['href'].replace(self.dl_base, ''))
hash_url = '{0}.{1}'.format(iso_url, self.hash_type)
@@ -145,6 +149,7 @@ class Updater(_base.BaseUpdater):
d = {'date': self.new_date.strftime(self._date_fmt),
'arch': self.arch,
'ver': self.new_ver,
'variant': self.variant,
self.hash_type: self.new_hash}
j = json.dumps(d, indent = 4)
with open(self.dest_ver, 'w') as fh: