From: Thanh Ha Date: Mon, 26 Nov 2018 03:05:51 +0000 (+0800) Subject: Only skip files start with maven-metadata.xml X-Git-Tag: v0.19.0~1 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=7ffd6769fab6ac1af36f1a05311208a04a592aaf;p=releng%2Flftools.git Only skip files start with maven-metadata.xml Ensure we are only skipping files that start with maven-metadata.xml* Having the word "maven-metadata" in our artifact is fine as long as it is not a Maven 2 repo file which is exactly 'maven-metadata.xml' the trialing * is to ensure it does not pick up the checksum files too. Also reword the function docs to be more clear about what it does. Issue: RELENG-1512 Change-Id: Icc20e4581a74625506ac9a0ff5d5e17b45034ccc Signed-off-by: Thanh Ha --- diff --git a/lftools/deploy.py b/lftools/deploy.py index 7b116e2d..baeb8505 100644 --- a/lftools/deploy.py +++ b/lftools/deploy.py @@ -504,7 +504,13 @@ def upload_maven_file_to_nexus(nexus_url, nexus_repo_id, def deploy_nexus(nexus_repo_url, deploy_dir, snapshot=False): - """Deploy Maven artifacts to Nexus. + """Deploy a local directory to a Nexus repository. + + This function intentially strips out the following files: + + - _remote.repositories + - resolver-status.properties + - maven-metadata.xml* (if not a snapshot repo) Parameters: nexus_repo_url: URL to Nexus server. (Ex: https://nexus.example.org) @@ -533,12 +539,18 @@ def deploy_nexus(nexus_repo_url, deploy_dir, snapshot=False): files = glob2.glob('**/*') for file in files: if os.path.isfile(file): - if not file.endswith("_remote.repositories") and not file.endswith("resolver-status.properties"): - if snapshot: - file_list.append(file) - else: - if not "maven-metadata" in file: - file_list.append(file) + base_name = os.path.basename(file) + + # Skip blacklisted files + if (base_name == "_remote.repositories" or + base_name == "resolver-status.properties"): + continue + + if not snapshot: + if base_name.startswith("maven-metadata.xml"): + continue + + file_list.append(file) # Perform parallel upload upload_start = time.time()