adoroszlai commented on a change in pull request #2177:
URL: https://github.com/apache/ozone/pull/2177#discussion_r619765424



##########
File path: hadoop-ozone/dev-support/checks/dependency.sh
##########
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -euo pipefail
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+cd "$DIR/../../.." || exit 1
+
+REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/dependency"}
+mkdir -p "$REPORT_DIR"
+REPORT_FILE="$REPORT_DIR/summary.txt"
+
+hadoop-ozone/dist/src/main/license/update-jar-report.sh current.txt
+
+cp hadoop-ozone/dist/src/main/license/jar-report.txt "$REPORT_DIR"
+cp hadoop-ozone/dist/src/main/license/current.txt "$REPORT_DIR"
+
+#implementation of sort cli is not exactly the same everywhere. It's better to 
sort with the same command locally
+(diff <(sort hadoop-ozone/dist/src/main/license/jar-report.txt) <(sort 
hadoop-ozone/dist/src/main/license/current.txt) || true ) > "$REPORT_FILE"

Review comment:
       Optional: I'd prefer unified diff, as it is more common (eg. git/github 
patches) and I find it more readable, too.
   
   ```suggestion
   (diff -uw <(sort hadoop-ozone/dist/src/main/license/jar-report.txt) <(sort 
hadoop-ozone/dist/src/main/license/current.txt) || true ) > "$REPORT_FILE"
   ```

##########
File path: .github/workflows/post-commit.yml
##########
@@ -112,6 +112,33 @@ jobs:
           rm -rf ~/.m2/repository/org/apache/hadoop/hadoop-hdds*
           rm -rf ~/.m2/repository/org/apache/hadoop/hadoop-ozone*
         if: always()
+  dependency:
+    needs: compile
+    runs-on: ubuntu-18.04
+    timeout-minutes: 300

Review comment:
       Nit: 300 minutes seems way too much for this check.

##########
File path: hadoop-ozone/dev-support/checks/dependency.sh
##########
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -euo pipefail
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+cd "$DIR/../../.." || exit 1
+
+REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/dependency"}
+mkdir -p "$REPORT_DIR"
+REPORT_FILE="$REPORT_DIR/summary.txt"
+
+hadoop-ozone/dist/src/main/license/update-jar-report.sh current.txt
+
+cp hadoop-ozone/dist/src/main/license/jar-report.txt "$REPORT_DIR"
+cp hadoop-ozone/dist/src/main/license/current.txt "$REPORT_DIR"
+
+#implementation of sort cli is not exactly the same everywhere. It's better to 
sort with the same command locally
+(diff <(sort hadoop-ozone/dist/src/main/license/jar-report.txt) <(sort 
hadoop-ozone/dist/src/main/license/current.txt) || true ) > "$REPORT_FILE"
+
+
+if [ -s "$REPORT_FILE" ]; then
+  echo ""
+   echo "Jar files are added/removed to/from the binary package."
+   echo ""
+   echo "Please update the hadoop-ozone/dist/src/main/license/bin/LICENSE.txt 
file with the modification"
+   echo "   AND execute 
hadoop-ozone/dist/src/main/license/update-jar-report.sh when you are ready 
(after a full build)"
+   echo ""
+   echo "Generated hadoop-ozone/dist/src/main/license/jar-report.txt file 
should be added to your pull-request. It will be used as the base of future 
comparison."
+   echo ""

Review comment:
       ```suggestion
      echo ""
      echo "This check may also report positive for PRs if the source is not 
up-to-date with the base branch (eg. `master`).  In this case please merge the 
base branch into your source branch."
      echo ""
   ```
   
   This problem also applies to this PR. ;)

##########
File path: hadoop-ozone/dist/src/main/license/update-jar-report.sh
##########
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -euo pipefail
+
+SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+REPORT_NAME=${1:-jar-report.txt}
+
+cd "$SCRIPTDIR/../../.." || exit 1
+
+OZONE_VERSION=$(mvn help:evaluate -Dexpression=ozone.version -q -DforceStdout)
+DIST_DIR="$SCRIPTDIR/../../../target/ozone-$OZONE_VERSION"
+: ${OZONE_DIST_DIR:=$DIST_DIR}
+
+cd "$OZONE_DIST_DIR"
+
+#sed expression removes the version. Usually license is not changed with 
version bumps
+#jacoco and test dependencies are excluded
+find . -type f -name "*.jar" | sed -r 's/-[0-9]+(.[0-9]+)*(-SNAPSHOT)?+//g' | 
grep -v jacoco | grep -v hadoop-hdds-test-utils | sort > 
"$SCRIPTDIR"/$REPORT_NAME

Review comment:
       `sed -r` does not work everywhere.  I think it can be replaced with Perl.
   
   Nit: `cut` can be used to get rid of `./` prefix.  (If you agree, then 
`jar-report.txt` needs to be updated accordingly.)
   
   ```suggestion
   find . -type f -name "*.jar" | cut -c3- | perl -wpl -e 
's/-[0-9]+(.[0-9]+)*(-SNAPSHOT)?+//g' | grep -v jacoco | grep -v 
hadoop-hdds-test-utils | sort > "$SCRIPTDIR"/$REPORT_NAME
   ```




-- 
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]



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

Reply via email to