summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2011-05-28 23:22:12 +0200
committerChristian Ruppert <idl0r@gentoo.org>2011-05-28 23:22:12 +0200
commitc9bd257c7cdd4c64ccefb687643958098c3c6d75 (patch)
tree8fd4e3f7e7fa40b21bcf754ba6594882c4def80b
parent85af50f1a7234c56077556756400f2a540f76605 (diff)
parentd04544e03702d7358a8ccdee4a7696cdcba91b9c (diff)
downloadgentoolkit-c9bd257c7cdd4c64ccefb687643958098c3c6d75.tar.gz
Merge branch 'gentoolkit' of git+ssh://overlays.gentoo.org/proj/gentoolkit into gentoolkit
-rwxr-xr-xbin/enalyze (renamed from bin/analyse)6
-rwxr-xr-xbin/euse111
-rwxr-xr-xbin/revdep-rebuild38
-rw-r--r--man/enalyze.1 (renamed from man/analyse.1)46
-rw-r--r--pym/gentoolkit/dependencies.py41
-rw-r--r--pym/gentoolkit/eclean/search.py16
-rw-r--r--pym/gentoolkit/enalyze/__init__.py (renamed from pym/gentoolkit/analyse/__init__.py)10
-rw-r--r--pym/gentoolkit/enalyze/analyze.py (renamed from pym/gentoolkit/analyse/analyse.py)46
-rw-r--r--pym/gentoolkit/enalyze/base.py (renamed from pym/gentoolkit/analyse/base.py)4
-rw-r--r--pym/gentoolkit/enalyze/lib.py (renamed from pym/gentoolkit/analyse/lib.py)4
-rw-r--r--pym/gentoolkit/enalyze/output.py (renamed from pym/gentoolkit/analyse/output.py)2
-rw-r--r--pym/gentoolkit/enalyze/rebuild.py (renamed from pym/gentoolkit/analyse/rebuild.py)26
-rw-r--r--pym/gentoolkit/eprefix.py28
-rw-r--r--pym/gentoolkit/equery/__init__.py3
-rw-r--r--pym/gentoolkit/equery/meta.py10
-rw-r--r--pym/gentoolkit/eshowkw/__init__.py12
-rw-r--r--pym/gentoolkit/eshowkw/display_pretty.py9
-rw-r--r--pym/gentoolkit/eshowkw/keywords_content.py6
-rw-r--r--pym/gentoolkit/eshowkw/keywords_header.py4
-rw-r--r--pym/gentoolkit/flag.py3
-rw-r--r--pym/gentoolkit/helpers.py2
-rw-r--r--pym/gentoolkit/package.py10
-rw-r--r--pym/gentoolkit/test/eclean/test_search.py2
-rwxr-xr-xsetup.py2
24 files changed, 243 insertions, 198 deletions
diff --git a/bin/analyse b/bin/enalyze
index a90410b..e48c5b4 100755
--- a/bin/analyse
+++ b/bin/enalyze
@@ -6,7 +6,7 @@
#
# $Header$
-"""'analyse' is a flexible utility for Gentoo linux which can display various
+"""'enalyze' 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.
@@ -33,10 +33,10 @@ except KeyboardInterrupt:
print()
sys.exit(1)
-from gentoolkit import analyse, errors
+from gentoolkit import enalyze, errors
try:
- analyse.main()
+ enalyze.main()
except errors.GentoolkitException as err:
if '--debug' in sys.argv:
raise
diff --git a/bin/euse b/bin/euse
index dbbb129..65fb119 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() {
@@ -181,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:
@@ -192,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:
@@ -207,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 {{{
@@ -218,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
@@ -238,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 {{{
@@ -380,6 +384,12 @@ 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
+ overlay="$(cat "${portdir}/profiles/repo_name")"
+ else
+ # 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
if [[ ! -d "$portdir/metadata/cache" ]]; then
@@ -393,16 +403,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
@@ -435,7 +435,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 +458,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
@@ -507,8 +507,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
@@ -606,7 +606,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 +671,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 +682,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 +693,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 +767,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 +778,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 +930,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 +990,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 +1239,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}"
diff --git a/bin/revdep-rebuild b/bin/revdep-rebuild
index e034124..f00b791 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
@@ -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
@@ -1111,9 +1118,12 @@ 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") )
- REBUILD_LIST="${REBUILD_LIST[@]/#/=}"
+ 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
@@ -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
diff --git a/man/analyse.1 b/man/enalyze.1
index b8db3e8..506d619 100644
--- a/man/analyse.1
+++ b/man/enalyze.1
@@ -1,13 +1,13 @@
-.TH "ANALYSE" "22" "Febuary 2010" "GENTOOLKIT" ""
+.TH "ENALYZE" "22" "Febuary 2010" "GENTOOLKIT" ""
.SH "NAME"
-analyse \- Gentoo Installed Package Analysis Tool
+enalyze \- Gentoo Installed Package Analysis Tool
.SH "SYNOPSIS"
-.BI "analyse " "[global\-options] " "module " "[local\-options]" "TARGET"
+.BI "enalyze " "[global\-options] " "module " "[local\-options]" "TARGET"
.SH "DESCRIPTION"
-.B Analyse
-Is a collection of modules for analysing the state of installed Gentoo packages for
+.B Enalyze
+Is a collection of modules for analyzing the state of installed Gentoo packages for
USE flags or keywords used for installation, and their current masking status.
.br
It can also optionally (re)generate new /etc/portage/package.* files.
@@ -15,7 +15,7 @@ It can also optionally (re)generate new /etc/portage/package.* files.
.br
.B CAUTION:
-This is beta software and is not yet feature complete. Some features, options or its name
+This is beta software and is not yet feature complete. Some features, options
may change in the future. Any files that it generates are saved to your home directory
and will not harm your system without effort on your part.
.br
@@ -37,7 +37,7 @@ Do not colorize output.
.B \-N, \-\-no\-pipe
.br
Turn off automatic pipe detection. Use this option if you do not want
-.B analyse
+.B enalyze
To detect if the output is being directed to the screen or to another program
and adjust color and verbosity accordingly.
.HP
@@ -48,7 +48,7 @@ Display \fBGentoolkit\fP's version. Please include this in all bug reports. (see
below)
.SH "MODULES"
-.B Analyse
+.B Enalyze
Uses a system of modules. Each module has both a long and short name.
The list below uses the notation "\fBmodule (m)\fP", where \fIm\fP is the short name
and \fImodule\fP is the long name.
@@ -58,11 +58,11 @@ You can view the
message for a specific module by using
.BR "\-h" ", " "\-\-help "
as either a global option (after
-.B analyse
+.B enalyze
and before the module name) or as a local option (after the module name).
.SS
-.BI "analyse (a) [OPTIONS] TARGET"
+.BI "analyze (a) [OPTIONS] TARGET"
Report on all installed packages for \fITARGET\fP.
.P
@@ -70,20 +70,20 @@ Report on all installed packages for \fITARGET\fP.
.HP
.B use
.br
-Will analyse the installed with USE flags for output results.
+Will analyze the installed with USE flags for output results.
.HP
.B pkguse
.br
-Will analyse the USE flags information from the installed pkg's 'PKGUSE' file which contains
+Will analyze the USE flags information from the installed pkg's 'PKGUSE' file which contains
only flags settings from /etc/portage/package.use at the time of installation.
.HP
.B keywords
.br
-Will analyse the recorded keywords for output results.
+Will analyze the recorded keywords for output results.
.HP
.B unmask
.br
-Will analyse the installed packages and portage trees for pkgs that require unmasking and report them.
+Will analyze the installed packages and portage trees for pkgs that require unmasking and report them.
.br
.P
.I R "LOCAL OPTIONS" ":"
@@ -100,7 +100,7 @@ Gives more detail about the results found and the current task being performed.
.I R "EXAMPLES" ":"
.EX
.HP
-analyse a \-\-verbose \-\-unset use
+enalyze a \-\-verbose \-\-unset use
.EE
.br
Report on all use flags used to install the packages. (\-\-unset) Include in the report all flags
@@ -120,15 +120,15 @@ other than the default settings.
.HP
.B use
.br
-Will analyse the USE flags for output results.
+Will analyze the USE flags for output results.
.HP
.B keywords
.br
-Will analyse the keywords for output results.
+Will analyze the keywords for output results.
.HP
.B unmask
.br
-Will analyse the installed packages and portage trees for pkgs that require
+Will analyze the installed packages and portage trees for pkgs that require
unmasking and produce output/a new /etc/portage/package.unmask file.
.P
.I R "LOCAL OPTIONS" ":"
@@ -154,10 +154,10 @@ Gives more detail about the results found and the current task being performed.
.I R "EXAMPLES" ":"
.EX
.HP
-analyse rebuild \-p use
+enalyze rebuild \-p use
.EE
.br
-Analyse the installed packages database and current system USE flag settings
+Analyze the installed packages database and current system USE flag settings
and output the results in the form of:
.br
@@ -174,17 +174,17 @@ for the current settings and pkg ebuild. (not Implemented yet)
.HP
.B use
.br
-Will analyse the USE flags and /etc/portage/package.use file(s) for entries that
+Will analyze the USE flags and /etc/portage/package.use file(s) for entries that
are redundant or no longer used by the pkg.
.HP
.B keywords
.br
-Will analyse the keywords and /etc/portage/package.keywords file(s) for entries
+Will analyze the keywords and /etc/portage/package.keywords file(s) for entries
that are no longer needed.
.HP
.B unmask
.br
-Will analyse the installed packages, /etc/portage/package.unmask file(s) and
+Will analyze the installed packages, /etc/portage/package.unmask file(s) and
portage trees for pkgs that no longer require unmasking.
.P
.I R "LOCAL OPTIONS" ":"
diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py
index feced63..0396952 100644
--- a/pym/gentoolkit/dependencies.py
+++ b/pym/gentoolkit/dependencies.py
@@ -115,7 +115,7 @@ class Dependencies(Query):
max_depth=1,
printer_fn=None,
# The rest of these are only used internally:
- depth=0,
+ depth=1,
seen=None,
depcache=None,
result=None
@@ -151,32 +151,29 @@ class Dependencies(Query):
except KeyError:
pkgdep = Query(dep.atom).find_best()
depcache[dep.atom] = pkgdep
- if pkgdep and pkgdep.cpv in seen:
+ if not pkgdep:
continue
- if depth < max_depth or max_depth <= 0:
-
+ elif pkgdep.cpv in seen:
+ continue
+ if depth <= max_depth or max_depth == 0:
if printer_fn is not None:
printer_fn(depth, pkgdep, dep)
- if not pkgdep:
- continue
+ result.append((depth,pkgdep))
seen.add(pkgdep.cpv)
- result.append((
- depth,
- pkgdep.deps.graph_depends(
- max_depth=max_depth,
- printer_fn=printer_fn,
- # The rest of these are only used internally:
- depth=depth+1,
- seen=seen,
- depcache=depcache,
- result=result
- )
- ))
-
- if depth == 0:
- return result
- return pkgdep
+ if depth < max_depth or max_depth == 0:
+ # result is passed in and added to directly
+ # so rdeps is disposable
+ rdeps = pkgdep.deps.graph_depends(
+ max_depth=max_depth,
+ printer_fn=printer_fn,
+ # The rest of these are only used internally:
+ depth=depth+1,
+ seen=seen,
+ depcache=depcache,
+ result=result
+ )
+ return result
def graph_reverse_depends(
self,
diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index e29bbfc..4992ad7 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -124,7 +124,7 @@ class DistfilesSearch(object):
self.output("...checking limits for %d ebuild sources"
%len(pkgs))
- checks = self._get_default_checks(size_limit, time_limit, exclude)
+ checks = self._get_default_checks(size_limit, time_limit, exclude, destructive)
checks.extend(extra_checks)
clean_me = self._check_limits(_distdir, checks, clean_me)
# remove any protected files from the list
@@ -140,7 +140,7 @@ class DistfilesSearch(object):
####################### begin _check_limits code block
- def _get_default_checks(self, size_limit, time_limit, excludes):
+ def _get_default_checks(self, size_limit, time_limit, excludes, destructive):
#checks =[(self._isreg_check_, "is_reg_check")]
checks =[self._isreg_check_]
if 'filenames' in excludes:
@@ -159,6 +159,10 @@ class DistfilesSearch(object):
checks.append(partial(self._time_check_, time_limit))
else:
self.output(" - skipping time limit check")
+ if destructive:
+ self.output(" - skipping dot files check")
+ else:
+ checks.append(self._dotfile_check_)
return checks
@@ -234,6 +238,14 @@ class DistfilesSearch(object):
return True, False
return False, True
+ @staticmethod
+ def _dotfile_check_(file_stat, file):
+ """check if file is a regular file."""
+ head, tail = os.path.split(file)
+ if tail:
+ is_dot_file = tail.startswith('.')
+ return is_dot_file, not is_dot_file
+
####################### end _check_limits code block
@staticmethod
diff --git a/pym/gentoolkit/analyse/__init__.py b/pym/gentoolkit/enalyze/__init__.py
index 46d6185..b43a82c 100644
--- a/pym/gentoolkit/analyse/__init__.py
+++ b/pym/gentoolkit/enalyze/__init__.py
@@ -16,7 +16,7 @@
__docformat__ = 'epytext'
# version is dynamically set by distutils sdist
__version__ = "svn"
-__productname__ = "analyse"
+__productname__ = "enalyze"
__authors__ = (
'Brian Dolbec, <brian.dolbec@gmail.com>'
@@ -48,15 +48,15 @@ from gentoolkit.formatters import format_options
NAME_MAP = {
- 'a': 'analyse',
+ 'a': 'analyze',
'r': 'rebuild'
}
FORMATTED_OPTIONS = (
- (" (a)nalyse",
- "analyses the installed PKG database USE flag or keyword useage"),
+ (" (a)nalyze",
+ "analyzes the installed PKG database USE flag or keyword useage"),
(" (r)ebuild",
- "analyses the Installed PKG database and generates files suitable"),
+ "analyzes the Installed PKG database and generates files suitable"),
(" ",
"to replace corrupted or missing /etc/portage/package.* files")
)
diff --git a/pym/gentoolkit/analyse/analyse.py b/pym/gentoolkit/enalyze/analyze.py
index e2628e3..180865d 100644
--- a/pym/gentoolkit/analyse/analyse.py
+++ b/pym/gentoolkit/enalyze/analyze.py
@@ -14,11 +14,11 @@ import sys
import gentoolkit
from gentoolkit.dbapi import PORTDB, VARDB
-from gentoolkit.analyse.base import ModuleBase
+from gentoolkit.enalyze.base import ModuleBase
from gentoolkit import pprinter as pp
from gentoolkit.flag import get_installed_use, get_flags
-from gentoolkit.analyse.lib import FlagAnalyzer, KeywordAnalyser
-from gentoolkit.analyse.output import nl, AnalysisPrinter
+from gentoolkit.enalyze.lib import FlagAnalyzer, KeywordAnalyser
+from gentoolkit.enalyze.output import nl, AnalysisPrinter
from gentoolkit.package import Package
from gentoolkit.helpers import get_installed_cpvs
@@ -35,10 +35,10 @@ def gather_flags_info(
_get_flags=get_flags,
_get_used=get_installed_use
):
- """Analyse the installed pkgs USE flags for frequency of use
+ """Analyze the installed pkgs USE flags for frequency of use
@type cpvs: list
- @param cpvs: optional list of [cat/pkg-ver,...] to analyse or
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or
defaults to entire installed pkg db
@type: system_flags: list
@param system_flags: the current default USE flags as defined
@@ -46,13 +46,13 @@ def gather_flags_info(
@type include_unset: bool
@param include_unset: controls the inclusion of unset USE flags in the report.
@type target: string
- @param target: the environment variable being analysed
+ @param target: the environment variable being analyzed
one of ["USE", "PKGUSE"]
@type _get_flags: function
@param _get_flags: ovride-able for testing,
- defaults to gentoolkit.analyse.lib.get_flags
+ defaults to gentoolkit.enalyze.lib.get_flags
@param _get_used: ovride-able for testing,
- defaults to gentoolkit.analyse.lib.get_installed_use
+ defaults to gentoolkit.enalyze.lib.get_installed_use
@rtype dict. {flag:{"+":[cat/pkg-ver,...], "-":[cat/pkg-ver,...], "unset":[]}
"""
if cpvs is None:
@@ -103,9 +103,9 @@ def gather_keywords_info(
keywords=portage.settings["ACCEPT_KEYWORDS"],
analyser = None
):
- """Analyse the installed pkgs 'keywords' for frequency of use
+ """Analyze the installed pkgs 'keywords' for frequency of use
- @param cpvs: optional list of [cat/pkg-ver,...] to analyse or
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or
defaults to entire installed pkg db
@param system_keywords: list of the system keywords
@param keywords: user defined list of keywords to check and report on
@@ -166,7 +166,7 @@ class Analyse(ModuleBase):
"""
def __init__(self):
ModuleBase.__init__(self)
- self.module_name = "analyse"
+ self.module_name = "enalyze"
self.options = {
"flags": False,
"keywords": False,
@@ -193,14 +193,14 @@ class Analyse(ModuleBase):
}
self.formatted_options = [
(" -h, --help", "Outputs this useage message"),
- (" -a, --analyse",
+ (" -a, --analyze",
"Action, sets the module to gather data and output the"),
("", "formatted stats/information to the screen"),
(" -u, --unset",
"Additionally include any unset USE flags and the packages"),
("", "that could use them"),
(" -v, --verbose",
- "Used in the analyse action to output more detailed information"),
+ "Used in the analyze action to output more detailed information"),
(" -p, --prefix",
"Used for testing purposes only, runs report using " +
"a prefix keyword and 'prefix' USE flag"),
@@ -210,15 +210,15 @@ class Analyse(ModuleBase):
]
self.formatted_args = [
(" use",
- "Causes the action to analyse the installed packages USE flags"),
+ "Causes the action to analyze the installed packages USE flags"),
(" pkguse",
- "Causes the action to analyse the installed packages PKGUSE flags"),
+ "Causes the action to analyze the installed packages PKGUSE flags"),
(" ",
"These are flags that have been set in /etc/portage/package.use"),
(" keywords",
- "Causes the action to analyse the installed packages keywords"),
+ "Causes the action to analyze the installed packages keywords"),
(" packages",
- "Causes the action to analyse the installed packages and the"),
+ "Causes the action to analyze the installed packages and the"),
(" ",
"USE flags they were installed with"),
]
@@ -251,12 +251,12 @@ class Analyse(ModuleBase):
self.analyse_packages()
def analyse_flags(self, target):
- """This will scan the installed packages db and analyse the
+ """This will scan the installed packages db and analyze the
USE flags used for installation and produce a report on how
they were used.
@type target: string
- @param target: the target to be analysed, one of ["use", "pkguse"]
+ @param target: the target to be analyzed, one of ["use", "pkguse"]
"""
system_use = portage.settings["USE"].split()
self.printer = AnalysisPrinter(
@@ -307,7 +307,7 @@ class Analyse(ModuleBase):
def analyse_keywords(self, keywords=None):
- """This will scan the installed packages db and analyse the
+ """This will scan the installed packages db and analyze the
keywords used for installation and produce a report on them.
"""
print()
@@ -390,11 +390,11 @@ class Analyse(ModuleBase):
def analyse_packages(self):
- """This will scan the installed packages db and analyse the
+ """This will scan the installed packages db and analyze the
USE flags used for installation and produce a report.
@type target: string
- @param target: the target to be analysed, one of ["use", "pkguse"]
+ @param target: the target to be analyzed, one of ["use", "pkguse"]
"""
system_use = portage.settings["USE"].split()
if self.options["verbose"]:
@@ -437,7 +437,7 @@ class Analyse(ModuleBase):
def main(input_args):
- """Common starting method by the analyse master
+ """Common starting method by the analyze master
unless all modules are converted to this class method.
@param input_args: input args as supplied by equery master module.
diff --git a/pym/gentoolkit/analyse/base.py b/pym/gentoolkit/enalyze/base.py
index a3f3fed..6622704 100644
--- a/pym/gentoolkit/analyse/base.py
+++ b/pym/gentoolkit/enalyze/base.py
@@ -6,7 +6,7 @@
#
# $Header: $
-"""Analyse Base Module class to hold common module operation functions
+"""Enalyze Base Module class to hold common module operation functions
"""
from __future__ import print_function
@@ -25,7 +25,7 @@ from gentoolkit.base import mod_usage
from gentoolkit import CONFIG
class ModuleBase(object):
- """Analyse base module class to parse module options print module help, etc.."""
+ """Enalyze base module class to parse module options print module help, etc.."""
def __init__(self):
self.module_name = None
diff --git a/pym/gentoolkit/analyse/lib.py b/pym/gentoolkit/enalyze/lib.py
index 901d757..015e23b 100644
--- a/pym/gentoolkit/analyse/lib.py
+++ b/pym/gentoolkit/enalyze/lib.py
@@ -6,7 +6,7 @@
#
-"""Provides support functions to analyse modules"""
+"""Provides support functions to enalyze modules"""
import sys
@@ -69,7 +69,7 @@ class FlagAnalyzer(object):
return self._analyse(installed, iuse)
def _analyse(self, installed, iuse):
- """Analyses the supplied info and returns the flag settings
+ """Analyzes the supplied info and returns the flag settings
that differ from the defaults
@type installed: set
diff --git a/pym/gentoolkit/analyse/output.py b/pym/gentoolkit/enalyze/output.py
index b193d54..326ebbc 100644
--- a/pym/gentoolkit/analyse/output.py
+++ b/pym/gentoolkit/enalyze/output.py
@@ -291,7 +291,7 @@ class RebuildPrinter(CpvValueWrapper):
h=("# This package.%s file was generated by "
%self.target +
- "gentoolkit's 'analyse rebuild' module\n"
+ "gentoolkit's 'enalyze rebuild' module\n"
"# Date: " + time.asctime() + "\n"
)
return h
diff --git a/pym/gentoolkit/analyse/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py
index 091df3a..f1d7e88 100644
--- a/pym/gentoolkit/analyse/rebuild.py
+++ b/pym/gentoolkit/enalyze/rebuild.py
@@ -18,12 +18,12 @@ import sys
import gentoolkit
from gentoolkit.dbapi import PORTDB, VARDB
-from gentoolkit.analyse.base import ModuleBase
+from gentoolkit.enalyze.base import ModuleBase
from gentoolkit import pprinter as pp
-from gentoolkit.analyse.lib import (get_installed_use, get_flags, FlagAnalyzer,
+from gentoolkit.enalyze.lib import (get_installed_use, get_flags, FlagAnalyzer,
KeywordAnalyser)
from gentoolkit.flag import reduce_flags
-from gentoolkit.analyse.output import RebuildPrinter
+from gentoolkit.enalyze.output import RebuildPrinter
from gentoolkit.atom import Atom
@@ -42,16 +42,16 @@ def cpv_all_diff_use(
and the currently installed pkgs recorded USE flag settings
@type cpvs: list
- @param cpvs: optional list of [cat/pkg-ver,...] to analyse or
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or
defaults to entire installed pkg db
@type: system_flags: list
@param system_flags: the current default USE flags as defined
by portage.settings["USE"].split()
@type _get_flags: function
@param _get_flags: ovride-able for testing,
- defaults to gentoolkit.analyse.lib.get_flags
+ defaults to gentoolkit.enalyze.lib.get_flags
@param _get_used: ovride-able for testing,
- defaults to gentoolkit.analyse.lib.get_installed_use
+ defaults to gentoolkit.enalyze.lib.get_installed_use
@rtype dict. {cpv:['flag1', '-flag2',...]}
"""
if cpvs is None:
@@ -91,9 +91,9 @@ def cpv_all_diff_keywords(
keywords=portage.settings["ACCEPT_KEYWORDS"],
analyser = None
):
- """Analyse the installed pkgs 'keywords' for difference from ACCEPT_KEYWORDS
+ """Analyze the installed pkgs 'keywords' for difference from ACCEPT_KEYWORDS
- @param cpvs: optional list of [cat/pkg-ver,...] to analyse or
+ @param cpvs: optional list of [cat/pkg-ver,...] to analyze or
defaults to entire installed pkg db
@param system_keywords: list of the system keywords
@param keywords: user defined list of keywords to check and report on
@@ -182,11 +182,11 @@ class Rebuild(ModuleBase):
]
self.formatted_args = [
(" use",
- "causes the action to analyse the installed packages USE flags"),
+ "causes the action to analyze the installed packages USE flags"),
(" keywords",
- "causes the action to analyse the installed packages keywords"),
+ "causes the action to analyze the installed packages keywords"),
(" unmask",
- "causes the action to analyse the installed packages " + \
+ "causes the action to analyze the installed packages " + \
"current mask status")
]
self.short_opts = "hepsv"
@@ -269,7 +269,7 @@ class Rebuild(ModuleBase):
def rebuild_keywords(self):
print("Module action not yet available")
print()
- """This will scan the installed packages db and analyse the
+ """This will scan the installed packages db and analyze the
keywords used for installation and produce a report on them.
"""
system_keywords = portage.settings["ACCEPT_KEYWORDS"].split()
@@ -357,7 +357,7 @@ class Rebuild(ModuleBase):
def main(input_args):
- """Common starting method by the analyse master
+ """Common starting method by the analyze master
unless all modules are converted to this class method.
@param input_args: input args as supplied by equery master module.
diff --git a/pym/gentoolkit/eprefix.py b/pym/gentoolkit/eprefix.py
index 9a04e4b..48bd140 100644
--- a/pym/gentoolkit/eprefix.py
+++ b/pym/gentoolkit/eprefix.py
@@ -10,25 +10,15 @@
used in all gentoolkit modules
Example useage: from gentoolkit.eprefix import EPREFIX
-then in code add it to the filepath eg.:
+then in code add it to the filepath eg.:
exclude_file = "%s/etc/%s/%s.exclude" % (EPREFIX,__productname__ , action)
"""
-
-import os
-
-
-EPREFIX = ''
-
-# the following code is used to set it when
-# non-installed code is being run
-if 'EPREFIX' in os.environ:
- EPREFIX = os.environ['EPREFIX']
-else:
- try:
- import portage.const
- EPREFIX = portage.BPREFIX
- except AttributeError:
- EPREFIX = ''
-
-#print("EPREFIX set to:", EPREFIX)
+# Load EPREFIX from Portage, fall back to the empty string if it fails
+try:
+ from portage.const import EPREFIX
+except ImportError:
+ EPREFIX = ''
+
+if __name__ == "__main__":
+ print("EPREFIX set to:", EPREFIX)
diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py
index e25ec54..b362bca 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -221,6 +221,9 @@ def initialize_configuration():
if CONFIG['piping']:
CONFIG['verbose'] = False
+ # set extra wide, should disable wrapping unless
+ # there is some extra long text
+ CONFIG['termWidth'] = 600
CONFIG['debug'] = bool(os.getenv('DEBUG', False))
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index b67cbc6..01e090a 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -244,6 +244,14 @@ def format_keywords_line(pkg, fmtd_keywords, slot, verstr_len):
return result
+def format_homepage(homepage):
+ """format the homepage(s) entries for dispaly"""
+ result = []
+ for page in homepage.split():
+ result.append(format_line(page, "Homepage: ", " " * 13))
+ return result
+
+
# R0912: *Too many branches (%s/%s)*
# pylint: disable-msg=R0912
def call_format_functions(best_match, matches):
@@ -284,11 +292,13 @@ def call_format_functions(best_match, matches):
if QUERY_OPTS["upstream"] or not got_opts:
upstream = format_upstream(best_match.metadata.upstream())
+ homepage = format_homepage(best_match.environment("HOMEPAGE"))
if QUERY_OPTS["upstream"]:
upstream = format_list(upstream)
else:
upstream = format_list(upstream, "Upstream: ", " " * 13)
print_sequence(upstream)
+ print_sequence(homepage)
if not got_opts:
pkg_loc = best_match.package_path()
diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index 9c70bee..e0544a9 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -14,10 +14,10 @@ from portage import config as portc
from portage import portdbapi as portdbapi
from portage import db as portdb
-from .keywords_header import keywords_header
-from .keywords_content import keywords_content
-from .display_pretty import string_rotator
-from .display_pretty import display
+from gentoolkit.eshowkw.keywords_header import keywords_header
+from gentoolkit.eshowkw.keywords_content import keywords_content
+from gentoolkit.eshowkw.display_pretty import string_rotator
+from gentoolkit.eshowkw.display_pretty import display
ignore_slots = False
bold = False
@@ -25,6 +25,7 @@ order = 'bottom'
topper = 'versionlist'
def process_display(package, keywords, dbapi):
+
portdata = keywords_content(package, keywords.keywords, dbapi, ignore_slots, order, bold, topper)
if topper == 'archlist':
header = string_rotator().rotateContent(keywords.content, keywords.length, bold)
@@ -108,7 +109,8 @@ def main(argv, indirect = False):
dbapi = portdbapi(mysettings=mysettings)
if not use_overlays:
dbapi.porttrees = [dbapi.porttree_root]
- map(lambda x: process_display(x, keywords, dbapi), package)
+ for pkg in package:
+ process_display(pkg, keywords, dbapi)
else:
currdir = os.getcwd()
# check if there are actualy some ebuilds
diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py
index 270a0eb..beca5f4 100644
--- a/pym/gentoolkit/eshowkw/display_pretty.py
+++ b/pym/gentoolkit/eshowkw/display_pretty.py
@@ -3,7 +3,10 @@
# Distributed under the terms of the GNU General Public License v2
from portage.output import colorize
-from itertools import izip_longest
+try: # newer python versions
+ from itertools import zip_longest
+except ImportError: # older python naming
+ from itertools import izip_longest as zip_longest
__all__ = ['string_rotator', 'colorize_string', 'align_string', 'rotate_dash', 'print_content', 'display']
@@ -17,14 +20,14 @@ def display(plain_list, rotated_list, plain_width, rotated_height, cp, toplist =
if toplist != 'archlist':
corner_image.extend(plain_list)
data_printout = ['%s%s' % (x, y)
- for x, y in izip_longest(corner_image, rotated_list, fillvalue=corner_image[0])]
+ for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])]
if toplist == 'archlist':
data_printout.extend(plain_list)
output.extend(data_printout)
print(print_content(output))
def align_string(string, align, length):
- """Align string to the specified alignment (left or right, and after rotation it becames top and bottom)"""
+ """Align string to the specified alignment (left or right, and after rotation it becomes top and bottom)"""
if align == 'top' or align == 'left':
string = string.ljust(length)
else:
diff --git a/pym/gentoolkit/eshowkw/keywords_content.py b/pym/gentoolkit/eshowkw/keywords_content.py
index 637c99a..99d652e 100644
--- a/pym/gentoolkit/eshowkw/keywords_content.py
+++ b/pym/gentoolkit/eshowkw/keywords_content.py
@@ -8,8 +8,8 @@ from portage.output import colorize
__all__ = ['keywords_content']
-from display_pretty import colorize_string
-from display_pretty import align_string
+from gentoolkit.eshowkw.display_pretty import colorize_string
+from gentoolkit.eshowkw.display_pretty import align_string
class keywords_content:
class RedundancyChecker:
@@ -101,7 +101,7 @@ class keywords_content:
def __getVersions(self, packages):
"""Obtain properly aligned version strings without colors."""
revlength = max([len(self.__getRevision(x)) for x in packages])
- return map(lambda x: self.__separateVersion(x, revlength), packages)
+ return [self.__separateVersion(x, revlength) for x in packages]
def __getRevision(self, cpv):
"""Get revision informations for each package for nice further alignment"""
diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 23588a4..f7e3e50 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -6,8 +6,8 @@ __all__ = ['keywords_header']
from portage import settings as ports
from portage.output import colorize
-from display_pretty import colorize_string
-from display_pretty import align_string
+from gentoolkit.eshowkw.display_pretty import colorize_string
+from gentoolkit.eshowkw.display_pretty import align_string
class keywords_header:
__IMPARCHS = [ 'arm', 'amd64', 'x86' ]
diff --git a/pym/gentoolkit/flag.py b/pym/gentoolkit/flag.py
index a7d944f..b5c8228 100644
--- a/pym/gentoolkit/flag.py
+++ b/pym/gentoolkit/flag.py
@@ -36,7 +36,8 @@ def get_iuse(cpv):
@returns [] or the list of IUSE flags
"""
try:
- return PORTDB.aux_get(cpv, ["IUSE"])[0].split()
+ # aux_get might return dupes, so run them through set() to remove them
+ return list(set(PORTDB.aux_get(cpv, ["IUSE"])[0].split()))
except:
return []
diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py
index cd8b763..225a198 100644
--- a/pym/gentoolkit/helpers.py
+++ b/pym/gentoolkit/helpers.py
@@ -333,7 +333,7 @@ class FileOwner(object):
osp = os.path
paths.extend([osp.realpath(x) for x in paths
- if osp.islink(x) and osp.realpath(x) not in paths])
+ if osp.realpath(x) not in paths])
return paths
diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py
index a4031a3..e405412 100644
--- a/pym/gentoolkit/package.py
+++ b/pym/gentoolkit/package.py
@@ -36,7 +36,7 @@ __all__ = (
FORMAT_TMPL_VARS = (
'$location', '$mask', '$mask2', '$cp', '$cpv', '$category', '$name',
- '$version', '$revision', '$fullversion', '$slot', '$repo'
+ '$version', '$revision', '$fullversion', '$slot', '$repo', '$keywords'
)
# =======
@@ -470,6 +470,7 @@ class PackageFormatter(object):
"fullversion")
fmt_vars.addLazySingleton("slot", self.format_slot)
fmt_vars.addLazySingleton("repo", self.pkg.repo_name)
+ fmt_vars.addLazySingleton("keywords", self.format_keywords)
def format_package_location(self):
"""Get the install status (in /var/db/?) and origin (from an overlay
@@ -570,5 +571,12 @@ class PackageFormatter(object):
else:
return value
+ def format_keywords(self):
+ value = self.pkg.environment("KEYWORDS")
+ if self._do_format:
+ return pp.keyword(value)
+ else:
+ return value
+
# vim: set ts=4 sw=4 tw=79:
diff --git a/pym/gentoolkit/test/eclean/test_search.py b/pym/gentoolkit/test/eclean/test_search.py
index 328c543..7980161 100644
--- a/pym/gentoolkit/test/eclean/test_search.py
+++ b/pym/gentoolkit/test/eclean/test_search.py
@@ -151,7 +151,7 @@ class TestCheckLimits(unittest.TestCase):
print("Error getting test data for index:", i)
#self.target_class.set_data(self.set_limits(test))
size_chk, time_chk, exclude = test["params"]
- checks = self.target_class._get_default_checks(size_chk, time_chk, exclude)
+ checks = self.target_class._get_default_checks(size_chk, time_chk, exclude, False)
clean_me = self.target_class._check_limits(self.workdir, checks, clean_me)
results = sorted(clean_me)
run_results.append(results)
diff --git a/setup.py b/setup.py
index 91f9e9c..09feb8f 100755
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ python_scripts = [os.path.join(cwd, path) for path in (
'bin/epkginfo',
'bin/glsa-check',
'pym/gentoolkit/eclean/cli.py',
- 'pym/gentoolkit/analyse/__init__.py',
+ 'pym/gentoolkit/enalyze/__init__.py',
'pym/gentoolkit/equery/__init__.py',
'pym/gentoolkit/eshowkw/__init__.py'
)]