#!/bin/bash PKGNAME="${1%/}" ORIGVER="${2}" NEWVER="${3}" usage() { echo "Usage: ${0##*/} pkgname origver newver" echo " Copies ebuild of orig version to new version and builds it" exit 1 } if [[ $# -ne 1 ]] && [[ $# -ne 3 ]]; then usage fi pushd ${1} &> /dev/null # Hacks for 1.0.0 bump, assuming only 1 ebuild in a directory #ORIGVER=$(ls *.ebuild) #ORIGVER=${ORIGVER/#${PKGNAME}-} #ORIGVER=${ORIGVER/%.ebuild} #NEWVER="1.0.0" # If we don't get versions, try and autodetect if [[ -z ${ORIGVER} ]] || [[ -z ${NEWVER} ]]; then for (( MAXVER=10; MAXVER >= 0; MAXVER-- )); do MAJOR_VER="0.99." FULLVER="${MAJOR_VER}${MAXVER}" # Autodetect doesn't work if revisions or other weird versions exist if [[ -e ${PKGNAME}-${FULLVER}-r*.ebuild ]]; then echo "Revision present in newest version; can't autodetect!" break elif [[ -e ${PKGNAME}-${FULLVER}_*.ebuild ]]; then echo "_pre, _rc etc present in newest version; can't autodetect!" break fi if [[ -e ${PKGNAME}-${FULLVER}.ebuild ]]; then ORIGVER=${FULLVER} NEWVER="${MAJOR_VER}$(( MAXVER + 1 ))" break fi done fi mv ${PKGNAME}-${ORIGVER}.ebuild ${PKGNAME}-${NEWVER}.ebuild for i in *.ebuild; do if [[ $i != ${PKGNAME}-${NEWVER}.ebuild ]]; then rm $i fi done GENTOO_MIRRORS="" ebuild ${PKGNAME}-${NEWVER}.ebuild digest sudo emerge =${PKGNAME}-${NEWVER} popd &> /dev/null