summaryrefslogtreecommitdiffstats
path: root/vndk
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2019-01-21 21:34:04 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-01-21 21:34:04 -0800
commit8cf9517a16aaca6471e3cbd812b11d8a3b1f2b7b (patch)
tree45a0a4b8bd23a05753545dbf81fe22559d024271 /vndk
parentd0ad924c9478cb66f25a1ba753ac734a117ccdb9 (diff)
parent29260adb1311170918bc4ceb87d5da77c06ce56a (diff)
downloadandroid_development-8cf9517a16aaca6471e3cbd812b11d8a3b1f2b7b.tar.gz
android_development-8cf9517a16aaca6471e3cbd812b11d8a3b1f2b7b.tar.bz2
android_development-8cf9517a16aaca6471e3cbd812b11d8a3b1f2b7b.zip
Merge "vndk-snapshot: Make the remote name settable" am: 06c57d0ecf am: 4ef90e79b8
am: 29260adb13 Change-Id: Ie3121158753e1ba6e6bdf1aba9ce45c046ee54b2
Diffstat (limited to 'vndk')
-rw-r--r--vndk/snapshot/check_gpl_license.py25
-rw-r--r--vndk/snapshot/update.py7
2 files changed, 26 insertions, 6 deletions
diff --git a/vndk/snapshot/check_gpl_license.py b/vndk/snapshot/check_gpl_license.py
index 0b3b89a9c..fcee1f88c 100644
--- a/vndk/snapshot/check_gpl_license.py
+++ b/vndk/snapshot/check_gpl_license.py
@@ -36,16 +36,23 @@ class GPLChecker(object):
MANIFEST_XML = utils.MANIFEST_FILE_NAME
MODULE_PATHS_TXT = utils.MODULE_PATHS_FILE_NAME
- def __init__(self, install_dir, android_build_top, temp_artifact_dir):
+ def __init__(self, install_dir, android_build_top, temp_artifact_dir,
+ remote_git):
"""GPLChecker constructor.
Args:
install_dir: string, absolute path to the prebuilts/vndk/v{version}
directory where the build files will be generated.
android_build_top: string, absolute path to ANDROID_BUILD_TOP
+ temp_artifact_dir: string, temp directory to hold build artifacts
+ fetched from Android Build server.
+ remote_git: string, remote name to fetch and check if the revision of
+ VNDK snapshot is included in the source if it is not in the current
+ git repository.
"""
self._android_build_top = android_build_top
self._install_dir = install_dir
+ self._remote_git = remote_git
self._manifest_file = os.path.join(temp_artifact_dir,
self.MANIFEST_XML)
self._notice_files_dir = os.path.join(install_dir,
@@ -140,14 +147,16 @@ class GPLChecker(object):
'Checking if the parent of revision {rev} exists in {proj}'.
format(rev=revision, proj=git_project_path))
try:
- cmd = ['git', '-C', path, 'fetch', 'goog', revision]
+ cmd = ['git', '-C', path, 'fetch', self._remote_git, revision]
utils.check_call(cmd)
cmd = ['git', '-C', path, 'rev-parse', 'FETCH_HEAD^2']
parent_revision = utils.check_output(cmd).strip()
except subprocess.CalledProcessError as error:
logging.error(
- 'Failed to get parent of revision {rev}: {err}'.format(
- rev=revision, err=error))
+ 'Failed to get parent of revision {rev} from "{remote}": '
+ '{err}'.format(
+ rev=revision, remote=self._remote_git, err=error))
+ logging.error('Try --remote to manually set remote name')
raise
else:
if not _check_rev_list(parent_revision):
@@ -227,6 +236,11 @@ def get_args():
parser.add_argument('-b', '--branch', help='Branch to pull manifest from.')
parser.add_argument('--build', help='Build number to pull manifest from.')
parser.add_argument(
+ '--remote',
+ default='aosp',
+ help=('Remote name to fetch and check if the revision of VNDK snapshot '
+ 'is included in the source to conform GPL license. default=aosp'))
+ parser.add_argument(
'-v',
'--verbose',
action='count',
@@ -248,6 +262,7 @@ def main():
args = get_args()
vndk_version = args.vndk_version
install_dir = os.path.join(PREBUILTS_VNDK_DIR, 'v{}'.format(vndk_version))
+ remote = args.remote
if not os.path.isdir(install_dir):
raise ValueError(
'Please provide valid VNDK version. {} does not exist.'
@@ -264,7 +279,7 @@ def main():
manifest_dest)
license_checker = GPLChecker(install_dir, ANDROID_BUILD_TOP,
- temp_artifact_dir)
+ temp_artifact_dir, remote)
try:
license_checker.check_gpl_projects()
except ValueError as error:
diff --git a/vndk/snapshot/update.py b/vndk/snapshot/update.py
index 051aac0c1..d15cf0464 100644
--- a/vndk/snapshot/update.py
+++ b/vndk/snapshot/update.py
@@ -185,6 +185,11 @@ def get_args():
action='store_true',
help='Perform the update in the current branch. Do not repo start.')
parser.add_argument(
+ '--remote',
+ default='aosp',
+ help=('Remote name to fetch and check if the revision of VNDK snapshot '
+ 'is included in the source to conform GPL license. default=aosp'))
+ parser.add_argument(
'-v',
'--verbose',
action='count',
@@ -250,7 +255,7 @@ def main():
if not local:
license_checker = GPLChecker(install_dir, ANDROID_BUILD_TOP,
- temp_artifact_dir)
+ temp_artifact_dir, args.remote)
check_gpl_license(license_checker)
logging.info(
'Successfully updated VNDK snapshot v{}'.format(vndk_version))