incubator-hugegraph
incubator-hugegraph copied to clipboard
[Summary] update licenses/notice for 1.5
References:
- https://github.com/hugegraph/actions/issues/6
- https://github.com/apache/incubator-hugegraph/wiki/Apache-%E5%8F%91%E7%89%88%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9
- https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses
Due to the introduction of the pd and store modules in version 1.5, it is necessary to update the current dependencies of HugeGraph. At present, I have adjusted the project structure in #2552. For the license and notice of each dependency in the binary package, it need to be updated in some way, and the steps are briefly introduced as follows:
- Generate a new dependency list using
regenerate_known_dependencies.sh
.-
diff <(curl -s https://raw.githubusercontent.com/apache/incubator-hugegraph/release-1.3.0/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt) install-dist/scripts/dependency/known-dependencies.txt | grep '^> ' | sed 's/^> //' > /tmp/deps
-
- For each new dependency item in the dependency list, obtain its corresponding license and notice in some way.
Similar handling for removed dependencies.
Currently, I have initially built a script for obtaining the dependency jar packages from the local maven package path and detecting the license and notice.
#!/bin/bash
# Read the jar file list from a file
jar_file_list=${1:-deps}
if [ ! -f "$jar_file_list" ]; then
echo "Jar file list not found: $jar_file_list"
exit 1
fi
rm -rf output/NOTICE
rm -rf output/LICENSE
# Create temporary and output directories
mkdir -p tmp
mkdir -p output/NOTICE
mkdir -p output/LICENSE
# Define result arrays
declare -a found_license_packages
declare -a other_packages
# Iterate through the jar file list
while IFS= read -r jar; do
# Remove leading and trailing whitespace
jar=$(echo "$jar" | xargs)
# Skip empty lines
[ -z "$jar" ] && continue
# Find the jar package path
jar_path=$(find ~/.m2/repository -name "$jar" 2>/dev/null)
if [ -z "$jar_path" ]; then
# Jar package not found
continue
fi
# Copy the jar package to the temporary directory
cp "$jar_path" ./tmp/
# Get the package name (without extension)
package_name="${jar%.jar}"
# Create the extraction directory
mkdir -p "./tmp/$package_name"
# Extract the jar package to the extraction directory
unzip -q "./tmp/$jar" -d "./tmp/$package_name"
# Check for NOTICE and LICENSE files in the META-INF directory
notice_found=$(find "./tmp/$package_name/META-INF" -iname "NOTICE*" 2>/dev/null)
license_found=$(find "./tmp/$package_name/META-INF" -iname "LICENSE*" 2>/dev/null)
# Process the NOTICE file
if [ -n "$notice_found" ]; then
notice_result="found NOTICE in jar package"
for notice in $notice_found; do
cp "$notice" "./output/NOTICE/NOTICE-${package_name}.txt"
done
else
notice_result="not found NOTICE in jar package"
fi
# Process the LICENSE file
if [ -n "$license_found" ]; then
license_result="found LICENSE in jar package"
for license in $license_found; do
cp "$license" "./output/LICENSE/LICENSE-${package_name}.txt"
done
else
license_result="not found LICENSE in jar package"
fi
# Generate the result
if [ "$license_result" == "found LICENSE in jar package" ]; then
result="- [ ] $package_name\n - found jar package\n - $notice_result\n - $license_result"
found_license_packages+=("$result")
else
result="- [ ] $package_name\n - found jar package\n - $notice_result\n - $license_result"
other_packages+=("$result")
fi
done < "$jar_file_list"
# Count the number of packages in found_license_packages and other_packages
num_found_license_packages="${#found_license_packages[@]}"
num_other_packages="${#other_packages[@]}"
# Print the results
echo "Packages with LICENSE ($num_found_license_packages found):"
for package in "${found_license_packages[@]}"; do
echo -e "$package"
done
echo ""
echo "Other packages ($num_other_packages found):"
for package in "${other_packages[@]}"; do
echo -e "$package"
done
rm -rf tmp