aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaekke <maekke@macbook.(none)>2009-10-15 08:49:28 +0200
committermaekke <maekke@macbook.(none)>2009-10-15 08:49:28 +0200
commit23337216203c849053dc0bf4894a8ae8bac0092c (patch)
treef673277442a88f116af9dd78b37734de6b7d1622 /scripts
parentold (diff)
downloadmaekke-23337216203c849053dc0bf4894a8ae8bac0092c.tar.gz
maekke-23337216203c849053dc0bf4894a8ae8bac0092c.tar.bz2
maekke-23337216203c849053dc0bf4894a8ae8bac0092c.zip
add some scripts, which might be useful for others too
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/keyword.sh120
-rwxr-xr-xscripts/rdep79
2 files changed, 199 insertions, 0 deletions
diff --git a/scripts/keyword.sh b/scripts/keyword.sh
new file mode 100755
index 0000000..eb5cb4b
--- /dev/null
+++ b/scripts/keyword.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+# by {maekke,opfer}@gentoo.org
+
+REPODIR="${HOME}/cvs/gentoo-x86"
+BUGZ_USER="maekke@gentoo.org"
+BUGZ="bugz"
+
+die() {
+ echo $@
+ exit 1
+}
+
+if [[ $# -lt 3 ]] ; then
+ echo "usage:"
+ echo " ${0} bug-id \"arch1 arch2...\" pkg1 pkg2 ..."
+ echo
+ echo "Examples: ${0} 1234 \"amd64 x86\" \$(cat /tmp/kde-3.5.9)"
+ echo " ${0} 2345 ppc =sys-kernel/vanilla-sources-2.6.25"
+ echo " ${0} 456 \"amd64 x86 sparc\" sys-apps/baselayout-2.0.0"
+ echo " ${0} 0 x86 media-gfx/graphviz (will generate a message w/o bug#)"
+ exit 1
+fi
+
+# some checks, that everything needed is installed
+if [[ ! -x $(which q) ]] ; then
+ echo "you need portage-utils"
+ echo "emerge app-portage/portage-utils"
+ exit 1
+fi
+
+if [[ ! -d ${REPODIR} ]] ; then
+ echo "your \${REPODIR}='${REPODIR}' does not exist."
+ exit 1
+fi
+
+bugid="${1}"
+arches="${2}"
+shift 2
+pkgs="$@"
+
+# check if arches are sane
+for arch in ${arches} ; do
+ [[ $(egrep "\<${arch/\~/}\>" ${REPODIR}/profiles/arch.list | wc -l) == 0 ]] && die "invalid arch (${arch})"
+done
+
+# commit message
+if [ ${arches:0:1} == "~" ] ; then
+ msg="add ${arches// //}"
+else
+ msg="${arches// //} stable"
+fi
+[[ ${bugid} != "0" ]] && msg="${msg}, bug #${bugid}"
+
+pkgno=0
+for pkg in ${pkgs} ; do
+ pkgno=$(( ${pkgno} + 1 ))
+ echo ">>> processing: ${pkg} (${pkgno}/$#)"
+ declare -a qatom
+ qatom=($(qatom ${pkg}))
+ [[ ${qatom#} < 2 ]] && die "invalid atom ${pkg}"
+ category=${qatom[0]/=}
+ pn=${qatom[1]}
+ version=${qatom[2]}
+ revision=${qatom[3]}
+ if [ -n "${revision}" ] ; then
+ version="${version}-${revision}"
+ fi
+
+ cd "${REPODIR}/${category}/${pn}" || die "package ${category}/${pn} not found"
+ cvs up || die "cvs up failed"
+ repoman -d full || die "repoman full failed"
+ ekeyword ${arches} ${pn}-${version}.ebuild || die "ebuild not found"
+ repoman -d full || die "repoman full failed"
+ echangelog --strict "${msg}" || die "echangelog failed"
+ repoman commit -m "${msg}" || die "repoman commit failed"
+done
+
+if [[ ${arches:0:1} == "~" ]] ; then
+ echo "removing arches from KEYWORDREQ bug unsupported atm"
+ exit 0
+fi
+[[ ${bugid} == 0 ]] && echo "done, as bug# is 0" && exit 0
+
+tmpfile="$(mktemp)"
+${BUGZ} --base=https://bugs.gentoo.org get ${bugid} > ${tmpfile}
+aliases="$(grep ^CC ${tmpfile} | sed -e "s|CC : ||g")"
+assignee="$(grep ^Assignee ${tmpfile} | sed -e "s|Assignee : ||")"
+rm ${tmpfile}
+
+# only accept arches, no herds/users etc
+for alias in ${aliases} ; do
+ if [[ $(grep ^${alias/@gentoo.org}\$ ${REPODIR}/profiles/arch.list | wc -l) -gt 0 ]] ; then
+ bugarches="${bugarches} ${alias}"
+ fi
+done
+
+lastarch="1"
+for bugarch in ${bugarches} ; do
+ found="0"
+ for arch in ${arches} ; do
+ [[ "${arch}@gentoo.org" == "${bugarch}" ]] && found="1"
+ done
+ [[ ${found} == 0 ]] && lastarch="0"
+done
+
+bugz_options="--base="https://bugs.gentoo.org" --user=${BUGZ_USER}"
+for arch in ${arches} ; do
+ bugz_options="${bugz_options} --remove-cc=${arch}@gentoo.org"
+done
+
+if [[ ${lastarch} == "1" ]] ; then
+ bugz_message="${arches// //} stable, all arches done."
+ [[ ${assignee} != "security@gentoo.org" ]] && bugz_options="${bugz_options} --fixed"
+else
+ bugz_message="${arches// //} stable"
+fi
+
+echo "running ${BUGZ} modify ${bugid} ${bugz_options} --comment=\"${bugz_message}\""
+${BUGZ} modify ${bugid} ${bugz_options} --comment="${bugz_message}" || die "bugz failed"
+echo ">>> finished successfully"
diff --git a/scripts/rdep b/scripts/rdep
new file mode 100755
index 0000000..68bb6e1
--- /dev/null
+++ b/scripts/rdep
@@ -0,0 +1,79 @@
+#!/bin/sh
+# get reverse dependencies for a specific arch from
+# the gentoo tinderbox and print the atoms
+# (with USE-dep syntax) out, so your arch-testing tool
+# can emerge them.
+
+REPODIR="${HOME}/cvs/gentoo-x86"
+BASE_URL="http://tinderbox.dev.gentoo.org/misc/dindex/"
+
+if [[ $# -ne 2 ]]; then
+ echo "usage:"
+ echo " ${0} arch category/package"
+ echo
+ echo "Examples: ${0} arm media-gfx/graphviz"
+ exit 1
+fi
+
+arch="${1}"
+pkg="${2}"
+
+if [[ ! -d ${REPODIR} ]]; then
+ echo "your \${REPODIR}='${REPODIR}' does not exist."
+ exit 1
+fi
+
+if [[ ! -x $(which q) ]] ; then
+ echo "you need portage-utils"
+ echo "emerge app-portage/portage-utils"
+ exit 1
+fi
+
+if [[ $(egrep "\<${arch}\>" ${REPODIR}/profiles/arch.list | wc -l) == 0 ]]; then
+ echo "invalid arch ${arch}"
+ exit 1
+fi
+
+if [[ ! -d ${REPODIR}/${pkg} ]]; then
+ echo "invalid package ${pkg} - do not use a version-number"
+fi
+
+tmp="$(mktemp)"
+wget -o /dev/null -O "${tmp}" "${BASE_URL}/${pkg}"
+
+last_pn=""
+# we sort it reverse, that we have the latest version in most cases the first and
+# not print the "older ones". this has some room for improvement
+for p in $(grep -v '^[B]' ${tmp} | sort -r); do
+ cpv="${p/:*/}"
+ use="${p/*:/}"
+ [[ ${use} == ${p} ]] && use=""
+ # negative use deps are !use and no -use
+ # multiple use-deps are separated by '+'
+ if [[ -n ${use} ]]; then
+ use="${use/!/-}"
+ use="${use/+/,}"
+ fi
+
+ # split up the category/package-version with q
+ declare -a qatom
+ qatom=($(qatom ${cpv}))
+ [[ ${qatom#} < 2 ]] && die "invalid atom ${cpv}"
+ category=${qatom[0]/=}
+ pn=${qatom[1]}
+ version=${qatom[2]}
+ revision=${qatom[3]}
+ [[ -n "${revision}" ]] && version="${version}-${revision}"
+
+ # make sure that the file exists, as the local or remote tree
+ # may be out of date
+ ebuild="${REPODIR}/${category}/${pn}/${pn}-${version}.ebuild"
+ if [[ -e ${ebuild} && $(egrep -H "KEYWORDS=.*( |\")\<${arch}\>" \
+ ${ebuild} | wc -l) == 1 ]]; then
+ if [[ ${last_pn} != ${category}/${pn} ]]; then
+ [[ -z ${use} ]] && echo "=${cpv}" || echo "=${cpv}[${use}]"
+ fi
+ fi
+ last_pn="${category}/${pn}"
+done
+rm "${tmp}"