@@ -6168,6 +6168,27 @@ def AppendNullBytes(indata=None, delimiter=__file_format_dict__['format_delimite
61686168def _hex_lower(n):
61696169 return format(int(n), 'x').lower()
61706170
6171+ def system_and_major():
6172+ info = platform.uname()
6173+
6174+ # Python 3: info is a namedtuple with .system / .release
6175+ # Python 2: info is a plain tuple (system, node, release, version, machine, processor)
6176+ try:
6177+ system = info.system
6178+ release = info.release
6179+ except AttributeError:
6180+ # Fallback for Python 2
6181+ system = info[0]
6182+ release = info[2]
6183+
6184+ # Find the first run of digits in the release string
6185+ m = re.search(r'\d+', release)
6186+ if m:
6187+ major = m.group(0) # e.g. '11' or '6'
6188+ return u"%s%s" % (system, major) # unicode-safe in Py2
6189+ else:
6190+ return system
6191+
61716192def AppendFileHeader(fp, numfiles, fencoding, extradata=[], jsondata={}, checksumtype=["md5", "md5"], formatspecs=__file_format_dict__, saltkey=None):
61726193 """
61736194 Build and write the archive file header.
@@ -6246,7 +6267,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], jsondata={}, checksu
62466267 else:
62476268 fctime = format(int(to_ns(time.time())), 'x').lower()
62486269 # Serialize the first group
6249- fnumfilesa = AppendNullBytes([tmpoutlenhex, fctime, fctime, fencoding, platform.system (), py_implementation, __program_name__+str(__version_info__[0]), fnumfiles_hex, "+"+str(len(formatspecs['format_delimiter']))], delimiter)
6270+ 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)
62506271 # Append tmpoutlist
62516272 fnumfilesa += AppendNullBytes(tmpoutlist, delimiter)
62526273 # Append extradata items if any
0 commit comments