commit:     2d9cdec94fb16809f228929351419f125a137af3
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 17 16:33:02 2014 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Wed Sep 17 16:35:46 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=2d9cdec9

[Documentation/maintainers] Add simple tool to drop versions based on a set.

---
 Documentation/maintainers/drop-from-set.sh | 58 ++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/Documentation/maintainers/drop-from-set.sh 
b/Documentation/maintainers/drop-from-set.sh
new file mode 100755
index 0000000..5645c78
--- /dev/null
+++ b/Documentation/maintainers/drop-from-set.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# requires app-portage/portage-utils and app-portage/gentoolkit-dev
+
+: ${PORTDIR:="$(pwd)"}
+
+get_package_list_from_set() {
+
+       local SET="${1}"
+
+       for entry in $(grep -v ^[#@] "${PORTDIR}/sets/${SET}") ; do
+               if [[ ${entry} == \#*  || ${entry} == @* ]] ; then
+                       continue
+               fi
+               echo $(qatom ${entry} | cut -d " " -f 1-2 | tr " " "/")
+       done
+
+}
+
+help() {
+       echo Simple set-based version removed.
+       echo
+       echo Given a set file, removes all packages of a specified version.
+       echo
+       echo Reads PORTDIR from your environment, defaulting to the current 
directory.
+       echo
+       echo Usage: drop-from-set.sh SETNAME VERSION
+       echo Example: drop-from-set.sh kde-plasma-5.0 5.0.1
+       exit 0
+}
+
+
+SETNAME="$1"
+VERSION="$2"
+
+if [[ $1 == "--help" ]] ; then
+       help
+fi
+
+if [[ -z "${SETNAME}" || -z "${VERSION}" ]] ; then
+       echo ERROR: Not enough arguments
+       echo
+       help
+fi
+
+packages=$(get_package_list_from_set ${SETNAME})
+
+for package in ${packages} ; do
+       pushd "${PORTDIR}/${package}" > /dev/null
+
+       pn=$(basename $(pwd))
+
+       rm -f ${pn}-${VERSION}.ebuild
+       rm -f ${pn}-${VERSION}-r*.ebuild
+
+       repoman manifest
+
+done

Reply via email to