diff options
author | Chris Gianelloni <wolf31o2@gentoo.org> | 2006-06-30 14:44:05 +0000 |
---|---|---|
committer | Chris Gianelloni <wolf31o2@gentoo.org> | 2006-06-30 14:44:05 +0000 |
commit | 16cda1b00b7f0b0f301772bf274202f7041a6079 (patch) | |
tree | 8dd1a27d97a9139e59257c68e4d8dc91ccf0c3d0 /users/wolf31o2 | |
parent | Adding X1 with 2.4 kernel thanks to tomric (diff) | |
download | gentoo-16cda1b00b7f0b0f301772bf274202f7041a6079.tar.gz gentoo-16cda1b00b7f0b0f301772bf274202f7041a6079.tar.bz2 gentoo-16cda1b00b7f0b0f301772bf274202f7041a6079.zip |
Updated version of my keyword script. It still isn't perfect, but it gets the job done.
Diffstat (limited to 'users/wolf31o2')
-rw-r--r-- | users/wolf31o2/keyword | 82 |
1 files changed, 78 insertions, 4 deletions
diff --git a/users/wolf31o2/keyword b/users/wolf31o2/keyword index 7e176ed8a8..fef0964223 100644 --- a/users/wolf31o2/keyword +++ b/users/wolf31o2/keyword @@ -1,8 +1,15 @@ #!/bin/bash -# $Header: /var/cvsroot/gentoo/users/wolf31o2/keyword,v 1.1 2006/05/25 22:12:51 wolf31o2 Exp $ + +EMAIL="wolf31o2@gentoo.org" +CVSROOT="/var/cvsroot/gentoo-x86" +COMMIT="yes" usage() { - echo "$(basename ${0}): <keyword> <input file>" + echo "$(basename ${0}): <keyword> <input file> [bug #]" + echo + echo "The input file should be a listing of packages in the following format:" + echo "category/package version" + echo } if [ -z "${1}" -o -z "${2}" ] @@ -11,7 +18,12 @@ then exit 0 fi -cvsroot=/var/cvsroot/gentoo-x86 +check_failed() { + if [ "${ret}" -ne 0 ] + then + failed_packages="${failed_packages} ${package}" + fi +} cpv=$(cat ${2} | grep -v "^#" | grep -v "^[[:space:]]*#") packages=$(cat ${2} | grep -v "^#" | grep -v "^[[:space:]]*#" | cut -d" " -f1 | sort -u) @@ -19,13 +31,75 @@ packages=$(cat ${2} | grep -v "^#" | grep -v "^[[:space:]]*#" | cut -d" " -f1 | echo "${cpv}" > /tmp/cpv.txt #echo "${packages}" > /tmp/packages.txt +# We actually make two passes. Pass #1 is where we do our initial KEYWORDS. +# This is so repoman doesn't find broken *DEPEND if our input file is not +# already sorted properly. for package in ${packages} do for version in $(grep "${package} " /tmp/cpv.txt | cut -d" " -f2) do ebuild="$(echo ${package} | cut -d"/" -f2)-${version}" - cd ${cvsroot}/${package} + cd ${CVSROOT}/${package} + cvs up ekeyword ${1} ${ebuild}.ebuild done done +# This second pass, we verify that the packages are still correct, and if not, +# we remove the file, then start over on just this one package. +for package in ${packages} +do + for version in $(grep "${package} " /tmp/cpv.txt | cut -d" " -f2) + do + ebuild="$(echo ${package} | cut -d"/" -f2)-${version}" + cd ${CVSROOT}/${package} + if [ "$(cvs up | grep ^C | cut -d" " -f1)" == "C" ] + then + rm -f .#* ${ebuild}.ebuild + cvs up + ekeyword ${1} ${ebuild}.ebuild + fi + done + if [ "${COMMIT}" == "yes" ] + then + rm -f .#* + if [ "$(cvs up | grep ^M | cut -d" " -f1)" == "M" ] + then + repoman scan + ret=$? + check_failed + if [ -n "${3}" ] + then + append_msg=" wrt bug #${3}." + else + append_msg="." + fi + + if [ $(echo ${1} | grep '^~') ] + then + commit_msg="Adding ${1}${append_msg}" + else + commit_msg="Stable on ${1}${append_msg}" + fi + echangelog "${commit_msg}" + ret=$? + check_failed + repoman commit -I -m "${commit_msg}" + ret=$? + check_failed + fi + fi +done + +if [ -n "${failed_packages}" ] +then +_email="From: ${EMAIL} +This email is to let you know that the following packages failed. +You will need to fix these packages manually. + +${failed_packages} + +Thanks, kcommit." +CMD="echo ${_email} |mail -s 'Failed packages from kcommit run!' ${EMAIL}" +eval ${CMD} +fi |