X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pkgs.py;h=3291dbef38dc868784e8cab1c53747bb4ceee307;hb=refs%2Fheads%2Fmaster;hp=bc8195a6a324bec8861f8cb27ca01db9bc255111;hpb=5097e161a9e86540782b27016d9fdc6730b84777;p=build.git diff --git a/pkgs.py b/pkgs.py index bc8195a6..4ba02afc 100755 --- a/pkgs.py +++ b/pkgs.py @@ -36,7 +36,7 @@ import re default_arch = 'x86_64' known_archs = ['i386', 'i686', 'x86_64'] -default_fcdistro = 'f35' +default_fcdistro = 'f43' known_fcdistros = [ 'centos5', 'centos6', # oldies but we have references to that in the pkgs files @@ -45,7 +45,7 @@ known_fcdistros = [ # these ones are still relevant; # f32 is mentioned to be able to use create-vms with that distro # as we're running into issues to build a minimal f33 from a f29 host - 'f29', 'f31', 'f32', 'f33', 'f35', + 'f29', 'f31', 'f32', 'f33', 'f35', 'f37', 'f39', 'f41', 'f43', # scientific linux 'sl6', # debians @@ -56,12 +56,13 @@ known_fcdistros = [ 'bionic', # 18.04 LTS 'focal', # 20.04 LTS 'jammy', # 22.04 LTS + 'noble', # 24.04 LTS ] default_pldistro = 'onelab' known_keywords = [ 'group', 'groupname', 'groupdesc', - 'package', 'pip', 'gem', + 'package', 'pip', 'gem', 'nodeyumexclude', 'plcyumexclude', 'yumexclude', 'precious', 'junk', 'mirror', ] @@ -107,25 +108,25 @@ class PkgsParser: return self.version <= version else: raise Exception( - 'Internal error - unexpected qualifier {}'.format(qualifier)) + f'Internal error - unexpected qualifier {qualifier}') m_comment = re.compile(r'\A\s*#') m_blank = re.compile(r'\A\s*\Z') m_ident = re.compile(r'\A'+re_ident+r'\Z') re_qualified = r'\s*' - re_qualified += r'(?P[+-]?)' - re_qualified += r'\s*' - re_qualified += r'(?P{re_ident})'.format(re_ident=re_ident) - re_qualified += r'\s*' - re_qualified += r'(?P>=|<=|=)' - re_qualified += r'\s*' - re_qualified += r'(?P{re_ident}[0-9]+)'.format(re_ident=re_ident) - re_qualified += r'\s*' - m_qualified = re.compile(r'\A{re_qualified}\Z'.format(re_qualified=re_qualified)) + re_qualified += rf'(?P[+-]?)' + re_qualified += rf'\s*' + re_qualified += rf'(?P{re_ident})' + re_qualified += rf'\s*' + re_qualified += rf'(?P=|<=|>=)' + re_qualified += rf'\s*' + re_qualified += rf'(?P{re_ident}[0-9]+)' + re_qualified += rf'\s*' + m_qualified = re.compile(rf'\A{re_qualified}\Z') re_old = '[a-z]+[+-][a-z]+[0-9]+' - m_old = re.compile(r'\A{}\Z'.format(re_old)) + m_old = re.compile(rf'\A{re_old}\Z') # returns a tuple (included, excluded) def parse(self, filename): @@ -144,7 +145,7 @@ class PkgsParser: ########## single ident if self.m_ident.match(left): if left not in known_keywords: - raise Exception("Unknown keyword {left}".format(**locals())) + raise Exception(f"Unknown keyword {left}") elif left == self.keyword: included += rights.split() else: @@ -152,9 +153,9 @@ class PkgsParser: if m: (plus_minus, kw, qual, fcdistro) = m.groups() if kw not in known_keywords: - raise Exception("Unknown keyword in {left}".format(**locals())) + raise Exception(f"Unknown keyword in {left}") if fcdistro not in known_fcdistros: - raise Exception('Unknown fcdistro {fcdistro}'.format(**locals())) + raise Exception(f'Unknown fcdistro {fcdistro}') # skip if another keyword if kw != self.keyword: continue # does this fcdistro match ? @@ -165,32 +166,31 @@ class PkgsParser: # skip if the qualifier does not fit if not self.match (qual, version): if self.options.verbose: - print('{filename}:{lineno}:qualifer {left} does not apply' - .format(**locals()), file=stderr) + print(f'{filename}:{lineno}:qualifer {left} does not apply', + file=stderr) continue # we're in, let's add (default) or remove (if plus_minus is minus) if plus_minus == '-': if self.options.verbose: - print('{filename}:{lineno}: from {left}, excluding {rights}' - .format(**locals()), file=stderr) + print(f'{filename}:{lineno}: from {left}, excluding {rights}', + file=stderr) excluded += rights.split() else: if self.options.verbose: - print('{filename}:{lineno}: from {left}, including {rights}'\ - .format(**locals()), file=stderr) + print(f'{filename}:{lineno}: from {left}, including {rights}', + file=stderr) included += rights.split() elif self.m_old.match(left): - raise Exception('Old-fashioned syntax not supported anymore {left}'.\ - format(**locals())) + raise Exception(f'Old-fashioned syntax not supported anymore {left}') else: - raise Exception('error in left expression {left}'.format(**locals())) + raise Exception(f'error in left expression {left}') except Exception as e: ok = False - print("{filename}:{lineno}:syntax error: {e}".format(**locals()), file=stderr) + print(f"{filename}:{lineno}:syntax error: {e}", file=stderr) except Exception as exc: ok = False - print('Could not parse file', filename, exc, file=stderr) + print(f'Could not parse file {filename} {exc=}', file=stderr) return (ok, included, excluded) def run (self): @@ -224,7 +224,7 @@ def main (): parser = OptionParser(usage=usage) parser.add_option( '-a', '--arch', dest='arch', action='store', default=default_arch, - help='target arch, e.g. i386 or x86_64, default={}'.format(default_arch)) + help=f'target arch, e.g. i386 or x86_64, default={default_arch}') parser.add_option( '-f', '--fcdistro', dest='fcdistro', action='store', default=default_fcdistro, help='fcdistro, e.g. f12 or centos5')