Wind-River / meta-tensorflow

Other
13 stars 18 forks source link

Archive script failure #12

Open dongvictor opened 2 years ago

dongvictor commented 2 years ago

Python script /oe-core/scripts/native-intercept/ar can't support @file option.

===========================================================

!/usr/bin/env python3

#

Wrapper around 'ar' that defaults to deterministic archives

import os import shutil import sys

calculate path to the real 'ar'

path = os.environ['PATH'] path = path.replace(os.path.dirname(sys.argv[0]), '')

real_ar = shutil.which('ar', path=path)

if len(sys.argv) == 1: os.execl(real_ar, 'ar')

modify args to mimic 'ar' configured with --default-deterministic-archives

argv = sys.argv

if argv[1].startswith('--'):

No modifier given

None

else:

remove the optional '-'

if argv[1][0] == '-':
    argv[1] = argv[1][1:]
if 'U' in argv[1]:
    sys.stderr.write("ar: non-deterministic mode requested\n")
else:
    argv[1] = argv[1].replace('u', '')
    argv[1] = 'D' + argv[1]

os.execv(real_ar, argv)

When argv[1] equals "@bazel-out/k8-opt/bin/external/llvm-project/llvm/libSupport.a-2.params", the "else" clause was executed. As a result argv[1] was modified to "D@bazel-ot/k8-opt/bin/external/llvm-project/llvm/libSpport.a-2.params". Thus, build failed.

My question is, why do we want to remove the character "u" from the file path/name?
Second, should we change "if" in "if 'U' in argv[1]" into "elif"? Third, when the first byte of is "@", we shouldn't modify argv[1], right? And last, why do we insert command "D" as "D" is already in the first line of file "libSpport.a-2.params"? (see first a few lines of params file below)

=========================================================== rcsD bazel-out/k8-opt/bin/external/llvm-project/llvm/libSupport.a bazel-out/k8-opt/bin/external/llvm-project/llvm/_objs/Support/AArch64TargetParser.o bazel-out/k8-opt/bin/external/llvm-project/llvm/_objs/Support/ABIBreak.o