Fail if cargo about
emits warnings (#24996)
Warnings are emitted despite --fail have no license field like `ring` Release Notes: - N/A
This commit is contained in:
parent
8b088b3985
commit
bcba0b92ed
2 changed files with 24 additions and 2 deletions
|
@ -24,11 +24,20 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Generating cargo licenses"
|
echo "Generating cargo licenses"
|
||||||
|
|
||||||
|
stderr_file=$(mktemp)
|
||||||
|
|
||||||
cargo about generate \
|
cargo about generate \
|
||||||
--fail \
|
--fail \
|
||||||
-c script/licenses/zed-licenses.toml \
|
-c script/licenses/zed-licenses.toml \
|
||||||
"${TEMPLATE_FILE}" >> $OUTPUT_FILE
|
"${TEMPLATE_FILE}" \
|
||||||
|
2> >(tee "$stderr_file") \
|
||||||
|
>> $OUTPUT_FILE
|
||||||
|
|
||||||
|
if cat "$stderr_file" | grep -v "\[WARN\]" > /dev/null; then
|
||||||
|
echo "Error: License check failed - warnings found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
sed -i.bak 's/"/"/g' $OUTPUT_FILE
|
sed -i.bak 's/"/"/g' $OUTPUT_FILE
|
||||||
sed -i.bak 's/'/'\''/g' $OUTPUT_FILE # The ` '\'' ` thing ends the string, appends a single quote, and re-opens the string
|
sed -i.bak 's/'/'\''/g' $OUTPUT_FILE # The ` '\'' ` thing ends the string, appends a single quote, and re-opens the string
|
||||||
|
@ -38,3 +47,5 @@ sed -i.bak 's/</</g' $OUTPUT_FILE
|
||||||
sed -i.bak 's/>/>/g' $OUTPUT_FILE
|
sed -i.bak 's/>/>/g' $OUTPUT_FILE
|
||||||
|
|
||||||
rm -rf "${OUTPUT_FILE}.bak"
|
rm -rf "${OUTPUT_FILE}.bak"
|
||||||
|
|
||||||
|
echo "generate-licenses completed. See $OUTPUT_FILE"
|
||||||
|
|
|
@ -14,10 +14,21 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Generating cargo licenses"
|
echo "Generating cargo licenses"
|
||||||
|
|
||||||
|
stderr_file=$(mktemp)
|
||||||
|
|
||||||
cargo about generate \
|
cargo about generate \
|
||||||
--fail \
|
--fail \
|
||||||
-c script/licenses/zed-licenses.toml \
|
-c script/licenses/zed-licenses.toml \
|
||||||
script/licenses/template.csv.hbs \
|
script/licenses/template.csv.hbs \
|
||||||
|
2> >(tee "$stderr_file") \
|
||||||
| awk 'NR==1{print;next} NF{print | "sort"}' \
|
| awk 'NR==1{print;next} NF{print | "sort"}' \
|
||||||
> $OUTPUT_FILE
|
> $OUTPUT_FILE
|
||||||
echo "Completed. See $OUTPUT_FILE"
|
|
||||||
|
# Check that there are no warnings.
|
||||||
|
if echo "$about_stderr" | grep -v "\[WARN\]" > /dev/null; then
|
||||||
|
echo "Error: License check failed - warnings found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "generate-licenses-csv completed. See $OUTPUT_FILE"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue