* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-02-25 16:50 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-02-25 16:50 UTC (permalink / raw
To: gentoo-commits
commit: d8579a7df0e40734cf4058bae64c63035d041d93
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 16:14:21 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 16:14:21 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d8579a7d
Fix whitespace
---
bin/euse | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/bin/euse b/bin/euse
index bb207c7..175febb 100755
--- a/bin/euse
+++ b/bin/euse
@@ -74,7 +74,7 @@ parse_arguments() {
-E | --enable) MODE="modify"; ACTION="add";;
-D | --disable) MODE="modify"; ACTION="remove";;
-P | --prune | -R | --remove)
- MODE="modify"; ACTION="prune";;
+ MODE="modify"; ACTION="prune";;
-p | --package) MODE="modify"; shift; PACKAGE=${1}; SCOPE="local";;
-*)
echo "ERROR: unknown option ${1} specified."
@@ -218,7 +218,7 @@ print ' '.join(r)"
# * - Lines of package atom followed by flags
# (app-editors/vim flag1 flag2 -flag3)
reduce_package_use() {
- echo "${@}" | python -c "import sys,re
+ echo "${@}" | python -c "import sys,re
h={}; getflags=re.compile(r'(-?[\w*-]+)')
for x in sys.stdin.read().split('\n'):
if not x: continue
@@ -708,7 +708,7 @@ ALL_PORTDIRS=( "$PORTDIR" $(get_all_overlays) )
# Returns:
# 0 (True) if needle in haystack, null (False) otherwise
array_contains() {
- for i in $1; do [[ $i == $2 ]] && return 0; done
+ for i in $1; do [[ $i == $2 ]] && return 0; done
return
} # }}}
@@ -979,8 +979,8 @@ scrub_use_flag() {
elif [[ -n "${PACKAGE}" ]]; then
if [[ -n $(echo "${line}" | grep -Ee "${pkg_re}") ]]; then
# If this is the only (remaining) use flag defined
- # for this package, then remove the whole line
- if [[ -z $(echo "${line}" | \
+ # for this package, then remove the whole line
+ if [[ -z $(echo "${line}" | \
grep -Ee "${pkg_re} *-?${flag} *$") ]]; then
# Remove flag from this line
echo "${line}" | sed -re "s/ *-?\b${flag}\b//"
@@ -1060,12 +1060,12 @@ modify_package() {
# XXX: Handle version or version wildcard?
warn "USE flag \"${flag}\" is not used by $PACKAGE"
# Don't necessarily bail for this, just warn
- elif [[ -n "${V}" && -z "$(egrep "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
- error "Invalid package atom. Did you forget the leading '='?"
- continue
- elif [[ -z "${V}" && -n "$(egrep "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
- error "Invalid package atom. Did you forget the version?"
- continue
+ elif [[ -n "${V}" && -z "$(egrep "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
+ error "Invalid package atom. Did you forget the leading '='?"
+ continue
+ elif [[ -z "${V}" && -n "$(egrep "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
+ error "Invalid package atom. Did you forget the version?"
+ continue
fi
# If flag is enabled in portage USE flags (emerge --info),
# then "remove"ing the flag should be replaced with adding
@@ -1084,10 +1084,10 @@ modify_package() {
flag="-${flag}"
ACTION="add"
fi
- else
- # Not enabled in package.use, so disable it there
- flag="-${flag}"
- ACTION="add"
+ else
+ # Not enabled in package.use, so disable it there
+ flag="-${flag}"
+ ACTION="add"
fi
else
error "USE flag \"$flag\" is already disabled for $PACKAGE"
@@ -1146,7 +1146,7 @@ modify_package() {
fi
# Walk through the file and add the flag manually
echo "Adding \"${PACKAGE}[${flag}]\" use flag in \"${filename}\""
- local added=0
+ local added=0
while read line; do
if [[ -n $(echo "${line}" | egrep -re "^[^#]*${PACKAGE} ") ]]; then
echo $(reduce_package_use "${line} ${flag}")
@@ -1281,7 +1281,7 @@ modify() {
echo -n 'USE="'
echo -ne "${NEW_MAKE_CONF_USE_2%% }"
echo '"'
- inuse=0
+ inuse=0
had_use=1
fi
done
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-02-25 16:50 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-02-25 16:50 UTC (permalink / raw
To: gentoo-commits
commit: c04bf420b43fd88b1c91a3242cfefa912855b440
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 16:26:00 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 16:26:00 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=c04bf420
Fix small typo
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 10e9044..dbbb129 100755
--- a/bin/euse
+++ b/bin/euse
@@ -1077,7 +1077,7 @@ modify_package() {
error "Invalid package atom. Did you forget the version?"
continue
fi
- # If removing a disabled flag, or addind an enabled one, emit a warning,
+ # If removing a disabled flag, or adding an enabled one, emit a warning,
# indicating a likely misunderstanding
if [[ "${ACTION}" == "remove" ]]; then
if [[ "${ACTIVE:-${GLOBAL_ACTIVE}}" == "-" ]]; then
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-02-25 16:50 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-02-25 16:50 UTC (permalink / raw
To: gentoo-commits
commit: 4dfe8e7e2fb3338d3473ddfd59f0f81d003e8cc1
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 16:21:04 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 16:21:04 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=4dfe8e7e
Apply latest changes from Jared Hancock
Fixes described issues from:
http://bugs.gentoo.org/show_bug.cgi?id=259318#c88
"It's now more vocal when handling global flags, and does not indicate
make.conf was edited if it was not. Actually, more specifically, it
does not modify make.conf unnecessarily. (As before, it modified
make.conf every time regardless of whether or not it changed anything)
Also fixed the issue with removing and disabling multiple flags for a
package."
---
bin/euse | 121 ++++++++++++++++++++++++-------------------------------------
1 files changed, 48 insertions(+), 73 deletions(-)
diff --git a/bin/euse b/bin/euse
index 175febb..10e9044 100755
--- a/bin/euse
+++ b/bin/euse
@@ -936,11 +936,13 @@ add_flag() {
return 1
else
NEW_MAKE_CONF_USE="${NEW_MAKE_CONF_USE} ${1}"
+ echo "Adding flag \"${1}\" to make.conf" >&2
fi
}
remove_flag() {
NEW_MAKE_CONF_USE="${NEW_MAKE_CONF_USE// ${1} / }"
+ echo "Removing flag \"${1}\" from make.conf" >&2
}
# Function: clean_package_use {{{
@@ -1035,6 +1037,7 @@ modify_package() {
while [[ -n ${2} ]]; do
shift
local flag=${1}
+ local method="add"
ACTIVE="-"
#
# Fetch flag ACTIVE status (+,-,null)
@@ -1045,8 +1048,15 @@ modify_package() {
get_flagstatus_pkg "${flag}" "${pkg}" "${ACTIVE}" "${V}" > /dev/null
#
# --- Sanity checks
- # (1) make sure ${pkg} exists in portdir
- if [[ ! -d "$(get_portdir)/${pkg}" ]]; then
+ # (1) make sure ${pkg} exists in portdir or an overlay
+ local exists=1
+ for portdir in ${ALL_PORTDIRS[@]}; do
+ if [[ -d "${portdir}/${pkg}" ]]; then
+ exists=0
+ break
+ fi
+ done
+ if [[ $exists == 1 ]]; then
fatal "Package \"${pkg}\" does not exist"
#
# (2) make sure ${flag} is defined in get_useflaglist
@@ -1067,66 +1077,24 @@ modify_package() {
error "Invalid package atom. Did you forget the version?"
continue
fi
- # If flag is enabled in portage USE flags (emerge --info),
- # then "remove"ing the flag should be replaced with adding
- # the negative flag instead
+ # If removing a disabled flag, or addind an enabled one, emit a warning,
+ # indicating a likely misunderstanding
if [[ "${ACTION}" == "remove" ]]; then
- if [[ "${ACTIVE:-${GLOBAL_ACTIVE}}" == "+" ]]; then
- if [[ -n $(echo "${ACTIVE_FLAGS[4]}" | grep "^$PACKAGE" \
- | grep " $flag") ]]; then
- iuse=$(echo "${ACTIVE_FLAGS[5]} " | grep -Ee "^${pkg_re}" \
- | cut -d ";" -f4 | egrep -o "[+-]?${flag}")
- # Ensure the flag is enabled in the ebuild _and_ in package.use,
- # if so, enable it in package.use
- if [[ "${iuse}" =~ "+" ]]; then
- # The flag is currently enabled in the ebuild, so add a
- # disablement
- flag="-${flag}"
- ACTION="add"
- fi
- else
- # Not enabled in package.use, so disable it there
- flag="-${flag}"
- ACTION="add"
- fi
- else
- error "USE flag \"$flag\" is already disabled for $PACKAGE"
- continue
+ if [[ "${ACTIVE:-${GLOBAL_ACTIVE}}" == "-" ]]; then
+ warn "USE flag \"$flag\" is already disabled for $PACKAGE"
fi
+ flag="-${flag}"
elif [[ "${ACTION}" == "prune" ]]; then
# Just remove the flag below
[[ "${ACTIVE}" == "-" ]] && flag="-${flag}"
- ACTION="remove"
- # If flag is currently disabled for the package requested
- # to be enabled in, then "remove" the negative
+ method="remove"
elif [[ "${ACTION}" == "add" ]]; then
- if [[ "${ACTIVE}" == "-" ]]; then
- # If flag is masked, it should be added to package.mask, instead
- # of package.use. For now, yield a warning and quit
- if [[ -n $(echo " ${ACTIVE_FLAGS[6]}" | grep " -${flag} ") ]]; then
- error "USE flag \"$flag\" is masked. Enabling in package.use will" \
- "\nbe ineffective. You may have an incorrect profile selected."
- continue
- elif [[ -n $(echo "${ACTIVE_FLAGS[4]}" | grep "^$PACKAGE" \
- | grep " -$flag") ]]; then
- iuse=$(echo "${ACTIVE_FLAGS[5]} " | grep -Ee "^${pkg_re}" \
- | cut -d ";" -f4 | egrep -o "[+-]?${flag}")
- # Ensure the flag is disabled in the ebuild _and_ in package.use,
- # if so, enable it in package.use
- if [[ "${iuse}" =~ "+" ]]; then
- # The flag is currently disabled by package.use only, so remove the
- # disablement
- flag="-${flag}"
- ACTION="remove"
- fi
- fi
- elif [[ "${ACTIVE:-${GLOBAL_ACTIVE:--}}" == "+" ]]; then
+ if [[ "${ACTIVE:-${GLOBAL_ACTIVE:--}}" == "+" ]]; then
# XXX: Perhaps look at indicating where it is enabled
- error "USE flag \"$flag\" is already enabled for $PACKAGE"
- continue
+ warn "USE flag \"$flag\" is already enabled for $PACKAGE"
fi
fi
- case "${ACTION}" in
+ case "${method}" in
"add")
local filename
if [[ -d ${PACKAGE_USE_PATH} ]]; then
@@ -1198,6 +1166,8 @@ modify() {
return;
fi;
+ local make_conf_modified=0
+
if [ -z "${*}" ]; then
if [ "${ACTION}" != "prune" ]; then
echo "WARNING: no USE flags listed for modification, do you really"
@@ -1212,41 +1182,45 @@ modify() {
NEW_MAKE_CONF_USE=" ${ACTIVE_FLAGS[1]} "
- while [ -n "${1}" ]; do
- if [ "${ACTION}" == "add" ]; then
- if echo " ${NEW_MAKE_CONF_USE} " | grep " ${1} " > /dev/null; then
+ while [[ -n "${1}" ]]; do
+ if [[ "${ACTION}" == "add" ]]; then
+ if [[ -n $(grep " ${1} " <<< " ${NEW_MAKE_CONF_USE} ") ]]; then
+ warn "Use flag \"${1}\" is already enabled globally"
shift
- elif echo " ${NEW_MAKE_CONF_USE} " | grep " -${1} " > /dev/null; then
- remove_flag "-${1}"
+ elif [[ -n $(grep " -${1} " <<< " ${NEW_MAKE_CONF_USE} ") ]]; then
+ remove_flag "-${1}" || exit
+ make_conf_modified=1
else
add_flag "${1}" || exit
+ make_conf_modified=1
shift
fi
- elif [ "${ACTION}" == "remove" ]; then
- if echo " ${NEW_MAKE_CONF_USE} " | grep " -${1} " > /dev/null; then
+ elif [[ "${ACTION}" == "remove" ]]; then
+ if [[ -n $(grep " -${1} " <<< " ${NEW_MAKE_CONF_USE} ") ]]; then
+ warn "Use flag \"${1}\" is already disabled globally"
shift
- elif echo " ${NEW_MAKE_CONF_USE} " | grep " ${1} " > /dev/null; then
- remove_flag "${1}"
+ elif [[ -n $(grep " ${1} " <<< " ${NEW_MAKE_CONF_USE} ") ]]; then
+ remove_flag "${1}" || exit
+ make_conf_modified=1
else
add_flag "-${1}" || exit
+ make_conf_modified=1
shift
fi
- elif [ "${ACTION}" == "prune" ]; then
- if echo " ${NEW_MAKE_CONF_USE} " | grep " ${1} " > /dev/null; then
- remove_flag "${1}"
- elif echo " ${NEW_MAKE_CONF_USE} " | grep " -${1} " > /dev/null; then
- remove_flag "-${1}"
+ elif [[ "${ACTION}" == "prune" ]]; then
+ if [[ -n $(grep " ${1} " <<< " ${NEW_MAKE_CONF_USE} ") ]]; then
+ remove_flag "${1}" || exit
+ make_conf_modified=1
+ elif [[ -n $(grep " -${1} " <<< " ${NEW_MAKE_CONF_USE} ") ]]; then
+ remove_flag "-${1}" || exit
+ make_conf_modified=1
+ else
+ warn "Use flag \"${1}\" is not set globally"
fi
shift
fi
done
- #echo "old flags:"
- #echo ${ACTIVE_FLAGS[1]}
- #echo
- #echo "new flags:"
- #echo ${NEW_MAKE_CONF_USE}
-
# a little loop to add linebreaks so we don't end with one ultra-long line
NEW_MAKE_CONF_USE_2=""
for x in ${NEW_MAKE_CONF_USE}; do
@@ -1257,6 +1231,7 @@ modify() {
fi
done
+ [[ ${make_conf_modified} == 1 ]] || return
# make a backup just in case the user doesn't like the new make.conf
cp -p "${MAKE_CONF_PATH}" "${MAKE_CONF_BACKUP_PATH}"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-03-29 2:18 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-03-29 2:18 UTC (permalink / raw
To: gentoo-commits
commit: d48d1c9525f6632e9ba58202e028bb517b0a118c
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 29 02:12:44 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Mar 29 02:12:44 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d48d1c95
Latest euse changes from Jared Hancock
Prefers /etc/portage/make.conf when modifing global flags only if it
defines the USE variable
Also fixes a bug where euse would refuse to add hyphenated use flags.
So you can:
euse -E bash-completion
---
bin/euse | 79 ++++++++++++++++++++++++++++++++++++--------------------------
1 files changed, 46 insertions(+), 33 deletions(-)
diff --git a/bin/euse b/bin/euse
index dbbb129..8262271 100755
--- a/bin/euse
+++ b/bin/euse
@@ -29,10 +29,13 @@ warn() {
echo -e "WARNING: ${*}"
}
-# /etc/make.conf can now exist in /etc/portage/make.conf, prefer it over /etc/make.conf for changes
-if [ -e "${ETC}/portage/make.conf" ]; then
+# /etc/make.conf can now exist in /etc/portage/make.conf, prefer it over
+# /etc/make.conf for changes. Since this will only be used for modifying
+# the USE variable, we need to make sure the one we pick is the one with
+# the USE variable defined.
+if [[ -n $(grep '^USE="' "${ETC}/portage/make.conf" 2>/dev/null) ]]; then
MAKE_CONF_PATH="${ETC}/portage/make.conf"
-elif [ -e "${ETC}/make.conf" ]; then
+elif [[ -e "${ETC}/make.conf" ]]; then
MAKE_CONF_PATH="${ETC}/make.conf"
else
fatal "make.conf does not exist"
@@ -56,7 +59,7 @@ else
fi
PACKAGE_USE_PATH=${ETC}/portage/package.use
-[ -z "${MODE}" ] && MODE="showhelp" # available operation modes: showhelp, showversion, showdesc, showflags, modify
+[ -z "${MODE:-}" ] && MODE="showhelp" # available operation modes: showhelp, showversion, showdesc, showflags, modify
parse_arguments() {
if [ -z "${1}" ]; then
@@ -74,8 +77,8 @@ parse_arguments() {
-E | --enable) MODE="modify"; ACTION="add";;
-D | --disable) MODE="modify"; ACTION="remove";;
-P | --prune | -R | --remove)
- MODE="modify"; ACTION="prune";;
- -p | --package) MODE="modify"; shift; PACKAGE=${1}; SCOPE="local";;
+ MODE="modify"; ACTION="prune";;
+ -p | --package) MODE="modify"; shift; PACKAGE=${1}; SCOPE="local";;
-*)
echo "ERROR: unknown option ${1} specified."
echo
@@ -83,10 +86,10 @@ parse_arguments() {
;;
"%active")
get_portageuseflags
- ARGUMENTS="${ARGUMENTS} ${ACTIVE_FLAGS[9]}"
+ ARGUMENTS="${ARGUMENTS:-} ${ACTIVE_FLAGS[9]}"
;;
*)
- ARGUMENTS="${ARGUMENTS} ${1}"
+ ARGUMENTS="${ARGUMENTS:-} ${1}"
;;
esac
shift
@@ -128,6 +131,7 @@ check_sanity() {
done
[ "${MODE}" == "modify" -a ! -w "${MAKE_CONF_PATH}" ] && fatal ""${MAKE_CONF_PATH}" is not writable"
[ "${MODE}" == "modify" -a -s "${PACKAGE_USE_PATH}" -a ! -w "${PACKAGE_USE_PATH}" ] && fatal ""${PACKAGE_USE_PATH}" is not writable"
+ return 0
} # }}}
showhelp() {
@@ -435,7 +439,7 @@ get_all_make_conf() {
traverse_profile() {
local curdir
local parent
- local rvalue
+ local rvalue=""
curdir="${2:-$(get_real_path ${MAKE_PROFILE_PATH})}"
@@ -458,7 +462,7 @@ traverse_profile() {
# Function: get_all_make_defaults {{{
# Det all make.defaults by traversing the cascaded profile directories
get_all_make_defaults() {
- if [[ -z $MAKE_DEFAULTS ]]; then
+ if [[ -z ${MAKE_DEFAULTS:-} ]]; then
MAKE_DEFAULTS=$(traverse_profile "make.defaults")
fi
echo $MAKE_DEFAULTS
@@ -606,7 +610,7 @@ get_flagstatus() {
# Flag status for package.use and ebuild, slot and version, and overlay
# the version lives is if not PORTDIR
#
-# Full positive would be "[+PB]", full negative would be "[-pb], and full
+# Full positive would be "[+PB]", full negative would be "[-pb]", and full
# missing would be "[? ]", question because the sign will default to the
# sign of the global status of the flag
get_flagstatus_pkg() {
@@ -671,8 +675,10 @@ get_flagstatus_pkg() {
# Outputs:
# Location of portage tree root
get_portdir() {
- if [ -z "${PORTDIR}" ]; then
- use_backup="${USE}"
+ # Use a subshell so we don't have to protect the variables in
+ # the current scope
+ (
+ if [ -z "${PORTDIR:-}" ]; then
source "${MAKE_GLOBALS_PATH}"
for x in $(get_all_make_defaults); do
source "${x}"
@@ -680,9 +686,9 @@ get_portdir() {
for x in $(get_all_make_conf); do
source "${x}"
done
- USE="${use_backup}"
fi
echo "${PORTDIR}"
+ )
} # }}}
# This won't change while the script is running, so cache it
PORTDIR="$(get_portdir)"
@@ -691,10 +697,14 @@ PORTDIR="$(get_portdir)"
# Outputs list of portage overlays as defined in the PORTDIR_OVERLAY
# variable defined in make.conf
get_all_overlays() {
- use_backup="${USE}"
- source "${MAKE_CONF_PATH}"
- USE="${use_backup}"
- echo ${PORTDIR_OVERLAY}
+ # Use a subshell so we don't have to protect the variables in
+ # the current scope
+ (
+ for x in $(get_all_make_conf); do
+ [[ -r "${x}" ]] && source "${x}"
+ done
+ echo ${PORTDIR_OVERLAY}
+ )
} # }}}
ALL_PORTDIRS=( "$PORTDIR" $(get_all_overlays) )
@@ -761,8 +771,7 @@ showdesc() {
if array_contains "${useflags[*]}" "$1"; then
get_flagstatus "${1}"
# XXX: Handle overlay
- grep "^${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.desc} 2> /dev/null \
- | sed -re "s/^([^:]+)://"
+ grep -h "^${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.desc} 2> /dev/null
foundone=1
fi
fi
@@ -773,14 +782,14 @@ showdesc() {
foundone=1
fi
# Fetch all the packages data using this flag
- infos=$( grep ":${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.local.desc} 2> /dev/null \
- | sed -re "s/^([^:]+):([^:]+):(${1}) *- *(.+)/\1|\2|\3|\4/g")
+ infos=$( grep -h ":${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.local.desc} 2> /dev/null \
+ | sed -re "s/^([^:]+):(${1}) *- *(.+)/\1|\2|\3/g")
OIFS=$IFS; IFS=$'\n'; infos=($infos); IFS=$OIFS;
for line in "${infos[@]}"; do
OIFS=$IFS; IFS="|"; line=($line); IFS=$OIFS
- pkg=${line[1]}
- flag=${line[2]}
- desc=${line[3]}
+ pkg=${line[0]}
+ flag=${line[1]}
+ desc=${line[2]}
if get_flagstatus "${flag}"; then
ACTIVE="+"
else
@@ -925,18 +934,22 @@ showflags() {
# two small helpers to add or remove a flag from a USE string
add_flag() {
- if [[ -n $(grep " -${1//-/} " <<< " ${ACTIVE_FLAGS[6]} ") ]]; then
- error "Use flag \"${1//-/}\" is masked and should not be added" \
+ # Remove leading '-' from flag if found
+ local flag=$1
+ [[ ${flag:0:1} == "-" ]] && flag=${1:1}
+
+ if [[ -n $(grep " -${flag} " <<< " ${ACTIVE_FLAGS[6]} ") ]]; then
+ error "Use flag \"${flag}\" is masked and should not be added" \
"to make.conf."
return 1
# Bug #104396 -- Only add use flags defined in use.desc and use.local.desc
- elif [[ -z $(grep "^${1//-/}$" <<< "$(get_useflaglist)") ]]; then
- error "Use flag \"${1//-/}\" is not defined in use.desc and should" \
+ elif [[ -z $(grep "^${flag}$" <<< "$(get_useflaglist)") ]]; then
+ error "Use flag \"${flag}\" is not defined in use.desc and should" \
"not be added\nto make.conf."
return 1
else
NEW_MAKE_CONF_USE="${NEW_MAKE_CONF_USE} ${1}"
- echo "Adding flag \"${1}\" to make.conf" >&2
+ echo "Adding flag \"${1}\" to make.conf" >&2
fi
}
@@ -981,9 +994,8 @@ scrub_use_flag() {
elif [[ -n "${PACKAGE}" ]]; then
if [[ -n $(echo "${line}" | grep -Ee "${pkg_re}") ]]; then
# If this is the only (remaining) use flag defined
- # for this package, then remove the whole line
- if [[ -z $(echo "${line}" | \
- grep -Ee "${pkg_re} *-?${flag} *$") ]]; then
+ # for this package, then remove the whole line
+ if [[ -z $(echo "${line}" | grep -Ee "${pkg_re} *-?${flag} *$") ]]; then
# Remove flag from this line
echo "${line}" | sed -re "s/ *-?\b${flag}\b//"
fi
@@ -1231,6 +1243,7 @@ modify() {
fi
done
+ # Bail if there is no need to modify make.conf
[[ ${make_conf_modified} == 1 ]] || return
# make a backup just in case the user doesn't like the new make.conf
cp -p "${MAKE_CONF_PATH}" "${MAKE_CONF_BACKUP_PATH}"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-04-24 0:59 Brian Dolbec
0 siblings, 0 replies; 46+ messages in thread
From: Brian Dolbec @ 2011-04-24 0:59 UTC (permalink / raw
To: gentoo-commits
commit: 38d480d4eea1d2db421d4fa9ed9af2a32bbebe37
Author: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Apr 24 00:59:32 2011 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Apr 24 00:59:32 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=38d480d4
fix python-3 compatibility for euse bug 364081
---
bin/euse | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/bin/euse b/bin/euse
index 8262271..5590fbb 100755
--- a/bin/euse
+++ b/bin/euse
@@ -185,7 +185,7 @@ VER
# worth another look to avoid calling python unnecessariy. Or we could
# just write the whole thing in python. ;)
reduce_incrementals() {
- echo $@ | python -c "import sys
+ echo $@ | python -c "from __future__ import print_function;import sys
r=[]
for x in sys.stdin.read().split():
if x[0] == '-' and x[1:] in r:
@@ -196,14 +196,14 @@ for x in sys.stdin.read().split():
r.append(x)
elif x == '-*': r = ['-*']
elif x not in r: r.append(x)
-print ' '.join(r)"
+print(' '.join(r))"
} # }}}
# Function: reduce_incrementals_trump {{{
# Similar to reduce_incrementals but negative flags trump positive
# flags, regardless of which follows which
reduce_incrementals_trump() {
- echo $@ | python -c "import sys
+ echo $@ | python -c "from __future__ import print_function;import sys
r=[]
for x in sys.stdin.read().split():
if x[0] == '-' and x[1:] in r:
@@ -211,7 +211,7 @@ for x in sys.stdin.read().split():
r.append(x)
elif x == '-*': r = ['-*']
elif x not in r and not '-'+x in r: r.append(x)
-print ' '.join(r)"
+print(' '.join(r))"
} # }}}
# Function: reduce_package_use {{{
@@ -222,7 +222,7 @@ print ' '.join(r)"
# * - Lines of package atom followed by flags
# (app-editors/vim flag1 flag2 -flag3)
reduce_package_use() {
- echo "${@}" | python -c "import sys,re
+ echo "${@}" | python -c "from __future__ import print_function;import sys,re
h={}; getflags=re.compile(r'(-?[\w*-]+)')
for x in sys.stdin.read().split('\n'):
if not x: continue
@@ -242,7 +242,7 @@ for x in sys.stdin.read().split('\n'):
elif x == '-*': r = h[pkg] = ['-*']
elif x not in r:
r.append(x)
-print '\n'.join(['%s %s' % (pkg,' '.join(flgs)) for pkg,flgs in h.iteritems() if len(flgs)])"
+print('\n'.join(['%s %s' % (pkg,' '.join(flgs)) for pkg,flgs in h.items() if len(flgs)]))"
} # }}}
# Function: get_useflags {{{
@@ -511,8 +511,8 @@ get_flagstatus_helper_pkg() {
if [[ -z "${atoms[@]/[<>=]*/}" ]]; then
atoms=($(
echo "${atoms[@]}" | python -c "
-import portage.dep as dep, sys
-print ' '.join(dep.match_to_list('$5-$6',sys.stdin.read().split()))"))
+from __future__ import print_function;import portage.dep as dep, sys
+print(' '.join(dep.match_to_list('$5-$6',sys.stdin.read().split()))"))
fi
flags=$(for atom in ${atoms[@]}; do
[[ -z $atom ]] && continue
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-05-11 0:43 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-05-11 0:43 UTC (permalink / raw
To: gentoo-commits
commit: 6d3eb84a5739faf2c4dcb6030791fdd7491ce570
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed May 11 00:43:20 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed May 11 00:43:20 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=6d3eb84a
Change chmod 700 to chmod 600 when changing permissions on the cache files. Bug 356779
---
bin/revdep-rebuild | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index e034124..7d89238 100755
--- a/bin/revdep-rebuild
+++ b/bin/revdep-rebuild
@@ -629,7 +629,7 @@ get_search_env() {
for file in "${FILES[@]}"; do
if [ -e "$file" ]; then
chown ${uid}:portage "$file"
- chmod 700 "$file"
+ chmod 600 "$file"
fi
done
fi
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-05-11 2:06 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-05-11 2:06 UTC (permalink / raw
To: gentoo-commits
commit: d1b60d492ca1ba845facb7a94ddfe56620584c36
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed May 11 02:06:19 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed May 11 02:06:19 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d1b60d49
Fix euse to print proper statement for egencache. Bug 366673
---
bin/euse | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/bin/euse b/bin/euse
index 5590fbb..07a244d 100755
--- a/bin/euse
+++ b/bin/euse
@@ -384,6 +384,16 @@ get_useflaglist_ebuild() {
local pkg=$(echo ${1} | cut -d/ -f2)
declare append
for portdir in ${ALL_PORTDIRS[@]}; do
+ if [[ $portdir == $PORTDIR ]]; then
+ overlay=""
+ else
+ if [[ -s $(dirname ${portdir}/repo_name) ]]; then
+ overlay="$(cat "${portdir}/profiles/repo_name")"
+ else
+ # XXX: May be better to use full path
+ overlay="$(basename "${portdir}")"
+ fi
+ fi
# Open the ebuild file and retrieve defined USE flags
[[ ! -d "$portdir/${1}" ]] && continue
if [[ ! -d "$portdir/metadata/cache" ]]; then
@@ -397,16 +407,6 @@ get_useflaglist_ebuild() {
| sed -e "s:$portdir/metadata/cache/${1}-::g" \
| while read -d $'\n' version; do
IFS=$'\n'
- if [[ $portdir == $PORTDIR ]]; then
- overlay=""
- else
- if [[ -s $(dirname ${portdir}/repo_name) ]]; then
- overlay="$(cat "${portdir}/profiles/repo_name")"
- else
- # XXX: May be better to use full path
- overlay="$(basename "${portdir}")"
- fi
- fi
if [[ ! -e "$portdir/metadata/cache/${1}-$version" ]]; then
# Repo does not have this particular package
continue
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-05-12 2:55 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-05-12 2:55 UTC (permalink / raw
To: gentoo-commits
commit: f8eb46209ebeb48c6ff515981bbf67819e00d0f7
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 02:52:07 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu May 12 02:52:07 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=f8eb4620
Fix euse to treat PORTDIR the same as an overlay for purposes of printing the repository name.
---
bin/euse | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/bin/euse b/bin/euse
index 07a244d..65fb119 100755
--- a/bin/euse
+++ b/bin/euse
@@ -384,15 +384,11 @@ get_useflaglist_ebuild() {
local pkg=$(echo ${1} | cut -d/ -f2)
declare append
for portdir in ${ALL_PORTDIRS[@]}; do
- if [[ $portdir == $PORTDIR ]]; then
- overlay=""
+ if [[ -s $(dirname ${portdir}/repo_name) ]]; then
+ overlay="$(cat "${portdir}/profiles/repo_name")"
else
- if [[ -s $(dirname ${portdir}/repo_name) ]]; then
- overlay="$(cat "${portdir}/profiles/repo_name")"
- else
- # XXX: May be better to use full path
- overlay="$(basename "${portdir}")"
- fi
+ # XXX: May be better to use full path
+ overlay="$(basename "${portdir}")"
fi
# Open the ebuild file and retrieve defined USE flags
[[ ! -d "$portdir/${1}" ]] && continue
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-05-23 21:28 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-05-23 21:28 UTC (permalink / raw
To: gentoo-commits
commit: aca55a8d49a4185b8c9e8fe497a1b3f175cac71f
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon May 23 21:28:33 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon May 23 21:28:33 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=aca55a8d
Fix revdep-rebuild to use the ORDER_FILE for the final emerge command. Bug 368475
---
bin/revdep-rebuild | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index 7d89238..6b584cf 100755
--- a/bin/revdep-rebuild
+++ b/bin/revdep-rebuild
@@ -1111,8 +1111,8 @@ setup_search_paths_and_masks() {
##
# Rebuild packages owning broken binaries
rebuild() {
- if [[ -r $LIST.5_order && -s $LIST.5_order ]]; then
- REBUILD_LIST=( $(<"$LIST.5_order") )
+ if [[ -r $ORDER_FILE && -s $ORDER_FILE ]]; then
+ REBUILD_LIST=( $(<"$ORDER_FILE") )
REBUILD_LIST="${REBUILD_LIST[@]/#/=}"
else
REBUILD_LIST=$(sort -u "$EBUILDS_FILE")
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-05-25 1:02 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-05-25 1:02 UTC (permalink / raw
To: gentoo-commits
commit: d04544e03702d7358a8ccdee4a7696cdcba91b9c
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 00:55:03 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed May 25 00:55:03 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d04544e0
Change revdep-rebuild to no longer determine the build order. Instead
we call emerge with --complete-graph=y to build the packages in the
correct order.
---
bin/revdep-rebuild | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index 6b584cf..f00b791 100755
--- a/bin/revdep-rebuild
+++ b/bin/revdep-rebuild
@@ -979,15 +979,19 @@ get_build_order() {
fi
fi
RAW_REBUILD_LIST="${RAW_REBUILD_LIST[@]}"
- REBUILD_GREP=$(emerge --nodeps $RAW_REBUILD_LIST | sed 's/\[[^]]*\]//g')
- if (( ${PIPESTATUS[0]} == 0 )); then
- emerge --deep $RAW_REBUILD_LIST |
- sed 's/\[[^]]*\]//g' |
- grep -F "$REBUILD_GREP" > "$ORDER_FILE"
- fi
- # Here we use the PIPESTATUS from the second emerge, the --deep one.
- if (( ${PIPESTATUS[0]} != 0 )); then
+ # We no longer determine the package order ourselves. Instead we call emerge
+ # with --complete-graph=y in the rebuild function.
+ if false ; then
+ REBUILD_GREP=$(emerge --nodeps $RAW_REBUILD_LIST | sed 's/\[[^]]*\]//g')
+ if (( ${PIPESTATUS[0]} == 0 )); then
+ emerge --deep $RAW_REBUILD_LIST |
+ sed 's/\[[^]]*\]//g' |
+ grep -F "$REBUILD_GREP" > "$ORDER_FILE"
+ fi
+
+ # Here we use the PIPESTATUS from the second emerge, the --deep one.
+ if (( ${PIPESTATUS[0]} != 0 )); then
eerror
eerror 'Warning: Failed to resolve package order.'
eerror 'Will merge in arbitrary order'
@@ -1000,6 +1004,9 @@ get_build_order() {
EOF
countdown 5
rm -f "$ORDER_FILE"
+ fi
+ else
+ echo "$RAW_REBUILD_LIST" > "$ORDER_FILE"
fi
export EMERGE_DEFAULT_OPTS="$OLD_EMERGE_DEFAULT_OPTS"
else
@@ -1112,8 +1119,11 @@ setup_search_paths_and_masks() {
# Rebuild packages owning broken binaries
rebuild() {
if [[ -r $ORDER_FILE && -s $ORDER_FILE ]]; then
- REBUILD_LIST=( $(<"$ORDER_FILE") )
- REBUILD_LIST="${REBUILD_LIST[@]/#/=}"
+ # The rebuild list contains category/package:slot atoms.
+ # Do not prepend with an '=' sign.
+ # REBUILD_LIST=( $(<"$ORDER_FILE") )
+ # REBUILD_LIST="${REBUILD_LIST[@]/#/=}"
+ REBUILD_LIST=$(<"$ORDER_FILE")
else
REBUILD_LIST=$(sort -u "$EBUILDS_FILE")
fi
@@ -1121,7 +1131,7 @@ rebuild() {
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
[[ $QUIET -ne 1 ]] && einfo 'All prepared. Starting rebuild'
- echo "emerge --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
+ echo "emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
is_real_merge && countdown 10
@@ -1130,7 +1140,7 @@ rebuild() {
# Run in background to correctly handle Ctrl-C
{
- emerge --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST <&6
+ emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST <&6
echo $? > "$STATUS_FILE"
} &
wait
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-05-29 10:59 Christian Ruppert
0 siblings, 0 replies; 46+ messages in thread
From: Christian Ruppert @ 2011-05-29 10:59 UTC (permalink / raw
To: gentoo-commits
commit: 85af50f1a7234c56077556756400f2a540f76605
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 26 00:34:29 2011 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Sat Feb 26 00:34:29 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=85af50f1
Fix some pylint complains
---
bin/glsa-check | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bin/glsa-check b/bin/glsa-check
index a35375b..1968607 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -48,7 +48,7 @@ params = []
try:
args, params = getopt(sys.argv[1:], "".join([o[0][1] for o in optionmap]), \
[x[2:] for x in reduce(lambda x,y: x+y, [z[1:-1] for z in optionmap])])
- args = [a for a,b in args]
+ args = [a for a, b in args]
for option in ["--nocolor", "-n"]:
if option in args:
@@ -231,7 +231,7 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr, encoding="utf-8"):
if verbose:
access = ("[%-8s] " % myglsa.access)
else:
- access=""
+ access = ""
fd1.write(color(myglsa.nr) + " " + color(status) + " " + color(access) + myglsa.title + " (")
if not verbose:
@@ -289,7 +289,7 @@ if mode in ["dump", "fix", "inject", "pretend"]:
sys.stderr.write(emergecmd+"\n")
exitcode = os.system(emergecmd)
# system() returns the exitcode in the high byte of a 16bit integer
- if exitcode >= 1<<8:
+ if exitcode >= 1 << 8:
exitcode >>= 8
if exitcode:
sys.exit(exitcode)
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-07-12 21:45 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-07-12 21:45 UTC (permalink / raw
To: gentoo-commits
commit: 3e223b65cac119c51fabe92555fe0bbd09d642a7
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 19:41:30 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 21:29:01 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=3e223b65
Switch revdep-rebuild to python version.
revdep-rebuild.sh is original bash scipt.
---
bin/revdep-ng | 51 --
bin/revdep-rebuild | 1244 ++---------------------------
bin/{revdep-rebuild => revdep-rebuild.sh} | 0
3 files changed, 50 insertions(+), 1245 deletions(-)
diff --git a/bin/revdep-ng b/bin/revdep-ng
deleted file mode 100755
index a4c8e11..0000000
--- a/bin/revdep-ng
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2010 Brian Dolbec <brian.dolbec@gmail.com>
-# Copyright 2002-2010 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2 or later
-#
-# $Header$
-
-"""'analyse' is a flexible utility for Gentoo linux which can display various
-information about installed packages, such as the USE flags used and the
-packages that use them. It can also be used to help rebuild /etc/portage/package.*
-files in the event of corruption, and possibly more.
-"""
-
-from __future__ import print_function
-
-import sys
-# This block ensures that ^C interrupts are handled quietly.
-try:
- import signal
-
- def exithandler(signum,frame):
- signal.signal(signal.SIGINT, signal.SIG_IGN)
- signal.signal(signal.SIGTERM, signal.SIG_IGN)
- print()
- sys.exit(1)
-
- signal.signal(signal.SIGINT, exithandler)
- signal.signal(signal.SIGTERM, exithandler)
- signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
-
-except KeyboardInterrupt:
- print()
- sys.exit(1)
-
-from gentoolkit import errors
-from gentoolkit.revdep_rebuild import rebuild
-
-try:
- success = rebuild.main(rebuild.parse_options())
- sys.exit(success)
-except errors.GentoolkitException as err:
- if '--debug' in sys.argv:
- raise
- else:
- from gentoolkit import pprinter as pp
- sys.stderr.write(pp.error(str(err)))
- print()
- print("Add '--debug' to global options for traceback.")
- sys.exit(1)
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index f00b791..a4c8e11 100755
--- a/bin/revdep-rebuild
+++ b/bin/revdep-rebuild
@@ -1,1195 +1,51 @@
-#!/bin/bash
-# Copyright 1999-2010 Gentoo Foundation
-
-# revdep-rebuild: Reverse dependency rebuilder.
-# Original Author: Stanislav Brabec
-# Rewrite Author: Michael A. Smith
-# Current Maintainer: Paul Varner <fuzzyray@gentoo.org>
-
-# TODO:
-# - Use more /etc/init.d/functions.sh
-# - Try to reduce the number of global vars
-
-##
-# Global Variables:
-
-# Must-be-blank:
-unset GREP_OPTIONS
-
-# Readonly variables:
-declare -r APP_NAME="${0##*/}" # The name of this application
-declare -r VERSION="svn"
-declare -r OIFS="$IFS" # Save the IFS
-declare -r ENV_FILE=0_env.rr # Contains environment variables
-declare -r FILES_FILE=1_files.rr # Contains a list of files to search
-declare -r LDPATH_FILE=2_ldpath.rr # Contains the LDPATH
-declare -r BROKEN_FILE=3_broken.rr # Contains the list of broken files
-declare -r ERRORS_FILE=3_errors.rr # Contains the ldd error output
-declare -r RAW_FILE=4_raw.rr # Contains the raw list of packages
-declare -r OWNERS_FILE=4_owners.rr # Contains the file owners
-declare -r PKGS_FILE=4_pkgs.rr # Contains the unsorted bare package names
-declare -r EBUILDS_FILE=4_ebuilds.rr # Contains the unsorted atoms
- # (Appropriately slotted or versioned)
-declare -r ORDER_FILE=5_order.rr # Contains the sorted atoms
-declare -r STATUS_FILE=6_status.rr # Contains the ldd error output
-declare -ra FILES=(
- "$ENV_FILE"
- "$FILES_FILE"
- "$LDPATH_FILE"
- "$BROKEN_FILE"
- "$ERRORS_FILE"
- "$RAW_FILE"
- "$OWNERS_FILE"
- "$PKGS_FILE"
- "$EBUILDS_FILE"
- "$ORDER_FILE"
- "$STATUS_FILE"
-)
-
-# "Boolean" variables: Considered "true" if it has any value at all
-# "True" indicates we should...
-declare FULL_LD_PATH # ...search across the COMPLETE_LD_LIBRARY_PATH
-declare KEEP_TEMP # ...not delete tempfiles from the current run
-declare ORDER_PKGS # ...sort the atoms in deep dependency order
-declare PACKAGE_NAMES # ...emerge by slot, not by versionated atom
-declare RM_OLD_TEMPFILES # ...remove tempfiles from prior runs
-declare SEARCH_BROKEN # ...search for broken libraries and binaries
-declare VERBOSE # ...give verbose output
-
-# Globals that impact portage directly:
-declare EMERGE_DEFAULT_OPTS # String of options portage assumes to be set
-declare EMERGE_OPTIONS # Array of options to pass to portage
-declare PORTAGE_NICENESS # Renice to this value
-declare PORTAGE_ROOT # The root path for portage
-
-# Customizable incremental variables:
-# These variables can be prepended to either by setting the variable in
-# your environment prior to execution, or by placing an entry in
-# /etc/make.conf.
+#!/usr/bin/python
#
-# An entry of "-*" means to clear the variable from that point forward.
-# Example: env SEARCH_DIRS="/usr/bin -*" revdep-rebuild will set SEARCH_DIRS
-# to contain only /usr/bin
-declare LD_LIBRARY_MASK # Mask of specially evaluated libraries
-declare SEARCH_DIRS # List of dirs to search for executables and libraries
-declare SEARCH_DIRS_MASK # List of dirs not to search
-
-# Other globals:
-declare OLDPROG # Previous pass through the progress meter
-declare EXACT_PKG # Versionated atom to emerge
-declare HEAD_TEXT # Feedback string about the search
-declare NOCOLOR # Set to "true" not to output term colors
-declare OK_TEXT # Feedback about a search which found no errors
-declare RC_NOCOLOR # Hack to insure we respect NOCOLOR
-declare REBUILD_LIST # Array of atoms to emerge
-declare SKIP_LIST # Array of atoms that cannot be emerged (masked?)
-declare SONAME # Soname/soname path pattern given on commandline
-declare SONAME_SEARCH # Value of SONAME modified to match ldd's output
-declare WORKING_TEXT # Feedback about the search
-declare WORKING_DIR # Working directory where cache files are kept
-
-main() {
- # preliminary setup
- portage_settings
- get_opts "$@"
- setup_portage
- setup_search_paths_and_masks
- get_search_env
- [[ $QUIET -ne 1 ]] && echo
-
- # Search for broken binaries
- get_files
- get_ldpath
- main_checks
-
- # Associate broken binaries with packages to rebuild
- if [[ $PACKAGE_NAMES ]]; then
- get_packages
- clean_packages
- assign_packages_to_ebuilds
- else
- get_exact_ebuilds
- fi
-
- # Rebuild packages owning broken binaries
- get_build_order
- rebuild
-
- # All done
- cleanup
-}
-##
-# Refuse to delete anything before we cd to our tmpdir
-# (See mkdir_and_cd_to_tmpdir()
-rm() {
- eerror "I was instructed to rm '$@'"
- die 1 "Refusing to delete anything before changing to temporary directory."
-}
-: <<'EW'
-##
-# GNU find has -executable, but if our users' finds do not have that flag
-# we emulate it with this function. Also emulates -writable and -readable.
-# Usage: find PATH ARGS -- use find like normal, except use -executable instead
-# of various versions of -perm /+ blah blah and hacks
-find() {
- hash find || { die 1 'find not found!'; }
- # We can be pretty sure find itself should be executable.
- local testsubject="$(type -P find)"
- if [[ $(command find "$testsubject" -executable 2> /dev/null) ]]; then
- unset -f find # We can just use the command find
- elif [[ $(command find "$testsubject" -perm /u+x 2> /dev/null) ]]; then
- find() {
- a=(${@//-executable/-perm \/u+x})
- a=(${a[@]//-writable/-perm \/u+w})
- a=(${a[@]//-readable/-perm \/r+w})
- command find "${a[@]}"
- }
- elif [[ $(command find "$testsubject" -perm +u+x 2> /dev/null) ]]; then
- find() {
- a=(${@//-executable/-perm +u+x})
- a=(${a[@]//-writable/-perm +u+w})
- a=(${a[@]//-readable/-perm +r+w})
- command find "${a[@]}"
- }
- else # Last resort
- find() {
- a=(${@//-executable/-exec test -x '{}' \; -print})
- a=(${a[@]//-writable/-exec test -w '{}' \; -print})
- a=(${a[@]//-readable/-exec test -r '{}' \; -print})
- command find "${a[@]}"
- }
- fi
- find "$@"
-}
-EW
-
-print_usage() {
-cat << EOF
-${APP_NAME}: (${VERSION})
-
-Copyright (C) 2003-2010 Gentoo Foundation, Inc.
-This is free software; see the source for copying conditions.
-
-Usage: $APP_NAME [OPTIONS] [--] [EMERGE_OPTIONS]
-
-Broken reverse dependency rebuilder.
-
- -C, --nocolor Turn off colored output
- -d, --debug Print way too much information (uses bash's set -xv)
- -e, --exact Emerge based on exact package version
- -h, --help Print this usage
- -i, --ignore Ignore temporary files from previous runs
- -k, --keep-temp Do not delete temporary files on exit
- -L, --library NAME Emerge existing packages that use the library with NAME
- --library=NAME NAME can be a full path to the library or a basic
- regular expression (man grep)
- -l, --no-ld-path Do not set LD_LIBRARY_PATH
- -o, --no-order Do not check the build order
- (Saves time, but may cause breakage.)
- -p, --pretend Do a trial run without actually emerging anything
- (also passed to emerge command)
- -P, --no-progress Turn off the progress meter
- -q, --quiet Be less verbose (also passed to emerge command)
- -v, --verbose Be more verbose (also passed to emerge command)
-
-Calls emerge, options after -- are ignored by $APP_NAME
-and passed directly to emerge.
-
-Report bugs to <http://bugs.gentoo.org>
-
-EOF
-}
-##
-# Usage: progress i n
-# i: current item
-# n: total number of items to process
-progress() {
- if [[ -t 1 ]]; then
- progress() {
- local curProg=$(( $1 * 100 / $2 ))
- (( curProg == OLDPROG )) && return # no change, output nothing
- OLDPROG="$curProg" # must be a global variable
- (( $1 == $2 )) && local lb=$'\n'
- echo -ne '\r \r'"[ $curProg% ] $lb"
- }
- progress $@
- else # STDOUT is not a tty. Disable progress meter.
- progress() { :; }
- fi
-}
-##
-# Usage: countdown n
-# n: number of seconds to count
-countdown() {
- local i
- for ((i=1; i<$1; i++)); do
- echo -ne '\a.'
- ((i<$1)) && sleep 1
- done
- echo -e '\a.'
-}
-##
-# Replace whitespace with linebreaks, normalize repeated '/' chars, and sort -u
-# (If any libs have whitespace in their filenames, someone needs punishment.)
-clean_var() {
- gawk 'BEGIN {RS="[[:space:]]"}
- /-\*/ {exit}
- /[^[:space:]]/ {gsub(/\/\/+/, "/"); print}' | sort -u
-}
-##
-# Exit and optionally output to sterr
-die() {
- local status=$1
- shift
-
- # Check if eerror has been loaded.
- # Its loaded _after_ opt parsing but not before due to RC_NOCOLOR.
- type eerror &> /dev/null
-
- if [[ $? -eq 0 ]];
- then
- eerror "$@"
- else
- echo " * ${@}" >> /dev/stderr
- fi
- exit $status
-}
-##
-# What to do when dynamic linking is consistent
-clean_exit() {
- if [[ ! $KEEP_TEMP ]]; then
- rm -f "${FILES[@]}"
- if [[ "$WORKING_DIR" != "/var/cache/${APP_NAME}" ]]; then
- # Remove the working directory
- builtin cd; rmdir "$WORKING_DIR"
- fi
- fi
- if [[ $QUIET -ne 1 ]];
- then
- echo
- einfo "$OK_TEXT... All done. "
- fi
- exit 0
-}
-##
-# Get the name of the package that owns a file or list of files given as args.
-# NOTE: depends on app-misc/realpath!
-get_file_owner() {
- local IFS=$'\n'
-
- rpath=$(realpath "${*}" 2>/dev/null)
- # To ensure we always have something in rpath...
- [[ -z $rpath ]] && rpath=${*}
-
- # Workaround for bug 280341
- mlib=$(echo ${*}|sed 's:/lib/:/lib64/:')
- [[ "${*}" == "${mlib}" ]] && mlib=$(echo ${*}|sed 's:/lib64/:/lib/:')
-
- # Add a space to the end of each object name to prevent false
- # matches, for example /usr/bin/dia matching /usr/bin/dialog (bug #196460).
- # The same for "${rpath} ".
- # Don't match an entry with a '-' at the start of the package name. This
- # prevents us from matching invalid -MERGING entries. (bug #338031)
- find -L /var/db/pkg -type f -name CONTENTS -print0 |
- xargs -0 grep -m 1 -Fl -e "${*} " -e "${rpath} " -e "${mlib} " |
- sed 's:/var/db/pkg/\(.*\)/\([^-].*\)/CONTENTS:\1/\2:'
-}
-##
-# Normalize some EMERGE_OPTIONS
-normalize_emerge_opts() {
- # Normalize some EMERGE_OPTIONS
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-p/--pretend})
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-f/--fetchonly})
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]/%-v/--verbose})
-}
-##
-# Use the color preference from portage
-setup_color() {
- # This should still work if NOCOLOR is set by the -C flag or in the user's
- # environment.
- [[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr)
- . /etc/init.d/functions.sh
-}
-##
-# Die if an argument is missing.
-die_if_missing_arg() {
- [[ ! $2 || $2 = -* ]] && die 1 "Missing expected argument to $1"
-}
-##
-# Die because an option is not recognized.
-die_invalid_option() {
- # Can't use eerror and einfo because this gets called before function.sh
- # is sourced
- echo
- echo "Encountered unrecognized option $1." >&2
- echo
- echo "$APP_NAME no longer automatically passes unrecognized options to portage."
- echo "Separate emerge-only options from revdep-rebuild options with the -- flag."
- echo
- echo "For example, $APP_NAME -v -- --ask"
- echo
- echo "See the man page or $APP_NAME -h for more detail."
- echo
- exit 1
-}
-##
-# Warn about deprecated options.
-warn_deprecated_opt() {
- # Can't use eerror and einfo because this gets called before function.sh
- # is sourced
- echo
- echo "Encountered deprecated option $1." >&2
- [[ $2 ]] && echo "Please use $2 instead." >&2
-}
-##
-# Get whole-word commandline options preceded by two dashes.
-get_longopts() {
- case $1 in
- --nocolor) export NOCOLOR="yes";;
- --no-color) warn_deprecated_opt "$1" "--nocolor"
- export NOCOLOR="yes";;
- --debug) set -xv;;
- --exact) unset PACKAGE_NAMES;;
- --help) print_usage
- exit 0;;
- --ignore) RM_OLD_TEMPFILES=1;;
- --keep-temp) KEEP_TEMP=1;;
- --library=*) # TODO: check for invalid values
- SONAME="${1#*=}"
- unset SEARCH_BROKEN;;
- --soname=*|--soname-regexp=*) # TODO: check for invalid values
- warn_deprecated_opt "${1%=*}" "--library"
- SONAME="${1#*=}"
- unset SEARCH_BROKEN;;
- --library) # TODO: check for invalid values
- die_if_missing_arg $1 $2
- shift
- SONAME="$1"
- unset SEARCH_BROKEN;;
- --soname|--soname-regexp) # TODO: check for invalid values
- warn_deprecated_opt "$1" "--library"
- die_if_missing_arg $1 $2
- shift
- SONAME="$1"
- unset SEARCH_BROKEN;;
- --no-ld-path) unset FULL_LD_PATH;;
- --no-order) unset ORDER_PKGS;;
- --no-progress) progress() { :; };;
- --pretend) EMERGE_OPTIONS+=("--pretend")
- PRETEND=1;;
- --quiet) progress() { :; }
- QUIET=1
- EMERGE_OPTIONS+=($1);;
- --verbose) VERBOSE=1
- EMERGE_OPTIONS+=("--verbose");;
- --extra-verbose) warn_deprecated_opt "$1" "--verbose"
- VERBOSE=1
- EMERGE_OPTIONS+=("--verbose");;
- --package-names) # No longer used, since it is the
- # default. We accept it for
- # backwards compatibility.
- warn_deprecated_opt "$1"
- PACKAGE_NAMES=1;;
- *) die_invalid_option $1;;
- esac
-}
-
-##
-# Get single-letter commandline options preceded by a single dash.
-get_shortopts() {
- local OPT OPTSTRING OPTARG OPTIND
- while getopts ":CdehikL:loPpqu:vX" OPT; do
- case "$OPT" in
- C) # TODO: Match syntax with the rest of gentoolkit
- export NOCOLOR="yes";;
- d) set -xv;;
- e) unset PACKAGE_NAMES;;
- h) print_usage
- exit 0;;
- i) RM_OLD_TEMPFILES=1;;
- k) KEEP_TEMP=1;;
- L) # TODO: Check for invalid values
- SONAME="${OPTARG#*=}"
- unset SEARCH_BROKEN;;
- l) unset FULL_LD_PATH;;
- o) unset ORDER_PKGS;;
- P) progress() { :; };;
- p) EMERGE_OPTIONS+=("--pretend")
- PRETEND=1;;
- q) progress() { :; }
- QUIET=1
- EMERGE_OPTIONS+=("--quiet");;
- v) VERBOSE=1
- EMERGE_OPTIONS+=("--verbose");;
- X) # No longer used, since it is the default.
- # We accept it for backwards compatibility.
- warn_deprecated_opt "-X"
- PACKAGE_NAMES=1;;
- *) die_invalid_option "-$OPTARG";;
- esac
- done
-}
-##
-# Get command-line options.
-get_opts() {
- local avoid_utils
- local -a args
- echo_v() { ewarn "$@"; }
- unset VERBOSE KEEP_TEMP EMERGE_OPTIONS RM_OLD_TEMPFILES
- ORDER_PKGS=1
- PACKAGE_NAMES=1
- SONAME="not found"
- SEARCH_BROKEN=1
- FULL_LD_PATH=1
- while [[ $1 ]]; do
- case $1 in
- --) shift
- EMERGE_OPTIONS+=("$@")
- break;;
- -*) while true; do
- args+=("$1")
- shift
- [[ ${1:--} = -* ]] && break
- done
- if [[ ${args[0]} = --* ]]; then
- get_longopts "${args[@]}"
- else
- get_shortopts "${args[@]}"
- fi;;
- *) die_invalid_option "$1";;
- esac
- unset args
- done
-
- setup_color
- normalize_emerge_opts
-
- # If the user is not super, add --pretend to EMERGE_OPTIONS
- if [[ ${EMERGE_OPTIONS[@]} != *--pretend* && $UID -ne 0 ]]; then
- ewarn "You are not superuser. Adding --pretend to emerge options."
- EMERGE_OPTIONS+=(--pretend)
- fi
-}
-##
-# Is there a --pretend or --fetchonly flag in the EMERGE_OPTIONS array?
-is_real_merge() {
- [[ ${EMERGE_OPTIONS[@]} != *--pretend* &&
- ${EMERGE_OPTIONS[@]} != *--fetchonly* ]]
-}
-##
-# Clean up temporary files and exit
-cleanup_and_die() {
- rm -f "$@"
- die 1 " ...terminated. Removing incomplete $@."
-}
-##
-# Clean trap
-clean_trap() {
- trap "cleanup_and_die $*" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
- rm -f "$@"
-}
-##
-# Returns 0 if the first arg is found in the remaining args, 1 otherwise
-# (Returns 2 if given fewer than 2 arguments)
-has() {
- (( $# > 1 )) || return 2
- local IFS=$'\a' target="$1"
- shift
- [[ $'\a'"$*"$'\a' = *$'\a'$target$'\a'* ]]
-}
-##
-# Dies when it can't change directories
-cd() {
- if builtin cd -P "$@"; then
- if [[ $1 != $PWD ]]; then
- # Some symlink malfeasance is going on
- die 1 "Working directory expected to be $1, but it is $PWD"
- fi
- else
- die 1 "Unable to change working directory to '$@'"
- fi
-}
-##
-# Tries not to delete any files or directories it shouldn't
-setup_rm() {
- ##
- # Anything in the FILES array in tmpdir is fair game for removal
- rm() {
- local i IFS=$'\a'
- [[ $APP_NAME ]] || die 1 '$APP_NAME is not defined! (This is a bug.)'
- case $@ in
- */*|*-r*|*-R*) die 1 "Oops, I'm not allowed to delete that. ($@)";;
- esac
- for i; do
- # Don't delete files that are not listed in the array
- # Allow no slashes or recursive deletes at all.
- case $i in
- */*|-*r*|-*R*) :;; # Not OK
- -*) continue;; # OK
- esac
- has "$i" "${FILES[@]}" && continue
- die 1 "Oops, I'm not allowed to delete that. ($@)"
- done
- command rm "$@"
- }
- # delete this setup function so it's harmless to re-run
- setup_rm() { :; }
-}
-##
-# Make our temporary files directory
-# $1 - directory name
-# $2 - user name
-verify_tmpdir() {
- if [[ ! $1 ]]; then
- die 1 'Temporary file path is unset! (This is a bug.)'
- elif [[ -d $1 ]]; then
- cd "$1"
- else
- die 1 "Unable to find a satisfactory location for temporary files ($1)"
- fi
- [[ $VERBOSE ]] && einfo "Temporary cache files are located in $PWD"
- setup_rm
-}
-get_search_env() {
- local new_env
- local old_env
- local uid=$(python -c 'import os; import pwd; print(pwd.getpwuid(os.getuid())[0])')
- # Find a place to put temporary files
- if [[ "$uid" == "root" ]]; then
- local tmp_target="/var/cache/${APP_NAME}"
- else
- local tmp_target="$(mktemp -d -t revdep-rebuild.XXXXXXXXXX)"
- fi
-
- # From here on all work is done inside the temporary directory
- verify_tmpdir "$tmp_target"
- WORKING_DIR="$tmp_target"
-
- if [[ $SEARCH_BROKEN ]]; then
- SONAME_SEARCH="$SONAME"
- HEAD_TEXT="broken by a package update"
- OK_TEXT="Dynamic linking on your system is consistent"
- WORKING_TEXT="consistency"
- else
- # first case is needed to test against /path/to/foo.so
- if [[ $SONAME = /* ]]; then
- # Set to "<space>$SONAME<space>"
- SONAME_SEARCH=" $SONAME "
- # Escape the "/" characters
- SONAME_SEARCH="${SONAME_SEARCH//\//\\/}"
- else
- # Set to "<tab>$SONAME<space>"
- SONAME_SEARCH=$'\t'"$SONAME "
- fi
- HEAD_TEXT="using $SONAME"
- OK_TEXT="There are no dynamic links to $SONAME"
- unset WORKING_TEXT
- fi
-
- # If any of our temporary files are older than 1 day, remove them all
- if [[ ! $KEEP_TEMP ]]; then
- while read; do
- RM_OLD_TEMPFILES=1
- break
- done < <(find -L . -maxdepth 1 -type f -name '*.rr' -mmin +1440 -print 2>/dev/null)
- fi
-
- # Compare old and new environments
- # Don't use our previous files if environment doesn't match
- new_env=$(
- # We do not care if these emerge options change
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--pretend/})
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--fetchonly/})
- EMERGE_OPTIONS=(${EMERGE_OPTIONS[@]//--verbose/})
- cat <<- EOF
- SEARCH_DIRS="$SEARCH_DIRS"
- SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK"
- LD_LIBRARY_MASK="$LD_LIBRARY_MASK"
- PORTAGE_ROOT="$PORTAGE_ROOT"
- EMERGE_OPTIONS="${EMERGE_OPTIONS[@]}"
- ORDER_PKGS="$ORDER_PKGS"
- FULL_LD_PATH="$FULL_LD_PATH"
- EOF
- )
- if [[ -r "$ENV_FILE" && -s "$ENV_FILE" ]]; then
- old_env=$(<"$ENV_FILE")
- if [[ $old_env != $new_env ]]; then
- ewarn 'Environment mismatch from previous run, deleting temporary files...'
- RM_OLD_TEMPFILES=1
- fi
- else
- # No env file found, silently delete any other tempfiles that may exist
- RM_OLD_TEMPFILES=1
- fi
-
- # If we should remove old tempfiles, do so
- if [[ $RM_OLD_TEMPFILES ]]; then
- rm -f "${FILES[@]}"
- else
- for file in "${FILES[@]}"; do
- if [ -e "$file" ]; then
- chown ${uid}:portage "$file"
- chmod 600 "$file"
- fi
- done
- fi
-
- # Save the environment in a file for next time
- echo "$new_env" > "$ENV_FILE"
-
- [[ $VERBOSE ]] && echo $'\n'"$APP_NAME environment:"$'\n'"$new_env"
-
- if [[ $QUIET -ne 1 ]];
- then
- echo
- einfo "Checking reverse dependencies"
- einfo "Packages containing binaries and libraries $HEAD_TEXT"
- einfo "will be emerged."
- fi
-}
-
-get_files() {
- [[ $QUIET -ne 1 ]] && einfo "Collecting system binaries and libraries"
- if [[ -r "$FILES_FILE" && -s "$FILES_FILE" ]]; then
- [[ $QUIET -ne 1 ]] && einfo "Found existing $FILES_FILE"
- else
- # Be safe and remove any extraneous temporary files
- # Don't remove 0_env.rr - The first file in the array
- rm -f "${FILES[@]:1}"
-
- clean_trap "$FILES_FILE"
-
- if [[ $SEARCH_DIRS_MASK ]]; then
- findMask=($SEARCH_DIRS_MASK)
- findMask="${findMask[@]/#/-o -path }"
- findMask="( ${findMask#-o } ) -prune -o"
- fi
- # TODO: Check this -- afaict SEARCH_DIRS isn't an array, so this should just be $SEARCH_DIRS?
- find ${SEARCH_DIRS[@]} $findMask -type f \( -perm -u+x -o -perm -g+x -o -perm -o+x -o \
- -name '*.so' -o -name '*.so.*' -o -name '*.la' \) -print 2> /dev/null |
- sort -u > "$FILES_FILE" ||
- die $? "find failed to list binary files (This is a bug.)"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $FILES_FILE"
- fi
-}
-parse_ld_so_conf() {
- # FIXME: not safe for paths with spaces
- local include
- for path in $(sed '/^#/d;s/#.*$//' < /etc/ld.so.conf); do
- if [[ $include = true ]]; then
- for include_path in $(sed '/^#/d;s/#.*$//' /etc/${path} 2>/dev/null); do
- echo $include_path
- done
- include=""
- continue
- fi
- if [[ $path != include ]]; then
- echo $path
- else
- include="true"
- continue
- fi
- done
-}
-get_ldpath() {
- local COMPLETE_LD_LIBRARY_PATH
- [[ $SEARCH_BROKEN && $FULL_LD_PATH ]] || return
- [[ $QUIET -ne 1 ]] && einfo 'Collecting complete LD_LIBRARY_PATH'
- if [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]]; then
- [[ $QUIET -ne 1 ]] && einfo "Found existing $LDPATH_FILE."
- else
- clean_trap "$LDPATH_FILE"
- # Ensure that the "trusted" lib directories are at the start of the path
- COMPLETE_LD_LIBRARY_PATH=(
- /lib*
- /usr/lib*
- $(parse_ld_so_conf)
- $(sed 's:/[^/]*$::' < "$FILES_FILE" | sort -ru)
- )
- IFS=':'
- COMPLETE_LD_LIBRARY_PATH="${COMPLETE_LD_LIBRARY_PATH[*]}"
- IFS="$OIFS"
- echo "$COMPLETE_LD_LIBRARY_PATH" > "$LDPATH_FILE"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $LDPATH_FILE"
- fi
-}
-main_checks() {
- local target_file
- local -a files
- local i=0
- local ldd_output
- local ldd_status
- local numFiles
- local COMPLETE_LD_LIBRARY_PATH
- if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then
- [[ -r "$LDPATH_FILE" && -s "$LDPATH_FILE" ]] ||
- die 1 "Unable to find $LDPATH_FILE"
- COMPLETE_LD_LIBRARY_PATH=$(<"$LDPATH_FILE")
- fi
- [[ $QUIET -ne 1 ]] && einfo "Checking dynamic linking $WORKING_TEXT"
- if [[ -r "$BROKEN_FILE" && -s "$BROKEN_FILE" ]]; then
- [[ $QUIET -ne 1 ]] && einfo "Found existing $BROKEN_FILE."
- else
- clean_trap "$BROKEN_FILE" "$ERRORS_FILE"
- files=($(<"$FILES_FILE"))
- numFiles="${#files[@]}"
- for target_file in "${files[@]}"; do
- if [[ $target_file != *.la ]]; then
- # Note: double checking seems to be faster than single with complete path
- # (special add ons are rare).
- ldd_output=$(ldd "$target_file" 2>> "$ERRORS_FILE" | sort -u)
- ldd_status=$? # TODO: Check this for problems with sort
- # HACK: if LD_LIBRARY_MASK is null or undefined grep -vF doesn't work
- if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" |
- grep -q -E "$SONAME_SEARCH"; then
- if [[ $SEARCH_BROKEN && $FULL_LD_PATH ]]; then
- if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$target_file" 2>/dev/null |
- grep -vF "$LD_LIBRARY_MASK" | grep -q -E "$SONAME_SEARCH"; then
- # FIXME: I hate duplicating code
- # Only build missing direct dependencies
- MISSING_LIBS=$(
- expr='s/[[:space:]]*\([^[:space:]]*\) => not found/\1/p'
- sed -n "$expr" <<< "$ldd_output"
- )
- REQUIRED_LIBS=$(
- expr='s/^[[:space:]]*NEEDED[[:space:]]*\([^[:space:]]*\).*/\1/p';
- objdump -x "$target_file" | grep NEEDED | sed "$expr" | sort -u
- )
- MISSING_LIBS=$(grep -F "$REQUIRED_LIBS" <<< "$MISSING_LIBS")
- if [[ $MISSING_LIBS ]]; then
- echo "obj $target_file" >> "$BROKEN_FILE"
- echo_v " broken $target_file (requires $MISSING_LIBS)"
- fi
- fi
- else
- # FIXME: I hate duplicating code
- # Only rebuild for direct dependencies
- MISSING_LIBS=$(
- expr="s/^[[:space:]]*\([^[:space:]]*\).*$/\1/p"
- sort -u <<< "$ldd_output" | grep -E "$SONAME" | sed -n "$expr"
- )
- REQUIRED_LIBS=$(
- expr='s/^[[:space:]]*NEEDED[[:space:]]*\([^[:space:]]*\).*/\1/p';
- objdump -x "$target_file" | grep NEEDED | sed "$expr" | sort -u
- )
- MISSING_LIBS=$(grep -F "$REQUIRED_LIBS" <<< "$MISSING_LIBS")
- if [[ $MISSING_LIBS ]]; then
- echo "obj $target_file" >> "$BROKEN_FILE"
- if [[ $SEARCH_BROKEN ]]; then
- echo_v " broken $target_file (requires $MISSING_LIBS)"
- else
- echo_v " found $target_file"
- fi
- fi
- fi
- fi
- elif [[ $SEARCH_BROKEN ]]; then
- # Look for broken .la files
- la_SEARCH_DIRS="$SEARCH_DIRS"
- la_search_dir=""
- la_broken=""
- la_lib=""
- for depend in $(
- gawk -F"[=']" '/^dependency_libs/{
- print $3
- }' "$target_file"
- ); do
- if [[ $depend = /* && ! -e $depend ]]; then
- echo "obj $target_file" >> "$BROKEN_FILE"
- echo_v " broken $target_file (requires $depend)"
- elif [[ $depend = -[LR]/* ]]; then
- if ! [[ $'\n'${la_SEARCH_DIRS}$'\n' == *$'\n'${depend#-?}$'\n'* ]]; then
- la_SEARCH_DIRS+=$'\n'"${depend#-?}"
- fi
- elif [[ $depend = "-l"* ]]; then
- la_lib="lib${depend#-l}"
- la_broken="yes"
- IFS=$'\n'
- for la_search_dir in $la_SEARCH_DIRS; do
- if [[ -e ${la_search_dir}/${la_lib}.so || -e ${la_search_dir}/${la_lib}.a ]]; then
- la_broken="no"
- fi
- done
- IFS="$OIFS"
- if [[ $la_broken = yes ]]; then
- echo "obj $target_file" >> "$BROKEN_FILE"
- echo_v " broken $target_file (requires $depend)"
- fi
- fi
- done
- unset la_SEARCH_DIRS la_search_dir la_broken la_lib
- fi
- [[ $VERBOSE ]] &&
- progress $((++i)) $numFiles $target_file ||
- progress $((++i)) $numFiles
- done
- if [[ $SEARCH_BROKEN && -f $ERRORS_FILE ]]; then
- # Look for missing version
- while read target_file; do
- echo "obj $target_file" >> "$BROKEN_FILE"
- echo_v " broken $target_file (no version information available)"
- done < <(
- # Regexify LD_LIBRARY_MASK. Exclude it from the search.
- LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}"
- gawk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" '
- /no version information available/ && $0 !~ ldmask {
- gsub(/[()]/, "", $NF)
- if (seen[$NF]++) next
- print $NF
- }' "$ERRORS_FILE"
- )
- fi
- [[ -r "$BROKEN_FILE" && -s "$BROKEN_FILE" ]] || clean_exit
- sort -u "$BROKEN_FILE" -o "$BROKEN_FILE"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $BROKEN_FILE"
- fi
-}
-get_packages() {
- local target_file
- local EXACT_PKG
- local PKG
- local obj
- einfo 'Assigning files to packages'
- if [[ -r "$RAW_FILE" && -s "$RAW_FILE" ]]; then
- einfo "Found existing $RAW_FILE"
- else
- clean_trap "$RAW_FILE" "$OWNERS_FILE"
- while read obj target_file; do
- EXACT_PKG=$(get_file_owner $target_file)
- if [[ $EXACT_PKG ]]; then
- # Strip version information
- PKG="${EXACT_PKG%%-r[[:digit:]]*}"
- PKG="${PKG%-*}"
- echo "$EXACT_PKG" >> "$RAW_FILE"
- echo "$target_file -> $EXACT_PKG" >> "$OWNERS_FILE"
- echo_v " $target_file -> $PKG"
- else
- ewarn " !!! $target_file not owned by any package is broken !!!"
- echo "$target_file -> (none)" >> "$OWNERS_FILE"
- echo_v " $target_file -> (none)"
- fi
- done < "$BROKEN_FILE"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $RAW_FILE and $OWNERS_FILE"
- fi
- # if we find '(none)' on every line, exit out
- if ! grep -qvF '(none)' "$OWNERS_FILE"; then
- ewarn "Found some broken files, but none of them were associated with known packages"
- ewarn "Unable to proceed with automatic repairs."
- ewarn "The broken files are listed in $OWNERS_FILE"
- if [[ $VERBOSE ]]; then
- ewarn "The broken files are:"
- while read filename junk; do
- ewarn " $filename"
- done < "$OWNERS_FILE"
- fi
- exit 0 # FIXME: Should we exit 1 here?
- fi
-}
-clean_packages() {
- [[ $QUIET -ne 1 ]] && einfo 'Cleaning list of packages to rebuild'
- if [[ -r "$PKGS_FILE" && -s "$PKGS_FILE" ]]; then
- [[ $QUIET -ne 1 ]] && einfo "Found existing $PKGS_FILE"
- else
- sort -u "$RAW_FILE" > "$PKGS_FILE"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $PKGS_FILE"
- fi
-}
-assign_packages_to_ebuilds() {
- local EXACT_PKG
- local PKG
- local SLOT
- einfo 'Assigning packages to ebuilds'
- if [[ -r "$EBUILDS_FILE" && -s "$EBUILDS_FILE" ]]; then
- einfo "Found existing $EBUILDS_FILE"
- elif [[ -r "$PKGS_FILE" && -s "$PKGS_FILE" ]]; then
- clean_trap "$EBUILDS_FILE"
- while read EXACT_PKG; do
- # Get the slot
- PKG="${EXACT_PKG%%-r[[:digit:]]*}"
- PKG="${PKG%-*}"
- SLOT=$(</var/db/pkg/$EXACT_PKG/SLOT)
- echo "$PKG:$SLOT"
- done < "$PKGS_FILE" > "$EBUILDS_FILE"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $EBUILDS_FILE"
- else
- einfo 'Nothing to rebuild.'
- die 1 '(The program should have already quit, so this is a minor bug.)'
- fi
-}
-get_exact_ebuilds() {
- einfo 'Assigning files to ebuilds'
- if [[ -r $EBUILDS_FILE && -s $EBUILDS_FILE ]]; then
- einfo "Found existing $EBUILDS_FILE"
- elif [[ -r $BROKEN_FILE && -s $BROKEN_FILE ]]; then
- rebuildList=" $(<"$BROKEN_FILE") "
- rebuildList=(${rebuildList//[[:space:]]obj[[:space:]]/ })
- get_file_owner "${rebuildList[@]}" | sed 's/^/=/' > "$EBUILDS_FILE"
- [[ $QUIET -ne 1 ]] && einfo "Generated new $EBUILDS_FILE"
- else
- einfo 'Nothing to rebuild.'
- die 1 '(The program should have already quit, so this is a minor bug.)'
- fi
-}
-list_skipped_packages() {
- ewarn
- ewarn 'Portage could not find any version of the following packages it could build:'
- ewarn "${SKIP_LIST[@]}"
- ewarn
- ewarn '(Perhaps they are masked, blocked, or removed from portage.)'
- ewarn 'Try to emerge them manually.'
- ewarn
-}
-get_build_order() {
- local -r OLD_EMERGE_DEFAULT_OPTS="$EMERGE_DEFAULT_OPTS"
- local RAW_REBUILD_LIST
- local REBUILD_GREP
- local i
- if [[ ! $ORDER_PKGS ]]; then
- einfo 'Skipping package ordering'
- return
- fi
- [[ $QUIET -ne 1 ]] && einfo 'Evaluating package order'
- if [[ -r "$ORDER_FILE" && -s "$ORDER_FILE" ]]; then
- einfo "Found existing $ORDER_FILE"
- else
- clean_trap "$ORDER_FILE"
- RAW_REBUILD_LIST=$(<"$EBUILDS_FILE")
- if [[ $RAW_REBUILD_LIST ]]; then
- export EMERGE_DEFAULT_OPTS="--nospinner --pretend --oneshot --quiet"
- RAW_REBUILD_LIST=($RAW_REBUILD_LIST) # convert into array
- # If PACKAGE_NAMES is defined we're using slots, not versions
- if [[ $PACKAGE_NAMES ]]; then
- # Eliminate atoms that can't be built
- for i in "${!RAW_REBUILD_LIST[@]}"; do
- if [[ "${RAW_REBUILD_LIST[i]}" = *[A-Za-z]* ]]; then
- portageq best_visible "$PORTAGE_ROOT" "${RAW_REBUILD_LIST[i]}" >/dev/null && continue
- SKIP_LIST+=("${RAW_REBUILD_LIST[i]}")
- fi
- unset RAW_REBUILD_LIST[i]
- done
- # If RAW_REBUILD_LIST is empty, then we have nothing to build.
- if (( ${#RAW_REBUILD_LIST[@]} == 0 )); then
- if (( ${#SKIP_LIST[@]} == 0 )); then
- ewarn "The list of packages to skip is empty, but there are no"
- ewarn "packages listed to rebuild either. (This is a bug.)"
- else
- list_skipped_packages
- fi
- die 1 'Warning: Portage cannot rebuild any of the necessary packages.'
- fi
- fi
- RAW_REBUILD_LIST="${RAW_REBUILD_LIST[@]}"
-
- # We no longer determine the package order ourselves. Instead we call emerge
- # with --complete-graph=y in the rebuild function.
- if false ; then
- REBUILD_GREP=$(emerge --nodeps $RAW_REBUILD_LIST | sed 's/\[[^]]*\]//g')
- if (( ${PIPESTATUS[0]} == 0 )); then
- emerge --deep $RAW_REBUILD_LIST |
- sed 's/\[[^]]*\]//g' |
- grep -F "$REBUILD_GREP" > "$ORDER_FILE"
- fi
-
- # Here we use the PIPESTATUS from the second emerge, the --deep one.
- if (( ${PIPESTATUS[0]} != 0 )); then
- eerror
- eerror 'Warning: Failed to resolve package order.'
- eerror 'Will merge in arbitrary order'
- eerror
- cat <<- EOF
- Possible reasons:
- - An ebuild is no longer in the portage tree.
- - An ebuild is masked, use /etc/portage/packages.keyword
- and/or /etc/portage/package.unmask to unmask it
- EOF
- countdown 5
- rm -f "$ORDER_FILE"
- fi
- else
- echo "$RAW_REBUILD_LIST" > "$ORDER_FILE"
- fi
- export EMERGE_DEFAULT_OPTS="$OLD_EMERGE_DEFAULT_OPTS"
- else
- einfo 'Nothing to rebuild.'
- die 1 '(The program should have already quit, so this is a minor bug.)'
- fi
- fi
- [[ -r "$ORDER_FILE" && -s "$ORDER_FILE" && $QUIET -ne 1 ]] && einfo "Generated new $ORDER_FILE"
-}
-
-show_unowned_files() {
- if grep -qF '(none)' "$OWNERS_FILE"; then
- ewarn "Found some broken files that weren't associated with known packages"
- ewarn "The broken files are:"
- while read filename junk; do
- [[ $junk = *none* ]] && ewarn " $filename"
- done < "$OWNERS_FILE" | gawk '!s[$0]++' # (omit dupes)
- fi
-}
-
-# Get multiple portage variables at once to speedup revdep-rebuild.
-portage_settings() {
- local ORIG_SEARCH_DIRS="$SEARCH_DIRS"
- local ORIG_SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK"
- local ORIG_LD_LIBRARY_MASK="$LD_LIBRARY_MASK"
- unset SEARCH_DIRS
- unset SEARCH_DIRS_MASK
- unset LD_LIBRARY_MASK
-
- eval $(portageq envvar -v PORTAGE_ROOT PORTAGE_NICENESS EMERGE_DEFAULT_OPTS NOCOLOR SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK)
- export NOCOLOR
-
- SEARCH_DIRS="$ORIG_SEARCH_DIRS $SEARCH_DIRS"
- SEARCH_DIRS_MASK="$ORIG_SEARCH_DIRS_MASK $SEARCH_DIRS_MASK"
- LD_LIBRARY_MASK="$ORIG_LD_LIBRARY_MASK $LD_LIBRARY_MASK"
-}
-
-##
-# Setup portage and the search paths
-setup_portage() {
- # Obey PORTAGE_NICENESS (which is incremental to the current nice value)
- if [[ $PORTAGE_NICENESS ]]; then
- current_niceness=$(nice)
- let PORTAGE_NICENESS=${current_niceness}+${PORTAGE_NICENESS}
- renice $PORTAGE_NICENESS $$ > /dev/null
- # Since we have already set our nice value for our processes,
- # reset PORTAGE_NICENESS to zero to avoid having emerge renice again.
- export PORTAGE_NICENESS="0"
- fi
-
- PORTAGE_ROOT="${PORTAGE_ROOT:-/}"
-}
-
-##
-# Setup the paths to search (and filter the ones to avoid)
-setup_search_paths_and_masks() {
- local configfile sdir mdir skip_me filter_SEARCH_DIRS
-
- [[ $QUIET -ne 1 ]] && einfo "Configuring search environment for $APP_NAME"
-
- # Update the incremental variables using /etc/profile.env, /etc/ld.so.conf,
- # portage, and the environment
-
- # Read the incremental variables from environment and portage
- # Until such time as portage supports these variables as incrementals
- # The value will be what is in /etc/make.conf
-# SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS)
-# SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK)
-# LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK)
-
- # Add the defaults
- if [[ -d /etc/revdep-rebuild ]]; then
- for configfile in /etc/revdep-rebuild/*; do
- SEARCH_DIRS+=" "$(. $configfile; echo $SEARCH_DIRS)
- SEARCH_DIRS_MASK+=" "$(. $configfile; echo $SEARCH_DIRS_MASK)
- LD_LIBRARY_MASK+=" "$(. $configfile; echo $LD_LIBRARY_MASK)
- done
- else
- SEARCH_DIRS+=" /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*"
- SEARCH_DIRS_MASK+=" /opt/OpenOffice /usr/lib/openoffice"
- LD_LIBRARY_MASK+=" libodbcinst.so libodbc.so libjava.so libjvm.so"
- fi
-
- # Get the ROOTPATH and PATH from /etc/profile.env
- if [[ -r "/etc/profile.env" && -s "/etc/profile.env" ]]; then
- SEARCH_DIRS+=" "$(. /etc/profile.env; /usr/bin/tr ':' ' ' <<< "$ROOTPATH $PATH")
- fi
-
- # Get the directories from /etc/ld.so.conf
- if [[ -r /etc/ld.so.conf && -s /etc/ld.so.conf ]]; then
- SEARCH_DIRS+=" "$(parse_ld_so_conf)
- fi
-
- # Set the final variables
- SEARCH_DIRS=$(clean_var <<< "$SEARCH_DIRS")
- SEARCH_DIRS_MASK=$(clean_var <<< "$SEARCH_DIRS_MASK")
- LD_LIBRARY_MASK=$(clean_var <<< "$LD_LIBRARY_MASK")
- # Filter masked paths from SEARCH_DIRS
- for sdir in ${SEARCH_DIRS} ; do
- skip_me=
- for mdir in ${SEARCH_DIRS_MASK}; do
- [[ ${sdir} == ${mdir}/* ]] && skip_me=1 && break
- done
- [[ -n ${skip_me} ]] || filter_SEARCH_DIRS+=" ${sdir}"
- done
- SEARCH_DIRS=$(clean_var <<< "${filter_SEARCH_DIRS}")
- [[ $SEARCH_DIRS ]] || die 1 "No search defined -- this is a bug."
-}
-##
-# Rebuild packages owning broken binaries
-rebuild() {
- if [[ -r $ORDER_FILE && -s $ORDER_FILE ]]; then
- # The rebuild list contains category/package:slot atoms.
- # Do not prepend with an '=' sign.
- # REBUILD_LIST=( $(<"$ORDER_FILE") )
- # REBUILD_LIST="${REBUILD_LIST[@]/#/=}"
- REBUILD_LIST=$(<"$ORDER_FILE")
- else
- REBUILD_LIST=$(sort -u "$EBUILDS_FILE")
- fi
-
- trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
-
- [[ $QUIET -ne 1 ]] && einfo 'All prepared. Starting rebuild'
- echo "emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
-
- is_real_merge && countdown 10
-
- # Link file descriptor #6 with stdin so --ask will work
- exec 6<&0
-
- # Run in background to correctly handle Ctrl-C
- {
- emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST <&6
- echo $? > "$STATUS_FILE"
- } &
- wait
-
- # Now restore stdin from fd #6, where it had been saved, and close fd #6 ( 6<&- ) to free it for other processes to use.
- exec 0<&6 6<&-
-}
-##
-# Finish up
-cleanup() {
- if [[ (( $(<"$STATUS_FILE") != 0 )) && ! is_real_merge ]]; then
- ewarn
- ewarn "$APP_NAME failed to emerge all packages."
- ewarn 'you have the following choices:'
- einfo "- If emerge failed during the build, fix the problems and re-run $APP_NAME."
- einfo '- Use /etc/portage/package.keywords to unmask a newer version of the package.'
- einfo " (and remove $ORDER_FILE to be evaluated again)"
- einfo '- Modify the above emerge command and run it manually.'
- einfo '- Compile or unmerge unsatisfied packages manually,'
- einfo ' remove temporary files, and try again.'
- einfo ' (you can edit package/ebuild list first)'
- einfo
- einfo 'To remove temporary files, please run:'
- einfo "rm ${WORKING_DIR}/*.rr"
- show_unowned_files
- exit $EMERGE_STATUS
- elif is_real_merge; then
- trap_cmd() {
- eerror "terminated. Please remove the temporary files manually:"
- eerror "rm ${WORKING_DIR}/*.rr"
- exit 1
- }
- [[ "${SKIP_LIST[@]}" != "" ]] && list_skipped_packages
- trap trap_cmd SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
- einfo 'Build finished correctly. Removing temporary files...'
- einfo
- einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries'
- einfo 'are fixed. Possible reasons for remaining inconsistencies include:'
- einfo ' orphaned files'
- einfo ' deep dependencies'
- einfo " packages installed outside of portage's control"
- einfo ' specially-evaluated libraries'
- if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then
- show_unowned_files
- fi
- [[ $KEEP_TEMP ]] || rm -f "${FILES[@]}"
- else
- einfo 'Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.'
- fi
-}
-
-main "$@"
+# Copyright 2010 Brian Dolbec <brian.dolbec@gmail.com>
+# Copyright 2002-2010 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2 or later
+#
+# $Header$
+
+"""'analyse' is a flexible utility for Gentoo linux which can display various
+information about installed packages, such as the USE flags used and the
+packages that use them. It can also be used to help rebuild /etc/portage/package.*
+files in the event of corruption, and possibly more.
+"""
+
+from __future__ import print_function
+
+import sys
+# This block ensures that ^C interrupts are handled quietly.
+try:
+ import signal
+
+ def exithandler(signum,frame):
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+ signal.signal(signal.SIGTERM, signal.SIG_IGN)
+ print()
+ sys.exit(1)
+
+ signal.signal(signal.SIGINT, exithandler)
+ signal.signal(signal.SIGTERM, exithandler)
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+
+except KeyboardInterrupt:
+ print()
+ sys.exit(1)
+
+from gentoolkit import errors
+from gentoolkit.revdep_rebuild import rebuild
+
+try:
+ success = rebuild.main(rebuild.parse_options())
+ sys.exit(success)
+except errors.GentoolkitException as err:
+ if '--debug' in sys.argv:
+ raise
+ else:
+ from gentoolkit import pprinter as pp
+ sys.stderr.write(pp.error(str(err)))
+ print()
+ print("Add '--debug' to global options for traceback.")
+ sys.exit(1)
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild.sh
similarity index 100%
copy from bin/revdep-rebuild
copy to bin/revdep-rebuild.sh
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-07-13 15:41 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-07-13 15:41 UTC (permalink / raw
To: gentoo-commits
commit: e3bd1e011048d776b39e38308bc22c58b03c5c7f
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 13 15:41:22 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 15:41:48 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=e3bd1e01
Hardcode APP_NAME to revdep-rebuild
---
bin/revdep-rebuild.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index f00b791..abeed6b 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -17,7 +17,7 @@
unset GREP_OPTIONS
# Readonly variables:
-declare -r APP_NAME="${0##*/}" # The name of this application
+declare -r APP_NAME="revdep-rebuild" # # The name of this application
declare -r VERSION="svn"
declare -r OIFS="$IFS" # Save the IFS
declare -r ENV_FILE=0_env.rr # Contains environment variables
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-07-13 16:01 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-07-13 16:01 UTC (permalink / raw
To: gentoo-commits
commit: 34a1346c93ddcc968a3e1189138be0bb0aa431a6
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 13 15:50:42 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 15:50:42 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=34a1346c
Change description from 'analyze' to 'revdep-rebuild' description
---
bin/revdep-rebuild | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index a4c8e11..cd7be0b 100755
--- a/bin/revdep-rebuild
+++ b/bin/revdep-rebuild
@@ -6,10 +6,9 @@
#
# $Header$
-"""'analyse' is a flexible utility for Gentoo linux which can display various
-information about installed packages, such as the USE flags used and the
-packages that use them. It can also be used to help rebuild /etc/portage/package.*
-files in the event of corruption, and possibly more.
+"""'revdep-rebuild' scans libraries and binaries for missing shared library dependencies and attempts to fix them by re-emerging
+those broken binaries and shared libraries. It is useful when an upgraded package breaks other software packages that are
+dependent upon the upgraded package.
"""
from __future__ import print_function
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-07-27 19:02 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-07-27 19:02 UTC (permalink / raw
To: gentoo-commits
commit: 9ad547e5f33fce1dfb378809252d871265a82c58
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 27 19:01:34 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Jul 27 19:01:34 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=9ad547e5
Fix missing parenthises in euse. Bug 376393
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 65fb119..be47cc9 100755
--- a/bin/euse
+++ b/bin/euse
@@ -508,7 +508,7 @@ get_flagstatus_helper_pkg() {
atoms=($(
echo "${atoms[@]}" | python -c "
from __future__ import print_function;import portage.dep as dep, sys
-print(' '.join(dep.match_to_list('$5-$6',sys.stdin.read().split()))"))
+print(' '.join(dep.match_to_list('$5-$6',sys.stdin.read().split())))"))
fi
flags=$(for atom in ${atoms[@]}; do
[[ -z $atom ]] && continue
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-08-24 17:30 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-08-24 17:30 UTC (permalink / raw
To: gentoo-commits
commit: 6edc15a5690a3c26a3c530669a922e01f50ab830
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 24 17:28:06 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Aug 24 17:28:06 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=6edc15a5
Fix traversal of cascading profiles by euse (Bug 379559).
Thanks to Ian Abbot for the patch!
---
bin/euse | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bin/euse b/bin/euse
index be47cc9..bedba35 100755
--- a/bin/euse
+++ b/bin/euse
@@ -439,7 +439,6 @@ traverse_profile() {
curdir="${2:-$(get_real_path ${MAKE_PROFILE_PATH})}"
- [[ -f "${curdir}/${1}" ]] && rvalue="${curdir}/${1} ${rvalue}"
if [[ -f "${curdir}/parent" ]]; then
for parent in $(egrep -v '(^#|^ *$)' ${curdir}/parent); do
# Bug 231394, handle parent path being absolute
@@ -448,9 +447,10 @@ traverse_profile() {
else
pdir="$(get_real_path ${curdir}/${parent})"
fi
- rvalue="$(traverse_profile ${1} ${pdir}) ${rvalue}"
+ rvalue="${rvalue} $(traverse_profile ${1} ${pdir})"
done
fi
+ [[ -f "${curdir}/${1}" ]] && rvalue="${rvalue} ${curdir}/${1}"
echo "${rvalue}"
} # }}}
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-09-07 12:40 Christian Ruppert
0 siblings, 0 replies; 46+ messages in thread
From: Christian Ruppert @ 2011-09-07 12:40 UTC (permalink / raw
To: gentoo-commits
commit: 4a1fe09bfdff516e28aab23eea102984fedb429a
Author: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 7 12:39:10 2011 +0000
Commit: Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Wed Sep 7 12:39:10 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=4a1fe09b
Add missing quotes
---
bin/euse | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/euse b/bin/euse
index bedba35..febe732 100755
--- a/bin/euse
+++ b/bin/euse
@@ -275,21 +275,21 @@ get_useflags() {
# backup portdir so get_portdir() doesn't give false results later
portdir_backup="${PORTDIR}"
- ACTIVE_FLAGS[0]="$(reduce_incrementals ${USE})"
+ ACTIVE_FLAGS[0]="$(reduce_incrementals "${USE}")"
USE=""
for x in $(get_all_make_conf); do
source "${x}"
- ACTIVE_FLAGS[1]="$(reduce_incrementals ${ACTIVE_FLAGS[1]} ${USE})"
+ ACTIVE_FLAGS[1]="$(reduce_incrementals "${ACTIVE_FLAGS[1]}" "${USE}")"
done
USE=""
for x in $(get_all_make_defaults); do
source "${x}"
ACTIVE_FLAGS[2]="${ACTIVE_FLAGS[2]} ${USE}"
done
- ACTIVE_FLAGS[2]="$(reduce_incrementals ${ACTIVE_FLAGS[2]})"
+ ACTIVE_FLAGS[2]="$(reduce_incrementals "${ACTIVE_FLAGS[2]}")"
USE=""
source "${MAKE_GLOBALS_PATH}"
- ACTIVE_FLAGS[3]="$(reduce_incrementals ${USE})"
+ ACTIVE_FLAGS[3]="$(reduce_incrementals "${USE}")"
# restore saved env variables
USE="${ACTIVE_FLAGS[0]}"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-10-12 16:39 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-10-12 16:39 UTC (permalink / raw
To: gentoo-commits
commit: 57d86eac981ce951c45890854752d62c6e2b2749
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 12 16:34:47 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Oct 12 16:34:47 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=57d86eac
Fix revdep-rebuiild to exit correctly with correct error code when emerge
fails. Bug 351054
---
bin/revdep-rebuild.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index abeed6b..538e101 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -18,7 +18,7 @@ unset GREP_OPTIONS
# Readonly variables:
declare -r APP_NAME="revdep-rebuild" # # The name of this application
-declare -r VERSION="svn"
+declare -r VERSION="vcs"
declare -r OIFS="$IFS" # Save the IFS
declare -r ENV_FILE=0_env.rr # Contains environment variables
declare -r FILES_FILE=1_files.rr # Contains a list of files to search
@@ -1151,7 +1151,8 @@ rebuild() {
##
# Finish up
cleanup() {
- if [[ (( $(<"$STATUS_FILE") != 0 )) && ! is_real_merge ]]; then
+ EMERGE_STATUS=$(<"$STATUS_FILE")
+ if [[ (( $EMERGE_STATUS != 0 )) && is_real_merge ]]; then
ewarn
ewarn "$APP_NAME failed to emerge all packages."
ewarn 'you have the following choices:'
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2011-11-28 15:46 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2011-11-28 15:46 UTC (permalink / raw
To: gentoo-commits
commit: 7bc10b6061fccb0cbb7c30987c622a2143d78a6d
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 28 15:45:57 2011 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Nov 28 15:45:57 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=7bc10b60
Fix typo in euse
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index febe732..0f59c91 100755
--- a/bin/euse
+++ b/bin/euse
@@ -155,7 +155,7 @@ Options: -h, --help - show this message
settings
-P, --prune - alias for --remove
-p, --package - used with -E, -D, and -R to apply to a
- speciic package only
+ specific package only
Notes: ${PROGRAM_NAME} currently works for global flags defined
in make.globals, make.defaults, make.conf, use.force, and use.mask
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-02-16 17:37 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-02-16 17:37 UTC (permalink / raw
To: gentoo-commits
commit: 3e51df74595c535656ef9f38bf7a577a4f64d0f5
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 16 17:34:37 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Feb 16 17:34:37 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=3e51df74
Fix revdep-rebuild.sh to properly honor emerge return codes.
This should fix bugs 326923, 351054, and 404065
---
bin/revdep-rebuild.sh | 70 +++++++++++++++++++++++++-----------------------
1 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 50bc070..1d27d63 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -1152,42 +1152,44 @@ rebuild() {
# Finish up
cleanup() {
EMERGE_STATUS=$(<"$STATUS_FILE")
- if [[ (( $EMERGE_STATUS != 0 )) && is_real_merge ]]; then
- ewarn
- ewarn "$APP_NAME failed to emerge all packages."
- ewarn 'you have the following choices:'
- einfo "- If emerge failed during the build, fix the problems and re-run $APP_NAME."
- einfo '- Use /etc/portage/package.keywords to unmask a newer version of the package.'
- einfo " (and remove $ORDER_FILE to be evaluated again)"
- einfo '- Modify the above emerge command and run it manually.'
- einfo '- Compile or unmerge unsatisfied packages manually,'
- einfo ' remove temporary files, and try again.'
- einfo ' (you can edit package/ebuild list first)'
- einfo
- einfo 'To remove temporary files, please run:'
- einfo "rm ${WORKING_DIR}/*.rr"
- show_unowned_files
- exit $EMERGE_STATUS
- elif is_real_merge; then
- trap_cmd() {
- eerror "terminated. Please remove the temporary files manually:"
- eerror "rm ${WORKING_DIR}/*.rr"
- exit 1
- }
- [[ "${SKIP_LIST[@]}" != "" ]] && list_skipped_packages
- trap trap_cmd SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
- einfo 'Build finished correctly. Removing temporary files...'
- einfo
- einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries'
- einfo 'are fixed. Possible reasons for remaining inconsistencies include:'
- einfo ' orphaned files'
- einfo ' deep dependencies'
- einfo " packages installed outside of portage's control"
- einfo ' specially-evaluated libraries'
- if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then
+ if is_real_merge; then
+ if [[ (( $EMERGE_STATUS != 0 )) ]]; then
+ ewarn
+ ewarn "$APP_NAME failed to emerge all packages."
+ ewarn 'you have the following choices:'
+ einfo "- If emerge failed during the build, fix the problems and re-run $APP_NAME."
+ einfo '- Use /etc/portage/package.keywords to unmask a newer version of the package.'
+ einfo " (and remove $ORDER_FILE to be evaluated again)"
+ einfo '- Modify the above emerge command and run it manually.'
+ einfo '- Compile or unmerge unsatisfied packages manually,'
+ einfo ' remove temporary files, and try again.'
+ einfo ' (you can edit package/ebuild list first)'
+ einfo
+ einfo 'To remove temporary files, please run:'
+ einfo "rm ${WORKING_DIR}/*.rr"
show_unowned_files
+ exit $EMERGE_STATUS
+ else
+ trap_cmd() {
+ eerror "terminated. Please remove the temporary files manually:"
+ eerror "rm ${WORKING_DIR}/*.rr"
+ exit 1
+ }
+ [[ "${SKIP_LIST[@]}" != "" ]] && list_skipped_packages
+ trap trap_cmd SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
+ einfo 'Build finished correctly. Removing temporary files...'
+ einfo
+ einfo 'You can re-run revdep-rebuild to verify that all libraries and binaries'
+ einfo 'are fixed. Possible reasons for remaining inconsistencies include:'
+ einfo ' orphaned files'
+ einfo ' deep dependencies'
+ einfo " packages installed outside of portage's control"
+ einfo ' specially-evaluated libraries'
+ if [[ -r "$OWNERS_FILE" && -s "$OWNERS_FILE" ]]; then
+ show_unowned_files
+ fi
+ [[ $KEEP_TEMP ]] || rm -f "${FILES[@]}"
fi
- [[ $KEEP_TEMP ]] || rm -f "${FILES[@]}"
else
einfo 'Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuild.'
fi
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-02-20 23:25 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-02-20 23:25 UTC (permalink / raw
To: gentoo-commits
commit: 946097d191bea9e46768cef2ea174506dd6021bf
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 20 23:13:02 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Feb 20 23:13:02 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=946097d1
Fix euse -i to not print errors from 'cat' when determining the repository name
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 0f59c91..25b718b 100755
--- a/bin/euse
+++ b/bin/euse
@@ -384,7 +384,7 @@ get_useflaglist_ebuild() {
local pkg=$(echo ${1} | cut -d/ -f2)
declare append
for portdir in ${ALL_PORTDIRS[@]}; do
- if [[ -s $(dirname ${portdir}/repo_name) ]]; then
+ if [[ -s "${portdir}/profiles/repo_name" ]]; then
overlay="$(cat "${portdir}/profiles/repo_name")"
else
# XXX: May be better to use full path
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-02-20 23:25 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-02-20 23:25 UTC (permalink / raw
To: gentoo-commits
commit: 61885eb383f8fd1475ab9d68ee33c06740d1ab27
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 20 23:22:19 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Feb 20 23:22:19 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=61885eb3
Change overlay name to match portage when repo_name is not found.
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 25b718b..6d3f811 100755
--- a/bin/euse
+++ b/bin/euse
@@ -388,7 +388,7 @@ get_useflaglist_ebuild() {
overlay="$(cat "${portdir}/profiles/repo_name")"
else
# XXX: May be better to use full path
- overlay="$(basename "${portdir}")"
+ overlay="x-$(basename "${portdir}")"
fi
# Open the ebuild file and retrieve defined USE flags
[[ ! -d "$portdir/${1}" ]] && continue
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-02-28 21:44 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-02-28 21:44 UTC (permalink / raw
To: gentoo-commits
commit: 1d8c4a9364f963af09bec98d97cfeca35cd3c332
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 20 23:41:38 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Feb 20 23:41:38 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=1d8c4a93
Update the comment for setting the overlay name.
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 6d3f811..1ce2076 100755
--- a/bin/euse
+++ b/bin/euse
@@ -387,7 +387,7 @@ get_useflaglist_ebuild() {
if [[ -s "${portdir}/profiles/repo_name" ]]; then
overlay="$(cat "${portdir}/profiles/repo_name")"
else
- # XXX: May be better to use full path
+ # XXX: Portage uses "x-<basename of the overlay>
overlay="x-$(basename "${portdir}")"
fi
# Open the ebuild file and retrieve defined USE flags
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-03-06 5:36 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-03-06 5:36 UTC (permalink / raw
To: gentoo-commits
commit: 2b73c56a831e188b1780f0749564dad8af8d13f8
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 6 05:33:35 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Mar 6 05:33:35 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=2b73c56a
Apply patch from Jared Hancock to disable globbing.
This patch disables shell globbing except where actually needed. This
will hopefully fix bug 382219.
---
bin/euse | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/bin/euse b/bin/euse
index 1ce2076..9c00cc3 100755
--- a/bin/euse
+++ b/bin/euse
@@ -1,4 +1,6 @@
#!/bin/bash
+# Disable globbing because "-*" and such is valid as a use flag.
+set -f
# $Header$
@@ -252,6 +254,7 @@ print('\n'.join(['%s %s' % (pkg,' '.join(flgs)) for pkg,flgs in h.items() if len
# 5: ebuild IUSE, 6: use.mask, 7: use.force,
# 9: flags indicated active by emerge --info (get_portageuseflags)
get_useflags() {
+ set +f
if [[ -z ${ACTIVE_FLAGS[4]} && ( $SCOPE == "local" || -z $SCOPE ) ]]; then
# Parse through /etc/portage/package.use
if [[ -d ${PACKAGE_USE_PATH} ]]; then
@@ -306,6 +309,7 @@ get_useflags() {
| sed -re "/^#.*$/ {d}"))
USE_FLAGS_CALCULATED=1
+ set -f
} # }}}
# Function: get_portageuseflags # {{{
@@ -398,7 +402,7 @@ get_useflaglist_ebuild() {
echo "!!! to generate metadata for your overlays" >&2
return 1
fi
- append=$(ls $portdir/metadata/cache/${1}-* \
+ append=$(set +f; ls $portdir/metadata/cache/${1}-* \
| egrep "${1}-[0-9.]+" \
| sed -e "s:$portdir/metadata/cache/${1}-::g" \
| while read -d $'\n' version; do
@@ -739,7 +743,6 @@ showdesc() {
local found_one
local args
- set -f
args="${*:-*}"
if [ -z "${SCOPE}" ]; then
@@ -754,7 +757,6 @@ showdesc() {
[ "${SCOPE}" == "global" ] && echo "global use flags (searching: ${args})"
[ "${SCOPE}" == "local" ] && echo "local use flags (searching: ${args})"
echo "************************************************************"
- set +f
if [ "${args}" == "*" ]; then
args="${useflags[*]}"
fi
@@ -1280,11 +1282,8 @@ modify() {
##### main program comes now #####
-# disable globbing as it fucks up with args=*
-set -f
parse_arguments "$@"
check_sanity
-set +f
eval ${MODE} ${ARGUMENTS}
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-03-20 4:04 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-03-20 4:04 UTC (permalink / raw
To: gentoo-commits
commit: 1ec0b2f81f2186c10411240a3b590c67dc341e1b
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 20 03:59:02 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Mar 20 03:59:02 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=1ec0b2f8
Add patch from Vitaly Shimansky to fix regex in modify_packages()
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 9c00cc3..24edeb9 100755
--- a/bin/euse
+++ b/bin/euse
@@ -1036,7 +1036,7 @@ scrub_use_flag() {
modify_package() {
get_useflags
- local atom_re="^[<>]?=?([a-z][\da-z/-]+[a-z])(-[0-9pr._*-]+)?"
+ local atom_re="^[<>]?=?([a-z][0-9a-z/-]+[a-z])(-[0-9pr._*-]+)?"
local pkg=$(echo "${PACKAGE}" | sed -re "s/${atom_re}/\1/")
local V=$(echo "${PACKAGE}" | sed -re "s/${atom_re}/\2/")
local pkg_re="[<>]?=?${pkg}(-[\dpr._*-]+)?"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-04-11 17:42 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-04-11 17:42 UTC (permalink / raw
To: gentoo-commits
commit: 34f3d9824db09afe71e5254e2f75f9379b7c2b63
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 11 17:41:32 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Apr 11 17:41:32 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=34f3d982
Remove incorrect usage of -r flage for egrep (Bug 410137).
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 24edeb9..27adb72 100755
--- a/bin/euse
+++ b/bin/euse
@@ -1126,7 +1126,7 @@ modify_package() {
echo "Adding \"${PACKAGE}[${flag}]\" use flag in \"${filename}\""
local added=0
while read line; do
- if [[ -n $(echo "${line}" | egrep -re "^[^#]*${PACKAGE} ") ]]; then
+ if [[ -n $(echo "${line}" | egrep -e "^[^#]*${PACKAGE} ") ]]; then
echo $(reduce_package_use "${line} ${flag}")
added=1
else
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-04-11 18:50 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-04-11 18:50 UTC (permalink / raw
To: gentoo-commits
commit: fb98d301841a6213e69e98a5de08d651f6391e30
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 11 18:50:29 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Apr 11 18:50:29 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=fb98d301
Fix eread to work on a prefix environment.
---
bin/eread | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/bin/eread b/bin/eread
index c6d4de1..7d0a970 100755
--- a/bin/eread
+++ b/bin/eread
@@ -6,13 +6,16 @@
# Author: Donnie Berkholz <spyderous@gentoo.org>
# Updated by: Uwe Klosa <uwe.klosa@gmail.com>
+# Get prefix
+EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}
+
# set decent PATH for bug 172969
-PATH=/usr/bin:/bin:${PATH}
+PATH=${EPREFIX}/usr/bin:${EPREFIX}/bin:${PATH}
# Set ELOGDIR
PORT_LOGDIR="$(portageq envvar PORT_LOGDIR)"
-[ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="/var/log/portage"
+[ "$PORT_LOGDIR" = "" ] && PORT_LOGDIR="${EPREFIX}/var/log/portage"
ELOGDIR="$PORT_LOGDIR/elog"
# Verify that ELOGDIR exists
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-05-16 22:31 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-05-16 22:31 UTC (permalink / raw
To: gentoo-commits
commit: 79135c7585402eadeb9e06cbf3138f0d191b15d9
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 22:27:54 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed May 16 22:27:54 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=79135c75
Change sed statement in euse to fix bug 410365.
The sed statement was looking for the useflag as part of the regular
expression. Since the input to the statement had already grepped for
the relevant entries from use.local.desc, this is unneccessary. Changed
the sed statement to look for '(.*) *' instead of '(${1}) *'.
---
bin/euse | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 27adb72..4d2c15d 100755
--- a/bin/euse
+++ b/bin/euse
@@ -781,7 +781,7 @@ showdesc() {
fi
# Fetch all the packages data using this flag
infos=$( grep -h ":${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.local.desc} 2> /dev/null \
- | sed -re "s/^([^:]+):(${1}) *- *(.+)/\1|\2|\3/g")
+ | sed -re "s/^([^:]+):(.*) *- *(.+)/\1|\2|\3/g")
OIFS=$IFS; IFS=$'\n'; infos=($infos); IFS=$OIFS;
for line in "${infos[@]}"; do
OIFS=$IFS; IFS="|"; line=($line); IFS=$OIFS
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-06-20 17:17 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-06-20 17:17 UTC (permalink / raw
To: gentoo-commits
commit: 6b94fbd3b74471cf9740a35d669963e0b6c84eac
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 17:11:44 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 17:11:44 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=6b94fbd3
Add support for the md5-cache metadata format. (Bug 422675)
The gentoo tree is moving to the md5-cache format instead of pms. This
add support for reading the md5-cache metadata format.
---
bin/euse | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/bin/euse b/bin/euse
index 85ff924..3b7556f 100755
--- a/bin/euse
+++ b/bin/euse
@@ -385,6 +385,7 @@ get_useflaglist() {
#
get_useflaglist_ebuild() {
local known=$(echo "${ACTIVE_FLAGS[5]}" | egrep "^${1}")
+ local cacheformat
if [[ -n $known ]]; then
# No need to recache
return
@@ -400,23 +401,34 @@ get_useflaglist_ebuild() {
fi
# Open the ebuild file and retrieve defined USE flags
[[ ! -d "$portdir/${1}" ]] && continue
- if [[ ! -d "$portdir/metadata/cache" ]]; then
+ cacheformat="unknown"
+ [[ -d "$portdir/metadata/cache" ]] && cacheformat="cache" # format is pms
+ [[ -d "$portdir/metadata/md5-cache" ]] && cacheformat="md5-cache" # format is md5-cache
+ if [[ "$cacheformat" == "unknown" ]]; then
echo "!!! Metadata cache not found. You need to run " >&2
echo "!!! 'egencache --repo=$overlay --update'" >&2
echo "!!! to generate metadata for your overlays" >&2
return 1
fi
- append=$(set +f; ls $portdir/metadata/cache/${1}-* \
+ append=$(set +f; ls ${portdir}/metadata/${cacheformat}/${1}-* \
| egrep "${1}-[0-9.]+" \
- | sed -e "s:$portdir/metadata/cache/${1}-::g" \
+ | sed -e "s:${portdir}/metadata/${cacheformat}/${1}-::g" \
| while read -d $'\n' version; do
IFS=$'\n'
- if [[ ! -e "$portdir/metadata/cache/${1}-$version" ]]; then
+ if [[ ! -e "${portdir}/metadata/${cacheformat}/${1}-$version" ]]; then
# Repo does not have this particular package
continue
fi
- iuse=$(head -11 "$portdir/metadata/cache/${1}-$version"|tail -1)
- slot=$(head -3 "$portdir/metadata/cache/${1}-$version"|tail -1)
+ if [[ "${cacheformat}" == "cache" ]]; then
+ iuse=$(head -n 11 "${portdir}/metadata/${cacheformat}/${1}-$version"|tail -n 1)
+ slot=$(head -n 3 "${portdir}/metadata/${cacheformat}/${1}-$version"|tail -n 1)
+ elif [[ "${cacheformat}" == "md5-cache" ]]; then
+ iuse=$(grep "^IUSE=" "${portdir}/metadata/${cacheformat}/${1}-$version" | sed 's/^IUSE=//')
+ slot=$(grep "^SLOT=" "${portdir}/metadata/${cacheformat}/${1}-$version" | sed 's/^SLOT=//')
+ else
+ # This is a bug, we should have already returned
+ return 1
+ fi
echo "${1};${version};${slot};${iuse};${overlay}"
done
)
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-06-20 17:17 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-06-20 17:17 UTC (permalink / raw
To: gentoo-commits
commit: 5178cca2df2b35a273ea97b15cbf011a4a08cb66
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 15:56:16 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 15:56:16 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=5178cca2
Add support for ':' in the profiles parent file for bug 414961.
Bug #414961 allows ':' shorthand to resolve to the ${PORTDIR}/profiles
A value before the ':' references the repository, no value means
gentoo
Example: local:base would refer to the profiles directory in the
repository path owned by the 'local' repository
---
bin/euse | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/bin/euse b/bin/euse
index 4d2c15d..85ff924 100755
--- a/bin/euse
+++ b/bin/euse
@@ -16,6 +16,10 @@ EPREFIX=${EPREFIX:-$(portageq envvar EPREFIX)}
ETC="${EPREFIX}/etc"
USR_SHARE_PORTAGE="${EPREFIX}/usr/share/portage"
+# Arrays containing the known repository names and repository profile paths
+PORTAGE_REPOS=( $(portageq get_repos ${EPREFIX}/) )
+PORTAGE_REPO_PATHS=( $(portageq get_repo_path ${EPREFIX}/ ${PORTAGE_REPOS[@]}) )
+
# define error functions so they can be used immediately
fatal() {
echo -e "ERROR: ${*}"
@@ -433,6 +437,12 @@ get_all_make_conf() {
# General method of collecting the contents of a profile
# component by traversing through the cascading profile
#
+# Bug #414961 allows ':' shorthand to resolve to the ${PORTDIR}/profiles
+# A value before the ':' references the repository, no value means gentoo
+#
+# Example: local:base would refer to the profiles directory in the repository
+# path owned by the 'local' repository
+#
# Arguments:
# $1 - Filename (make.profile)
# [$2] - Current directory (unspecified means to start at the top)
@@ -446,10 +456,25 @@ traverse_profile() {
if [[ -f "${curdir}/parent" ]]; then
for parent in $(egrep -v '(^#|^ *$)' ${curdir}/parent); do
# Bug 231394, handle parent path being absolute
+ index=$(expr index "${parent}" :)
if [[ ${parent:0:1} == "/" ]]; then
pdir="$(get_real_path ${parent})"
- else
+ elif [[ $index -eq 0 ]]; then
pdir="$(get_real_path ${curdir}/${parent})"
+ else
+ # We have a path with a colon shortcut
+ let i=$index-1
+ repo="${parent:0:${i}}"
+ [[ -z "${repo}" ]] && repo="gentoo"
+ parent="${parent:$index}"
+ limit=${#PORTAGE_REPOS[@]}
+ for ((i=0; i < limit ; i++)); do
+ if [[ ${repo} == ${PORTAGE_REPOS[i]} ]]; then
+ parent="${PORTAGE_REPO_PATHS[i]}/profiles/${parent}"
+ break
+ fi
+ done
+ pdir="$(get_real_path ${parent})"
fi
rvalue="${rvalue} $(traverse_profile ${1} ${pdir})"
done
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2012-09-26 6:13 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2012-09-26 6:13 UTC (permalink / raw
To: gentoo-commits
commit: 2ab755734b81867c6139278c65a1765b1b642c76
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 26 06:12:13 2012 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Sep 26 06:12:13 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=2ab75573
Fix euse to always prefer /etc/portage/make.conf over /etc/make.conf. Bug 434672
---
bin/euse | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/bin/euse b/bin/euse
index 3b7556f..1279a2c 100755
--- a/bin/euse
+++ b/bin/euse
@@ -35,11 +35,9 @@ warn() {
echo -e "WARNING: ${*}"
}
-# /etc/make.conf can now exist in /etc/portage/make.conf, prefer it over
-# /etc/make.conf for changes. Since this will only be used for modifying
-# the USE variable, we need to make sure the one we pick is the one with
-# the USE variable defined.
-if [[ -n $(grep '^USE="' "${ETC}/portage/make.conf" 2>/dev/null) ]]; then
+# /etc/make.conf now exists as /etc/portage/make.conf by default, prefer
+# it over /etc/make.conf for changes.
+if [[ -e "${ETC}/portage/make.conf" ]]; then
MAKE_CONF_PATH="${ETC}/portage/make.conf"
elif [[ -e "${ETC}/make.conf" ]]; then
MAKE_CONF_PATH="${ETC}/make.conf"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-07-08 19:20 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-07-08 19:20 UTC (permalink / raw
To: gentoo-commits
commit: 2e5a3b4c423eaefbbc8d1ad2fff55168c22cb48d
Author: Michael Marineau <mike <AT> marineau <DOT> org>
AuthorDate: Wed Jun 19 00:57:21 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Jul 8 19:12:01 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=2e5a3b4c
euse: fix looking up portage-2 style parent paths with empty repo name
When a parent is defined as ":path/to/profile" the blank name before the
colon means the current repo, not the "gentoo" repo.
---
bin/euse | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/bin/euse b/bin/euse
index 6997b2b..7efb03f 100755
--- a/bin/euse
+++ b/bin/euse
@@ -448,7 +448,7 @@ get_all_make_conf() {
# component by traversing through the cascading profile
#
# Bug #414961 allows ':' shorthand to resolve to the ${PORTDIR}/profiles
-# A value before the ':' references the repository, no value means gentoo
+# A value before the ':' references the repository, no value means same repo
#
# Example: local:base would refer to the profiles directory in the repository
# path owned by the 'local' repository
@@ -475,12 +475,15 @@ traverse_profile() {
# We have a path with a colon shortcut
let i=$index-1
repo="${parent:0:${i}}"
- [[ -z "${repo}" ]] && repo="gentoo"
parent="${parent:$index}"
limit=${#PORTAGE_REPOS[@]}
for ((i=0; i < limit ; i++)); do
- if [[ ${repo} == ${PORTAGE_REPOS[i]} ]]; then
- parent="${PORTAGE_REPO_PATHS[i]}/profiles/${parent}"
+ repo_profiles="${PORTAGE_REPO_PATHS[i]}/profiles"
+ if [[ "${repo}" == ${PORTAGE_REPOS[i]} ]] || \
+ ( [[ -z "${repo}" ]] &&
+ [[ "${curdir}" == ${repo_profiles}/* ]] )
+ then
+ parent="${repo_profiles}/${parent}"
break
fi
done
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-08-29 17:37 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-08-29 17:37 UTC (permalink / raw
To: gentoo-commits
commit: cd6a0dbd9e44eb2dd8c418d3d4733cb4e71962c2
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 29 17:32:17 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Aug 29 17:32:17 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=cd6a0dbd
Convert EMERGE_DEFAULT_OPTS to an array (Bug 482232).
Patch from zmedico
---
bin/revdep-rebuild.sh | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index a14700e..7f848bc 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -942,7 +942,7 @@ list_skipped_packages() {
ewarn
}
get_build_order() {
- local -r OLD_EMERGE_DEFAULT_OPTS="$EMERGE_DEFAULT_OPTS"
+ local -a OLD_EMERGE_DEFAULT_OPTS=("${EMERGE_DEFAULT_OPTS[@]}")
local RAW_REBUILD_LIST
local REBUILD_GREP
local i
@@ -957,7 +957,7 @@ get_build_order() {
clean_trap "$ORDER_FILE"
RAW_REBUILD_LIST=$(<"$EBUILDS_FILE")
if [[ $RAW_REBUILD_LIST ]]; then
- export EMERGE_DEFAULT_OPTS="--nospinner --pretend --oneshot --quiet"
+ EMERGE_DEFAULT_OPTS=(--nospinner --pretend --oneshot --quiet)
RAW_REBUILD_LIST=($RAW_REBUILD_LIST) # convert into array
# If PACKAGE_NAMES is defined we're using slots, not versions
if [[ $PACKAGE_NAMES ]]; then
@@ -1010,7 +1010,7 @@ get_build_order() {
else
echo "$RAW_REBUILD_LIST" > "$ORDER_FILE"
fi
- export EMERGE_DEFAULT_OPTS="$OLD_EMERGE_DEFAULT_OPTS"
+ EMERGE_DEFAULT_OPTS=("${OLD_EMERGE_DEFAULT_OPTS[@]}")
else
einfo 'Nothing to rebuild.'
die 1 '(The program should have already quit, so this is a minor bug.)'
@@ -1043,6 +1043,8 @@ portage_settings() {
eval $(portageq envvar -v PORTAGE_ROOT PORTAGE_NICENESS EMERGE_DEFAULT_OPTS NOCOLOR SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK REVDEP_REBUILD_DEFAULT_OPTS)
export NOCOLOR
+ # Convert quoted paths to array.
+ eval "EMERGE_DEFAULT_OPTS=(${EMERGE_DEFAULT_OPTS})"
SEARCH_DIRS="$ORIG_SEARCH_DIRS $SEARCH_DIRS"
SEARCH_DIRS_MASK="$ORIG_SEARCH_DIRS_MASK $SEARCH_DIRS_MASK"
LD_LIBRARY_MASK="$ORIG_LD_LIBRARY_MASK $LD_LIBRARY_MASK"
@@ -1142,7 +1144,7 @@ rebuild() {
trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
[[ $QUIET -ne 1 ]] && einfo 'All prepared. Starting rebuild'
- echo "emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
+ echo "emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS[@]} ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
is_real_merge && countdown 10
@@ -1151,7 +1153,7 @@ rebuild() {
# Run in background to correctly handle Ctrl-C
{
- emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS} ${EMERGE_OPTIONS[@]} $REBUILD_LIST <&6
+ emerge --complete-graph=y --oneshot "${EMERGE_DEFAULT_OPTS[@]}" ${EMERGE_OPTIONS[@]} $REBUILD_LIST <&6
echo $? > "$STATUS_FILE"
} &
wait
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-09-04 21:44 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-09-04 21:44 UTC (permalink / raw
To: gentoo-commits
commit: 4f99b208ab73fab1b6ed334dea1b29392d85c3cc
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 4 21:43:03 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Sep 4 21:43:03 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=4f99b208
Copy eclean to exlean-dist and eclean-pkg.
---
bin/eclean-dist | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
bin/eclean-pkg | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+)
diff --git a/bin/eclean-dist b/bin/eclean-dist
new file mode 100755
index 0000000..715787b
--- /dev/null
+++ b/bin/eclean-dist
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+"""Copyright 2003-2010 Gentoo Foundation
+Distributed under the terms of the GNU General Public License v2
+"""
+
+from __future__ import print_function
+
+
+# Meta:
+__author__ = "Thomas de Grenier de Latour (tgl), " + \
+ "modular re-write by: Brian Dolbec (dol-sen)"
+__email__ = "degrenier@easyconnect.fr, " + \
+ "brian.dolbec@gmail.com"
+__version__ = "git"
+__productname__ = "eclean"
+__description__ = "A cleaning tool for Gentoo distfiles and binaries."
+
+
+import sys
+
+# This block ensures that ^C interrupts are handled quietly.
+try:
+ import signal
+
+ def exithandler(signum,frame):
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+ signal.signal(signal.SIGTERM, signal.SIG_IGN)
+ print()
+ sys.exit(1)
+
+ signal.signal(signal.SIGINT, exithandler)
+ signal.signal(signal.SIGTERM, exithandler)
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+except KeyboardInterrupt:
+ print()
+ sys.exit(1)
+
+
+from gentoolkit.eclean.cli import main
+
+try:
+ main()
+except KeyboardInterrupt:
+ print("Aborted.")
+ sys.exit(130)
+sys.exit(0)
+
diff --git a/bin/eclean-pkg b/bin/eclean-pkg
new file mode 100755
index 0000000..715787b
--- /dev/null
+++ b/bin/eclean-pkg
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+"""Copyright 2003-2010 Gentoo Foundation
+Distributed under the terms of the GNU General Public License v2
+"""
+
+from __future__ import print_function
+
+
+# Meta:
+__author__ = "Thomas de Grenier de Latour (tgl), " + \
+ "modular re-write by: Brian Dolbec (dol-sen)"
+__email__ = "degrenier@easyconnect.fr, " + \
+ "brian.dolbec@gmail.com"
+__version__ = "git"
+__productname__ = "eclean"
+__description__ = "A cleaning tool for Gentoo distfiles and binaries."
+
+
+import sys
+
+# This block ensures that ^C interrupts are handled quietly.
+try:
+ import signal
+
+ def exithandler(signum,frame):
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+ signal.signal(signal.SIGTERM, signal.SIG_IGN)
+ print()
+ sys.exit(1)
+
+ signal.signal(signal.SIGINT, exithandler)
+ signal.signal(signal.SIGTERM, exithandler)
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+except KeyboardInterrupt:
+ print()
+ sys.exit(1)
+
+
+from gentoolkit.eclean.cli import main
+
+try:
+ main()
+except KeyboardInterrupt:
+ print("Aborted.")
+ sys.exit(130)
+sys.exit(0)
+
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-09-10 16:01 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-09-10 16:01 UTC (permalink / raw
To: gentoo-commits
commit: db997501ec8e0ef0c5e4426649c17d2498b40e06
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 10 15:59:31 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Sep 10 15:59:31 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=db997501
Fix use of REVDEP_REBUILD_DEFAULT_OPTS (Bug 484340).
---
bin/revdep-rebuild.sh | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 7f848bc..6cb5608 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -1034,27 +1034,24 @@ portage_settings() {
local ORIG_SEARCH_DIRS="$SEARCH_DIRS"
local ORIG_SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK"
local ORIG_LD_LIBRARY_MASK="$LD_LIBRARY_MASK"
- local ORIG_REVDEP_REBUILD_DEFAULT_OPTS="$REVDEP_REBUILD_DEFAULT_OPTS"
unset SEARCH_DIRS
unset SEARCH_DIRS_MASK
unset LD_LIBRARY_MASK
- unset REVDEP_REBUILD_DEFAULT_OPTS
eval $(portageq envvar -v PORTAGE_ROOT PORTAGE_NICENESS EMERGE_DEFAULT_OPTS NOCOLOR SEARCH_DIRS SEARCH_DIRS_MASK LD_LIBRARY_MASK REVDEP_REBUILD_DEFAULT_OPTS)
export NOCOLOR
# Convert quoted paths to array.
eval "EMERGE_DEFAULT_OPTS=(${EMERGE_DEFAULT_OPTS})"
+ eval "REVDEP_REBUILD_DEFAULT_OPTS=(${REVDEP_REBUILD_DEFAULT_OPTS})"
SEARCH_DIRS="$ORIG_SEARCH_DIRS $SEARCH_DIRS"
SEARCH_DIRS_MASK="$ORIG_SEARCH_DIRS_MASK $SEARCH_DIRS_MASK"
LD_LIBRARY_MASK="$ORIG_LD_LIBRARY_MASK $LD_LIBRARY_MASK"
- REVDEP_REBUILD_DEFAULT_OPTS="$ORIG_REVDEP_REBUILD_DEFAULT_OPTS $REVDEP_REBUILD_DEFAULT_OPTS"
# Replace EMERGE_DEFAULT_OPTS with REVDEP_REBUILD_DEFAULT_OPTS (if it exists)
if [[ -n ${REVDEP_REBUILD_DEFAULT_OPTS} ]]; then
- EMERGE_DEFAULT_OPTS=("$REVDEP_REBUILD_DEFAULT_OPTS")
+ EMERGE_DEFAULT_OPTS=("${REVDEP_REBUILD_DEFAULT_OPTS[@]}")
fi
-
}
##
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-09-10 18:53 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-09-10 18:53 UTC (permalink / raw
To: gentoo-commits
commit: 87a01450ab33220f6f0821d4f4209004cdc3aa8b
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 10 18:52:28 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Sep 10 18:52:28 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=87a01450
Fix Ctrl-C handling when running emerge (Bug 476740).
---
bin/revdep-rebuild.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 6cb5608..09f5135 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -1052,6 +1052,7 @@ portage_settings() {
if [[ -n ${REVDEP_REBUILD_DEFAULT_OPTS} ]]; then
EMERGE_DEFAULT_OPTS=("${REVDEP_REBUILD_DEFAULT_OPTS[@]}")
fi
+
}
##
@@ -1138,7 +1139,7 @@ rebuild() {
REBUILD_LIST=$(sort -u "$EBUILDS_FILE")
fi
- trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
+ trap "kill 0" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
[[ $QUIET -ne 1 ]] && einfo 'All prepared. Starting rebuild'
echo "emerge --complete-graph=y --oneshot ${EMERGE_DEFAULT_OPTS[@]} ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-09-10 23:03 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-09-10 23:03 UTC (permalink / raw
To: gentoo-commits
commit: eb1931d628dcd4517965238a5558f8bbc0859960
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 10 23:00:47 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Sep 10 23:00:47 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=eb1931d6
Add fallback to using portageq for get_portdir function.
Newer versions of portage no longer define PORTDIR in make.defaults or
make.conf. This change uses portageq to get the value of PORTDIR if
it is not found in make.defaults or make.conf.
---
bin/euse | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/bin/euse b/bin/euse
index 7efb03f..96d1f9b 100755
--- a/bin/euse
+++ b/bin/euse
@@ -712,6 +712,10 @@ get_flagstatus_pkg() {
#
# Outputs:
# Location of portage tree root
+#
+# OBSOLETE: newer versions of portage do not define PORTDIR
+# in make.defaults or make.conf anymore. Add fallback to
+#portageq to handle that situation.
get_portdir() {
# Use a subshell so we don't have to protect the variables in
# the current scope
@@ -725,6 +729,10 @@ get_portdir() {
source "${x}"
done
fi
+
+ if [ -z "${PORTDIR:-}" ]; then
+ eval $(portageq envvar -v PORTDIR)
+ fi
echo "${PORTDIR}"
)
} # }}}
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-11-05 17:24 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-11-05 17:24 UTC (permalink / raw
To: gentoo-commits
commit: 155295410d147b88886f7eb65f40dd9668747a92
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 5 17:21:41 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Nov 5 17:21:41 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=15529541
euse: use portageq for get_portdir function unconditionally.
Newer versions of portage don't define PORTDIR in make.conf or
make.defaults. Additionally, if it is defined, it can still be
overridden in repos.conf. Use portageq to ensure we have the correct
value.
---
bin/euse | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/bin/euse b/bin/euse
index 96d1f9b..7d5c83a 100755
--- a/bin/euse
+++ b/bin/euse
@@ -714,26 +714,14 @@ get_flagstatus_pkg() {
# Location of portage tree root
#
# OBSOLETE: newer versions of portage do not define PORTDIR
-# in make.defaults or make.conf anymore. Add fallback to
-#portageq to handle that situation.
+# in make.defaults or make.conf anymore and can be overridden
+# in repos.conf. Use portageq to determine the correct value.
get_portdir() {
# Use a subshell so we don't have to protect the variables in
# the current scope
(
- if [ -z "${PORTDIR:-}" ]; then
- source "${MAKE_GLOBALS_PATH}"
- for x in $(get_all_make_defaults); do
- source "${x}"
- done
- for x in $(get_all_make_conf); do
- source "${x}"
- done
- fi
-
- if [ -z "${PORTDIR:-}" ]; then
eval $(portageq envvar -v PORTDIR)
- fi
- echo "${PORTDIR}"
+ echo "${PORTDIR}"
)
} # }}}
# This won't change while the script is running, so cache it
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-11-20 2:34 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2013-11-20 2:34 UTC (permalink / raw
To: gentoo-commits
commit: 1e98f68837f64657bc2d80efa19eb6acb0c11040
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 20 02:29:45 2013 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Wed Nov 20 02:29:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=1e98f688
revdep-rebuild.sh: Change la_SEARCH_DIRS to use the library paths from
ld.so.conf. (Bug 491658)
la_SEARCH_DIRS was using SEARCH_DIRS to locate libraries in .la files.
This is incorrect, it should be using the standard library path.
---
bin/revdep-rebuild.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 09f5135..8cf9f79 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -787,7 +787,7 @@ main_checks() {
fi
elif [[ $SEARCH_BROKEN ]]; then
# Look for broken .la files
- la_SEARCH_DIRS="$SEARCH_DIRS"
+ la_SEARCH_DIRS="$(parse_ld_so_conf)"
la_search_dir=""
la_broken=""
la_lib=""
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2013-11-20 20:38 Vikraman Choudhury
0 siblings, 0 replies; 46+ messages in thread
From: Vikraman Choudhury @ 2013-11-20 20:38 UTC (permalink / raw
To: gentoo-commits
commit: dc21831a9a058c8f3c110674c5d3dd0de757cb5c
Author: Vikraman Choudhury <vikraman <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 20 20:37:20 2013 +0000
Commit: Vikraman Choudhury <vikraman <AT> gentoo <DOT> org>
CommitDate: Wed Nov 20 20:37:20 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=dc21831a
Handle numbers in package names
Fixes bug 491764
---
bin/euse | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/euse b/bin/euse
index 7d5c83a..e60cab0 100755
--- a/bin/euse
+++ b/bin/euse
@@ -1070,7 +1070,7 @@ scrub_use_flag() {
modify_package() {
get_useflags
- local atom_re="^[<>]?=?([a-z][0-9a-z/-]+[a-z])(-[0-9pr._*-]+)?"
+ local atom_re="^[<>]?=?([a-z][0-9a-z/-]+[0-9a-z])(-[0-9pr._*-]+)?"
local pkg=$(echo "${PACKAGE}" | sed -re "s/${atom_re}/\1/")
local V=$(echo "${PACKAGE}" | sed -re "s/${atom_re}/\2/")
local pkg_re="[<>]?=?${pkg}(-[\dpr._*-]+)?"
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2014-02-12 10:22 Brian Dolbec
0 siblings, 0 replies; 46+ messages in thread
From: Brian Dolbec @ 2014-02-12 10:22 UTC (permalink / raw
To: gentoo-commits
commit: fa1cc2fadc8779136eac59c9e534b4daa415711b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 12 10:16:07 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Feb 12 10:16:07 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=fa1cc2fa
revdep_rebuild: Remove bin/revdep-ng accidently merged in.
Commit: 4335bf979f374300ac6678765f490f92ee805ab4
slis <lis.slawek <AT> gmail.com> (Tue 21 Jan 2014 02:48:32 AM PST)
Merged revdep-rebuild branch
---
bin/revdep-ng | 51 ---------------------------------------------------
1 file changed, 51 deletions(-)
diff --git a/bin/revdep-ng b/bin/revdep-ng
deleted file mode 100755
index a4c8e11..0000000
--- a/bin/revdep-ng
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2010 Brian Dolbec <brian.dolbec@gmail.com>
-# Copyright 2002-2010 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2 or later
-#
-# $Header$
-
-"""'analyse' is a flexible utility for Gentoo linux which can display various
-information about installed packages, such as the USE flags used and the
-packages that use them. It can also be used to help rebuild /etc/portage/package.*
-files in the event of corruption, and possibly more.
-"""
-
-from __future__ import print_function
-
-import sys
-# This block ensures that ^C interrupts are handled quietly.
-try:
- import signal
-
- def exithandler(signum,frame):
- signal.signal(signal.SIGINT, signal.SIG_IGN)
- signal.signal(signal.SIGTERM, signal.SIG_IGN)
- print()
- sys.exit(1)
-
- signal.signal(signal.SIGINT, exithandler)
- signal.signal(signal.SIGTERM, exithandler)
- signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
-
-except KeyboardInterrupt:
- print()
- sys.exit(1)
-
-from gentoolkit import errors
-from gentoolkit.revdep_rebuild import rebuild
-
-try:
- success = rebuild.main(rebuild.parse_options())
- sys.exit(success)
-except errors.GentoolkitException as err:
- if '--debug' in sys.argv:
- raise
- else:
- from gentoolkit import pprinter as pp
- sys.stderr.write(pp.error(str(err)))
- print()
- print("Add '--debug' to global options for traceback.")
- sys.exit(1)
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2014-03-06 16:39 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2014-03-06 16:39 UTC (permalink / raw
To: gentoo-commits
commit: 11cc48f031c017e8746109a9a28782085e2d1292
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 6 16:38:08 2014 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Mar 6 16:38:08 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=11cc48f0
Update revdep-rebuild.sh to use new path for functions.sh. (Bug 373219)
---
bin/revdep-rebuild.sh | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 8cf9f79..3179a83 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -309,7 +309,16 @@ setup_color() {
# This should still work if NOCOLOR is set by the -C flag or in the user's
# environment.
[[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr)
- . /etc/init.d/functions.sh
+ # TODO: Change location according to Bug 373219
+ # Remove /etc/init.d/functions.sh once everything is migrated
+ if [ -e /lib/gentoo/functions.sh ]; then
+ . /lib/gentoo/functions.sh
+ elif [ -e /etc/init.d/functions.sh ]; then
+ . /etc/init.d/functions.sh
+ else
+ echo "Unable to find functions.sh"
+ exit 1
+ fi
}
##
# Die if an argument is missing.
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2014-10-24 18:02 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2014-10-24 18:02 UTC (permalink / raw
To: gentoo-commits
commit: 91023ef967c680db9307b5c58762e8872346167e
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 24 17:59:59 2014 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Fri Oct 24 17:59:59 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=91023ef9
Fix gawk warning escape sequence \. treated as plain. Bug 526400
---
bin/revdep-rebuild.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 3179a83..01a0454 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -842,7 +842,7 @@ main_checks() {
done < <(
# Regexify LD_LIBRARY_MASK. Exclude it from the search.
LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}"
- gawk -v ldmask="(${LD_LIBRARY_MASK//./\\\.})" '
+ gawk -v ldmask="(${LD_LIBRARY_MASK//./\\\\.})" '
/no version information available/ && $0 !~ ldmask {
gsub(/[()]/, "", $NF)
if (seen[$NF]++) next
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2015-01-23 21:22 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2015-01-23 21:22 UTC (permalink / raw
To: gentoo-commits
commit: 6f5d03a6bd34f684331837575560babfa91899ea
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 23 21:19:42 2015 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Fri Jan 23 21:19:42 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=6f5d03a6
Fix eread to only display elog files. (Bug 534686)
---
bin/eread | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bin/eread b/bin/eread
index d74a167..fe095a6 100755
--- a/bin/eread
+++ b/bin/eread
@@ -34,13 +34,13 @@ PS3="Choice? "
SORT=${EREAD_SORT_ORDER}
find_unsorted() {
- find . -type f | sed -e "s:\./::g"
+ find . -name '*:*:*.log*' | sed -e "s:\./::g"
}
find_by_name() {
- find . -type f | sort | sed -e "s:\./::g"
+ find . -name '*:*:*.log*' | sort | sed -e "s:\./::g"
}
find_by_time() {
- find . -type f | sort -k 3 -t : | sed -e "s:\./::g"
+ find . -name '*:*:*.log*' | sort -k 3 -t : | sed -e "s:\./::g"
}
find_files() {
case ${SORT} in
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2015-04-23 21:20 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2015-04-23 21:20 UTC (permalink / raw
To: gentoo-commits
commit: b7c075d2aeb593f0ddf1450e75b535cafbbd7201
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 21:17:12 2015 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 21:17:12 2015 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b7c075d2
euse: Fix PORTDIR deprecation message. Bug 505160
This change removes the concepts of PORTDIR and PORTDIR_OVERLAY.
Portage is moving to the concept of just repositories. This fix
searches all repository paths for the USE flag information.
bin/euse | 77 ++++++++++++++--------------------------------------------------
1 file changed, 16 insertions(+), 61 deletions(-)
diff --git a/bin/euse b/bin/euse
index e60cab0..c3f9f24 100755
--- a/bin/euse
+++ b/bin/euse
@@ -112,7 +112,6 @@ get_real_path() {
# Performs some basic system sanity checks
check_sanity() {
# file permission tests
- local descdir
local make_defaults
local make_conf
@@ -122,13 +121,9 @@ check_sanity() {
[ ! -r "${make_conf}" ] && fatal "${make_conf} is not readable"
done
- descdir="$(get_portdir)/profiles"
[ ! -r "${MAKE_GLOBALS_PATH}" ] && fatal "${MAKE_GLOBALS_PATH} is not readable"
- [ -z "$(get_portdir)" ] && fatal "\$PORTDIR couldn't be determined"
- [ ! -d "${descdir}" ] && fatal "${descdir} does not exist or is not a directory"
- [ ! -r "${descdir}/use.desc" ] && fatal "${descdir}/use.desc is not readable"
- [ ! -r "${descdir}/use.local.desc" ] && fatal "${descdir}/use.local.desc is not readable"
+ [ -z "$PORTAGE_REPO_PATHS" ] && fatal "Repository paths couldn't be determined"
for make_defaults in $(get_all_make_defaults); do
[ ! -r "$make_defaults" ] && fatal "$_make_defaults is not readable"
@@ -277,9 +272,6 @@ get_useflags() {
# only calculate once as calling emerge is painfully slow
[ -n "${USE_FLAGS_CALCULATED}" ] && return
- # backup portdir so get_portdir() doesn't give false results later
- portdir_backup="${PORTDIR}"
-
ACTIVE_FLAGS[0]="$(reduce_incrementals "${USE}")"
USE=""
for x in $(get_all_make_conf); do
@@ -298,7 +290,6 @@ get_useflags() {
# restore saved env variables
USE="${ACTIVE_FLAGS[0]}"
- PORTDIR="${portdir_backup}"
#
# Traverse through use.mask and use.force (0.5s)
@@ -345,7 +336,7 @@ get_portageuseflags() {
get_useflaglist() {
local descdir
local overlay
- for profiledir in ${ALL_PORTDIRS[@]}; do
+ for profiledir in ${PORTAGE_REPO_PATHS[@]}; do
descdir="${profiledir}/profiles"
if [[ -z ${SCOPE} || ${SCOPE} == "global" ]]; then
[[ ! -s "${descdir}/use.desc" ]] && continue
@@ -378,7 +369,6 @@ get_useflaglist() {
# Nothing significant
#
# Environment:
-# PORTDIR - Root of portage tree
# ACTIVE_FLAGS - Array of current use flag info
#
get_useflaglist_ebuild() {
@@ -390,7 +380,7 @@ get_useflaglist_ebuild() {
fi
local pkg=$(echo ${1} | cut -d/ -f2)
declare append
- for portdir in ${ALL_PORTDIRS[@]}; do
+ for portdir in ${PORTAGE_REPO_PATHS[@]}; do
if [[ -s "${portdir}/profiles/repo_name" ]]; then
overlay="$(cat "${portdir}/profiles/repo_name")"
else
@@ -447,7 +437,9 @@ get_all_make_conf() {
# General method of collecting the contents of a profile
# component by traversing through the cascading profile
#
-# Bug #414961 allows ':' shorthand to resolve to the ${PORTDIR}/profiles
+# Bug #414961 allows ':' shorthand to resolve to the profiles directory in a
+# repository
+#
# A value before the ':' references the repository, no value means same repo
#
# Example: local:base would refer to the profiles directory in the repository
@@ -645,8 +637,8 @@ get_flagstatus() {
# 4 - (Optional) version of package to evaluate (empty means all versions)
#
# Outputs:
-# Flag status for package.use and ebuild, slot and version, and overlay
-# the version lives is if not PORTDIR
+# Flag status for package.use and ebuild, slot and version, and repository
+# the version lives in if not gentoo
#
# Full positive would be "[+PB]", full negative would be "[-pb]", and full
# missing would be "[? ]", question because the sign will default to the
@@ -707,41 +699,6 @@ get_flagstatus_pkg() {
echo
} # }}}
-# Function: get_portdir {{{
-# faster replacement to `portageq portdir`
-#
-# Outputs:
-# Location of portage tree root
-#
-# OBSOLETE: newer versions of portage do not define PORTDIR
-# in make.defaults or make.conf anymore and can be overridden
-# in repos.conf. Use portageq to determine the correct value.
-get_portdir() {
- # Use a subshell so we don't have to protect the variables in
- # the current scope
- (
- eval $(portageq envvar -v PORTDIR)
- echo "${PORTDIR}"
- )
-} # }}}
-# This won't change while the script is running, so cache it
-PORTDIR="$(get_portdir)"
-
-# Function: get_all_overlays {{{
-# Outputs list of portage overlays as defined in the PORTDIR_OVERLAY
-# variable defined in make.conf
-get_all_overlays() {
- # Use a subshell so we don't have to protect the variables in
- # the current scope
- (
- for x in $(get_all_make_conf); do
- [[ -r "${x}" ]] && source "${x}"
- done
- echo ${PORTDIR_OVERLAY}
- )
-} # }}}
-ALL_PORTDIRS=( "$PORTDIR" $(get_all_overlays) )
-
# Function: array_contains {{{
# PHP-style array_contains function.
#
@@ -772,7 +729,6 @@ array_contains() {
# (STDOUT) Flag description(s) for given USE flags
#
showdesc() {
- local descdir
local current_desc
local found_one
local args
@@ -780,9 +736,9 @@ showdesc() {
args="${*:-*}"
if [ -z "${SCOPE}" ]; then
- SCOPE="global" showdesc ${args}
+ SCOPE="global" showdesc "${args}"
echo
- SCOPE="local" showdesc ${args}
+ SCOPE="local" showdesc "${args}"
return
fi
@@ -803,7 +759,7 @@ showdesc() {
if array_contains "${useflags[*]}" "$1"; then
get_flagstatus "${1}"
# XXX: Handle overlay
- grep -h "^${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.desc} 2> /dev/null
+ grep -h "^${1} *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.desc} 2> /dev/null
foundone=1
fi
fi
@@ -814,7 +770,7 @@ showdesc() {
foundone=1
fi
# Fetch all the packages data using this flag
- infos=$( grep -h ":${1} *-" ${ALL_PORTDIRS[@]/%//profiles/use.local.desc} 2> /dev/null \
+ infos=$( grep -h ":${1} *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.local.desc} 2> /dev/null \
| sed -re "s/^([^:]+):(.*) *- *(.+)/\1|\2|\3/g")
OIFS=$IFS; IFS=$'\n'; infos=($infos); IFS=$OIFS;
for line in "${infos[@]}"; do
@@ -875,7 +831,6 @@ showinstdesc() {
return;;
esac
- descdir="$(get_portdir)/profiles"
echo "************************************************************"
if [ "${args}" = "*" ]; then
@@ -887,7 +842,7 @@ showinstdesc() {
while [ -n "${1}" ]; do
case "${SCOPE}" in
"global")
- if desc=$(grep "^${1} *-" "${descdir}/use.desc"); then
+ if desc=$(grep "^${1} *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.desc}); then
get_flagstatus "${1}"
echo "$desc"
# get list of installed packages matching this USE flag.
@@ -906,7 +861,7 @@ showinstdesc() {
# local flags are a bit more complicated as there can be multiple
# entries per flag and we can't pipe into printf
IFS=': ' # Use a space instead of a dash because dashes occur in cat/pkg
- while read pkg flag desc; do
+ while read path pkg flag desc; do
# print name only if package is installed
# NOTE: If we implement bug #114086 's enhancement we can just use the
# exit status of equery instead of a subshell and pipe to wc -l
@@ -918,7 +873,7 @@ showinstdesc() {
IFS=': '
printf "%s (%s):\n%s\n\n" "${flag}" "${pkg}" "${desc#- }"
fi
- done < <(grep ":${1} *-" "${descdir}/use.local.desc")
+ done < <(grep ":${1} *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.local.desc} 2>/dev/null)
;;
esac
shift
@@ -1094,7 +1049,7 @@ modify_package() {
# --- Sanity checks
# (1) make sure ${pkg} exists in portdir or an overlay
local exists=1
- for portdir in ${ALL_PORTDIRS[@]}; do
+ for portdir in ${PORTAGE_REPO_PATHS[@]}; do
if [[ -d "${portdir}/${pkg}" ]]; then
exists=0
break
^ permalink raw reply related [flat|nested] 46+ messages in thread
* [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/
@ 2015-06-02 19:32 Paul Varner
0 siblings, 0 replies; 46+ messages in thread
From: Paul Varner @ 2015-06-02 19:32 UTC (permalink / raw
To: gentoo-commits
commit: e6f03e5fb6c26f9ada7fabf25126a135f5ef1dbf
Author: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 2 19:30:31 2015 +0000
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Jun 2 19:30:31 2015 +0000
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e6f03e5f
euse: Fix 'grep: Unmatched ( or \(' errors with euse -i
bin/euse | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/euse b/bin/euse
index c3f9f24..56fc917 100755
--- a/bin/euse
+++ b/bin/euse
@@ -771,7 +771,7 @@ showdesc() {
fi
# Fetch all the packages data using this flag
infos=$( grep -h ":${1} *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.local.desc} 2> /dev/null \
- | sed -re "s/^([^:]+):(.*) *- *(.+)/\1|\2|\3/g")
+ | sed -re "s/^([^:]+):(.*) *- *(.+)/\1|\2|\3/g")
OIFS=$IFS; IFS=$'\n'; infos=($infos); IFS=$OIFS;
for line in "${infos[@]}"; do
OIFS=$IFS; IFS="|"; line=($line); IFS=$OIFS
^ permalink raw reply related [flat|nested] 46+ messages in thread
end of thread, other threads:[~2015-06-02 19:32 UTC | newest]
Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-12 2:55 [gentoo-commits] proj/gentoolkit:gentoolkit commit in: bin/ Paul Varner
-- strict thread matches above, loose matches on Subject: below --
2015-06-02 19:32 Paul Varner
2015-04-23 21:20 Paul Varner
2015-01-23 21:22 Paul Varner
2014-10-24 18:02 Paul Varner
2014-03-06 16:39 Paul Varner
2014-02-12 10:22 Brian Dolbec
2013-11-20 20:38 Vikraman Choudhury
2013-11-20 2:34 Paul Varner
2013-11-05 17:24 Paul Varner
2013-09-10 23:03 Paul Varner
2013-09-10 18:53 Paul Varner
2013-09-10 16:01 Paul Varner
2013-09-04 21:44 Paul Varner
2013-08-29 17:37 Paul Varner
2013-07-08 19:20 Paul Varner
2012-09-26 6:13 Paul Varner
2012-06-20 17:17 Paul Varner
2012-06-20 17:17 Paul Varner
2012-05-16 22:31 Paul Varner
2012-04-11 18:50 Paul Varner
2012-04-11 17:42 Paul Varner
2012-03-20 4:04 Paul Varner
2012-03-06 5:36 Paul Varner
2012-02-28 21:44 Paul Varner
2012-02-20 23:25 Paul Varner
2012-02-20 23:25 Paul Varner
2012-02-16 17:37 Paul Varner
2011-11-28 15:46 Paul Varner
2011-10-12 16:39 Paul Varner
2011-09-07 12:40 Christian Ruppert
2011-08-24 17:30 Paul Varner
2011-07-27 19:02 Paul Varner
2011-07-13 16:01 Paul Varner
2011-07-13 15:41 Paul Varner
2011-07-12 21:45 Paul Varner
2011-05-29 10:59 Christian Ruppert
2011-05-25 1:02 Paul Varner
2011-05-23 21:28 Paul Varner
2011-05-11 2:06 Paul Varner
2011-05-11 0:43 Paul Varner
2011-04-24 0:59 Brian Dolbec
2011-03-29 2:18 Paul Varner
2011-02-25 16:50 Paul Varner
2011-02-25 16:50 Paul Varner
2011-02-25 16:50 Paul Varner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox