|
|
|
@ -42,21 +42,21 @@ setLocalTranslate('cl_install3', sys.modules[__name__])
|
|
|
|
|
class DistroRepository(Linux):
|
|
|
|
|
contentCache = {}
|
|
|
|
|
|
|
|
|
|
marches = [r'i686', r'x86_64']
|
|
|
|
|
marches = ['i686', 'x86_64']
|
|
|
|
|
|
|
|
|
|
extensiton = [r'iso', r'tar.bz2', r'tar.gz', r'tar.7z', r'tar.lzma']
|
|
|
|
|
extensiton = ['iso', 'tar.bz2', 'tar.gz', 'tar.7z', 'tar.lzma']
|
|
|
|
|
|
|
|
|
|
reDistName = re.compile(r"""
|
|
|
|
|
reDistName = re.compile("""
|
|
|
|
|
^.*/(?P<os_linux_shortname>%(name)s)
|
|
|
|
|
-(?P<os_linux_ver>%(ver)s)
|
|
|
|
|
(?:-(?P<serial_id>%(ser)s))?
|
|
|
|
|
-(?P<os_arch_machine>%(march)s)
|
|
|
|
|
.(?P<ext>%(ext)s)$""" %
|
|
|
|
|
{r'name': r"[a-z0-9]+",
|
|
|
|
|
r'ver': r"(\d+\.)*\d+",
|
|
|
|
|
r'ser': r"\d+",
|
|
|
|
|
r'march': r"|".join(marches),
|
|
|
|
|
r'ext': r"|".join(extensiton)
|
|
|
|
|
{'name': "[a-z0-9]+",
|
|
|
|
|
'ver': r"(\d+\.)*\d+",
|
|
|
|
|
'ser': r"\d+",
|
|
|
|
|
'march': "|".join(marches),
|
|
|
|
|
'ext': "|".join(extensiton)
|
|
|
|
|
}, re.X)
|
|
|
|
|
|
|
|
|
|
def _getDistrInfo(self, filename):
|
|
|
|
@ -71,9 +71,9 @@ class DistroRepository(Linux):
|
|
|
|
|
distdic = match.groupdict()
|
|
|
|
|
distdic["os_linux_build"] = ""
|
|
|
|
|
if "os_linux_ver" in distdic:
|
|
|
|
|
if re.match(r"^\d{8}$", distdic["os_linux_ver"]):
|
|
|
|
|
distdic[r"os_linux_build"] = distdic["os_linux_ver"]
|
|
|
|
|
distdic[r"os_linux_ver"] = ""
|
|
|
|
|
if re.match("^\d{8}$", distdic["os_linux_ver"]):
|
|
|
|
|
distdic["os_linux_build"] = distdic["os_linux_ver"]
|
|
|
|
|
distdic["os_linux_ver"] = ""
|
|
|
|
|
return distdic
|
|
|
|
|
|
|
|
|
|
def getImage(self, scratch, rootType, imagePath, march=None,
|
|
|
|
@ -99,7 +99,7 @@ class DistroRepository(Linux):
|
|
|
|
|
return sorted(list(set([x.groupdict()['name'] for x in distros])))
|
|
|
|
|
def opcompareByString(self, buf):
|
|
|
|
|
if buf:
|
|
|
|
|
reOp = re.compile(r"^(!=|=|==|<=|>=|>|<)?(\d+.*)$")
|
|
|
|
|
reOp = re.compile("^(!=|=|==|<=|>=|>|<)?(\d+.*)$")
|
|
|
|
|
res = reOp.search(buf)
|
|
|
|
|
if res:
|
|
|
|
|
return ({'!=': operator.ne,
|
|
|
|
@ -245,15 +245,15 @@ class DistroRepository(Linux):
|
|
|
|
|
def getBestStage(self, dirs, march=None, hardened=None):
|
|
|
|
|
"""Get latest stage by march"""
|
|
|
|
|
if march:
|
|
|
|
|
march = {r'x86_64': r'amd64'}.get(march, march)
|
|
|
|
|
march = {'x86_64': 'amd64'}.get(march, march)
|
|
|
|
|
else:
|
|
|
|
|
march = r"[^-]+"
|
|
|
|
|
march = "[^-]+"
|
|
|
|
|
if hardened is None:
|
|
|
|
|
hardened = r"(?:-hardened)?"
|
|
|
|
|
hardened = "(?:-hardened)?"
|
|
|
|
|
elif hardened is True:
|
|
|
|
|
hardened = r"-hardened"
|
|
|
|
|
hardened = "-hardened"
|
|
|
|
|
elif hardened is False:
|
|
|
|
|
hardened = r""
|
|
|
|
|
hardened = ""
|
|
|
|
|
reStage = re.compile(r'^.*/stage3-%s%s-(\d+)\.tar\.bz2$' %
|
|
|
|
|
(march, hardened), re.S)
|
|
|
|
|
return self._findLatestFile(dirs, reStage, lambda x: x.groups()[0])
|
|
|
|
|