[DEV] try better check for .a files

This commit is contained in:
Edouard DUPIN 2013-07-05 07:41:19 +02:00
parent 06d1dcf576
commit 04ebd5ce2e
3 changed files with 33 additions and 15 deletions

View File

@ -86,7 +86,7 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
def NeedRePackage(dst, srcList, mustHaveSrc):
def NeedRePackage(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
debug.verbose("Resuest check of dependency of :")
debug.verbose(" dst='" + dst + "'")
debug.verbose(" src()=")
@ -114,6 +114,22 @@ def NeedRePackage(dst, srcList, mustHaveSrc):
debug.verbose(" ==> must re-package (source time greater) : '" + src + "'")
return True
if ""!=file_cmd:
if False==os.path.exists(file_cmd):
debug.verbose(" ==> must rebuild (no commandLine file)")
return True
# check if the 2 cmdline are similar :
file2 = open(file_cmd, "r")
firstAndUniqueLine = file2.read()
if firstAndUniqueLine != cmdLine:
debug.verbose(" ==> must rebuild (cmdLines are not identical)")
debug.verbose(" ==> '" + cmdLine + "'")
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
file2.close()
return True
# the cmdfile is correct ...
file2.close()
debug.verbose(" ==> Not re-package (all dependency is OK)")
return False

View File

@ -227,31 +227,32 @@ class module:
## Commands for running ar.
###############################################################################
def Link_to_a(self, file, binary, target, depancy):
tmpList = target.GenerateFile(binary, self.name,self.originFolder,file,"lib-static")
# check the dependency for this file :
if False==dependency.NeedRePackage(tmpList[1], tmpList[0], True) \
and False==dependency.NeedRePackage(tmpList[1], depancy.src, False):
return tmpList[1]
lutinTools.CreateDirectoryOfFile(tmpList[1])
debug.printElement("StaticLib", self.name, "==>", tmpList[1])
# explicitly remove the destination to prevent error ...
if os.path.exists(tmpList[1]) and os.path.isfile(tmpList[1]):
os.remove(tmpList[1])
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"lib-static")
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
cmdLine=lutinTools.ListToStr([
target.ar,
target.global_flags_ar,
self.flags_ar,
tmpList[1],
tmpList[0]])#,
file_dst,
file_src])#,
#depancy.src])
# check the dependency for this file :
if False==dependency.NeedRePackage(file_dst, file_src, True, file_cmd, cmdLine) \
and False==dependency.NeedRePackage(file_dst, depancy.src, Falsefile_cmd, cmdLine):
return file_dst
lutinTools.CreateDirectoryOfFile(file_dst)
debug.printElement("StaticLib", self.name, "==>", file_dst)
# explicitly remove the destination to prevent error ...
if os.path.exists(file_dst) and os.path.isfile(file_dst):
os.remove(file_dst)
RunCommand(cmdLine)
#$(Q)$(TARGET_RANLIB) $@
cmdLine=lutinTools.ListToStr([
target.ranlib,
tmpList[1] ])
file_dst ])
RunCommand(cmdLine)
return tmpList[1]
return file_dst
###############################################################################

View File

@ -120,6 +120,7 @@ class Target:
list.append(file)
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_lib_static)
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_dependence)
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_cmdLine)
else:
debug.error("unknow type : " + type)
return list