[ 
https://issues.apache.org/jira/browse/HADOOP-13374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15847287#comment-15847287
 ] 

Allen Wittenauer edited comment on HADOOP-13374 at 1/31/17 6:48 PM:
--------------------------------------------------------------------

bq. A fully-qualified path is absolute, but find gives out relative paths.

Assuming POSIX, find returns the path based upon what was in the pathspec.  In 
this particular case, the code guarantees the pathspec is absolute via multiple 
interactions with hadoop_abs:

{code}
BASEDIR=$(hadoop_abs "${BINDIR}/../..")
{code}

This gives us the absolute path of the source tree, based upon the relative 
path of the location of verify-license-files.

{code}
DIST_DIR="${BASEDIR}/hadoop-dist/target/hadoop-${PROJ_VERSION}"
{code}

This gives us the absolute path of the distribution directory, based upon the 
source tree path determined above.

{code}
find "${DIST_DIR}" \
  -name "hadoop-*${PROJ_VERSION}*.jar" -or \
  -name "hadoop-*${PROJ_VERSION}*.war"
{code}

This returns the absolute path of hadoop jars and wars in the dist tree, which 
is then sent to process_jar.  Using bash -x, we can see this in action:

{code}
$ bash -x dev-support/bin/verify-license-files 
...
+ BINDIR=/Users/aw/shared-vmware/hadoop/dev-support/bin
...
+ BASEDIR=/Users/aw/shared-vmware/hadoop
...
+ 
DIST_DIR=/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT
...
+ read -r filename
++ find 
/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT 
-name 'hadoop-*3.0.0-alpha3-SNAPSHOT*.jar' -or -name 
'hadoop-*3.0.0-alpha3-SNAPSHOT*.war'
+ process_jar 
/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
+ declare 
fqfn=/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
...
+ process_file LICENSE 
/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
+ declare check=LICENSE
+ declare 
fqfn=/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
...
{code}

fqfn above is definitely the absolute location of the jar file. 


was (Author: aw):
bq. A fully-qualified path is absolute, but find gives out relative paths.

find returns the path based upon what was in the pathspec.  In this particular 
case, the code guarantees the pathspec is absolute via multiple interactions 
with hadoop_abs:

{code}
BASEDIR=$(hadoop_abs "${BINDIR}/../..")
{code}

This gives us the absolute path of the source tree, based upon the relative 
path of the location of verify-license-files.

{code}
DIST_DIR="${BASEDIR}/hadoop-dist/target/hadoop-${PROJ_VERSION}"
{code}

This gives us the absolute path of the distribution directory, based upon the 
source tree path determined above.

{code}
find "${DIST_DIR}" \
  -name "hadoop-*${PROJ_VERSION}*.jar" -or \
  -name "hadoop-*${PROJ_VERSION}*.war"
{code}

This returns the absolute path of hadoop jars and wars in the dist tree, which 
is then sent to process_jar.  Using bash -x, we can see this in action:

{code}
$ bash -x dev-support/bin/verify-license-files 
...
+ BINDIR=/Users/aw/shared-vmware/hadoop/dev-support/bin
...
+ BASEDIR=/Users/aw/shared-vmware/hadoop
...
+ 
DIST_DIR=/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT
...
+ read -r filename
++ find 
/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT 
-name 'hadoop-*3.0.0-alpha3-SNAPSHOT*.jar' -or -name 
'hadoop-*3.0.0-alpha3-SNAPSHOT*.war'
+ process_jar 
/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
+ declare 
fqfn=/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
...
+ process_file LICENSE 
/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
+ declare check=LICENSE
+ declare 
fqfn=/Users/aw/shared-vmware/hadoop/hadoop-dist/target/hadoop-3.0.0-alpha3-SNAPSHOT/share/hadoop/client/hadoop-client-api-3.0.0-alpha3-SNAPSHOT.jar
...
{code}

fqfn above is definitely the absolute location of the jar file. 

> Add the L&N verification script
> -------------------------------
>
>                 Key: HADOOP-13374
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13374
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Xiao Chen
>            Assignee: Allen Wittenauer
>         Attachments: HADOOP-13374.01.patch, HADOOP-13374.02.patch, 
> HADOOP-13374.03.patch, HADOOP-13374.04.patch
>
>
> This is the script that's used for L&N change verification during 
> HADOOP-12893. We should commit this as [~ozawa] 
> [suggested|https://issues.apache.org/jira/browse/HADOOP-13298?focusedCommentId=15374498&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15374498].
> I was 
> [initially|https://issues.apache.org/jira/browse/HADOOP-12893?focusedCommentId=15283040&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15283040]
>  verifying from an on-fly shell command, and [~andrew.wang] contributed the 
> script later in [a comment|
> https://issues.apache.org/jira/browse/HADOOP-12893?focusedCommentId=15303281&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15303281],
>  so most credit should go to him. :)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to