summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Polatel <hawking@gentoo.org>2007-12-13 17:23:49 +0000
committerAli Polatel <hawking@gentoo.org>2007-12-13 17:23:49 +0000
commitee51deba3790f6adc4f08a7e61320458d975a99e (patch)
treee07da17caf7d8f07829866b8d3c3a92de2e4515e
parentDon't ignore versions when SLOT doesn't exist, bug 201848 (diff)
downloadpython-updater-ee51deba3790f6adc4f08a7e61320458d975a99e.tar.gz
python-updater-ee51deba3790f6adc4f08a7e61320458d975a99e.tar.bz2
python-updater-ee51deba3790f6adc4f08a7e61320458d975a99e.zip
changed indentation to use 4 spaces instead of tabs, added vim modeline
-rwxr-xr-xpython-updater195
1 files changed, 97 insertions, 98 deletions
diff --git a/python-updater b/python-updater
index f91a0a5..1c9d247 100755
--- a/python-updater
+++ b/python-updater
@@ -1,5 +1,5 @@
#!/bin/bash
-#
+# vim: set et sw=4 sts=4 :
# A bit of hackery to update everything that is humanly possible
# that maybe related to an older version of python. This script can
# be run as many times as you like.
@@ -47,13 +47,13 @@ EBUILD="1"
source /etc/init.d/functions.sh
usage() {
- echo "usage: python-updater [-h|-p|-o X.X]"
- echo " --help, -h help"
- echo " --pretend, -p pretend (don't do anything)"
- echo " --old-version, -o X.X set old python version to upgrade from [default: ${OLD_PY_VER}]"
- echo " --ignore-versions, -i ignore versions when remerging packages (still respects SLOTs)"
- echo " --direct-only don't consider indirect aka manually added packages"
- echo " --package-manager, -P name select between ${SUPPORTED_PMS} [default: portage]"
+ echo "usage: python-updater [-h|-p|-o X.X]"
+ echo " --help, -h help"
+ echo " --pretend, -p pretend (don't do anything)"
+ echo " --old-version, -o X.X set old python version to upgrade from [default: ${OLD_PY_VER}]"
+ echo " --ignore-versions, -i ignore versions when remerging packages (still respects SLOTs)"
+ echo " --direct-only don't consider indirect aka manually added packages"
+ echo " --package-manager, -P name select between ${SUPPORTED_PMS} [default: portage]"
}
#
@@ -61,15 +61,15 @@ usage() {
#
if [ -z "${PORTDIR}" ]; then
- eerror "Unable to proceed. Can not find PORTDIR. Make sure the command:"
- eerror " "
- eerror " portageq portdir"
- eerror " "
- eerror "returns a value. If it doesn't, make sure you have updated to"
- eerror "latest portage version."
- eerror " "
- eerror "Report bugs to http://bugs.gentoo.org/"
- exit 1
+ eerror "Unable to proceed. Can not find PORTDIR. Make sure the command:"
+ eerror " "
+ eerror " portageq portdir"
+ eerror " "
+ eerror "returns a value. If it doesn't, make sure you have updated to"
+ eerror "latest portage version."
+ eerror " "
+ eerror "Report bugs to http://bugs.gentoo.org/"
+ exit 1
fi
#
@@ -78,62 +78,62 @@ fi
#
#
while [ -n "$1" ]; do
- case "$1" in
- -h|--help)
- usage
- exit 0
- ;;
- -p|--pretend)
- PRETEND=1
- ;;
- -o|--old-version)
- shift
- OLD_PY_VER="$1"
- ;;
- -i|--ignore-versions)
- IGNORE_VERSIONS=1
- ;;
- --direct-only)
- DIRECT_ONLY=1
- ;;
- -P|--package-manager)
- shift
- PACKAGE_MANAGER="$1"
- case "${PACKAGE_MANAGER}" in
- portage|pkgcore|paludis)
- ;;
- *)
- echo "unrecognised package manager selected. please select between ${SUPPORTED_PMS}"
- exit
- ;;
- esac
-
- # PMS_INDEX is used to select the right commands and options for the selected package manager
- PMS_INDEX=0
- for PM in ${SUPPORTED_PMS}; do
- [[ ${PM} == ${PACKAGE_MANAGER} ]] && break
- PMS_INDEX=$((${PMS_INDEX} + 1))
- done
- ;;
- *)
- usage
- echo "unrecognised option: $1"
- exit 0
- ;;
- esac
- shift
+ case "$1" in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ -p|--pretend)
+ PRETEND=1
+ ;;
+ -o|--old-version)
+ shift
+ OLD_PY_VER="$1"
+ ;;
+ -i|--ignore-versions)
+ IGNORE_VERSIONS=1
+ ;;
+ --direct-only)
+ DIRECT_ONLY=1
+ ;;
+ -P|--package-manager)
+ shift
+ PACKAGE_MANAGER="$1"
+ case "${PACKAGE_MANAGER}" in
+ portage|pkgcore|paludis)
+ ;;
+ *)
+ echo "unrecognised package manager selected. please select between ${SUPPORTED_PMS}"
+ exit
+ ;;
+ esac
+
+ # PMS_INDEX is used to select the right commands and options for the selected package manager
+ PMS_INDEX=0
+ for PM in ${SUPPORTED_PMS}; do
+ [[ ${PM} == ${PACKAGE_MANAGER} ]] && break
+ PMS_INDEX=$((${PMS_INDEX} + 1))
+ done
+ ;;
+ *)
+ usage
+ echo "unrecognised option: $1"
+ exit 0
+ ;;
+ esac
+ shift
done
# Determine old python version
if [[ -z "${OLD_PY_VER}" ]]; then
- for old in 2.5 2.4 2.3 2.2 2.1; do
- if [ "${old}" != "${NEW_PY_VER}" ]; then
- if [ -e /usr/bin/python${old} ] ; then
- OLD_PY_VER=${old}
- break;
- fi
- fi
- done
+ for old in 2.5 2.4 2.3 2.2 2.1; do
+ if [ "${old}" != "${NEW_PY_VER}" ]; then
+ if [ -e /usr/bin/python${old} ] ; then
+ OLD_PY_VER=${old}
+ break;
+ fi
+ fi
+ done
fi
@@ -142,15 +142,14 @@ if [ -z "${OLD_PY_VER}" ] ; then
exit 1
fi
-
#
# Test where portage is, in python2.2 or somewhere else?
#
for py in /usr/bin/python /usr/bin/python${OLD_PY_VER} /usr/bin/python${NEW_PY_VER}; do
- if ${py} -c "import portage" > /dev/null 2>&1; then
- PORTAGE_PYTHON=${py}
- break;
- fi
+ if ${py} -c "import portage" > /dev/null 2>&1; then
+ PORTAGE_PYTHON=${py}
+ break;
+ fi
done
#
@@ -174,47 +173,47 @@ for content in `find ${PKG_DBDIR} -name CONTENTS`; do
# exclude packages that are an exception, like portage and python itself.
exception=0
for exp in ${PKGS_EXCEPTIONS}; do
- if [ -z "${CATPKG##${exp}}" ]; then
- exception=1
- break;
- fi
+ if [ -z "${CATPKG##${exp}}" ]; then
+ exception=1
+ break;
+ fi
done
-
+
if [ ${exception} = 1 ]; then
- continue;
+ continue;
fi
-
+
# Check if package is in PKGS_MANUAL
if [[ DIRECT_ONLY -ne 1 ]]; then
- for pkg in ${PKGS_MANUAL}; do
- if [ -z "${CATPKG##${pkg}}" ]; then
- exception=2
- break;
- fi
- done
+ for pkg in ${PKGS_MANUAL}; do
+ if [ -z "${CATPKG##${pkg}}" ]; then
+ exception=2
+ break;
+ fi
+ done
fi
-
+
# replace version number by SLOT if IGNORE_VERSIONS != 0
# Don't ignore versions when SLOT doesn't exist, bug 201848
if [[ IGNORE_VERSIONS -ne 0 && -f "${content/CONTENTS/SLOT}" ]]; then
SLOT=$(< ${content/CONTENTS/SLOT})
CATPKGVER="${CATPKG}:${SLOT}"
else
- CATPKGVER="=${CATPKGVER}"
+ CATPKGVER="=${CATPKGVER}"
fi
-
+
if [ ${exception} = 2 ]; then
- PKGS_TO_REMERGE="${PKGS_TO_REMERGE} ${CATPKGVER}"
- einfo "Adding to list (manually): ${CATPKGVER}"
- continue;
+ PKGS_TO_REMERGE="${PKGS_TO_REMERGE} ${CATPKGVER}"
+ einfo "Adding to list (manually): ${CATPKGVER}"
+ continue;
fi
-
+
for OLD_MODULES_DIR in ${OLD_MODULES_DIRS}; do
if fgrep "${OLD_MODULES_DIR}" ${content} > /dev/null; then
- PKGS_TO_REMERGE="${PKGS_TO_REMERGE} ${CATPKGVER}"
+ PKGS_TO_REMERGE="${PKGS_TO_REMERGE} ${CATPKGVER}"
einfo "Adding to list: ${CATPKGVER}"
elif fgrep "${OLD_INCLUDE_DIR}" ${content} > /dev/null; then
- PKGS_TO_REMERGE="${PKGS_TO_REMERGE} ${CATPKGVER}"
+ PKGS_TO_REMERGE="${PKGS_TO_REMERGE} ${CATPKGVER}"
fi
done
done
@@ -224,7 +223,7 @@ done
# (Pretend to) remerge packages
if [[ -n "${PKGS_TO_REMERGE}" ]]; then
- ${PMS_COMMAND[${PMS_INDEX}]} ${PMS_OPTIONS[${PMS_INDEX}]} ${PKGS_TO_REMERGE}
+ ${PMS_COMMAND[${PMS_INDEX}]} ${PMS_OPTIONS[${PMS_INDEX}]} ${PKGS_TO_REMERGE}
else
- einfo "No packages needs to be remerged."
+ einfo "No packages needs to be remerged."
fi