summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/qa.sh117
1 files changed, 117 insertions, 0 deletions
diff --git a/scripts/qa.sh b/scripts/qa.sh
new file mode 100755
index 0000000..1a668bd
--- /dev/null
+++ b/scripts/qa.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+# Copyright 2007 Wulf C. Krueger <philantrop@gentoo.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This is a script for running QA checks in both the official Gentoo Portage Tree
+# as well as any overlay.
+# To see what it needs, how to use it and how to set some configuration options,
+# please read on.
+
+# Requirements:
+# sys-apps/portage
+# >=sys-apps/paludis-0.24.6 (with the "qa" USE flag set)
+# dev-util/pkgcore-checks
+# www-client/pybugz
+# app-crypt/gnupg
+# dev-util/cvs
+
+# NOTE: The current directory must be the one to check for QA issues!
+
+# Parameters:
+# $1 = package name without (!) category
+# $2 = path to the repository
+#
+# Example for app-editors/beaver in the official Gentoo Portage Tree:
+# $1 = beaver
+# $2 = /home/krueger/workspace/gentoo-x86
+
+# Configuration options:
+# (All paths shouldn't have trailing slashes.)
+# The path to the Gentoo Portage tree
+GENTOO_PORTAGE_TREE="/home/krueger/workspace/gentoo-x86"
+# The path to the Gentoo GLSAs
+GLSA_DIR="/home/krueger/workspace/gentoo/xml/htdocs/security/en/glsa"
+# Path for temporary files like the qa-results, glsa update timestamp file, etc.
+TMP_DIR="/home/krueger/workspace/gentoo-stuff/tmp"
+# The signing user's GPG directory
+GPG_DIR="/home/krueger/.gnupg"
+# A file that holds the password to the Manifest signing key (secure it!)
+GPG_PASSWD_FILE="gentoo_pass"
+# Defines which GPG key is used for Manifest signing
+GPG_KEY="CABCD089"
+
+# Search for open bugs for the current package name
+/usr/bin/bugz search "$1"
+
+# We'll change dirs so keep the current one in mind.
+pushd . >/dev/null
+
+# Delete the Manifest to avoid double-signing
+rm -f Manifest
+
+# Fetch all files
+for x in $(find . -type f -name "*.ebuild"); do
+ echo "Fetching distfiles for $x..."
+ USE=$(grep -h "IUSE=" *.ebuild | cut -d "=" -f 2 | tr ' ' '\n' | sed "s/[\n\"]//g" | sort -u | tr '\n' ' ')
+ export USE="${USE} linguas_af linguas_ar linguas_bg linguas_br linguas_bs linguas_ca linguas_cs linguas_cy linguas_da linguas_de linguas_el linguas_en_GB linguas_eo linguas_es linguas_et linguas_eu linguas_fi linguas_fr linguas_ga linguas_he linguas_hi linguas_hu linguas_is linguas_it linguas_ja linguas_ko linguas_lt linguas_lv linguas_mk linguas_ms linguas_nb linguas_nl linguas_nn linguas_pl linguas_pt linguas_pt_BR linguas_ro linguas_ru linguas_se linguas_sk linguas_sl linguas_sr linguas_sr@Latn linguas_sv linguas_ta linguas_tg linguas_th linguas_tr linguas_uk linguas_uz linguas_zh_CN linguas_zh_TW"
+ RESTRICT="mirror" ebuild $x fetch >/dev/null 2>&1
+ # Make sure we *really* got all :-)
+ RESTRICT="mirror" emerge --nodeps --fetch-all-uri $x >/dev/null 2>&1
+ /usr/bin/ebuild $x digest
+done
+unset USE
+
+# Show the KEYWORDS matrix
+echo
+if [[ "$2" == ${GENTOO_PORTAGE_TREE} ]] ; then
+ adjutrix -k --log-level warning
+else
+ echo "adjutrix doesn't work in overlays."
+fi
+
+# I wanted use reprehendo but it requires >=paludis-0.25.0 or paludis-scm and the latter sucks
+# reprehendo --sign --key-id ${GPG_KEY}
+
+# Sign the manifest
+cat "${GPG_DIR}/${GPG_PASSWD_FILE}" | gpg -q --batch --passphrase-fd 0 --sign --clearsign --yes --default-key ${GPG_KEY} --homedir ${GPG_DIR} Manifest >/dev/null 2>&1
+cp Manifest.asc Manifest
+rm -f Manifest.asc
+
+# See what Qualudis has to say about it...
+if [[ "$2" != ${GENTOO_PORTAGE_TREE} ]] ; then
+ qualudis --log-level warning --master-repository-dir ${GENTOO_PORTAGE_TREE}
+else
+ qualudis --log-level warning
+fi
+echo
+
+if [[ $(find "${TMP_DIR}" -type f -amin +1440 -name "glsa_update") != "" ]] ; then
+ touch "${TMP_DIR}/glsa_update"
+ echo "Updating GLSAs..."
+ cd "${GLSA_DIR}/../../"
+ cvs update -d -P >/dev/null 2>&1
+fi
+
+# Change back to the original directory we were in.
+popd >/dev/null
+
+# pkgcore's pcheck is useful, too.
+if [[ "$2" != ${GENTOO_PORTAGE_TREE} ]] ; then
+ pcheck --nocolor -o ${GENTOO_PORTAGE_TREE} --profile-base=${GENTOO_PORTAGE_TREE}/profiles --license-dir=${GENTOO_PORTAGE_TREE}/licenses --glsa-dir=${GLSA_DIR} -d UnusedLicense -d CategoryMetadataXmlCheck -d UnusedGlobalFlags
+else
+ pcheck --nocolor -r "$2" --profile-base=${GENTOO_PORTAGE_TREE}/profiles --license-dir=${GENTOO_PORTAGE_TREE}/licenses --glsa-dir=${GLSA_DIR} -d UnusedLicense -d CategoryMetadataXmlCheck -d UnusedGlobalFlags
+fi
+
+# And, finally, of course, repoman does its job.
+repoman -q -x full | tail -n+5