#!/usr/bin/env bash # Licence facts, read from the sources at run time: Maven POMs and the iText licence page. set -u echo "# licences as declared in the POMs Maven downloaded (~/.m2) and in the pdfCalligraph POM on iText's own repository, fetched $(date -u +%F)" M2="${HOME}/.m2/repository" lic() { grep -A1 '' "$1" | grep '' | sed 's/^ *//; s###' | tr '\n' ';'; } echo "openpdf 3.0.5 (declared in openpdf-parent): $(lic "$M2/com/github/librepdf/openpdf-parent/3.0.5/openpdf-parent-3.0.5.pom")" echo "itext kernel/layout 9.8.0 (root pom): $(lic "$M2/com/itextpdf/root/9.8.0/root-9.8.0.pom")" echo "flying-saucer-pdf 10.7.0 (flying-saucer-parent): $(lic "$M2/org/xhtmlrenderer/flying-saucer-parent/10.7.0/flying-saucer-parent-10.7.0.pom")" pom() { curl -s --retry 3 "$1" | grep -A2 '' | grep -E '' | sed 's/^ *//; s###' | tr '\n' ';'; } echo "typography (pdfCalligraph) 5.1.1: $(pom https://repo.itextsupport.com/releases/com/itextpdf/typography/5.1.1/typography-5.1.1.pom | tr '\n' ' ')" echo echo "# sentences from https://itextpdf.com/how-buy/agpl-license (verbatim, page text with tags stripped)" curl -sL https://itextpdf.com/how-buy/agpl-license | python3 -c ' import re, sys, html t = sys.stdin.read() t = re.sub(r"|", "", t, flags=re.S) t = html.unescape(re.sub(r"<[^>]+>", "\n", t)) keys = ("dual-licensed", "AGPLv3 license. This license applies", "You may not deploy it on a network", "Producer", "producer line", "violation to use", "release you from the AGPLv3") seen = set() for line in (l.strip() for l in t.split("\n")): if any(k in line for k in keys) and line not in seen and len(line) > 40: seen.add(line); print("- " + line) ' echo echo "# versions: latest GA per maven-metadata.xml" for a in com/github/librepdf/openpdf com/itextpdf/kernel org/xhtmlrenderer/flying-saucer-pdf org/xhtmlrenderer/flying-saucer-pdf-openpdf org/apache/pdfbox/pdfbox; do v="" for _ in 1 2 3 4 5 6; do # Maven Central answers 429 now and then v="$(curl -s https://repo1.maven.org/maven2/$a/maven-metadata.xml | tr '<' '\n' | grep -E '^(release|latest)>' | head -1 | sed 's/>/ /')" [ -n "$v" ] && break; sleep 15 done printf '%-45s %s\n' "$a" "${v:-(rate limited, not read)}" done