@@ -6174,6 +6174,27 @@ def AppendNullBytes(indata=None, delimiter=__file_format_dict__['format_delimite
61746174def _hex_lower(n):
61756175 return format(int(n), 'x').lower()
61766176
6177+ def system_and_major():
6178+ info = platform.uname()
6179+
6180+ # Python 3: info is a namedtuple with .system / .release
6181+ # Python 2: info is a plain tuple (system, node, release, version, machine, processor)
6182+ try:
6183+ system = info.system
6184+ release = info.release
6185+ except AttributeError:
6186+ # Fallback for Python 2
6187+ system = info[0]
6188+ release = info[2]
6189+
6190+ # Find the first run of digits in the release string
6191+ m = re.search(r'\d+', release)
6192+ if m:
6193+ major = m.group(0) # e.g. '11' or '6'
6194+ return u"%s%s" % (system, major) # unicode-safe in Py2
6195+ else:
6196+ return system
6197+
61776198def AppendFileHeader(fp, numfiles, fencoding, extradata=[], jsondata={}, checksumtype=["md5", "md5"], formatspecs=__file_format_dict__, saltkey=None):
61786199 """
61796200 Build and write the archive file header.
@@ -6252,7 +6273,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], jsondata={}, checksu
62526273 else:
62536274 fctime = format(int(to_ns(time.time())), 'x').lower()
62546275 # Serialize the first group
6255- fnumfilesa = AppendNullBytes([tmpoutlenhex, fctime, fctime, fencoding, platform.system (), py_implementation, __program_name__+str(__version_info__[0]), fnumfiles_hex, "+"+str(len(formatspecs['format_delimiter']))], delimiter)
6276+ fnumfilesa = AppendNullBytes([tmpoutlenhex, fctime, fctime, fencoding, system_and_major (), py_implementation, __program_name__+str(__version_info__[0]), fnumfiles_hex, "+"+str(len(formatspecs['format_delimiter']))], delimiter)
62566277 # Append tmpoutlist
62576278 fnumfilesa += AppendNullBytes(tmpoutlist, delimiter)
62586279 # Append extradata items if any
0 commit comments