ebump: Whitespace fixes.
authoridl0r <idl0r@gentoo.org>
Mon, 25 Oct 2010 16:38:26 +0000 (16:38 -0000)
committeridl0r <idl0r@gentoo.org>
Mon, 25 Oct 2010 16:38:26 +0000 (16:38 -0000)
svn path=/trunk/gentoolkit-dev/; revision=820

ChangeLog
src/ebump/ebump

index 1233ae09016bc252e0656030422ef7edbb221422..db498db2fd7f5a9c2e343a4b3a5e6051a45a50ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2010-10-25: Christian Ruppert <idl0r@gentoo.org>
+       * ebump: Whitespace fixes.
+
 2010-10-23: Christian Ruppert <idl0r@gentoo.org>
        * echangelog: Fix version bump detection for hg/mercurial, bug 335636,
                thanks to Mike Gilbert <floppymaster@gmail.com>.
@@ -14,8 +17,6 @@
 2010-07-03: Christian Ruppert <idl0r@gentoo.org>
        * ekeyword: Don't touch an empty KEYWORDS variable in case it occurs more
        than once, like in live ebuilds. Bug 321475.
-
-2010-07-03: Christian Ruppert <idl0r@gentoo.org>
        * ekeyword: Fix stabilization with "all", bug 304133#c11.
 
 2010-07-02: Christian Ruppert <idl0r@gentoo.org>
index 0b905d1c866cb266e9bbf8f2aca4dd3f633937b4..58ffb1a13ebc0a1d48d3128bc005f56a7fdd29e8 100755 (executable)
@@ -14,32 +14,32 @@ __description__="Ebuild version bumping tool"
 
 
 die() {
-    echo $1 > /dev/stderr
-    exit -1
+       echo $1 > /dev/stderr
+       exit -1
 }
 
 einfo() {
-    if [ ${opt_verbosity} -gt 1 ] ; then
-       echo $*
-    fi
+       if [ ${opt_verbosity} -gt 1 ] ; then
+               echo $*
+       fi
 }
 
 print_version() {
-    echo "${__description__}, v${__version__}"
-    echo "Copyright (c) 2004 ${__author__} ${__email__}"
-    echo "Copyright (c) 2004 Gentoo Technologies, Inc."
-    echo "Licensed under the GNU General Public License, version 2"
+       echo "${__description__}, v${__version__}"
+       echo "Copyright (c) 2004 ${__author__} ${__email__}"
+       echo "Copyright (c) 2004 Gentoo Technologies, Inc."
+       echo "Licensed under the GNU General Public License, version 2"
 }
 
 print_usage() {
-    echo "Usage: ebump <options> foo<.ebuild>"
-    echo "Ebuild version bumping tool, v${__version__}"
-    echo "  -V|--version           show version info"
-    echo "  -v|--verbose           increase verbosity"
-    echo "  -q|--quiet             turn off output"
-    echo "  -C|--no-vcs            do not add to VCS"
-    echo "  -m|--message           append message to ChangeLog"
-    echo "  -d|--delete-old        delete previous revision from VCS (DANGEROUS!)"
+       echo "Usage: ebump <options> foo<.ebuild>"
+       echo "Ebuild version bumping tool, v${__version__}"
+       echo "  -V|--version           show version info"
+       echo "  -v|--verbose           increase verbosity"
+       echo "  -q|--quiet             turn off output"
+       echo "  -C|--no-vcs            do not add to VCS"
+       echo "  -m|--message           append message to ChangeLog"
+       echo "  -d|--delete-old        delete previous revision from VCS (DANGEROUS!)"
 }
 
 #
@@ -47,19 +47,18 @@ print_usage() {
 # Home directory file takes precedence.
 #
 load_options() {
+       # FIXME: Sourcing config files like this is really a bad idea; users may
+       # easily override any function in this program inside his config files.
 
-    # FIXME: Sourcing config files like this is really a bad idea; users may
-    # easily override any function in this program inside his config files.
-
-    if [ -f /etc/gentoolkit/ebump.conf ] ; then
-       . /etc/gentoolkit/ebump.conf
-    fi
-    if [ -f ${HOME}/.gentoo/gentool-env ] ; then
-       . ${HOME}/.gentoo/gentool-env
-    fi
-    if [ -f ${HOME}/.gentoo/ebump.conf ] ; then
-       . ${HOME}/.gentoo/ebump.conf
-    fi
+       if [ -f /etc/gentoolkit/ebump.conf ] ; then
+               . /etc/gentoolkit/ebump.conf
+       fi
+       if [ -f ${HOME}/.gentoo/gentool-env ] ; then
+               . ${HOME}/.gentoo/gentool-env
+       fi
+       if [ -f ${HOME}/.gentoo/ebump.conf ] ; then
+               . ${HOME}/.gentoo/ebump.conf
+       fi
 
        # FIXME: remove this warning in 2-3 releases.
        if [[ -n ${opt_add_cvs} ]];
@@ -72,98 +71,98 @@ load_options() {
 # Find closes ebuild to ${1}, if any
 #
 find_ebuild() {
-    f=${1}
+       f=${1}
 
-    if [ -f ${1} ] ; then
-       echo ${1}
-    fi
+       if [ -f ${1} ] ; then
+               echo ${1}
+       fi
 
-    if [ -f ${1}.ebuild ] ; then
-       echo ${1}
-    fi
+       if [ -f ${1}.ebuild ] ; then
+               echo ${1}
+       fi
 }
 
 #
 # splitname (version|name|revision) package-name-version-revision
 #
 splitname() {
-    case $1 in
-       version)
-           echo ${2} | sed -r "s/.*-([0-9].*)/\1/"
-           ;;
-       name)
-           name=$(echo ${2} | sed -r "s/(.*)-[0-9].*/\1/")
-           if [ ${name} == ${2} ] ; then
-               if [ $(echo ${2} | grep "^[0-9].*") ] ; then
-                   # The filename starts with a version number, thus it has no
-                    # name
-                   name=""
-               else
-                   # The filename doesn't have a recognizeable version number;
-                    # everything is a name
-                   name=${2}
-               fi
-           fi
-           echo ${name}
-           ;;
-       revision)
-           rev=$(echo ${2} | sed -r "s/.*-r([0-9][0-9]*)/\1/")
-           if [ ${rev} == ${2} ] ; then
-               rev=0
-           fi
-           echo ${rev}
-           ;;
-       vernorev)
-           ver=$(echo ${2} | sed -r "s/.*-([0-9].*)-r[0-9]+/\1/")
-           if [ ${ver} == ${2} ] ; then
-               ver=$(echo ${2} | sed -r "s/.*-([0-9].*)/\1/")
-           fi
-           echo ${ver}
-           ;;
-       *)
-           echo
-    esac
+       case $1 in
+               version)
+                       echo ${2} | sed -r "s/.*-([0-9].*)/\1/"
+               ;;
+               name)
+                       name=$(echo ${2} | sed -r "s/(.*)-[0-9].*/\1/")
+                       if [ ${name} == ${2} ] ; then
+                               if [ $(echo ${2} | grep "^[0-9].*") ] ; then
+                                       # The filename starts with a version number, thus it has no
+                                       # name
+                                       name=""
+                               else
+                                       # The filename doesn't have a recognizeable version number;
+                                       # everything is a name
+                                       name=${2}
+                               fi
+                       fi
+                       echo ${name}
+               ;;
+               revision)
+                       rev=$(echo ${2} | sed -r "s/.*-r([0-9][0-9]*)/\1/")
+                       if [ ${rev} == ${2} ] ; then
+                               rev=0
+                       fi
+                       echo ${rev}
+               ;;
+               vernorev)
+                       ver=$(echo ${2} | sed -r "s/.*-([0-9].*)-r[0-9]+/\1/")
+                       if [ ${ver} == ${2} ] ; then
+                               ver=$(echo ${2} | sed -r "s/.*-([0-9].*)/\1/")
+                       fi
+                       echo ${ver}
+               ;;
+               *)
+                       echo
+       esac
 }
 
 process_ebuild() {
        vcs=$1
-    ebuild_arg=$2
+       ebuild_arg=$2
        shift $#
 
-    # Files to add to VCS
-    addfiles=""
-    # Files to remove from VCS
-    delfiles=""
+       # Files to add to VCS
+       addfiles=""
+       # Files to remove from VCS
+       delfiles=""
 
-    if [ -z ${ebuild_arg} ] ; then
-       print_usage
-       exit
-    fi
+       if [ -z ${ebuild_arg} ] ; then
+               print_usage
+               exit
+       fi
 
-    #
-    # Try to find a matching ebuild
-    #
+       #
+       # Try to find a matching ebuild
+       #
 
-    ebuild_name=$(find_ebuild ${ebuild_arg})
-    if [ -z ${ebuild_name} ] ; then
-       die "Could not find ${ebuild_arg}"
-    fi
-    einfo "Processing ebuild ${ebuild_name}"
+       ebuild_name=$(find_ebuild ${ebuild_arg})
+       if [ -z ${ebuild_name} ] ; then
+               die "Could not find ${ebuild_arg}"
+       fi
+       einfo "Processing ebuild ${ebuild_name}"
 
-    #
-    # Bump revision suffix (or add one)
-    #
+       #
+       # Bump revision suffix (or add one)
+       #
 
-    PF=$(basename ${ebuild_name} .ebuild)
-    PN=$(splitname name ${PF})
-    PV=$(splitname version ${PF})
-    rev=$(splitname revision ${PF})
-    PV_norev=$(splitname vernorev ${PF})
-    newPF=${PN}-${PV_norev}-r$[rev+1]
+       PF=$(basename ${ebuild_name} .ebuild)
+       PN=$(splitname name ${PF})
+       PV=$(splitname version ${PF})
+       rev=$(splitname revision ${PF})
+       PV_norev=$(splitname vernorev ${PF})
+       newPF=${PN}-${PV_norev}-r$[rev+1]
 
-#    echo $PF / $PN / $PV / $rev / $PV_norev / $newPF
+#      echo $PF / $PN / $PV / $rev / $PV_norev / $newPF
 
-    einfo "Bumped ${PF}.ebuild to ${newPF}.ebuild"
+       einfo "Bumped ${PF}.ebuild to ${newPF}.ebuild"
 
        if [[ "${vcs}" == "svn" ]];
        then
@@ -176,127 +175,123 @@ process_ebuild() {
 
        ekeyword '~all' "${newPF}.ebuild"
 
-    addfiles="${addfiles} ${newPF}.ebuild"
-    delfiles="${delfiles} ${PF}.ebuild"
+       addfiles="${addfiles} ${newPF}.ebuild"
+       delfiles="${delfiles} ${PF}.ebuild"
 
-    #
-    # (Optional) Bump relevant files in files/
-    #
+       #
+       # (Optional) Bump relevant files in files/
+       #
+       if [ "${opt_bump_auxfiles}" == "y" ] ; then
+               # Gather list of auxiliary files in files/ that has a versioned
+               # filename, where the version matches our current version.
 
-    if [ "${opt_bump_auxfiles}" == "y" ] ; then
-
-        # Gather list of auxiliary files in files/ that has a versioned
-       # filename, where the version matches our current version.
+               bumplist=""
+               for x in $(echo files/*) ; do
+                       if [ ! -z $(echo $x | grep "${PV}$") ] ; then
+                               bumplist="${bumplist} ${x}"
+                       fi
+               done
 
-       bumplist=""
-       for x in $(echo files/*) ; do
-           if [ ! -z $(echo $x | grep "${PV}$") ] ; then
-               bumplist="${bumplist} ${x}"
-           fi
-       done
+               # Bump version of all matches
+               for x in ${bumplist} ; do
+                       bn=$(basename ${x})
+                       dn=$(dirname ${x})
 
-        # Bump version of all matches
+                       PN=$(splitname name ${bn})
+                       PV=$(splitname version ${bn})
+                       rev=$(splitname revision ${bn})
+                       PV_norev=$(splitname vernorev ${bn})
 
-       for x in ${bumplist} ; do
+#                      echo $PN / ${PV_norev} / ${rev}
 
-           bn=$(basename ${x})
-           dn=$(dirname ${x})
+                       # Special case for when we have no name part; filename
+                       # is just a version number
+                       if [ -z "${PN}" ] ; then
+                               newbn=${PV_norev}-r$[rev+1]
+                       else
+                               newbn=${PN}-${PV_norev}-r$[rev+1]
+                       fi
 
-           PN=$(splitname name ${bn})
-           PV=$(splitname version ${bn})
-           rev=$(splitname revision ${bn})
-           PV_norev=$(splitname vernorev ${bn})
+                       if [ -d ${dn}/${bn} ] ; then
+                               if [ -e ${dn}/${newbn} ] ; then
+                                       echo "Directory ${dn}/${newbn} exists, not copying" > /dev/stderr
+                               else
+                                       cp -a ${dn}/${bn} ${dn}/${newbn}
+                                       # uhm, is that necessary?
+#                                      find ${dn}/${newbn} -name CVS | xargs rm -rf
+                               fi
+                       else
+                               cp ${dn}/${bn} ${dn}/${newbn}
+                       fi
 
-#          echo $PN / ${PV_norev} / ${rev}
+                       addfiles="${addfiles} ${dn}/${newbn}"
+                       delfiles="${delfiles} ${dn}/${bn}"
 
-           # Special case for when we have no name part; filename
-           # is just a version number
-           if [ -z "${PN}" ] ; then
-               newbn=${PV_norev}-r$[rev+1]
-           else
-               newbn=${PN}-${PV_norev}-r$[rev+1]
-           fi
+                       einfo "Bumped ${dn}/${bn} to ${dn}/${newbn}"
+                       done
+               fi
 
-           if [ -d ${dn}/${bn} ] ; then
-               if [ -e ${dn}/${newbn} ] ; then
-                   echo "Directory ${dn}/${newbn} exists, not copying" > /dev/stderr
-               else
-                   cp -a ${dn}/${bn} ${dn}/${newbn}
-                       # uhm, is that necessary?
-#                  find ${dn}/${newbn} -name CVS | xargs rm -rf
+#              echo "addfiles ${addfiles}"
+#              echo "delfiles ${delfiles}"
+
+               filelist="${addfiles}"
+
+               #
+               # (Optional) Add VCS entry for all new files
+               #
+               if [ "${opt_add_vcs}" == "y" ] ; then
+                       for x in ${addfiles} ; do
+                               if [ -d ${x} ] ; then
+                                       find ${x} -exec ${vcs} add {} ';'
+                               else
+                                       ${vcs} add ${x}
+                               fi
+                       done
+                       einfo "Added ${addfiles} to VCS"
                fi
-           else
-               cp ${dn}/${bn} ${dn}/${newbn}
-           fi
-
-           addfiles="${addfiles} ${dn}/${newbn}"
-           delfiles="${delfiles} ${dn}/${bn}"
-
-           einfo "Bumped ${dn}/${bn} to ${dn}/${newbn}"
-       done
-    fi
-
-#    echo "addfiles ${addfiles}"
-#    echo "delfiles ${delfiles}"
-
-       filelist="${addfiles}"
-
-    #
-    # (Optional) Add VCS entry for all new files
-    #
-    if [ "${opt_add_vcs}" == "y" ] ; then
-               for x in ${addfiles} ; do
-                   if [ -d ${x} ] ; then
-                               find ${x} -exec ${vcs} add {} ';'
-                   else
-                               ${vcs} add ${x}
-                   fi
-               done
-               einfo "Added ${addfiles} to VCS"
-    fi
 
 
-    #
-    # (Optional) Delete previous entry
-    #
-    # Could we use 'rm' instead of remove for all vcs?
-    if [ "${opt_delete_old}" == "y" ] ; then
-               for x in ${delfiles} ; do
-                       if [[ "${vcs}" == "cvs" ]];
-                       then
-                           ${vcs} remove -f ${x}
-                       elif [[ "${vcs}" == "git" ]];
-                       then
-                               ${vcs} rm ${x}
-                       else
-                               ${vcs} remove ${x}
-                       fi
-               done
-               einfo "Removed ${delfiles} from VCS"
-    fi
+               #
+               # (Optional) Delete previous entry
+               #
+               # Could we use 'rm' instead of remove for all vcs?
+               if [ "${opt_delete_old}" == "y" ] ; then
+                       for x in ${delfiles} ; do
+                               if [[ "${vcs}" == "cvs" ]];
+                               then
+                                       ${vcs} remove -f ${x}
+                               elif [[ "${vcs}" == "git" ]];
+                               then
+                                       ${vcs} rm ${x}
+                               else
+                                       ${vcs} remove ${x}
+                               fi
+                       done
+                       einfo "Removed ${delfiles} from VCS"
+               fi
 
-    #
-    # (Optional) Add ChangeLog entry
-    #
-       if [[ "${opt_add_changelog}" == "y" ]] && [[ "${opt_add_vcs}" == "y" ]];
-       then
-               # FIXME: remove this warning in 2-3 releases
-               if [[ -n ${AUTHORNAME} ]] || [[ -n ${AUTHOREMAIL} ]];
+               #
+               # (Optional) Add ChangeLog entry
+               #
+               if [[ "${opt_add_changelog}" == "y" ]] && [[ "${opt_add_vcs}" == "y" ]];
                then
-                       echo "Warning: AUTHORNAME and AUTHOREMAIL is deprecated!" >/dev/stderr
-                       echo "Please take a look at echangelog(1)." >/dev/stderr
-                       echo "To avoid this warning unset AUTHORNAME and AUTHOREMAIL." >/dev/stderr
-               fi
+                       # FIXME: remove this warning in 2-3 releases
+                       if [[ -n ${AUTHORNAME} ]] || [[ -n ${AUTHOREMAIL} ]];
+                       then
+                               echo "Warning: AUTHORNAME and AUTHOREMAIL is deprecated!" >/dev/stderr
+                               echo "Please take a look at echangelog(1)." >/dev/stderr
+                               echo "To avoid this warning unset AUTHORNAME and AUTHOREMAIL." >/dev/stderr
+                       fi
 
-               echangelog "${opt_commitmessage}" || set $?
+                       echangelog "${opt_commitmessage}" || set $?
 
-               if [[ ${1:-0} -ne 0 ]];
-               then
-                       einfo "Modifying ChangeLog failed!"
-               else
-                       einfo "Added ChangeLog entry"
+                       if [[ ${1:-0} -ne 0 ]];
+                       then
+                               einfo "Modifying ChangeLog failed!"
+                       else
+                               einfo "Added ChangeLog entry"
+                       fi
                fi
-    fi
 }
 
 get_vcs() {
@@ -339,41 +334,41 @@ load_options
 
 skip=0
 while [ ${#} -gt 0 ] ; do
-    arg=${1}
-    shift
-    if [ ${skip} -gt 0 ] ; then
+       arg=${1}
+       shift
+       if [ ${skip} -gt 0 ] ; then
        skip=$[skip-1]
-    else
+       else
        case ${arg} in
-           -h|--help)
+       -h|--help)
                print_usage
                exit 0
                ;;
-           -m|--message)
+       -m|--message)
                opt_commitmessage="${1}"
                skip=1
                ;;
-           -C|--no-vcs)
+       -C|--no-vcs)
                opt_add_vcs=n
                ;;
-           -V|--version)
+       -V|--version)
                print_version
                exit
                ;;
-           -v|--verbose)
+       -v|--verbose)
                opt_verbosity=$[opt_verbosity + 1]
                ;;
-           -q|--quiet)
+       -q|--quiet)
                opt_verbosity=0
                ;;
-           -d|--delete-old)
+       -d|--delete-old)
                opt_delete_old=y
                ;;
-           *)
+       *)
                ebuild_arg=${arg}
                ;;
        esac
-    fi
+       fi
 done
 
 _vcs=$(get_vcs)