#!/bin/bash # Copyright 2007 Wulf C. Krueger # # 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 . # 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-0.7.0 (0.7.1 is broken, bug 197874) # 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" | sed "s/\+//g" | sort -u | tr '\n' ' ') export USE="${USE} $(cat ${GENTOO_PORTAGE_TREE}/profiles/desc/linguas.desc | grep -v '^#' | cut -d ' ' -f1 | sed '/./,$!d' | sed -e 's:^:linguas_:' | sort -u | tr '\n' ' ')" 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 manifest done unset USE # Show the KEYWORDS matrix echo adjutrix -k --log-level silent # 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... #QA_DIR=$(pwd | sed -e "s:$2/::") #cd "$2" if [[ ${2: -10} = ${GENTOO_PORTAGE_TREE: -10} ]] ; then # qualudis --log-level warning ${QA_DIR} qualudis --log-level warning elif [[ $2 != ${GENTOO_PORTAGE_TREE} ]] ; then # qualudis --log-level warning --master-repository-dir ${GENTOO_PORTAGE_TREE} ${QA_DIR} qualudis --log-level warning --master-repository-dir ${GENTOO_PORTAGE_TREE} 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 # The following GLSA is broken. rm -f "${GLSA_DIR}"/glsa-200710-22.xml # 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