gen-third-party.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/sh
  2. # Regenera THIRD_PARTY.md con go-licenses (issue #1170).
  3. # Requiere: go install github.com/google/go-licenses@latest
  4. set -e
  5. cd "$(dirname "$0")/.."
  6. GL="${GO_LICENSES:-go-licenses}"
  7. GL="$(command -v "$GL" 2>/dev/null || echo "$HOME/go/bin/go-licenses")"
  8. if [ ! -x "$GL" ]; then
  9. echo "go-licenses no encontrado: go install github.com/google/go-licenses@latest" >&2
  10. exit 1
  11. fi
  12. # go-licenses clasifica modernc.org/mathutil como Unknown, pero su LICENSE es
  13. # BSD-3-Clause (verificado a mano); se corrige aquí al regenerar.
  14. MATHUTIL='| modernc.org/mathutil | BSD-3-Clause¹ | https://gitlab.com/cznic/mathutil/blob/v1.7.1/LICENSE |'
  15. gen() {
  16. (cd "$1" && "$GL" report ./... --ignore github.com/gnacho/netpulse 2>/dev/null \
  17. | awk -F',' '{name=$1; lic=$3; url=$2; gsub(/^ +| +$/,"",lic); printf "| %s | %s | %s |\n", name, lic, url}' \
  18. | grep -v 'modernc.org/mathutil' | sort -u)
  19. printf '%s\n' "$MATHUTIL"
  20. }
  21. {
  22. cat <<'HDR'
  23. # Third-Party Licenses
  24. NetPulse itself is licensed under the GNU Affero General Public License v3.0 (see `LICENSE`).
  25. The release binaries ship with the following third-party Go modules compiled in. Their licenses are all permissive (MIT / BSD-2-Clause / BSD-3-Clause / Apache-2.0) and require preserving their copyright notices, which this file collects. Full license texts are available at the linked URLs and in the Go module cache used at build time.
  26. Regenerate with `deploy/gen-third-party.sh` (requires `go install github.com/google/go-licenses@latest`).
  27. ## Server (`server-go`)
  28. | Module | License | License URL |
  29. |---|---|---|
  30. HDR
  31. gen server-go
  32. cat <<'COL'
  33. ## Collector (`collector`)
  34. | Module | License | License URL |
  35. |---|---|---|
  36. COL
  37. gen collector
  38. cat <<'AG'
  39. ## Agent (`agent`)
  40. | Module | License | License URL |
  41. |---|---|---|
  42. AG
  43. gen agent
  44. cat <<'FT'
  45. ---
  46. ¹ `go-licenses` reports `modernc.org/mathutil` as "Unknown" because its LICENSE file is not recognized by the tool's classifier; the file itself contains the standard BSD-3-Clause text (verified manually).
  47. FT
  48. } > THIRD_PARTY.md
  49. echo "THIRD_PARTY.md regenerado ($(wc -l < THIRD_PARTY.md) lineas)"