Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
Change-Id: I6989b78dd72835584b7e7c5f1a85ce9f9f22c5ab
Signed-off-by: Shenglei Zhang <[email protected]>
  • Loading branch information
shenglei10 committed Jul 14, 2020
1 parent 04e54d8 commit 8c5d91a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .pytool/Plugin/LicenseCheck/LicenseCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM,
self.ok = True
self.startcheck = False
self.license = True
self.all_file_pass = True
count = len(patch)
line_index = 0
for line in patch:
Expand All @@ -80,22 +81,25 @@ def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM,
if f in added_file:
continue
added_file_extension = os.path.splitext(added_file)[1]
if added_file_extension in self.file_extension_list:
if added_file_extension in self.file_extension_list and packagename in added_file:
self.startcheck = True
self.license = False
if self.startcheck and self.license_format_preflix in line:
if self.bsd2_patent in line or self.bsd3_patent in line:
self.license = True
if line_index + 1 == count or patch[line_index + 1].startswith('diff --') and self.startcheck:
if not self.license:
error_message = "Invalid License in: " + added_file
self.all_file_pass = False
error_message = "Invalid license in: " + added_file
logging.error(error_message)
self.startcheck = False
self.license = True
line_index = line_index + 1

if self.license:
if self.all_file_pass:
tc.SetSuccess()
return 0
else:
tc.SetFailed("License Check {0} Failed. ".format(packagename), "LICENSE_CHECK_FAILED")
return 1

0 comments on commit 8c5d91a

Please sign in to comment.