commit:     dddd95da392dc0e44cfff488be6432645df1a31f
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 12 11:05:18 2014 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Tue Aug 12 11:05:18 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=dddd95da

[Documentation/maintainers] Add new simple script for set-based 9999 -> release 
bumps.

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

diff --git a/Documentation/maintainers/bump-from-set.sh 
b/Documentation/maintainers/bump-from-set.sh
new file mode 100755
index 0000000..741f199
--- /dev/null
+++ b/Documentation/maintainers/bump-from-set.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# requires app-portage/portage-utils and app-portage/gentoolkit-dev
+
+: ${KEYWORDS:="~amd64"}
+: ${PORTDIR:="$(pwd)"}
+
+get_package_list_from_set() {
+
+       local SET="${1}"
+
+       for entry in $(cat "${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 bumper.
+       echo
+       echo Given a set file, bumps all packages in the given set given source
+       echo and destination versions. Designed for workflows where ebuilds are
+       echo bumped from up-to-date live versions.
+       echo
+       echo Reads PORTDIR from your enviroment, defaulting to the current 
directory.
+       echo
+       echo Reads KEYWORDS for the new ebuild from your environment, 
defaulting to ~amd64.
+       echo
+       echo Usage: bump-from-set.sh SETNAME SOURCEVERSION DESTINATIONVERSION
+       echo Example: bump-from-set.sh kde-plasma-5.0 5.0.9999 5.0.1
+       exit 0
+}
+
+
+SETNAME="$1"
+SOURCEVERSION="$2"
+DESTINATIONVERSION="$3"
+
+if [[ $1 == "--help" ]] ; then
+       help
+fi
+
+if [[ -z "${SETNAME}" || -z "${SOURCEVERSION}" || -z "${DESTINATIONVERSION}" 
]] ; 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))
+       source=${pn}-${SOURCEVERSION}.ebuild
+       destination=${pn}-${DESTINATIONVERSION}.ebuild
+
+       cp ${source} ${destination}
+       ekeyword ^all ${destination} > /dev/null
+
+       if [[ ${destination} != *9999* ]] ; then
+               ekeyword ${KEYWORDS} ${destination} > /dev/null
+       fi
+
+       repoman manifest
+
+       popd > /dev/null
+done

Reply via email to