Adding overlay master searching to license functionality.

This adds the overlay searching changes to the pre-upload hook.

BUG=chromium:865512
TEST=ran tests, manual test
CQ-DEPEND=CL:1162636

Change-Id: I815830f746a0f5ba507132faff60a4fea135698e
Reviewed-on: https://chromium-review.googlesource.com/1162637
Commit-Ready: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index c923463..374b821 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -858,9 +858,13 @@
     if ebuild.split('/')[-3] == 'virtual':
       continue
 
+    # e.g. path/to/overlay/category/package/package.ebuild -> path/to/overlay
+    overlay_path = os.sep.join(ebuild.split(os.sep)[:-3])
+
     try:
       ebuild_content = _get_file_content(ebuild, commit)
-      license_types = licenses_lib.GetLicenseTypesFromEbuild(ebuild_content)
+      license_types = licenses_lib.GetLicenseTypesFromEbuild(ebuild_content,
+                                                             overlay_path)
     except ValueError as e:
       return HookFailure(e.message, [ebuild])
 
@@ -868,7 +872,8 @@
     for license_type in [x for x in license_types
                          if x not in LICENSES_IGNORE and not x.endswith('?')]:
       try:
-        licenses_lib.Licensing.FindLicenseType(license_type)
+        licenses_lib.Licensing.FindLicenseType(license_type,
+                                               overlay_path=overlay_path)
       except AssertionError as e:
         return HookFailure(e.message, [ebuild])