[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 003/115] run-coverity-scan: get Coverity token and email from spec
From: |
Paolo Bonzini |
Subject: |
[PULL 003/115] run-coverity-scan: get Coverity token and email from special git config section |
Date: |
Thu, 11 Jun 2020 15:42:57 -0400 |
Support a [coverity] section in .git/config. It can be used to retrieve the
token and also, if it is different from user.email, the username of the
submitter.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/coverity-scan/run-coverity-scan | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/scripts/coverity-scan/run-coverity-scan
b/scripts/coverity-scan/run-coverity-scan
index 2e067ef5cf..990f75138d 100755
--- a/scripts/coverity-scan/run-coverity-scan
+++ b/scripts/coverity-scan/run-coverity-scan
@@ -41,9 +41,10 @@
# is intended mainly for internal use by the Docker support
#
# User-specifiable environment variables:
-# COVERITY_TOKEN -- Coverity token
+# COVERITY_TOKEN -- Coverity token (default: looks at your
+# coverity.token config)
# COVERITY_EMAIL -- the email address to use for uploads (default:
-# looks at your git user.email config)
+# looks at your git coverity.email or user.email config)
# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is
# number of CPUs as determined by 'nproc')
# COVERITY_TOOL_BASE -- set to directory to put coverity tools
@@ -58,11 +59,11 @@ check_upload_permissions() {
# with status 1 if the check failed (usually a bad token);
# will exit the script with status 0 if the check indicated that we
# can't upload yet (ie we are at quota)
- # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized.
+ # Assumes that COVERITY_TOKEN, PROJNAME and DRYRUN have been initialized.
echo "Checking upload permissions..."
- if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted
--post-data "token=$PROJTOKEN&project=$PROJNAME" -q -O -)"; then
+ if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted
--post-data "token=$COVERITY_TOKEN&project=$PROJNAME" -q -O -)"; then
echo "Coverity Scan API access denied: bad token?"
exit 1
fi
@@ -94,20 +95,20 @@ check_upload_permissions() {
update_coverity_tools () {
# Check for whether we need to download the Coverity tools
# (either because we don't have a copy, or because it's out of date)
- # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set.
+ # Assumes that COVERITY_TOOL_BASE, COVERITY_TOKEN and PROJNAME are set.
mkdir -p "$COVERITY_TOOL_BASE"
cd "$COVERITY_TOOL_BASE"
echo "Checking for new version of coverity build tools..."
- wget https://scan.coverity.com/download/linux64 --post-data
"token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new
+ wget https://scan.coverity.com/download/linux64 --post-data
"token=$COVERITY_TOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new
if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then
# out of date md5 or no md5: download new build tool
# blow away the old build tool
echo "Downloading coverity build tools..."
rm -rf coverity_tool coverity_tool.tgz
- wget https://scan.coverity.com/download/linux64 --post-data
"token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz
+ wget https://scan.coverity.com/download/linux64 --post-data
"token=$COVERITY_TOKEN&project=$PROJNAME" -O coverity_tool.tgz
if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5sum
-c --status; then
echo "Downloaded tarball didn't match md5sum!"
exit 1
@@ -205,6 +206,9 @@ while [ "$#" -ge 1 ]; do
esac
done
+if [ -z "$COVERITY_TOKEN" ]; then
+ COVERITY_TOKEN="$(git config coverity.token)"
+fi
if [ -z "$COVERITY_TOKEN" ]; then
echo "COVERITY_TOKEN environment variable not set"
exit 1
@@ -225,7 +229,6 @@ if [ -z "$SRCDIR" ]; then
SRCDIR="$PWD"
fi
-PROJTOKEN="$COVERITY_TOKEN"
PROJNAME=QEMU
TARBALL=cov-int.tar.xz
@@ -268,6 +271,9 @@ if [ -z "$DESCRIPTION" ]; then
DESCRIPTION="$(git rev-parse HEAD)"
fi
+if [ -z "$COVERITY_EMAIL" ]; then
+ COVERITY_EMAIL="$(git config coverity.email)"
+fi
if [ -z "$COVERITY_EMAIL" ]; then
COVERITY_EMAIL="$(git config user.email)"
fi
@@ -393,7 +399,7 @@ if [ "$DRYRUN" = yes ]; then
exit 0
fi
-curl --form token="$PROJTOKEN" --form email="$COVERITY_EMAIL" \
+curl --form token="$COVERITY_TOKEN" --form email="$COVERITY_EMAIL" \
--form file=@"$TARBALL" --form version="$VERSION" \
--form description="$DESCRIPTION" \
https://scan.coverity.com/builds?project="$PROJNAME"
--
2.26.2
- [PULL 000/115] Huge miscellaneous pull request for 2020-06-11, Paolo Bonzini, 2020/06/11
- [PULL 008/115] run-coverity-scan: support --update-tools-only --docker, Paolo Bonzini, 2020/06/11
- [PULL 002/115] docker.py/build: support binary files in --extra-files, Paolo Bonzini, 2020/06/11
- [PULL 004/115] run-coverity-scan: use docker.py, Paolo Bonzini, 2020/06/11
- [PULL 001/115] docker.py/build: support -t and -f arguments, Paolo Bonzini, 2020/06/11
- [PULL 011/115] icount: fix shift=auto for record/replay, Paolo Bonzini, 2020/06/11
- [PULL 007/115] run-coverity-scan: download tools outside the container, Paolo Bonzini, 2020/06/11
- [PULL 006/115] run-coverity-scan: use --no-update-tools in docker run, Paolo Bonzini, 2020/06/11
- [PULL 003/115] run-coverity-scan: get Coverity token and email from special git config section,
Paolo Bonzini <=
- [PULL 010/115] numa: prevent usage of -M memory-backend and -numa memdev at the same time, Paolo Bonzini, 2020/06/11
- [PULL 016/115] Makefile: Let the 'help' target list the helper targets, Paolo Bonzini, 2020/06/11
- [PULL 015/115] io/task: Move 'qom/object.h' header to source, Paolo Bonzini, 2020/06/11
- [PULL 021/115] i386: Hyper-V VMBus ACPI DSDT entry, Paolo Bonzini, 2020/06/11
- [PULL 018/115] vmbus: add vmbus protocol definitions, Paolo Bonzini, 2020/06/11
- [PULL 020/115] i386:pc: whitelist dynamic vmbus-bridge, Paolo Bonzini, 2020/06/11
- [PULL 028/115] hw/i386/vmport: Set EAX to -1 on failed and unsupported commands, Paolo Bonzini, 2020/06/11
- [PULL 023/115] target/i386: Fix the CPUID leaf CPUID_Fn80000008, Paolo Bonzini, 2020/06/11
- [PULL 029/115] hw/i386/vmport: Introduce vmware-vmx-version property, Paolo Bonzini, 2020/06/11
- [PULL 012/115] qom/object: Fix object_child_foreach_recursive() return value, Paolo Bonzini, 2020/06/11