diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> | 2011-12-26 03:34:14 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> | 2011-12-26 03:34:14 +0000 |
commit | e960348c17ec11ddb23216684adb17e28284d09e (patch) | |
tree | ab6279b3e253bc30d0b041686737ca3d0d0e5e04 | |
parent | Improve coding style. (diff) | |
download | python-updater-e960348c17ec11ddb23216684adb17e28284d09e.tar.gz python-updater-e960348c17ec11ddb23216684adb17e28284d09e.tar.bz2 python-updater-e960348c17ec11ddb23216684adb17e28284d09e.zip |
Add support for --enable-all / --disable-all options.
-rwxr-xr-x | python-updater | 112 |
1 files changed, 63 insertions, 49 deletions
diff --git a/python-updater b/python-updater index ab66b3e..f5d2681 100755 --- a/python-updater +++ b/python-updater @@ -53,21 +53,19 @@ PMS_INDEX=0 CUSTOM_PMS_COMMAND="" ADDITIONAL_OPTIONS="" -# Checks -CHECK_MANUAL=1 -CHECK_PYLIBDIR=1 -CHECK_PYTHON_ABIS=1 -CHECK_SHARED_LINKING=1 -CHECK_STATIC_LINKING=1 -CHECK_ECLASS_NEED_REBUILD=1 - -# load the gentoo-style info macros, but hack to get around -# it thinking this is an rc script -EBUILD="1" -source /etc/init.d/functions.sh - -# portage variables -PKG_DBDIR=/var/db/pkg +# Checks. +CHECK_MANUAL="1" +CHECK_NEED_REBUILD="1" +CHECK_PYLIBDIR="1" +CHECK_PYTHON_ABIS="1" +CHECK_SHARED_LINKING="1" +CHECK_STATIC_LINKING="1" + +# Load the Gentoo-style info macros, but hack to get around it thinking this is an rc script. +EBUILD="1" . /etc/init.d/functions.sh + +# Portage variables. +PKG_DBDIR="/var/db/pkg" # usage() # display usage @@ -87,12 +85,7 @@ Options: -P PM, --package-manager PM Use package manager PM, where PM can be one of: $(for p in ${SUPPORTED_PMS}; do -echo -ne $'\t\t '\* ${p} -if [[ ${p} == portage ]]; then - echo ' (Default)' -else - echo -fi + echo -e "\t\t * ${p}$([[ "${p}" == "portage" ]] && echo " (Default)")" done) -c CMD, --command CMD Pipe found packages to command CMD instead of invoking package @@ -102,6 +95,7 @@ done) package manager. -eCHECK --enable-CHECK Enable CHECK where CHECK can be one of: + * all * manual (Enabled by default) * need_rebuild (Enabled by default) * pylibdir (Enabled by default) @@ -380,7 +374,7 @@ for pm in ${SUPPORTED_PMS}; do done # Command Line Parsing -while [[ -n "${1}" ]]; do +while (($#)); do case "${1}" in -h|--help) usage @@ -391,13 +385,13 @@ while [[ -n "${1}" ]]; do exit 0 ;; -p|--pretend) - PRETEND=1 + PRETEND="1" ;; -v|--verbose) ((VERBOSE++)) ;; --reinstall-identical-versions) - REINSTALL_IDENTICAL_VERSIONS=1 + REINSTALL_IDENTICAL_VERSIONS="1" ;; -P|--package-manager) shift @@ -426,41 +420,57 @@ while [[ -n "${1}" ]]; do shift PIPE_COMMAND="${1}" ;; + -eall|--enable-all) + CHECK_MANUAL="1" + CHECK_NEED_REBUILD="1" + CHECK_PYLIBDIR="1" + CHECK_PYTHON_ABIS="1" + CHECK_SHARED_LINKING="1" + CHECK_STATIC_LINKING="1" + ;; + -dall|--disable-all) + CHECK_MANUAL="0" + CHECK_NEED_REBUILD="0" + CHECK_PYLIBDIR="0" + CHECK_PYTHON_ABIS="0" + CHECK_SHARED_LINKING="0" + CHECK_STATIC_LINKING="0" + ;; -emanual|--enable-manual) - CHECK_MANUAL=1 + CHECK_MANUAL="1" ;; -dmanual|--disable-manual) - CHECK_MANUAL=0 + CHECK_MANUAL="0" ;; -eneed_rebuild|--enable-need_rebuild) - CHECK_ECLASS_NEED_REBUILD=1 + CHECK_NEED_REBUILD="1" ;; -dneed_rebuild|--disable-need_rebuild) - CHECK_ECLASS_NEED_REBUILD=0 + CHECK_NEED_REBUILD="0" ;; -epylibdir|--enable-pylibdir) - CHECK_PYLIBDIR=1 + CHECK_PYLIBDIR="1" ;; -dpylibdir|--disable-pylibdir) - CHECK_PYLIBDIR=0 + CHECK_PYLIBDIR="0" ;; -ePYTHON_ABIS|--enable-PYTHON_ABIS) - CHECK_PYTHON_ABIS=1 + CHECK_PYTHON_ABIS="1" ;; -dPYTHON_ABIS|--disable-PYTHON_ABIS) - CHECK_PYTHON_ABIS=0 + CHECK_PYTHON_ABIS="0" ;; -eshared_linking|--enable-shared_linking) - CHECK_SHARED_LINKING=1 + CHECK_SHARED_LINKING="1" ;; -dshared_linking|--disable-shared_linking) - CHECK_SHARED_LINKING=0 + CHECK_SHARED_LINKING="0" ;; -estatic_linking|--enable-static_linking) - CHECK_STATIC_LINKING=1 + CHECK_STATIC_LINKING="1" ;; -dstatic_linking|--disable-static_linking) - CHECK_STATIC_LINKING=0 + CHECK_STATIC_LINKING="0" ;; --) shift @@ -622,7 +632,7 @@ eoutdent [[ "${CHECK_MANUAL}" -ne 0 ]] \ && veinfo 1 'Check "manual" enabled.' \ || veinfo 1 'Check "manual" disabled.' -[[ "${CHECK_ECLASS_NEED_REBUILD}" -ne 0 ]] \ +[[ "${CHECK_NEED_REBUILD}" -ne 0 ]] \ && veinfo 1 'Check "need_rebuild" enabled.' \ || veinfo 1 'Check "need_rebuild" disabled.' [[ "${CHECK_PYLIBDIR}" -ne 0 ]] \ @@ -704,17 +714,6 @@ for contents_file in $(find ${PKG_DBDIR}/ -name CONTENTS | sort); do continue fi - # Check if package is in PKGS_MANUAL. - if [[ "${CHECK_MANUAL}" -ne 0 ]] && has "${CATPKG}" ${PKGS_MANUAL}; then - PKGS_TO_REMERGE+=" ${CATPKGVER}" - eindent - einfo "Adding to list: ${CATPKGVER}" - eindent - einfo "check: manual [Added to list manually, see CHECKS in manpage for more information.]" - eoutdent && eoutdent - continue - fi - if [[ -n "${PYTHON_MULTIPLE_ABIS}" && "${EAPI}" =~ ^4-python$ ]]; then # Potentially update USE flags in IUSE in EAPI >= 4-python. if [[ "${PRETEND}" -eq 0 && -f "${contents_file%CONTENTS}IUSE" && -f "${contents_file%CONTENTS}USE" && -f "${contents_file%CONTENTS}repository" ]]; then @@ -739,6 +738,21 @@ for contents_file in $(find ${PKG_DBDIR}/ -name CONTENTS | sort); do continue fi + if [[ "$((${CHECK_MANUAL} + ${CHECK_NEED_REBUILD} + ${CHECK_PYLIBDIR} + ${CHECK_PYTHON_ABIS} + ${CHECK_SHARED_LINKING} + ${CHECK_STATIC_LINKING}))" -eq 0 ]]; then + continue + fi + + # Check if package is in PKGS_MANUAL. + if [[ "${CHECK_MANUAL}" -ne 0 ]] && has "${CATPKG}" ${PKGS_MANUAL}; then + PKGS_TO_REMERGE+=" ${CATPKGVER}" + eindent + einfo "Adding to list: ${CATPKGVER}" + eindent + einfo "check: manual [Added to list manually, see CHECKS in manpage for more information.]" + eoutdent && eoutdent + continue + fi + if [[ "${CHECK_PYTHON_ABIS}" -ne 0 ]]; then if [[ -n "${PYTHON_MULTIPLE_ABIS}" || -n "${SUPPORT_PYTHON_ABIS}" ]]; then new_PYTHON_ABIS="" @@ -802,7 +816,7 @@ for contents_file in $(find ${PKG_DBDIR}/ -name CONTENTS | sort); do continue fi - if [[ "${CHECK_ECLASS_NEED_REBUILD}" -ne 0 ]]; then + if [[ "${CHECK_NEED_REBUILD}" -ne 0 ]]; then get_vdb_variable PYTHON_NEED_REBUILD "${environment_file}" if echo "${PYTHON_NEED_REBUILD}" | grep -qE "$(get_OLD_PYTHON_VERSIONS_REGEX)"; then PKGS_TO_REMERGE+=" ${CATPKGVER}" |