[ 
https://issues.apache.org/jira/browse/BEAM-11067?focusedWorklogId=501146&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-501146
 ]

ASF GitHub Bot logged work on BEAM-11067:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Oct/20 16:31
            Start Date: 15/Oct/20 16:31
    Worklog Time Spent: 10m 
      Work Description: alanmyrvold commented on a change in pull request 
#13117:
URL: https://github.com/apache/beam/pull/13117#discussion_r505680858



##########
File path: sdks/java/container/license_scripts/pull_licenses_java.py
##########
@@ -140,17 +149,22 @@ def execute(dep):
     }
     '''
 
-    name = dep['moduleName'].split(':')[1].lower()
+    name = dep['moduleName'].split(':')[1]
     version = dep['moduleVersion']
     name_version = name + '-' + version
+    # javac is not a runtime dependency
+    if name == 'javac':
+      logging.debug('Skipping', name_version)
+      return
     dir_name = '{license_dir}/{name_version}.jar'.format(
         license_dir=license_dir, name_version=name_version)
 
     # if auto pulled, directory is existing at {license_dir}
     if not os.path.isdir(dir_name):
         # skip self dependencies
         if dep['moduleName'].startswith('beam'):
-            logging.debug('Skippig', name_version)
+            logging.debug('Skipping', name_version)

Review comment:
       Moved to the top.

##########
File path: sdks/java/container/license_scripts/pull_licenses_java.py
##########
@@ -101,13 +101,22 @@ def pull_from_url(file_name, url, dep, no_list):
 
 def pull_source_code(base_url, dir_name, dep):
     # base_url example: 
https://repo1.maven.org/maven2/org/mortbay/jetty/jsp-2.1/6.1.14/
-    soup = BeautifulSoup(urlopen(base_url).read(), "html.parser")
+    try:
+      soup = BeautifulSoup(urlopen(base_url).read(), "html.parser")
+    except:
+      logging.error('Error reading source base from 
{base_url}'.format(base_url=base_url))
+      raise
+    source_count = 0
     for href in (a["href"] for a in soup.select("a[href]")):
         if href.endswith(
-                '.jar') and not 'javadoc' in href:  # download jar file only
+                '.jar') and 'sources.jar' in href:  # download sources jar 
file only
             file_name = dir_name + '/' + href
             url = base_url + '/' + href
+            logging.info('Pulling source from {url}'.format(url=url))

Review comment:
       done

##########
File path: sdks/java/container/license_scripts/pull_licenses_java.py
##########
@@ -101,13 +101,22 @@ def pull_from_url(file_name, url, dep, no_list):
 
 def pull_source_code(base_url, dir_name, dep):
     # base_url example: 
https://repo1.maven.org/maven2/org/mortbay/jetty/jsp-2.1/6.1.14/
-    soup = BeautifulSoup(urlopen(base_url).read(), "html.parser")
+    try:
+      soup = BeautifulSoup(urlopen(base_url).read(), "html.parser")
+    except:
+      logging.error('Error reading source base from 
{base_url}'.format(base_url=base_url))
+      raise
+    source_count = 0
     for href in (a["href"] for a in soup.select("a[href]")):
         if href.endswith(
-                '.jar') and not 'javadoc' in href:  # download jar file only
+                '.jar') and 'sources.jar' in href:  # download sources jar 
file only

Review comment:
       Yes, and this is guarded by the check that at least one file is found 
matching.
   
       if source_count == 0:
         raise RuntimeError('No source found at 
{base_url}'.format(base_url=base_url))




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 501146)
    Time Spent: 40m  (was: 0.5h)

> Source not included on Java SDK docker image for some GPL/LGPL/MPL 
> dependencies, like saxon-he and jformatstring
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-11067
>                 URL: https://issues.apache.org/jira/browse/BEAM-11067
>             Project: Beam
>          Issue Type: Bug
>          Components: build-system
>    Affects Versions: 2.25.0
>            Reporter: Alan Myrvold
>            Assignee: Alan Myrvold
>            Priority: P1
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> The java sdk docker image attempts to include source for GPL/LGPL/MPL/CDDL 
> dependencies, but misses several.
> ./gradlew -Pdocker-pull-licenses :sdks:java:container:docker --info
> the problem seems to be in the check for the license type:
> [https://github.com/alanmyrvold/beam/blob/c921b0c8384809dbcab3edcd5007e92da25067c6/sdks/java/container/license_scripts/pull_licenses_java.py#L41]
> SOURCE_CODE_REQUIRED_LICENSES = ['lgpl', 'glp', 'cddl', 'mpl']
> Some of the license types in the beam_java_dependency_list.csv.gz spell out 
> the license name, like "GNU Lesser" and don't match.
> spotbugs-4.0.6,https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html,"GNU
>  LESSER GENERAL PUBLIC LICENSE, Version 2.1",False
> jformatstring-3.0.0,http://www.gnu.org/licenses/lgpl.html,GNU Lesser Public 
> License,False
> spotbugs-annotations-4.0.6,https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html,"GNU
>  LESSER GENERAL PUBLIC LICENSE, Version 2.1",False
> saxon-he-9.9.1-2,http://www.mozilla.org/MPL/2.0/,Mozilla Public License 
> Version 2.0,False
> saxon-he-9.9.1-4,http://www.mozilla.org/MPL/2.0/,Mozilla Public License 
> Version 2.0,False
> checkstyle-8.23,http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt,LGPL-2.1+,True
> javassist-3.24.0-GA,http://www.mozilla.org/MPL/MPL-1.1.html,MPL 1.1,True



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to