From: Kito Date: Wed, 25 Jan 2006 19:02:30 +0000 (-0000) Subject: Merge with trunk - 2368:2584. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=6741d8840c59af5df81501473c4b08098b3afacc;p=portage.git Merge with trunk - 2368:2584. svn path=/main/branches/prefix/; revision=2585 --- diff --git a/NEWS b/NEWS index e69de29bb..ca85bd313 100644 --- a/NEWS +++ b/NEWS @@ -0,0 +1,29 @@ +News (mainly features/major bug fixes) + +portage-2.1 (ongoing via pre releases) +------------ + +* elog framework and accompanying modules for logging ebuild warnings, errors + and general notices. Collects eerror/ewarn/elog/einfo messages. +* New elog function (should replace einfo in many cases) +* version syntax enhancements allowing multiple suffixes and a new 'cvs' + prefix for denoting "live sources" ebuilds. +* config files as directories enabling more flexible settings management. +* Addition of an register_die_hook method that allows ebuild/eclasses to + register functions to be called for better debugging on errors. +* Addition of pre and post user hookable functions for each ebuild phase, accessible + via portage bashrc. Example would be pre_src_unpack . +* cache refactoring- runtime improvement from 35% -> 65%. +* Intelligently handle and display USE_EXPAND-based IUSE variables. +* FEATURES="parallel-fetch". Download in parallel to compilation. +* Include a "changed or new" USE flag output when --verbose isn't specified. +* Support for splitting out debug information into separate files in + /usr/lib{,32,64}. +* exec subsystem refactoring (now with less bugs!) +* Added sha256 and rmd160 hashes for digests/manifests +* Make --emptytree only apply to ${ROOT} rather than always including /. +* Allow packages to be upgraded that are only depended on via a + "|| ( =cat/pkg-1* =cat/pkg-2* )" construct. +* Ebuild output is no longer cut off early when using PORT_LOGDIR. +* Distfiles indirection- $DISTFILES access goes through a tmp dir to fail + access to files not listed in SRC_URI. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6743324a8..c6c99e95d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,38 +1,8 @@ -Release Notes for portage-2.2_pre1 -================================== +Release Notes; upgrade information mainly. +Features/major bugfixes are listed in NEWS -New features / Major changes ----------------------------- -* elog framework: This finally adds a flexible way to log all einfo, ewarn and - eerror messages as well as adding a new elog command for ebuilds. New ebuilds - should use elog instead of einfo for delivering important information as - einfo messages will not be logged by default. [genone] -* elog modules: Together with the framework some basic modules implementing - common logging facilities are shipped, these include: - - mod_syslog for relaying messages to syslog - - mod_mail for sending messages to a predefined mail adress - - mod_save for saving messages to a file - - mod_custom for processing messages with a custom command - NOTE: The elog interfaces are still subject to change, so don't rely on the - exact format yet. [genone] -* version syntax enhancements: The version parsing and comparison code was - completely rewritten and now supports two extensions to previous versions: - - a cvs prefix to denote live cvs (or svn or any other vcs) ebuilds, so now - you can have a package foo with the ebuilds foo-1.ebuild and - foo-cvs.1.ebuild in the same directory. cvs ebuilds will always be - ranked higher than any non-cvs ebuild. - - multiple suffixes now allow for constructions like foo-1.0_pre1_rc5 - [genone] -* recursive config files: Most of the config files in /etc/portage can now - also be directories, if they are then portage will recursively use all - files in them. So you could have /etc/portage/package.keywords/kde/base - and /etc/portage/package.keywords/gnome instead of a single package.keywords. - [genone] -* multi-hash support: digests and Manifests will now use SHA256 and RMD160 in - addition to MD5 [genone] +portage-2.1 +================================== -Bug fixes / Minor Changes -------------------------- -* Removal of "masked by -*" message [genone] -* Fixed some minor screwup in the sort algorithm for versions [genone] -* Make digest errors more verbose (list actual and expected checksums) +* new cache framework, breaking all old cache modules. + If you're having problems with portage_db_cdb, this is likely the cause. diff --git a/bin/archive-conf b/bin/archive-conf index bdd0968fb..e50c39078 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/archive-conf,v 1.7 2004/10/04 13:57:36 vapier Exp $ diff --git a/bin/chkcontents b/bin/chkcontents index c21966a43..008b4de4f 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/chkcontents,v 1.11 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/clean_locks b/bin/clean_locks index 254d42a95..4e10e270b 100755 --- a/bin/clean_locks +++ b/bin/clean_locks @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/clean_locks,v 1.1 2004/09/26 10:44:31 carpaski Exp $ diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 2b777da00..a2370de94 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dispatch-conf,v 1.7.2.10 2005/05/12 15:20:22 jstubbs Exp $ @@ -204,6 +204,8 @@ class dispatch: show_new_diff = 1 continue elif c == 'e': + if not os.environ.has_key('EDITOR'): + os.environ['EDITOR']='nano' os.system(os.environ['EDITOR'] + ' ' + newconf) continue elif c == 'z': diff --git a/bin/dobin b/bin/dobin index 0e3b3fe38..c14e9cc73 100755 --- a/bin/dobin +++ b/bin/dobin @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dobin,v 1.13 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/doconfd b/bin/doconfd index 8a85bd4f5..23576f0ae 100755 --- a/bin/doconfd +++ b/bin/doconfd @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doconfd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $ diff --git a/bin/dodir b/bin/dodir index 3180fcad3..c4cd0f66c 100755 --- a/bin/dodir +++ b/bin/dodir @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dodir,v 1.5 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dodoc b/bin/dodoc index b8134ed15..d76b11b66 100755 --- a/bin/dodoc +++ b/bin/dodoc @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 if [ $# -lt 1 ] ; then diff --git a/bin/doenvd b/bin/doenvd index 6c92d344a..e9adc7941 100755 --- a/bin/doenvd +++ b/bin/doenvd @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doenvd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $ diff --git a/bin/doexe b/bin/doexe index f448eb9e4..caae6ee3b 100755 --- a/bin/doexe +++ b/bin/doexe @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doexe,v 1.10.2.1 2004/12/06 03:01:43 carpaski Exp $ diff --git a/bin/dohard b/bin/dohard index 32163d1d9..ebe23afd4 100755 --- a/bin/dohard +++ b/bin/dohard @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dohard,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dohtml b/bin/dohtml index 1091e082c..9a0d23823 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dohtml,v 1.14.2.1 2004/10/27 14:39:29 jstubbs Exp $ @@ -63,6 +63,10 @@ def install(basename, dirname, options, prefix=""): pfx = basename if prefix: pfx = prefix + "/" + pfx install(i, dirname, options, pfx) + else: + return False + return True + class OptionsClass: def __init__(self): @@ -150,10 +154,19 @@ def main(): print "Document prefix : '" + options.doc_prefix + "'" print "Allowed files :", options.allowed_files + success = True + for x in args: basename = os.path.basename(x) dirname = os.path.dirname(x) - install(basename, dirname, options) + success = success and install(basename, dirname, options) + + if success: + retcode = 0 + else: + retcode = 1 + + sys.exit(retcode) if __name__ == "__main__": main() diff --git a/bin/doinfo b/bin/doinfo index 1ee9be1c6..cdec34ef7 100755 --- a/bin/doinfo +++ b/bin/doinfo @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doinfo,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/doinitd b/bin/doinitd index 3665baa69..8f2926f83 100755 --- a/bin/doinitd +++ b/bin/doinitd @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doinitd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $ diff --git a/bin/doins b/bin/doins index 1c5471893..cfcd4612c 100755 --- a/bin/doins +++ b/bin/doins @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doins,v 1.7.2.2 2004/12/17 22:25:13 carpaski Exp $ diff --git a/bin/dojar b/bin/dojar index 6f30332b7..1a462d6c5 100755 --- a/bin/dojar +++ b/bin/dojar @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dojar,v 1.8 2004/10/04 13:56:50 vapier Exp $ # Author Karl Trygve Kalleberg diff --git a/bin/dolib b/bin/dolib index b0189b744..56b33fa1a 100755 --- a/bin/dolib +++ b/bin/dolib @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dolib,v 1.8.2.2 2005/01/12 02:07:15 carpaski Exp $ diff --git a/bin/dolib.a b/bin/dolib.a index b21f0c120..839fad811 100755 --- a/bin/dolib.a +++ b/bin/dolib.a @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dolib.a,v 1.8 2004/10/10 10:07:20 carpaski Exp $ diff --git a/bin/dolib.so b/bin/dolib.so index 52d693546..4c3401c2e 100755 --- a/bin/dolib.so +++ b/bin/dolib.so @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dolib.so,v 1.12 2004/10/10 10:07:20 carpaski Exp $ diff --git a/bin/doman b/bin/doman index 07a6793b1..8fb66d2b1 100755 --- a/bin/doman +++ b/bin/doman @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/doman,v 1.13.2.2 2005/07/29 05:55:34 vapier Exp $ diff --git a/bin/domo b/bin/domo index a1b15a1f7..d9950e9ed 100755 --- a/bin/domo +++ b/bin/domo @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/domo,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dopython b/bin/dopython index 776ad6108..cb6b5112e 100755 --- a/bin/dopython +++ b/bin/dopython @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dopython,v 1.8 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dosbin b/bin/dosbin index 66fc911f7..65df3aab3 100755 --- a/bin/dosbin +++ b/bin/dosbin @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dosbin,v 1.11 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dosed b/bin/dosed index 428feb0cf..e606844ae 100755 --- a/bin/dosed +++ b/bin/dosed @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dosed,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/dosym b/bin/dosym index a1e990305..956ef7bb9 100755 --- a/bin/dosym +++ b/bin/dosym @@ -1,14 +1,16 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/dosym,v 1.7 2004/10/04 13:56:50 vapier Exp $ -if [ ${#} -ne 2 ] ; then +if [[ $# -ne 2 ]] ; then echo "${0}: two arguments needed" exit 1 fi +<<<<<<< .working target="${1}" linkname="${2}" [[ ${target:0:1} == "/" ]] && target="${PREFIX}${target}" -ln -snf "${target}" "${D}${linkname}" +exec ln -snf "${target}" "${D}${linkname}" + diff --git a/bin/ebuild b/bin/ebuild index b1d78f7aa..ff6f740a6 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $ @@ -35,6 +35,10 @@ ebuild_split = ebuild.split("/") del ebuild_split[-2] cpv = "/".join(ebuild_split[-2:])[:-7] +if not portage.catpkgsplit(cpv): + print "!!! %s does not follow correct package syntax." % (cpv) + sys.exit(1) + if ebuild.startswith(portage.root + portage_const.VDB_PATH): mytree = "vartree" diff --git a/bin/ebuild.sh b/bin/ebuild.sh index f718aa241..8d78dc3ee 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1,9 +1,8 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.201.2.42 2005/08/20 17:24:30 jstubbs Exp $ - export SANDBOX_PREDICT="${SANDBOX_PREDICT}:/proc/self/maps:/dev/console:@PORTAGE_BASE@/pym:/dev/random" export SANDBOX_WRITE="${SANDBOX_WRITE}:/dev/shm:/dev/stdout:/dev/stderr:${PORTAGE_TMPDIR}" export SANDBOX_READ="${SANDBOX_READ}:/dev/shm:/dev/stdin:${PORTAGE_TMPDIR}" @@ -398,7 +397,7 @@ use_enable() { return 0 } -add-ebuild-death-hook() { +register_die_hook() { export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*" } @@ -407,9 +406,10 @@ diefunc() { shift 3 echo >&2 echo "!!! ERROR: $CATEGORY/$PF failed." >&2 - echo "!!! Function $funcname, Line $lineno, Exitcode $exitcode" >&2 + dump_trace 2 1>&2 + echo >&2 echo "!!! ${*:-(no error message)}" >&2 - echo "!!! If you need support, post the topmost build error, NOT this status message." >&2 + echo "!!! If you need support, post the topmost build error, and the call stack if relevant." >&2 echo >&2 if [ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]; then for x in $EBUILD_DEATH_HOOKS; do @@ -419,6 +419,39 @@ diefunc() { exit 1 } +shopt -s extdebug + +# usage- first arg is the number of funcs on the stack to ignore. +# defaults to 1 (ignoring dump_trace) +dump_trace() { + local funcname="" sourcefile="" lineno="" n e s="yes" + + declare -i strip=1 + + if [[ -n $1 ]]; then + strip=$(( $1 )) + fi + + echo "Call stack:" + for (( n = ${#FUNCNAME[@]} - 1, p = ${#BASH_ARGV[@]} ; n > $strip ; n-- )) ; do + funcname=${FUNCNAME[${n} - 1]} + sourcefile=$(basename ${BASH_SOURCE[${n}]}) + lineno=${BASH_LINENO[${n} - 1]} + # Display function arguments + args= + if [[ -n "${BASH_ARGV[@]}" ]]; then + for (( j = 0 ; j < ${BASH_ARGC[${n} - 1]} ; ++j )); do + newarg=${BASH_ARGV[$(( p - j - 1 ))]} + args="${args:+${args} }'${newarg}'" + done + (( p -= ${BASH_ARGC[${n} - 1]} )) + fi + echo " ${sourcefile}, line ${lineno}: Called ${funcname}${args:+ ${args}}" + done +} + + + #if no perms are specified, dirs/files will have decent defaults #(not secretive, but not stupid) umask 022 @@ -775,7 +808,7 @@ dyn_unpack() { echo ">>> ${EBUILD} has been updated; recreating WORKDIR..." newstuff="yes" rm -rf "${WORKDIR}" - elif [ ! -f "${BUILDDIR}/.unpacked" ]; then + elif [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then echo ">>> Not marked as unpacked; recreating WORKDIR..." newstuff="yes" rm -rf "${WORKDIR}" @@ -793,9 +826,9 @@ dyn_unpack() { [ -d "$WORKDIR" ] && cd "${WORKDIR}" echo ">>> Unpacking source..." src_unpack - touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR" + touch "${PORTAGE_BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in ${PORTAGE_BUILDDIR}" echo ">>> Source unpacked." - cd "$BUILDDIR" + cd "${PORTAGE_BUILDDIR}" [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack @@ -805,14 +838,14 @@ dyn_unpack() { dyn_clean() { if [ "$USERLAND" == "BSD" ] && type -p chflags &>/dev/null; then chflags -R noschg,nouchg,nosappnd,nouappnd,nosunlnk,nouunlnk \ - "${BUILDDIR}" + "${PORTAGE_BUILDDIR}" fi if [ "$USERLAND" == "Darwin" ] && type -p chflags &>/dev/null; then - chflags -R noschg,nouchg,nosappnd,nouappnd "${BUILDDIR}" + chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}" fi - rm -rf "${BUILDDIR}/image" + rm -rf "${PORTAGE_BUILDDIR}/image" if ! hasq keeptemp $FEATURES; then rm -rf "${T}" @@ -821,27 +854,30 @@ dyn_clean() { fi if ! hasq keepwork $FEATURES; then - rm -rf "${BUILDDIR}/.unpacked" - rm -rf "${BUILDDIR}/.compiled" - rm -rf "${BUILDDIR}/.tested" - rm -rf "${BUILDDIR}/.installed" - rm -rf "${BUILDDIR}/.packaged" - rm -rf "${BUILDDIR}/build-info" + rm -rf "${PORTAGE_BUILDDIR}/.unpacked" + rm -rf "${PORTAGE_BUILDDIR}/.compiled" + rm -rf "${PORTAGE_BUILDDIR}/.tested" + rm -rf "${PORTAGE_BUILDDIR}/.installed" + rm -rf "${PORTAGE_BUILDDIR}/.packaged" + rm -rf "${PORTAGE_BUILDDIR}/build-info" rm -rf "${WORKDIR}" fi - if [ -f "${BUILDDIR}/.unpacked" ]; then - find "${BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null + if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then + find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null fi - if [ -z "$(find "${BUILDDIR}" -mindepth 1 -maxdepth 1)" ]; then - rmdir "${BUILDDIR}" + if [ -z "$(find "${PORTAGE_BUILDDIR}" -mindepth 1 -maxdepth 1)" ]; then + rmdir "${PORTAGE_BUILDDIR}" fi + # do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll + # result in it wiping the users distfiles directory (bad). + rm -rf "${PORTAGE_BUILDDIR}/distdir" true } into() { - if [ $1 == "/" ]; then + if [ "$1" == "/" ]; then export DESTTREE="" else export DESTTREE=$1 @@ -948,33 +984,33 @@ abort_handler() { abort_compile() { abort_handler "src_compile" $1 - rm -f "${BUILDDIR}/.compiled" + rm -f "${PORTAGE_BUILDDIR}/.compiled" exit 1 } abort_unpack() { abort_handler "src_unpack" $1 - rm -f "${BUILDDIR}/.unpacked" - rm -rf "${BUILDDIR}/work" + rm -f "${PORTAGE_BUILDDIR}/.unpacked" + rm -rf "${PORTAGE_BUILDDIR}/work" exit 1 } abort_package() { abort_handler "dyn_package" $1 - rm -f "${BUILDDIR}/.packaged" + rm -f "${PORTAGE_BUILDDIR}/.packaged" rm -f "${PKGDIR}"/All/${PF}.t* exit 1 } abort_test() { abort_handler "dyn_test" $1 - rm -f "${BUILDDIR}/.tested" + rm -f "${PORTAGE_BUILDDIR}/.tested" exit 1 } abort_install() { abort_handler "src_install" $1 - rm -rf "${BUILDDIR}/image" + rm -rf "${PORTAGE_BUILDDIR}/image" exit 1 } @@ -996,7 +1032,7 @@ dyn_compile() { [ "${DISTCC_DIR-unset}" == "unset" ] && export DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc" [ ! -z "${DISTCC_DIR}" ] && addwrite "${DISTCC_DIR}" - if hasq noauto $FEATURES &>/dev/null && [ ! -f ${BUILDDIR}/.unpacked ]; then + if hasq noauto $FEATURES &>/dev/null && [ ! -f ${PORTAGE_BUILDDIR}/.unpacked ]; then echo echo "!!! We apparently haven't unpacked... This is probably not what you" echo "!!! want to be doing... You are using FEATURES=noauto so I'll assume" @@ -1011,14 +1047,14 @@ dyn_compile() { sleep 3 fi - local srcdir=${BUILDDIR} - cd "${BUILDDIR}" + local srcdir=${PORTAGE_BUILDDIR} + cd "${PORTAGE_BUILDDIR}" if [ ! -e "build-info" ]; then mkdir build-info fi cp "${EBUILD}" "build-info/${PF}.ebuild" - if [ ${BUILDDIR}/.compiled -nt "${WORKDIR}" ]; then + if [ "${PORTAGE_BUILDDIR}/.compiled" -nt "${WORKDIR}" ]; then echo ">>> It appears that ${PN} is already compiled; skipping." echo ">>> (clean to force compilation)" trap SIGINT SIGQUIT @@ -1039,41 +1075,20 @@ dyn_compile() { src_compile echo ">>> Source compiled." #|| abort_compile "fail" - cd "${BUILDDIR}" + cd "${PORTAGE_BUILDDIR}" touch .compiled cd build-info - echo "$ASFLAGS" > ASFLAGS - echo "$CATEGORY" > CATEGORY - echo "$CBUILD" > CBUILD - echo "$CC" > CC - echo "$CFLAGS" > CFLAGS - echo "$CHOST" > CHOST - echo "$CTARGET" > CTARGET - echo "$CXX" > CXX - echo "$CXXFLAGS" > CXXFLAGS - echo "$DEPEND" > DEPEND - echo "$EXTRA_ECONF" > EXTRA_ECONF - echo "$EXTRA_EINSTALL" > EXTRA_EINSTALL - echo "$EXTRA_EMAKE" > EXTRA_MAKE - echo "$FEATURES" > FEATURES - echo "$INHERITED" > INHERITED - echo "$IUSE" > IUSE - echo "$PKGUSE" > PKGUSE - echo "$LDFLAGS" > LDFLAGS - echo "$LIBCFLAGS" > LIBCFLAGS - echo "$LIBCXXFLAGS" > LIBCXXFLAGS - echo "$LICENSE" > LICENSE - echo "$PDEPEND" > PDEPEND - echo "$PF" > PF - echo "$PROVIDE" > PROVIDE - echo "$RDEPEND" > RDEPEND - echo "$RESTRICT" > RESTRICT - echo "$SLOT" > SLOT - echo "$USE" > USE - echo "${EAPI:-0}" > EAPI - - set > environment + for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \ + CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ + FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \ + LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT \ + KEYWORDS HOMEPAGE SRC_URI DESCRIPTION; do + [ -n "${!f}" ] && echo $(echo "${!f}" | tr '\n,\r,\t' ' , , ' | sed s/' \+'/' '/g) > ${f} + done + echo "${USE}" > USE + echo "${EAPI:-0}" > EAPI + set > environment export -p | sed 's:declare -rx:declare -x:' >> environment bzip2 -9 environment @@ -1089,7 +1104,7 @@ dyn_compile() { dyn_package() { trap "abort_package" SIGINT SIGQUIT - cd "${BUILDDIR}/image" + cd "${PORTAGE_BUILDDIR}/image" tar cpvf - ./ | bzip2 -f > ../bin.tar.bz2 || die "Failed to create tarball" cd .. xpak build-info inf.xpak @@ -1101,15 +1116,15 @@ dyn_package() { fi ln -sf "../All/${PF}.tbz2" "${PKGDIR}/${CATEGORY}/${PF}.tbz2" || die "Failed to create symlink in ${PKGDIR}/${CATEGORY}" echo ">>> Done." - cd "${BUILDDIR}" - touch .packaged || die "Failed to 'touch .packaged' in ${BUILDDIR}" + cd "${PORTAGE_BUILDDIR}" + touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}" trap SIGINT SIGQUIT } dyn_test() { [ "$(type -t pre_src_test)" == "function" ] && pre_src_test - if [ ${BUILDDIR}/.tested -nt "${WORKDIR}" ]; then + if [ "${PORTAGE_BUILDDIR}/.tested" -nt "${WORKDIR}" ]; then echo ">>> It appears that ${PN} has already been tested; skipping." [ "$(type -t post_src_test)" == "function" ] && post_src_test return @@ -1127,8 +1142,8 @@ dyn_test() { src_test fi - cd "${BUILDDIR}" - touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}" + cd "${PORTAGE_BUILDDIR}" + touch .tested || die "Failed to 'touch .tested' in ${PORTAGE_BUILDDIR}" [ "$(type -t post_src_test)" == "function" ] && post_src_test trap SIGINT SIGQUIT } @@ -1140,8 +1155,8 @@ PORTAGE_INST_GID="0" dyn_install() { trap "abort_install" SIGINT SIGQUIT [ "$(type -t pre_src_install)" == "function" ] && pre_src_install - rm -rf "${BUILDDIR}/image" - mkdir "${BUILDDIR}/image" + rm -rf "${PORTAGE_BUILDDIR}/image" + mkdir "${PORTAGE_BUILDDIR}/image" if [ -d "${S}" ]; then cd "${S}" fi @@ -1181,13 +1196,13 @@ dyn_install() { done if type -p scanelf > /dev/null ; then - local qa_sucks_for_sure=0 qa_kinda_sucks=0 + local insecure_rpath=0 # Make sure we disallow insecure RUNPATH/RPATH's # Don't want paths that point to the tree where the package was built # (older, broken libtools would do this). Also check for null paths # because the loader will search $PWD when it finds null paths. - f=$(scanelf -qyRF '%r %p' "${D}" | grep -E "(${BUILDDIR}|: |::|^ )") + f=$(scanelf -qyRF '%r %p' "${D}" | grep -E "(${PORTAGE_BUILDDIR}|: |::|^:|^ )") if [[ -n ${f} ]] ; then echo -ne '\a\n' echo "QA Notice: the following files contain insecure RUNPATH's" @@ -1196,7 +1211,7 @@ dyn_install() { echo " http://bugs.gentoo.org/81745" echo "${f}" echo -ne '\a\n' - qa_sucks_for_sure=1 + insecure_rpath=1 fi # Check for setid binaries but are not built with BIND_NOW @@ -1208,46 +1223,60 @@ dyn_install() { echo " LDFLAGS='-Wl,-z,now' emerge ${PN}" echo "${f}" echo -ne '\a\n' - qa_kinda_sucks=1 + die_msg="${die_msg} setXid lazy bindings," sleep 1 fi # TEXTREL's are baaaaaaaad f=$(scanelf -qyRF '%t %p' "${D}") if [[ -n ${f} ]] ; then + scanelf -qyRF '%T %p' "${WORKDIR}"/ &> "${T}"/scanelf-textrel.log echo -ne '\a\n' echo "QA Notice: the following files contain runtime text relocations" echo " Text relocations force the dynamic linker to perform extra" echo " work at startup, waste system resources, and may pose a security" echo " risk. On some architectures, the code may not even function" echo " properly, if at all." + echo " Please include this file in your report:" + echo " ${T}/scanelf-textrel.log" echo "${f}" echo -ne '\a\n' - qa_kinda_sucks=1 + die_msg="${die_msg} textrels," sleep 1 fi - # Check for files with executable stacks - f=$(scanelf -qyRF '%e %p' "${D}") + # Check for files with executable stacks, but only on arches which + # are supported at the moment. Keep this list in sync with + # http://hardened.gentoo.org/gnu-stack.xml (Arch Status) + case ${CTARGET:-${CHOST}} in + i?86*|ia64*|s390*|x86_64*) + f=$(scanelf -qyRF '%e %p' "${D}") ;; + *) + f="" ;; + esac if [[ -n ${f} ]] ; then + # One more pass to help devs track down the source + scanelf -qyRF '%e %p' "${WORKDIR}"/ &> "${T}"/scanelf-exec.log echo -ne '\a\n' echo "QA Notice: the following files contain executable stacks" echo " Files with executable stacks will not work properly (or at all!)" echo " on some architectures/operating systems. A bug should be filed" echo " at http://bugs.gentoo.org/ to make sure the file is fixed." + echo " Please include this file in your report:" + echo " ${T}/scanelf-exec.log" echo "${f}" echo -ne '\a\n' - qa_kinda_sucks=1 + die_msg="${die_msg} execstacks" sleep 1 fi # Save NEEDED information - scanelf -qyRF '%p %n' "${D}" | sed -e 's:^:/:' > "${BUILDDIR}"/build-info/NEEDED + scanelf -qyRF '%p %n' "${D}" | sed -e 's:^:/:' > "${PORTAGE_BUILDDIR}"/build-info/NEEDED - if [[ ${qa_sucks_for_sure} -eq 1 ]] ; then - die "Aborting due to serious QA concerns" - elif [[ ${qa_kinda_sucks} -eq 1 ]] && has stricter ${FEATURES} && ! has stricter ${RESTRICT} ; then - die "Aborting due to QA concerns" + if [[ ${insecure_rpath} -eq 1 ]] ; then + die "Aborting due to serious QA concerns with RUNPATH/RPATH" + elif [[ ${die_msg} != "" ]] && has stricter ${FEATURES} && ! has stricter ${RESTRICT} ; then + die "Aborting due to QA concerns: ${die_msg}" fi fi @@ -1334,7 +1363,7 @@ dyn_install() { if hasq multilib-strict ${FEATURES} && [ -x file -a -x find -a \ -n "${MULTILIB_STRICT_DIRS}" -a -n "${MULTILIB_STRICT_DENY}" ]; then - MULTILIB_STRICT_EXEMPT=${MULTILIB_STRICT_EXEMPT:-"(perl5|gcc|gcc-lib)"} + MULTILIB_STRICT_EXEMPT=${MULTILIB_STRICT_EXEMPT:-"(perl5|gcc|gcc-lib|debug)"} for dir in ${MULTILIB_STRICT_DIRS}; do [ -d "${D}/${dir}" ] || continue for file in $(find ${D}/${dir} -type f | @EGREP@ -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do @@ -1343,10 +1372,10 @@ dyn_install() { done fi - touch "${BUILDDIR}/.installed" + touch "${PORTAGE_BUILDDIR}/.installed" echo ">>> Completed installing ${PF} into ${D}" echo - cd ${BUILDDIR} + cd ${PORTAGE_BUILDDIR} [ "$(type -t post_src_install)" == "function" ] && post_src_install trap SIGINT SIGQUIT } @@ -1361,7 +1390,13 @@ dyn_preinst() { declare -r D=${IMAGE} pkg_preinst - # hopefully this will someday allow us to get rid of the no* feature flags + # remove man pages, info pages, docs if requested + for f in man info doc; do + if hasq no${f} $FEATURES; then + INSTALL_MASK="${INSTALL_MASK} /usr/share/${f}" + fi + done + # we don't want globbing for initial expansion, but afterwards, we do local shopts=$- set -o noglob @@ -1378,21 +1413,6 @@ dyn_preinst() { set +o noglob set -${shopts} - # remove man pages - if hasq noman $FEATURES; then - rm -fR "${IMAGE}/usr/share/man" - fi - - # remove info pages - if hasq noinfo $FEATURES; then - rm -fR "${IMAGE}/usr/share/info" - fi - - # remove docs - if hasq nodoc $FEATURES; then - rm -fR "${IMAGE}/usr/share/doc" - fi - # remove share dir if unnessesary if hasq nodoc $FEATURES -o hasq noman $FEATURES -o hasq noinfo $FEATURES; then rmdir "${IMAGE}/usr/share" &> /dev/null @@ -1513,7 +1533,7 @@ dyn_rpm() { dyn_help() { echo echo "Portage" - echo "Copyright 1999-2004 Gentoo Foundation" + echo "Copyright 1999-2006 Gentoo Foundation" echo echo "How to use the ebuild command:" echo @@ -1617,7 +1637,7 @@ debug-print-section() { declare -ix ECLASS_DEPTH=0 inherit() { ECLASS_DEPTH=$(($ECLASS_DEPTH + 1)) - if [[ $ECLASS_DEPTH > 1 ]]; then + if [[ ${ECLASS_DEPTH} > 1 ]]; then debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})" fi diff --git a/bin/emaint b/bin/emaint index d964ee0f9..eabe68687 100755 --- a/bin/emaint +++ b/bin/emaint @@ -4,7 +4,7 @@ import sys from copy import copy from optparse import OptionParser, OptionValueError - +import re import os, portage, portage_const class WorldHandler(object): @@ -16,8 +16,6 @@ class WorldHandler(object): def __init__(self): self.invalid = [] self.not_installed = [] - self.masked = [] - self.unavailable = [] self.okay = [] self.found = os.access(portage_const.WORLD_FILE, os.R_OK) @@ -26,8 +24,6 @@ class WorldHandler(object): self.invalid.append(atom) elif not portage.db["/"]["vartree"].dbapi.match(atom): self.not_installed.append(atom) - elif not portage.db["/"]["porttree"].dbapi.xmatch("match-all", atom): - self.unavailable.append(atom) elif not portage.db["/"]["porttree"].dbapi.match("match-visible", atom): self.masked.append(atom) else: @@ -38,8 +34,6 @@ class WorldHandler(object): if self.found: errors += map(lambda x: "'%s' is not a valid atom" % x, self.invalid) errors += map(lambda x: "'%s' is not installed" % x, self.not_installed) - errors += map(lambda x: "'%s' is masked (manually fix by adding to package.keywords)" % x, self.masked) - errors += map(lambda x: "'%s' has no ebuilds available" % x, self.unavailable) if self.masked: errors += "Masked ebuilds can be manually unmasked with package.keywords or package.unmask" else: @@ -54,71 +48,130 @@ class WorldHandler(object): errors.append(portage_const.WORLD_FILE + " could not be opened for writing") return errors +class VdbKeyHandler(object): + def name(): + return "vdbkeys" + name = staticmethod(name) -modules = {"world" : WorldHandler} + def __init__(self): + self.list = portage.db["/"]["vartree"].dbapi.cpv_all() + self.missing = [] + self.keys = ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"] + + for p in self.list: + mydir = os.path.join(os.sep, portage.settings["ROOT"], portage_const.VDB_PATH, p)+os.sep + ismissing = True + for k in self.keys: + if os.path.exists(mydir+k): + ismissing = False + break + if ismissing: + self.missing.append(p) + + def check(self): + return ["%s has missing keys" % x for x in self.missing] + + def fix(self): + + errors = [] + + for p in self.missing: + mydir = os.path.join(os.sep, portage.settings["ROOT"], portage_const.VDB_PATH, p)+os.sep + if not os.access(mydir+"environment.bz2", os.R_OK): + errors.append("Can't access %s" % (mydir+"environment.bz2")) + elif not os.access(mydir, os.W_OK): + errors.append("Can't create files in %s" % mydir) + else: + env = os.popen("bzip2 -dcq "+mydir+"environment.bz2", "r") + envlines = env.read().split("\n") + env.close() + for k in self.keys: + s = [l for l in envlines if l.startswith(k+"=")] + if len(s) > 1: + errors.append("multiple matches for %s found in %senvironment.bz2" % (k, mydir)) + elif len(s) == 0: + s = "" + else: + s = s[0].split("=",1)[1] + s = s.lstrip("$").strip("\'\"") + s = re.sub("(\\\\[nrt])+", " ", s) + s = " ".join(s.split()).strip() + if s != "": + try: + keyfile = open(mydir+os.sep+k, "w") + keyfile.write(s+"\n") + keyfile.close() + except (IOError, OSError), e: + errors.append("Could not write %s, reason was: %s" % (mydir+k, e)) + + return errors +# this sucks, should track this in a different manner. +modules = {"world" : WorldHandler, + "vdbkeys": VdbKeyHandler} module_names = modules.keys() module_names.sort() module_names.insert(0, "all") - -def exclusive(option, unused1, unused2, unused3, var=None): - if not var: - raise ValueError("var not specified to exclusive()") - if getattr(parser, var, ""): - raise OptionValueError("%s and %s are exclusive options" % (getattr(parser, var), value)) - setattr(parser, var, str(option)) +if __name__ == "__main__": + def exclusive(option, *args, **kw): + var = kw.get("var", None) + if var is None: + raise ValueError("var not specified to exclusive()") + if getattr(parser, var, ""): + raise OptionValueError("%s and %s are exclusive options" % (getattr(parser, var), option)) + setattr(parser, var, str(option)) -usage = "usage: emaint [options] " + " | ".join(module_names) + usage = "usage: emaint [options] " + " | ".join(module_names) -usage+= "\n\nCurrently emaint can only check and fix problems with one's world\n" -usage+= "file. Future versions will integrate other portage check-and-fix\n" -usage+= "tools and provide a single interface to system health checks." + usage+= "\n\nCurrently emaint can only check and fix problems with one's world\n" + usage+= "file. Future versions will integrate other portage check-and-fix\n" + usage+= "tools and provide a single interface to system health checks." -parser = OptionParser(usage=usage) -parser.add_option("-c", "--check", help="check for problems", - action="callback", callback=exclusive, callback_kwargs={"var":"action"}) -parser.add_option("-f", "--fix", help="attempt to fix problems", - action="callback", callback=exclusive, callback_kwargs={"var":"action"}) -parser.action = None + parser = OptionParser(usage=usage) + parser.add_option("-c", "--check", help="check for problems", + action="callback", callback=exclusive, callback_kwargs={"var":"action"}) + parser.add_option("-f", "--fix", help="attempt to fix problems", + action="callback", callback=exclusive, callback_kwargs={"var":"action"}) + parser.action = None -(options, args) = parser.parse_args() -if len(args) != 1: - parser.error("Incorrect number of arguments") -if args[0] not in module_names: - parser.error("%s target is not a known target" % args[0]) + (options, args) = parser.parse_args() + if len(args) != 1: + parser.error("Incorrect number of arguments") + if args[0] not in module_names: + parser.error("%s target is not a known target" % args[0]) -if parser.action: - action = parser.action -else: - print "Defaulting to --check" - action = "-c/--check" + if parser.action: + action = parser.action + else: + print "Defaulting to --check" + action = "-c/--check" -if args[0] == "all": - tasks = modules.values() -else: - tasks = [modules[args[0]]] + if args[0] == "all": + tasks = modules.values() + else: + tasks = [modules[args[0]]] -if action == "-c/--check": - status = "Checking %s for problems" - func = "check" -else: - status = "Attempting to fix %s" - func = "fix" + if action == "-c/--check": + status = "Checking %s for problems" + func = "check" + else: + status = "Attempting to fix %s" + func = "fix" -for task in tasks: - print status % task.name() - inst = task() - result = getattr(inst, func)() - if result: - print - print "\n".join(result) - print "\n" + for task in tasks: + print status % task.name() + inst = task() + result = getattr(inst, func)() + if result: + print + print "\n".join(result) + print "\n" -print "Finished" + print "Finished" diff --git a/bin/emake b/bin/emake index 02e38523f..bfbe87aa8 100755 --- a/bin/emake +++ b/bin/emake @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/emake,v 1.9.2.1 2005/05/18 15:19:52 jstubbs Exp $ # diff --git a/bin/emerge b/bin/emerge index b7e36e340..3059da79c 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/emerge,v 1.345.2.38 2005/08/13 17:25:26 ferringb Exp $ @@ -185,7 +185,7 @@ options=[ "--onlydeps", "--pretend", "--quiet", "--resume", "--searchdesc", "--selective", -"--skipfirst", +"--skipfirst", "--skip-first", "--tree", "--update", "--upgradeonly", "--usepkg", "--usepkgonly", @@ -246,6 +246,8 @@ for x in cmdline: if len(x)>=2 and x[0:2]=="--": if x == "--cols": x = "--columns" + elif x == "--skip-first": + x = "--skipfirst" if x in options: myopts.append(x) elif x[2:] in actions: @@ -326,6 +328,11 @@ if ("--tree" in myopts) and ("--columns" in myopts): if ("--quiet" in myopts): update_spinner = update_quiet_spinner + portage_util.noiselimit = -1 + portage.settings.unlock() + portage.settings["PORTAGE_QUIET"]="1" + portage.settings.backup_changes("PORTAGE_QUIET") + portage.settings.lock() # Always create packages if FEATURES=buildpkg # Imply --buildpkg if --buildpkgonly @@ -820,10 +827,10 @@ class search: if "--quiet" not in myopts: print " ", darkgreen("Latest version available:"),myversion print " ", self.getInstallationStatus(mycat+'/'+mypkg) - print " ", darkgreen("Size of downloaded files:"),mysum[0] - print " ", darkgreen("Homepage:")+" ",homepage - print " ", darkgreen("Description:"),desc - print " ", darkgreen("License:")+" ",license + print " ", darkgreen("Size of files:"),mysum[0] + print " ", darkgreen("Homepage:")+" ",homepage + print " ", darkgreen("Description:")+" ",desc + print " ", darkgreen("License:")+" ",license print print # @@ -948,16 +955,15 @@ class depgraph: # select the correct /var database that we'll be checking against vardbapi=portage.db[myroot]["vartree"].dbapi - if addme: - # if the package is already on the system, we add a "nomerge" - # directive, otherwise we add a "merge" directive. - if mytype=="blocks": - # we've encountered a "blocks" node. We will totally ignore this - # node and not add it to our digraph if it doesn't apply to us. - if "--buildpkgonly" not in myopts and myparent and (self.mydbapi[myroot].match(mykey) or vardbapi.match(mykey)): - mybigkey.append(myparent.split()[2]) - self.digraph.addnode(string.join(mybigkey),myparent) - return 1 + # if the package is already on the system, we add a "nomerge" + # directive, otherwise we add a "merge" directive. + if mytype=="blocks": + # we've encountered a "blocks" node. We will totally ignore this + # node and not add it to our digraph if it doesn't apply to us. + if addme and "--buildpkgonly" not in myopts and myparent and (self.mydbapi[myroot].match(mykey) or vardbapi.match(mykey)): + mybigkey.append(myparent.split()[2]) + self.digraph.addnode(string.join(mybigkey),myparent) + return 1 if myuse == None: self.pkgsettings.setcpv(mykey) @@ -1430,6 +1436,7 @@ class depgraph: newlist.append(atom) mylist = newlist + missing_atoms = [] for mydep in mylist: try: if not self.select_dep(portage.root, mydep, raise_on_missing=True): @@ -1438,12 +1445,17 @@ class depgraph: except ValueError: if "--debug" in myopts: raise - world_problems = True + missing_atoms.append(mydep) if world_problems: print "\n!!! Problems have been detected with your world file" print "!!! Please run "+green("emaint --check world")+"\n" + if missing_atoms and "--verbose" in myopts: + print "\n!!! Packages for the following atoms are either all" + print "!!! masked or don't exist:" + print " ".join(missing_atoms) + "\n" + return 1 def match(self,mydep,myroot=portage.root,mykey=None): @@ -1481,41 +1493,29 @@ class depgraph: p=[] totalsize=0 - if "--verbose" in myopts: - # Full USE display - def create_use_string(name, cur_iuse, cur_use, old_iuse, old_use, is_new): - usestrs = [] - for flag in cur_iuse: - suffix = "" - if flag in cur_use: - color = red - prefix = "" - else: - color = blue - prefix = "-" - if not is_new and ((flag in old_use) ^ (flag in cur_use)): - color = green - suffix = "*" - usestrs.append(color(prefix+flag)+suffix) - ret = " ".join(usestrs) - if ret: - ret = '%s="%s" ' % (name, ret) - return ret + if "--quiet" in myopts: + def create_use_string(*args): + return "" else: - # Changed-since-previous USE display - def create_use_string(name, cur_iuse, cur_use, old_iuse, old_use, is_new): + def create_use_string(name, cur_iuse, cur_use, old_iuse, old_use, is_new, all_flags=("--verbose" in myopts)): enabled = [] disabled = [] for flag in cur_iuse: - if flag in cur_use and flag not in old_use: - if flag in old_iuse: - enabled.append(green(flag)+"*") - else: + if flag in cur_use: + if is_new or flag in old_use and all_flags: enabled.append(red(flag)) - elif flag not in cur_use and flag in old_use: - disabled.append(green("-"+flag)+"*") - elif is_new or flag not in old_iuse: - disabled.append(blue("-"+flag)) + elif flag not in old_iuse: + enabled.append(yellow(flag)+"%") + elif flag not in old_use: + enabled.append(green(flag)+"*") + else: + if is_new or flag in old_iuse and flag not in old_use and all_flags: + disabled.append(blue("-"+flag)) + elif flag not in old_iuse: + disabled.append(yellow("-"+flag)+"%") + elif flag in old_use: + disabled.append(green("-"+flag)+"*") + enabled = " ".join(enabled) disabled = " ".join(disabled) if enabled and disabled: @@ -1679,7 +1679,7 @@ class depgraph: for key in use_expand: verboseadd += create_use_string(key.upper(), cur_iuse_map[key], cur_use_map[key], - old_iuse_map[key], cur_use_map[key], is_new) + old_iuse_map[key], old_use_map[key], is_new) if "--verbose" in myopts: # size verbose @@ -1938,6 +1938,9 @@ class depgraph: sys.stderr = open("/dev/null","w") os.dup2(sys.stdout.fileno(), 1) os.dup2(sys.stdout.fileno(), 2) + # wipe the mtimedb so that portage doesn't attempt to flush it. + # do not convert this code away from a fork without correcting this. + portage.mtimedb = None for x in ("autoaddcvs", "cvs"): try: myfeat.remove(x) except ValueError: pass @@ -2881,6 +2884,13 @@ if myaction in ["sync","rsync","metadata"] and (not "--help" in myopts): chk_updated_cfg_files() + if myaction != "metadata": + if os.access(portage.USER_CONFIG_PATH + "/bin/post_sync", os.X_OK): + try: + portage.spawn(portage.USER_CONFIG_PATH + "/bin/post_sync " + dosyncuri, portage.settings, free=1) + except: + print red(" * ")+bold("spawn failed of "+ portage.USER_CONFIG_PATH + "/bin/post_sync") + if(mybestpv != mypvs) and not "--quiet" in myopts: print print red(" * ")+bold("An update to portage is available.")+" It is _highly_ recommended" diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index d65c15617..49034d007 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/Attic/emerge-webrsync,v 1.8.2.4 2005/02/26 11:22:38 carpaski Exp $ # Author: Karl Trygve Kalleberg diff --git a/bin/env-update b/bin/env-update index 18074603b..938373e49 100755 --- a/bin/env-update +++ b/bin/env-update @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/env-update,v 1.9 2004/10/04 13:56:50 vapier Exp $ @@ -7,5 +7,20 @@ import os,sys os.environ["PORTAGE_CALLER"] = "env-update" sys.path = ["@PORTAGE_BASE@/pym"]+sys.path +def usage(status): + print "Usage: env-update" + print "" + print "See the env-update(1) man page for more info" + sys.exit(status) + +if "-h" in sys.argv or "--help" in sys.argv: + usage(0) + +makelinks=1 + +if len(sys.argv) > 1: + print "!!! Invalid command line options!\n" + usage(1) + import portage -portage.env_update() +portage.env_update(makelinks) diff --git a/bin/env-update.sh b/bin/env-update.sh index 9f3c939cf..6fd8694ce 100755 --- a/bin/env-update.sh +++ b/bin/env-update.sh @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/env-update.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/etc-update b/bin/etc-update index f1970628f..06b55bc85 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: etc-update 2221 2005-11-01 01:32:07Z vapier $ diff --git a/bin/find-requires b/bin/find-requires index 5e5742cdb..8399326da 100755 --- a/bin/find-requires +++ b/bin/find-requires @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/find-requires,v 1.5 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/fix-db.py b/bin/fix-db.py index 7cf15b12d..92e9f4e5d 100755 --- a/bin/fix-db.py +++ b/bin/fix-db.py @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fix-db.py,v 1.8 2004/10/11 04:01:00 jstubbs Exp $ diff --git a/bin/fixdbentries b/bin/fixdbentries index 6b8640172..1b71d0587 100755 --- a/bin/fixdbentries +++ b/bin/fixdbentries @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fixdbentries,v 1.3 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/fixpackages b/bin/fixpackages index 85b9ec7c3..8b9172fc2 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/fixpackages,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/fowners b/bin/fowners index 06ec6d4d3..1919340a1 100755 --- a/bin/fowners +++ b/bin/fowners @@ -1,15 +1,7 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: /var/cvsroot/gentoo-src/portage/bin/fowners,v 1.6 2004/10/04 13:56:50 vapier Exp $ +# $Id: fowners 1912 2005-08-25 03:54:42Z ferringb $ -if [ ${#} -lt 2 ] ; then - echo "${0}: at least two arguments needed" - exit 1 -fi - -OWNER="${1}" -shift -for FILE in $*; do - chown "${OWNER}" "${D}${FILE}" -done +slash=/ +exec chown "${@/#${slash}/${D}${slash}}" diff --git a/bin/fperms b/bin/fperms index efb159ce5..f24324982 100755 --- a/bin/fperms +++ b/bin/fperms @@ -1,15 +1,7 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: /var/cvsroot/gentoo-src/portage/bin/fperms,v 1.6 2004/10/04 13:56:50 vapier Exp $ +# $Id: fperms 1912 2005-08-25 03:54:42Z ferringb $ -if [ ${#} -lt 2 ] ; then - echo "${0}: at least two arguments needed" - exit 1 -fi - -PERM="${1}" -shift -for FILE in $*; do - chmod "${PERM}" "${D}${FILE}" -done +slash=/ +exec chmod "${@/#${slash}/${D}${slash}}" diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 860bc5890..20be25e77 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -1,4 +1,4 @@ -# Copyright 1999-2004 Gentoo Technologies, Inc. +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ @@ -16,28 +16,28 @@ elog_base() { return 1 ;; esac - echo ${*} >> ${T}/logging/${EBUILD_PHASE}.${messagetype} + echo "$*" >> ${T}/logging/${EBUILD_PHASE}.${messagetype} return 0 } elog() { - elog_base LOG ${*} - echo -e " ${GOOD}*${NORMAL} ${*}" + elog_base LOG "$*" + echo -e " ${GOOD}*${NORMAL} $*" return 0 } esyslog() { local pri= local tag= - + if [ -x /usr/bin/logger ] then pri="$1" tag="$2" - + shift 2 [ -z "$*" ] && return 0 - + /usr/bin/logger -p "${pri}" -t "${tag}" -- "$*" fi @@ -45,160 +45,165 @@ esyslog() { } einfo() { - einfon ${*} - echo + einfon "$*\n" + LAST_E_CMD="einfo" return 0 } einfon() { - elog_base INFO ${*} - echo -ne " ${GOOD}*${NORMAL} ${*}" + elog_base INFO "$*" + [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo + echo -ne " ${GOOD}*${NORMAL} $*" + LAST_E_CMD="einfon" return 0 } ewarn() { - elog_base WARN ${*} - echo -e " ${WARN}*${NORMAL} ${*}" + elog_base WARN "$*" + [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo + echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*" + LAST_E_CMD="ewarn" return 0 } eerror() { - elog_base ERROR ${*} - echo -e " ${BAD}*${NORMAL} ${*}" + elog_base ERROR "$*" + [[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo + echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*" + LAST_E_CMD="eerror" return 0 } ebegin() { - if [ -z "${NOCOLOR}" ]; then - echo -ne " ${GOOD}*${NORMAL} ${*}..." + local msg="$*" dots spaces=${RC_DOT_PATTERN//?/ } + if [[ -n ${RC_DOT_PATTERN} ]] ; then + dots=$(printf "%$(( COLS - 3 - ${#RC_INDENTATION} - ${#msg} - 7 ))s" '') + dots=${dots//${spaces}/${RC_DOT_PATTERN}} + msg="${msg}${dots}" else - echo -e " ${GOOD}*${NORMAL} ${*}..." + msg="${msg} ..." fi + einfon "${msg}" + [[ ${RC_ENDCOL} == "yes" ]] && echo + LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} )) + LAST_E_CMD="ebegin" return 0 } -eend() { - local retval= - if [ "$#" -eq 0 ] || [ "${1:-1}" -eq 0 ]; then - echo -e "${ENDCOL} ${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}" +_eend() { + local retval=${1:-0} efunc=${2:-eerror} msg + shift 2 + + if [[ ${retval} == "0" ]] ; then + msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}" else - retval="$1" - - if [ "$#" -ge 2 ] - then - shift - eerror "${*}" + if [[ -n $* ]] ; then + ${efunc} "$*" fi - echo -e "${ENDCOL} ${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}" - # extra spacing makes it easier to read - echo - return ${retval} + msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}" fi - return 0 + + if [[ ${RC_ENDCOL} == "yes" ]] ; then + echo -e "${ENDCOL} ${msg}" + else + [[ ${LAST_E_CMD} == ebegin ]] || LAST_E_LEN=0 + printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}" + fi + + return ${retval} } -KV_major() { - local KV= - - [ -z "$1" ] && return 1 +eend() { + local retval=${1:-0} + shift - KV="$(echo "$1" | \ - awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }')" - echo "${KV}" | awk -- 'BEGIN { FS = "." } { print $1 }' + _eend ${retval} eerror "$*" - return 0 + return ${retval} } -KV_minor() { - local KV= - - [ -z "$1" ] && return 1 +KV_major() { + [[ -z $1 ]] && return 1 - KV="$(echo "$1" | \ - awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }')" - echo "${KV}" | awk -- 'BEGIN { FS = "." } { print $2 }' + local KV=$@ + echo "${KV%%.*}" +} - return 0 +KV_minor() { + [[ -z $1 ]] && return 1 + + local KV=$@ + KV=${KV#*.} + echo "${KV%%.*}" } KV_micro() { - local KV= - - [ -z "$1" ] && return 1 - - KV="$(echo "$1" | \ - awk '{ tmp = $0; gsub(/^[0-9\.]*/, "", tmp); sub(tmp, ""); print }')" - echo "${KV}" | awk -- 'BEGIN { FS = "." } { print $3 }' + [[ -z $1 ]] && return 1 - return 0 + local KV=$@ + KV=${KV#*.*.} + echo "${KV%%[^[:digit:]]*}" } KV_to_int() { - local KV_MAJOR= - local KV_MINOR= - local KV_MICRO= - local KV_int= - - [ -z "$1" ] && return 1 - - KV_MAJOR="$(KV_major "$1")" - KV_MINOR="$(KV_minor "$1")" - KV_MICRO="$(KV_micro "$1")" - KV_int="$((KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO))" - + [[ -z $1 ]] && return 1 + + local KV_MAJOR=$(KV_major "$1") + local KV_MINOR=$(KV_minor "$1") + local KV_MICRO=$(KV_micro "$1") + local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) + # We make version 2.2.0 the minimum version we will handle as # a sanity check ... if its less, we fail ... - if [ "${KV_int}" -ge 131584 ] - then + if [[ ${KV_int} -ge 131584 ]] ; then echo "${KV_int}" - return 0 fi return 1 -} +} +_RC_GET_KV_CACHE="" get_KV() { - local KV="$(uname -r)" + [[ -z ${_RC_GET_KV_CACHE} ]] \ + && _RC_GET_KV_CACHE=$(uname -r) - echo "$(KV_to_int "${KV}")" + echo $(KV_to_int "${_RC_GET_KV_CACHE}") return $? } -getcols() { - echo "$2" -} - unset_colors() { COLS="25 80" ENDCOL= - + GOOD= WARN= BAD= NORMAL= HILITE= BRACKET= - - if [ -n "${EBUILD}" ] && [ "${*/depend}" = "$*" ]; then - stty cols 80 &>/dev/null - stty rows 25 &>/dev/null - fi } set_colors() { - COLS="`stty size 2> /dev/null`" - COLS="`getcols ${COLS}`" - COLS=$((${COLS} - 7)) - ENDCOL=$'\e[A\e['${COLS}'G' # Now, ${ENDCOL} will move us to the end of the + COLS=${COLUMNS:-0} # bash's internal COLUMNS variable + (( COLS == 0 )) && COLS=$(set -- `stty size 2>/dev/null` ; echo $2) + (( COLS > 0 )) || (( COLS = 80 )) + COLS=$((${COLS} - 8)) # width of [ ok ] == 7 + + ENDCOL=$'\e[A\e['${COLS}'C' # Now, ${ENDCOL} will move us to the end of the # column; irregardless of character width - + GOOD=$'\e[32;01m' WARN=$'\e[33;01m' BAD=$'\e[31;01m' - NORMAL=$'\e[0m' HILITE=$'\e[36;01m' BRACKET=$'\e[34;01m' + NORMAL=$'\e[0m' } + +RC_ENDCOL="yes" +RC_INDENTATION='' +RC_DEFAULT_INDENT=2 +RC_DOT_PATTERN='' true diff --git a/bin/md5check.py b/bin/md5check.py index c72fc1b8f..bdc788dd4 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.py,v 1.4 2004/10/10 10:07:20 carpaski Exp $ diff --git a/bin/md5check.sh b/bin/md5check.sh index 6c229f70b..a0361a96d 100755 --- a/bin/md5check.sh +++ b/bin/md5check.sh @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/mirror.py b/bin/mirror.py index 2b348c6f2..8830b6015 100755 --- a/bin/mirror.py +++ b/bin/mirror.py @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/mirror.py,v 1.3 2004/10/10 10:07:20 carpaski Exp $ diff --git a/bin/newbin b/bin/newbin index d8c005679..c3f291b87 100755 --- a/bin/newbin +++ b/bin/newbin @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newbin,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newconfd b/bin/newconfd index 5fc6971ef..dcb57ce7a 100755 --- a/bin/newconfd +++ b/bin/newconfd @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newconfd,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newdoc b/bin/newdoc index b19cff1d6..38d5424fe 100755 --- a/bin/newdoc +++ b/bin/newdoc @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newdoc,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newenvd b/bin/newenvd index a5ec9f9bb..452add109 100755 --- a/bin/newenvd +++ b/bin/newenvd @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newenvd,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newexe b/bin/newexe index 9edd296e7..f4ddf67d4 100755 --- a/bin/newexe +++ b/bin/newexe @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newexe,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newinitd b/bin/newinitd index ef6f2bcf1..62de7b075 100755 --- a/bin/newinitd +++ b/bin/newinitd @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newinitd,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newins b/bin/newins index b549a29d7..72c084ea3 100755 --- a/bin/newins +++ b/bin/newins @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newins,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newlib.a b/bin/newlib.a index ebd3c0eca..7f9d80d58 100755 --- a/bin/newlib.a +++ b/bin/newlib.a @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newlib.a,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newlib.so b/bin/newlib.so index 99e139509..1aa6747fb 100755 --- a/bin/newlib.so +++ b/bin/newlib.so @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newlib.so,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newman b/bin/newman index fb47a8854..ce817a622 100755 --- a/bin/newman +++ b/bin/newman @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newman,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/newsbin b/bin/newsbin index 4f4aec65d..985a62330 100755 --- a/bin/newsbin +++ b/bin/newsbin @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/newsbin,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/pkgmerge b/bin/pkgmerge index 137b11d43..4499599fe 100755 --- a/bin/pkgmerge +++ b/bin/pkgmerge @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/pkgmerge,v 1.8 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/pkgmerge.new b/bin/pkgmerge.new index 46b6f03ea..cfab4f9d3 100755 --- a/bin/pkgmerge.new +++ b/bin/pkgmerge.new @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/pkgmerge.new,v 1.7 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/pkgname b/bin/pkgname index 9a5314830..d60bac803 100755 --- a/bin/pkgname +++ b/bin/pkgname @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/pkgname,v 1.8 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/portage_gpg_update.sh b/bin/portage_gpg_update.sh index f3f76f21f..7d526c231 100755 --- a/bin/portage_gpg_update.sh +++ b/bin/portage_gpg_update.sh @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/portage_gpg_update.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/portageq b/bin/portageq index a3125a13d..70e5d55b9 100755 --- a/bin/portageq +++ b/bin/portageq @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/portageq,v 1.13.2.1 2005/04/12 12:23:41 jstubbs Exp $ @@ -47,6 +47,7 @@ def has_version(argv): sys.exit(1) except KeyError: sys.exit(1) +has_version.uses_root = True def best_version(argv): @@ -61,6 +62,7 @@ def best_version(argv): print portage.best(mylist) except KeyError: sys.exit(1) +best_version.uses_root = True def mass_best_version(argv): @@ -76,6 +78,7 @@ def mass_best_version(argv): print pack+":"+portage.best(mylist) except KeyError: sys.exit(1) +mass_best_version.uses_root = True def best_visible(argv): @@ -90,6 +93,7 @@ def best_visible(argv): print portage.best(mylist) except KeyError: sys.exit(1) +best_visible.uses_root = True def mass_best_visible(argv): @@ -105,6 +109,7 @@ def mass_best_visible(argv): print pack+":"+portage.best(mylist) except KeyError: sys.exit(1) +mass_best_visible.uses_root = True def all_best_visible(argv): @@ -119,6 +124,8 @@ def all_best_visible(argv): mybest=portage.best(portage.db[argv[0]]["porttree"].dbapi.match(pkg)) if mybest: print mybest +all_best_visible.uses_root = True + def match(argv): """ @@ -131,6 +138,7 @@ def match(argv): print string.join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]),"\n") except KeyError: sys.exit(1) +match.uses_root = True def vdb_path(argv): @@ -140,6 +148,7 @@ def vdb_path(argv): """ print portage.root+portage.VDB_PATH + def gentoo_mirrors(argv): """ Returns the mirrors set to use in the portage configuration. @@ -194,11 +203,14 @@ def envvar(argv): Returns a specific environment variable as exists prior to ebuild.sh. Similar to: emerge --verbose --info | @EGREP@ '^=' """ - if (argv[0] == "-v"): - verbose=1 - argv=argv[1:] - else: - verbose=0 + verbose = "-v" in argv + if verbose: + argv.pop(argv.index("-v")) + + if len(argv) == 0: + print "ERROR: insufficient parameters!" + sys.exit(2) + for arg in argv: if verbose: print arg +"='"+ portage.settings[arg] +"'" @@ -255,13 +267,16 @@ def main(): usage(sys.argv) sys.exit() - # no more fatties - global portage - import portage - cmd = sys.argv[1] try: function = globals()[cmd] + uses_root = (getattr(function, "uses_root", False) and len(sys.argv) > 2) + if uses_root: + os.environ["ROOT"] = sys.argv[2] + global portage + import portage + if uses_root: + sys.argv[2] = portage.root function(sys.argv[2:]) except KeyError: usage(sys.argv) diff --git a/bin/prepall b/bin/prepall index dc96dc50c..9dff8f111 100755 --- a/bin/prepall +++ b/bin/prepall @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: prepall 2230 2005-11-01 01:35:59Z vapier $ @@ -72,6 +72,7 @@ for d in "${D}"lib* "${D}"usr/lib* ; do if [[ -n ${f} ]] ; then echo -e "\n\aQA Notice: the following shared libraries lack a SONAME\a" echo "${f}" + echo sleep 1 fi @@ -79,8 +80,10 @@ for d in "${D}"lib* "${D}"usr/lib* ; do if [[ -n ${f} ]] ; then echo -e "\n\aQA Notice: the following shared libraries lack NEEDED entries\a" echo "${f}" + echo sleep 1 fi done fi + diff --git a/bin/prepalldocs b/bin/prepalldocs index 64aca6222..bb6948c90 100755 --- a/bin/prepalldocs +++ b/bin/prepalldocs @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepalldocs,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepallinfo b/bin/prepallinfo index 2d6b9e609..7d30031b7 100755 --- a/bin/prepallinfo +++ b/bin/prepallinfo @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallinfo,v 1.6 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepallman b/bin/prepallman index 456ee004b..b241fff59 100755 --- a/bin/prepallman +++ b/bin/prepallman @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallman,v 1.10 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepallstrip b/bin/prepallstrip index 8d876ff66..3be06084e 100755 --- a/bin/prepallstrip +++ b/bin/prepallstrip @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallstrip,v 1.12 2004/10/04 13:56:50 vapier Exp $ diff --git a/bin/prepinfo b/bin/prepinfo index 62d911f37..fa44a086c 100755 --- a/bin/prepinfo +++ b/bin/prepinfo @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepinfo,v 1.6.2.1 2005/05/29 12:40:08 jstubbs Exp $ diff --git a/bin/preplib b/bin/preplib index d92e6dad4..844b3ab27 100755 --- a/bin/preplib +++ b/bin/preplib @@ -1,9 +1,9 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/preplib,v 1.7.2.1 2005/01/02 09:36:02 jstubbs Exp $ -ewarn "QA Notice: Please stop using me, fix your package instead" +echo "QA Notice: Please stop using me, fix your package instead" 1>&2 LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then diff --git a/bin/prepman b/bin/prepman index 46435cdf0..19aba773d 100755 --- a/bin/prepman +++ b/bin/prepman @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepman,v 1.10.2.3 2005/05/29 12:40:08 jstubbs Exp $ diff --git a/bin/prepstrip b/bin/prepstrip index 73f3a164a..8a7d500c7 100755 --- a/bin/prepstrip +++ b/bin/prepstrip @@ -1,15 +1,19 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepstrip,v 1.23.2.3 2005/08/15 02:58:20 vapier Exp $ -if [ "${FEATURES//*nostrip*/true}" == "true" ] || [ "${RESTRICT//*nostrip*/true}" == "true" ] ; then - echo "nostrip" +if [[ " ${FEATURES} " == *" nostrip "* ]] || \ + [[ " ${RESTRICT} " == *" nostrip "* ]] || \ + [[ " ${RESTRICT} " == *" strip "* ]] +then exit 0 fi -STRIP="${STRIP:-${CHOST}-strip}" +STRIP=${STRIP:-${CHOST}-strip} type -p -- ${STRIP} > /dev/null || STRIP=strip +OBJCOPY=${OBJCOPY:-${CHOST}-objcopy} +type -p -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS:---strip-unneeded} @@ -19,29 +23,51 @@ save_elf_debug() { local x=$1 local y="${D}/usr/lib/debug/${x:${#D}:${#x}}" - [ "${FEATURES//*splitdebug*/true}" != "true" ] && return 0 + [[ " ${FEATURES} " != *" splitdebug "* ]] && return 0 - mkdir -p $(dirname ${y}) - ${CHOST}-objcopy --only-keep-debug ${x} ${y}.debug - ${CHOST}-objcopy --add-gnu-debuglink=${y}.debug ${x} + # dont save debug info twice. + [[ ${x:7} == ".debug" ]] && return 0 + + mkdir -p $(dirname "${y}") + ${OBJCOPY} --only-keep-debug ${x} ${y}.debug + ${OBJCOPY} --add-gnu-debuglink=${y}.debug ${x} + + [[ " ${FEATURES} " != *" installsources "* ]] && return 0 + + if [[ -x "/usr/bin/debugedit" ]] ; then + debugedit -b "${WORKDIR}" -d /usr/src/debug/${PF} -l "${T}"/debug.sources "${x}" + if [[ -s ${T}/debug.sources ]] ; then + [[ -d ${D}/usr/src/debug/${PF} ]] || mkdir -p "${D}/usr/src/debug/${PF}" + cat "${T}"/debug.sources | (cd "${WORKDIR}"; LANG=C sort -z -u | xargs -0 -- cp --parents -p --target-directory="${D}/usr/src/debug/${PF}" ) + fi } -for x in $(scanelf -yRBF%F "$@") $(for y in "$@"; do find $y -type f -name '*.a' -print0 ; done); do - if [ ${banner} -eq 1 ] ; then +for x in $(scanelf -yRBF%F "$@") $(for y in "$@"; do find "${y}" -type f -name '*.a' -print0 ; done); do + if [[ ${banner} -eq 1 ]] ; then echo "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}" banner=0 fi f=$(file "${x}") || continue - [ -z "${f}" ] && continue + [[ -z ${f} ]] && continue + + # The noglob funk is to support STRIP_MASK="/*/booga" and to keep + # the for loop from expanding the globs. + # The eval echo is to support STRIP_MASK="/*/{booga,bar}" sex. + set -o noglob + stripitbaby=1 + for m in $(eval echo ${STRIP_MASK}) ; do + [[ ${x} == ${m} ]] && stripitbaby=1 && break + done + set +o noglob if [[ ${f} == *"current ar archive"* ]] ; then echo " ${x:${#D}:${#x}}" - ${STRIP} -g "${x}" + [[ ${stripitbaby} -eq 1 ]] && ${STRIP} -g "${x}" fi if [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then echo " ${x:${#D}:${#x}}" save_elf_debug "${x}" - ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" + [[ ${stripitbaby} -eq 1 ]] && ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" fi done diff --git a/bin/quickpkg b/bin/quickpkg index 45df6a193..61b9cd7ba 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -1,5 +1,5 @@ #!@BASH@ -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/quickpkg,v 1.13.2.6 2005/08/10 22:08:48 vapier Exp $ diff --git a/bin/regenworld b/bin/regenworld index ac8ff2362..94acf10a1 100755 --- a/bin/regenworld +++ b/bin/regenworld @@ -1,5 +1,5 @@ #!@PYTHON@ -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/regenworld,v 1.10.2.1 2005/01/11 03:40:57 carpaski Exp $ diff --git a/bin/repoman b/bin/repoman index 7643b1597..bccf8320f 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2005 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/repoman,v 1.98.2.23 2005/06/18 01:00:43 vapier Exp $ @@ -26,6 +26,7 @@ import portage import portage_checksum import portage_const import portage_dep +import portage_exception import cvstree import time import codecs @@ -96,11 +97,12 @@ qahelp={ "file.size":"Files in the files directory must be under 20k", "file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars, "file.UTF8":"File is not UTF8 compliant", - "KEYWORDS.missing":"Ebuilds that have a missing KEYWORDS variable", - "LICENSE.missing":"Ebuilds that have a missing LICENSE variable", - "DESCRIPTION.missing":"Ebuilds that have a missing DESCRIPTION variable", - "SLOT.missing":"Ebuilds that have a missing SLOT variable", - "HOMEPAGE.missing":"Ebuilds that have a missing HOMEPAGE variable", + "KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable", + "KEYWORDS.stupid":"Ebuilds that use KEYWORDS=-* instead of package.mask", + "LICENSE.missing":"Ebuilds that have a missing or empty LICENSE variable", + "DESCRIPTION.missing":"Ebuilds that have a missing or empty DESCRIPTION variable", + "SLOT.missing":"Ebuilds that have a missing or empty SLOT variable", + "HOMEPAGE.missing":"Ebuilds that have a missing or empty HOMEPAGE variable", "DEPEND.bad":"User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds)", "RDEPEND.bad":"User-visible ebuilds with bad RDEPEND settings (matched against *visible* ebuilds)", "PDEPEND.bad":"User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds)", @@ -117,6 +119,7 @@ qahelp={ "RDEPEND.syntax":"Syntax error in RDEPEND (usually an extra/missing space/parenthesis)", "PDEPEND.syntax":"Syntax error in PDEPEND (usually an extra/missing space/parenthesis)", "LICENSE.syntax":"Syntax error in LICENSE (usually an extra/missing space/parenthesis)", + "PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)", "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error", "ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.", "ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.", @@ -155,6 +158,7 @@ qawarnings=[ "DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev", "DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev", "IUSE.invalid", +"KEYWORDS.stupid", "ebuild.minorsyn", "ebuild.badheader", "file.size", @@ -210,7 +214,7 @@ def help(): print print green(exename+" "+version) print " \"Quality is job zero.\"" - print " Copyright 1999-2005 Gentoo Foundation" + print " Copyright 1999-2006 Gentoo Foundation" print " Distributed under the terms of the GNU General Public License v2" print print bold(" Usage:"),turquoise(exename),"[",green("option"),"] [",green("mode"),"]" @@ -286,7 +290,7 @@ def last(): print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.") print if dowarn and not dofail: - print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\nI took it, but I wasn't happy.\"" + print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\n I took it, but I wasn't happy.\"" elif not dofail: print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"" print @@ -806,7 +810,7 @@ for x in scanlist: else: stats["digest.partial"] += 1 fails["digest.partial"].append(y+"::"+myf) - else: + elif "assume-digests" not in portage.features: if os.path.exists(myff): if not portage_checksum.verify_all(myff, mydigests[myf]): stats["digest.fail"] += 1 @@ -941,6 +945,18 @@ for x in scanlist: stats[myqakey]=stats[myqakey]+1 fails[myqakey].append(x+"/"+y+".ebuild") + # KEYWORDS="-*" is a stupid replacement for package.mask and screws general KEYWORDS semantics + if "-*" in myaux["KEYWORDS"].split(): + haskeyword = False + for kw in myaux["KEYWORDS"].split(): + if kw[0] == "~": + kw = kw[1:] + if kw in kwlist: + haskeyword = True + if not haskeyword: + stats["KEYWORDS.stupid"] += 1 + fails["KEYWORDS.stupid"].append(x+"/"+y+".ebuild") + if "--ignore-other-arches" in myoptions: arches=[[repoman_settings["ARCH"], repoman_settings["ARCH"], portage.groups]] else: @@ -956,29 +972,60 @@ for x in scanlist: baddepsyntax = False badlicsyntax = False + badprovsyntax = False catpkg = catdir+"/"+y - for mytype in ["DEPEND","RDEPEND","PDEPEND","LICENSE"]: + myiuse = myaux["IUSE"].split() + portage.archlist + type_list, badsyntax = [], [] + for mytype in ("DEPEND", "RDEPEND", "PDEPEND", "LICENSE", "PROVIDE"): mydepstr = myaux[mytype] + if (string.find(mydepstr, " ?") != -1): - stats[mytype+".syntax"] += 1 - fails[mytype+".syntax"].append(catpkg+".ebuild "+mytype+": '?' preceded by space") - if mytype != "LICENSE": - baddepsyntax = True - else: - badlicsyntax = True + badsyntax.append("'?' preceded by space") + try: # Missing closing parenthesis will result in a ValueError - mydeplist=portage_dep.paren_reduce(mydepstr) + mydeplist = portage_dep.paren_reduce(mydepstr) # Missing opening parenthesis will result in a final "" element if "" in mydeplist or "(" in mydeplist: raise ValueError except ValueError: - stats[mytype+".syntax"] += 1 - fails[mytype+".syntax"].append(catpkg+".ebuild "+mytype+": Mismatched parenthesis") - if mytype != "LICENSE": - baddepsyntax = True + badsyntax.append("parenthesis mismatch") + mydeplist = [] + + try: + portage_dep.use_reduce(mydeplist, excludeall=myiuse) + except portage_exception.InvalidDependString, e: + badsyntax.append(str(e)) + + for token in ("||", "(", ")"): + if mydepstr.startswith(token+" "): + myteststr = mydepstr[len(token):] else: - badlicsyntax = True + myteststr = mydepstr + if myteststr.endswith(" "+token): + myteststr = myteststr[:-len(token)] + while myteststr.find(" "+token+" ") != -1: + myteststr = " ".join(myteststr.split(" "+token+" ", 1)) + if myteststr.find(token) != -1: + badsyntax.append("'%s' not separated by space" % (token)) + + + if mytype in ("DEPEND", "RDEPEND", "PDEPEND"): + for token in filter(lambda x: not (x.endswith("?") or x.strip() in ("||", "&&", "(", ")")), mydepstr.split()): + if not "/" in token: + badsyntax.append("'%s' not a valid atom" % token) + + type_list.extend([mytype] * (len(badsyntax) - len(type_list))) + + for m,b in zip(type_list, badsyntax): + stats[m+".syntax"] += 1 + fails[m+".syntax"].append(catpkg+".ebuild "+m+": "+b) + + badlicsyntax = len(filter(lambda x:x=="LICENSE", type_list)) + badprovsyntax = len(filter(lambda x:x=="PROVIDE", type_list)) + baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax + badlicsyntax = badlicsyntax > 0 + badprovsyntax = badprovsyntax > 0 for keyword,arch,groups in arches: portage.groups=groups @@ -1263,7 +1310,7 @@ if mymode!="commit": print bold("Note: type \"repoman full\" for a complete listing.") print if dowarn and not dofail: - print green("RepoMan sez:"),"\"You're only giving me a partial QA payment?\nI'll take it this time, but I'm not happy.\"" + print green("RepoMan sez:"),"\"You're only giving me a partial QA payment?\n I'll take it this time, but I'm not happy.\"" elif not dofail: print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"" print diff --git a/bin/xpak b/bin/xpak index 8e4fec656..30127c96b 100755 --- a/bin/xpak +++ b/bin/xpak @@ -1,5 +1,5 @@ #!@PYTHON@ -O -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/xpak,v 1.10 2004/10/04 13:56:50 vapier Exp $ diff --git a/cnf/make.conf b/cnf/make.conf index bae8e2cc5..fb2cad1e8 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -280,7 +280,7 @@ CHOST="i686-pc-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -345,13 +345,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient address # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.alpha b/cnf/make.conf.alpha index 6b226eef9..32cba977c 100644 --- a/cnf/make.conf.alpha +++ b/cnf/make.conf.alpha @@ -266,7 +266,7 @@ CFLAGS="-mcpu=ev5 -O3 -pipe " # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -329,13 +329,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.amd64 b/cnf/make.conf.amd64 index 30dcf341a..f2de1cef3 100644 --- a/cnf/make.conf.amd64 +++ b/cnf/make.conf.amd64 @@ -277,7 +277,7 @@ CHOST="x86_64-pc-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -340,13 +340,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.arm b/cnf/make.conf.arm index 649e22071..3f07565c2 100644 --- a/cnf/make.conf.arm +++ b/cnf/make.conf.arm @@ -274,7 +274,7 @@ CHOST="armv4l-unknown-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -337,13 +337,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.hppa b/cnf/make.conf.hppa index 87e79887e..6f948642a 100644 --- a/cnf/make.conf.hppa +++ b/cnf/make.conf.hppa @@ -283,7 +283,7 @@ CHOST="hppa-unknown-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -346,13 +346,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.ia64 b/cnf/make.conf.ia64 index ede5a447e..81f6a29a8 100644 --- a/cnf/make.conf.ia64 +++ b/cnf/make.conf.ia64 @@ -245,7 +245,7 @@ CHOST="ia64-unknown-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -308,13 +308,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.mips b/cnf/make.conf.mips index cf2ab82bd..d63369da6 100644 --- a/cnf/make.conf.mips +++ b/cnf/make.conf.mips @@ -263,7 +263,7 @@ CHOST="mips-unknown-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -326,13 +326,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.ppc b/cnf/make.conf.ppc index 17c12e62e..d15bc999e 100644 --- a/cnf/make.conf.ppc +++ b/cnf/make.conf.ppc @@ -303,7 +303,7 @@ CHOST="powerpc-unknown-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -366,13 +366,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.ppc64 b/cnf/make.conf.ppc64 index f4eb71204..35becf4ec 100644 --- a/cnf/make.conf.ppc64 +++ b/cnf/make.conf.ppc64 @@ -281,7 +281,7 @@ CHOST="powerpc64-unknown-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -344,13 +344,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.s390 b/cnf/make.conf.s390 index 2dd663618..fca5c058f 100644 --- a/cnf/make.conf.s390 +++ b/cnf/make.conf.s390 @@ -245,7 +245,7 @@ CHOST="s390-ibm-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -308,13 +308,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.sparc b/cnf/make.conf.sparc index 6cf9b0db8..b91446bf6 100644 --- a/cnf/make.conf.sparc +++ b/cnf/make.conf.sparc @@ -281,7 +281,7 @@ # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -344,13 +344,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.x86 b/cnf/make.conf.x86 index f3adf66ad..4c769dbf7 100644 --- a/cnf/make.conf.x86 +++ b/cnf/make.conf.x86 @@ -280,7 +280,7 @@ CHOST="i686-pc-linux-gnu" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -343,13 +343,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.conf.x86-fbsd b/cnf/make.conf.x86-fbsd index f0f8f9aa5..115aca554 100644 --- a/cnf/make.conf.x86-fbsd +++ b/cnf/make.conf.x86-fbsd @@ -270,7 +270,7 @@ CHOST="i686-unknown-freebsd5.3" # 'keeptemp' prevents the clean phase from deleting the temp files ($T) # from a merge. # 'keepwork' prevents the clean phase from deleting the WORKDIR. -# 'maketest' causes ebuilds to perform testing phases if they are capable +# 'test' causes ebuilds to perform testing phases if they are capable # of it. Some packages support this automaticaly via makefiles. # 'noauto' causes ebuild to perform only the action requested and # not any other required actions like clean or unpack -- for @@ -334,13 +334,13 @@ PORTAGE_ELOG_CLASSES="warn error log" #PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '${PACKAGE}' -f '${LOGFILE}'" # PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail -# module. In most cases listing the recipient adress and +# module. In most cases listing the recipient address and # the receiving mailserver should be sufficient, but you can # also use advanced settings like authentication or TLS. The # full syntax is: -# adress [[user:passwd@]mailserver[:port]] +# address [[user:passwd@]mailserver[:port]] # where -# adress: recipient adress +# address: recipient adress # user: username for smtp auth (defaults to none) # passwd: password for smtp auth (defaults to none) # mailserver: smtp server that should be used to deliver the mail (defaults to localhost) diff --git a/cnf/make.globals b/cnf/make.globals index 83c28f3fc..cd34f8447 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -57,6 +57,9 @@ RSYNC_TIMEOUT="180" # Minimal CONFIG_PROTECT CONFIG_PROTECT="/etc" +# Disable auto-use +USE_ORDER="env:pkg:conf:defaults" + # ***************************** # ** DO NOT EDIT THIS FILE ** # *************************************************** diff --git a/man/emerge.1 b/man/emerge.1 index 0be368ed8..66a626e03 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -99,6 +99,13 @@ Re\-emerge the complaining package to fix this issue. \fBNote that changes in USE flags can drastically affect the output of \-\-depclean.\fR .TP +.BR "\-\-help " (\fB\-h\fR) +Displays help information for emerge. Adding one of the additional +arguments listed above will give you more specific help information +on that subject. The internal \fBemerge\fR help documentation is +updated more frequently than this man page; check it out if you +are having problems that this man page does not help resolve. +.TP .BR \-\-info This is a list of information to include in bug reports which aids the developers with fixing any problems you may report. \fBPlease include this @@ -140,6 +147,11 @@ the cache. After a portage update, rsync users may find it convenient to run \fBemerge \-\-metadata\fR to rebuild the cache as portage does at the end of a sync operation. .TP +.BR "\-\-resume" +Resumes the last merge operation. Please note that this operation +will only return an error on failure. If there is nothing for portage +to do, then portage will exit with a message and a success condition. +.TP .BR "\-\-search " (\fB\-s\fR) Searches for matches of the supplied string in the portage tree. The \-\-search string is a regular expression. For example, \fBemerge @@ -147,7 +159,12 @@ The \-\-search string is a regular expression. For example, \fBemerge \fBemerge \-\-search "gcc$"\fR searches for any package that ends with "gcc"; \fBemerge \-\-search "office"\fR searches for any package that contains the word "office". If you want to search the package -descriptions as well, use the \fB\-\-searchdesc\fR option. +descriptions as well, use the \fB\-\-searchdesc\fR action. +.TP +.BR "\-\-searchdesc " (\fB\-S\fR) +Matches the search string against the description field as well as +the package name. \fBTake caution\fR as the descriptions are also +matched as regular expressions. .TP .BR \-\-sync Initiates a portage tree update with one of the rsync.gentoo.org @@ -163,6 +180,22 @@ it may remove packages necessary for the proper operation of your system. Its arguments can be \fIebuilds\fR, \fIclasses\fR, or \fIdependencies\fR \-\- see \fB\-\-clean\fR above for examples. .TP +.BR "\-\-update " (\fB\-u\fR) +Updates packages to the best version available, which may not always be the +highest version number due to masking for testing and development. This will +also update direct dependencies which may not be what you want. In general, +use this option only in combination with the world or system target. +.TP +.BR "\-\-upgradeonly " (\fB\-U\fR) +Updates packages, but excludes updates that would result in a lower version of +the package being installed. \fBSLOT\fRs are considered at a basic level. +.br +This option is deprecated and should not be used anymore. Please use the +/etc/portage/package.* files from now on. +.TP +.BR "\-\-version " (\fB\-V\fR) +Displays the version number of \fBemerge\fR. +.TP .BR "\-\-config " Run package specific actions needed to be executed after the emerge process has completed. This usually entails configuration @@ -191,7 +224,7 @@ merging the packages. This comes with the caveat that all build-time dependencies must already be emerged on the system. .TP .BR "\-\-changelog " (\fB\-l\fR) -Use this in conjunction with the \fB\-\-pretend\fR action. This will +Use this in conjunction with the \fB\-\-pretend\fR option. This will show the ChangeLog entries for all the packages that will be upgraded. .TP .BR "\-\-columns" @@ -238,13 +271,6 @@ information from the local machine. All binaries will be downloaded from the remote server without consulting packages existing in the local packages directory. .TP -.BR "\-\-help " (\fB\-h\fR) -Displays help information for emerge. Adding one of the additional -arguments listed above will give you more specific help information -on that subject. The internal \fBemerge\fR help documentation is -updated more frequently than this man page; check it out if you -are having problems that this man page does not help resolve. -.TP .BR "\-\-newuse " (\fB\-N\fR) Tells emerge to include installed packages where USE flags have changed since compilation. An asterisk marks when a USE flag has changed since the package @@ -311,18 +337,8 @@ the printout, Results may vary, but the general outcome is a reduced or condensed output from portage's displays. .TP -.BR "\-\-resume" -Resumes the last merge operation. Please note that this operation -will only return an error on failure. If there is nothing for portage -to do, then portage will exit with a message and a success condition. -.TP -.BR "\-\-searchdesc " (\fB\-S\fR) -Matches the search string against the description field as well as -the package name. \fBTake caution\fR as the descriptions are also -matched as regular expressions. -.TP .BR "\-\-skipfirst" -This action is only valid when used with \fB\-\-resume\fR. It removes the +This option is only valid when used with \fB\-\-resume\fR. It removes the first package in the resume list so that a merge may continue in the presence of an uncorrectable or inconsequential error. This should only be used in cases where skipping the package will not result in failed dependencies. @@ -332,19 +348,6 @@ Shows the dependency tree for the given target by indenting dependencies. This is only really useful in combination with \fB\-\-emptytree\fR or \fB\-\-update\fR and \fB\-\-deep\fR. .TP -.BR "\-\-update " (\fB\-u\fR) -Updates packages to the best version available, which may not always be the -highest version number due to masking for testing and development. This will -also update direct dependencies which may not be what you want. In general, -use this option only in combination with the world or system target. -.TP -.BR "\-\-upgradeonly " (\fB\-U\fR) -Updates packages, but excludes updates that would result in a lower version of -the package being installed. \fBSLOT\fRs are considered at a basic level. -.br -This option is deprecated and should not be used anymore. Please use the -/etc/portage/package.* files from now on. -.TP .BR "\-\-usepkg " (\fB\-k\fR) Tells emerge to use binary packages (from $PKGDIR) if they are available, thus possibly avoiding some time\-consuming compiles. This option is useful for CD installs; you can export PKGDIR=/mnt/cdrom/packages @@ -358,10 +361,13 @@ information so all masking information is ignored. .TP .BR "\-\-verbose " (\fB\-v\fR) Tell emerge to run in verbose mode. Currently this flag causes emerge to print out GNU info errors, if any, and to show the USE flags that will be used for each package when pretending. +.SH "ENVIRONMENT OPTIONS" .TP -.BR "\-\-version " (\fB\-V\fR) -Displays the version number of \fBemerge\fR. It cannot be used in -conjunction with other options. +\fBROOT\fR = \fI[path]\fR +Use \fBROOT\fR to specify the target root filesystem to be used for +merging packages or ebuilds. +.br +Defaults to /. .SH "ENVIRONMENT OPTIONS" .TP \fBROOT\fR = \fI[path]\fR @@ -418,24 +424,18 @@ libgd 2.x is incompatible with libgd 1.x. This means that packages that were created with libgd 1.x will not compile with 2.x and must downgrade libgd first before they can emerge. .TP -.B [ebuild U\-] x11\-base/xfree\-4.3.0 [4.2.99.902] -The \- represents lack of \fBSLOT\fR information about Xfree. This will occur -when the previous version emerged was injected (see \fBinject\fR for more info) -or very outdated (so old that \fBSLOT\fR did not exist). Either way, a newer version -of Xfree is availabe for your updating delight. -.TP -.B [ebuild U ] sys\-devel/distcc\-2.16 [2.13\-r1] \-gtk +ipv6* (\-selinux) -The \-gtk reflects the status of \fBUSE\fR variables when emerging distcc. -Here we see that distcc can use the \fBUSE\fR variable gtk, but that your -current settings have gtk disabled. This means optional support for gtk will -not be enabled in distcc when you emerge it. An asterisk shows that the -\fBUSE\fR flags have changed since the package was last installed. In this -case, ipv6 is enabled but was previously disabled. A \fBUSE\fR flag in -pparenthesis, like (\-selinux), is always disabled and shows that the flag is -not available for the current system profile. +.B [ebuild U ] sys\-devel/distcc\-2.16 [2.13\-r1] USE="ipv6* \-gtk \-qt%" +Here we see that the make.conf variable \fBUSE\fR affects how this package is +built. In this example, ipv6 optional support is enabled and both gtk and qt +support are disabled. The asterisk following ipv6 indicates that ipv6 support +was disabled the last time this packages was installed. The percent sign +following qt indicates that the qt option has been added to the package since +it was last installed. .br -\fB*Note:\fR The \fBUSE\fR status is only displayed when you use the -\fB\-\-pretend\fR and \fB\-\-verbose\fR options. +\fB*Note:\fR Flags that haven't changed since the last install are only +displayed when you use the \fB\-\-pretend\fR and \fB\-\-verbose\fR options. +Using the \fB\-\-quiet\fR option will prevent all information from being +displayed. .SH "NOTES" You should almost always precede any package install or update attempt with a \fB\-\-pretend\fR install or update. This lets you see how much will be diff --git a/man/make.conf.5 b/man/make.conf.5 index 5f8e7e67e..a914848c9 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -39,6 +39,12 @@ This variable is passed by the \fIebuild scripts\fR to the \fIconfigure\fR as \fI\-\-build=${CBUILD}\fR only if it is defined. Do not set this yourself unless you know what you are doing. .TP +\fBCCACHE_DIR\fR = \fI[path]\fR +Defines the location of the ccache working directory. See the \fBccache\fR(1) +man page for more information. +.br +Defaults to ${PORTAGE_TMPDIR}/ccache +.TP \fBCCACHE_SIZE\fR = \fI"size"\fR This controls the space use limitations for ccache. The default is 2 gigabytes ('2G'). Sizes are specified with 'G', 'M', or 'K'. @@ -103,6 +109,10 @@ part of \fBFEATURES\fR and should not be disabled by default. This is an incremental variable. .RS .TP +.B assume-digests +When commiting work to cvs with \fBrepoman\fR(1), assume that all existing +SRC_URI digests are correct. +.TP .B autoaddcvs Causes portage to automatically try to add files to cvs that will have to be added later. Done at generation times and only works when \fIcvs\fR is also in @@ -184,7 +194,7 @@ Disables xterm titlebar updates (which contains status info). Fetch in the background while compiling. .TP .B sandbox -Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild(1)\fR. +Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild\fR(1). .TP .B severe When checking Manifests, only accept ones that have been signed by a @@ -201,6 +211,10 @@ See also \fIsuidctl\fR below. When commiting work to cvs with \fBrepoman\fR(1), sign the Manifest with a GPG key. Read about the \fIPORTAGE_GPG_KEY\fR variable in \fBmake.conf\fR(5). .TP +.B splitdebug +Prior to stripping ELF etdyn and etexec files, the debugging info is +stored for later use by various debuggers. +.TP .B strict Have portage react strongly to conditions that have the potential to be dangerous (like missing or incorrect Manifests). diff --git a/man/portage.5 b/man/portage.5 index c0c807326..ab1fc0318 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -217,6 +217,9 @@ sys-kernel/development-sources-2.6.7 # you installed your own special copy of QT x11-libs/qt-3.3.0 + +# you have modular X but packages want monolithic +x11-base/xorg-x11-6.8 .fi .TP .BR parent diff --git a/man/repoman.1 b/man/repoman.1 index 6439a7960..7a0deaf7c 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -114,6 +114,9 @@ commiting the ebuild. .BR KEYWORDS.missing The ebuild does not have a KEYWORDS variable. .TP +.BR KEYWORDS.stupid +The ebuild uses KEYWORDS=-* instead of package.mask. +.TP .BR LICENSE.missing The ebuild does not have a LICENSE variable. .TP diff --git a/pym/elog_modules/mod_mail.py b/pym/elog_modules/mod_mail.py index a007833ee..59fd56a8e 100644 --- a/pym/elog_modules/mod_mail.py +++ b/pym/elog_modules/mod_mail.py @@ -18,7 +18,7 @@ def process(mysettings, cpv, logentries, fulltext): if " " in mysettings["PORTAGE_ELOG_MAILURI"]: myrecipient, mymailuri = mysettings["PORTAGE_ELOG_MAILURI"].split() if "@" in mymailuri: - myauthdata, myconndata = mymailuri.split("@") + myauthdata, myconndata = mymailuri.rsplit("@", 1) try: mymailuser,mymailpasswd = myauthdata.split(":") except ValueError: diff --git a/pym/output.py b/pym/output.py index 69dcb5390..ac57fe366 100644 --- a/pym/output.py +++ b/pym/output.py @@ -3,7 +3,7 @@ # $Id: /var/cvsroot/gentoo-src/portage/pym/output.py,v 1.24.2.4 2005/04/17 09:01:55 jstubbs Exp $ -import os,sys,re +import commands,os,sys,re havecolor=1 dotitles=1 @@ -102,11 +102,12 @@ def xtermTitle(mystr): sys.stderr.flush() break -def xtermTitleReset(): - if havecolor and dotitles and os.environ.has_key("TERM"): - myt=os.environ["TERM"] - xtermTitle(os.environ["TERM"]) +prompt_command = os.getenv("PROMPT_COMMAND", 'echo -ne "${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}"') +default_xterm_title = commands.getoutput(prompt_command) +del prompt_command +def xtermTitleReset(): + xtermTitle(default_xterm_title) def notitles(): "turn off title setting" diff --git a/pym/portage.py b/pym/portage.py index 3548332c1..f55f662fe 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -88,9 +88,9 @@ try: portage_uid, portage_gid import portage_util - from portage_util import grab_multiple, grabdict, grabdict_package, grabfile, grabfile_package, \ - grabints, map_dictlist_vals, pickle_read, pickle_write, stack_dictlist, stack_dicts, stack_lists, \ - unique_array, varexpand, writedict, writeints, writemsg, getconfig, dump_traceback + from portage_util import grabdict, grabdict_package, grabfile, grabfile_package, \ + map_dictlist_vals, pickle_read, pickle_write, stack_dictlist, stack_dicts, stack_lists, \ + unique_array, varexpand, writedict, writemsg, writemsg_stdout, getconfig, dump_traceback import portage_exception import portage_gpg import portage_locks @@ -669,7 +669,8 @@ def env_update(makelinks=1): elif ostype in ("FreeBSD","DragonFly"): if (ld_cache_update): writemsg(">>> Regenerating "+str(root)+"var/run/ld-elf.so.hints...\n") - commands.getstatusoutput("cd / ; "+portage_const.PREFIX+"/sbin/ldconfig -i -elf -f "+str(root)+portage_const.PREFIX+"var/run/ld-elf.so.hints "+str(root)+portage_const.PREFIX+"etc/ld.so.conf") + commands.getstatusoutput("cd / ; "+portage_const.PREFIX+"/sbin/ldconfig -elf -i -f "+str(root)+portage_const.PREFIX+"var/run/ld-elf.so.hints "+str(root)+portage_const.PREFIX+"etc/ld.so.conf") + commands.getstatusoutput("cd / ; /sbin/ldconfig -elf -i -f "+str(root)+"var/run/ld-elf.so.hints "+str(root)+"etc/ld.so.conf") del specials["LDPATH"] @@ -1008,7 +1009,7 @@ class config: self.user_profile_dir = os.path.normpath("/"+"///"+CUSTOM_PROFILE_PATH) self.profiles.append(self.user_profile_dir[:]) - self.packages_list = grab_multiple("packages", self.profiles, grabfile_package) + self.packages_list = [grabfile_package(os.path.join(x, "packages")) for x in self.profiles] self.packages = stack_lists(self.packages_list, incremental=1) del self.packages_list #self.packages = grab_stacked("packages", self.profiles, grabfile, incremental_lines=1) @@ -1023,15 +1024,15 @@ class config: self.prevmaskdict[mycatpkg].append(x) # get profile-masked use flags -- INCREMENTAL Child over parent - usemask_lists = grab_multiple("use.mask", self.profiles, grabfile) + usemask_lists = [grabfile(os.path.join(x, "use.mask")) for x in self.profiles] self.usemask = stack_lists(usemask_lists, incremental=True) del usemask_lists - use_defs_lists = grab_multiple("use.defaults", self.profiles, grabdict) + use_defs_lists = [grabdict(os.path.join(x, "use.defaults")) for x in self.profiles] self.use_defs = stack_dictlist(use_defs_lists, incremental=True) del use_defs_lists try: - mygcfg_dlists = grab_multiple("make.globals", self.profiles+["/etc"], getconfig) + mygcfg_dlists = [getconfig(os.path.join(x, "make.globals")) for x in self.profiles+["/etc"]] self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=portage_const.INCREMENTALS, ignore_none=1) if self.mygcfg == None: @@ -1049,7 +1050,7 @@ class config: self.mygcfg = {} if self.profiles: try: - mygcfg_dlists = grab_multiple("make.defaults", self.profiles, getconfig) + mygcfg_dlists = [getconfig(os.path.join(x, "make.defaults")) for x in self.profiles] self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=portage_const.INCREMENTALS, ignore_none=1) #self.mygcfg = grab_stacked("make.defaults", self.profiles, getconfig) if self.mygcfg == None: @@ -1103,9 +1104,6 @@ class config: self.lookuplist=self.configlist[:] self.lookuplist.reverse() - archlist = grabfile(self["PORTDIR"]+"/profiles/arch.list") - self.configdict["conf"]["PORTAGE_ARCHLIST"] = string.join(archlist) - if os.environ.get("PORTAGE_CALLER","") == "repoman": # repoman shouldn't use local settings. locations = [self["PORTDIR"] + "/profiles"] @@ -1158,15 +1156,19 @@ class config: self.punmaskdict[mycatpkg]=[x] #getting categories from an external file now - categories = grab_multiple("categories", locations, grabfile) + categories = [grabfile(os.path.join(x, "categories")) for x in locations] self.categories = stack_lists(categories, incremental=1) del categories + archlist = [grabfile(os.path.join(x, "arch.list")) for x in locations] + archlist = stack_lists(archlist, incremental=1) + self.configdict["conf"]["PORTAGE_ARCHLIST"] = " ".join(archlist) + # get virtuals -- needs categories self.loadVirtuals('/') #package.mask - pkgmasklines = grab_multiple("package.mask", self.profiles, grabfile_package) + pkgmasklines = [grabfile_package(os.path.join(x, "package.mask")) for x in self.profiles] for l in locations: pkgmasklines.append(grabfile_package(l+os.path.sep+"package.mask", recursive=1)) pkgmasklines = stack_lists(pkgmasklines, incremental=1) @@ -1179,7 +1181,7 @@ class config: else: self.pmaskdict[mycatpkg]=[x] - pkgprovidedlines = grab_multiple("package.provided", self.profiles, grabfile) + pkgprovidedlines = [grabfile(os.path.join(x, "package.provided")) for x in self.profiles] pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1) for x in range(len(pkgprovidedlines)-1, -1, -1): cpvr = catpkgsplit(pkgprovidedlines[x]) @@ -1286,7 +1288,7 @@ class config: try: mod = load_mod(best_mod) except: - writemsg(red("!!! Failed to import module '%s'\n") % best_mod) + dump_traceback(red("Error: Failed to import module '%s'") % best_mod, noiselevel=0) sys.exit(1) return mod @@ -1381,7 +1383,8 @@ class config: if not self.treeVirtuals.has_key(virt): self.treeVirtuals[virt] = [] # XXX: Is this bad? -- It's a permanent modification - self.treeVirtuals[virt] = portage_util.unique_array(self.treeVirtuals[virt]+[cp]) + if cp not in self.treeVirtuals[virt]: + self.treeVirtuals[virt].append(cp) self.virtuals = self.__getvirtuals_compile() @@ -1498,7 +1501,7 @@ class config: # 2. user-declared set # 5. profile - self.dirVirtuals = grab_multiple("virtuals", myvirtdirs, grabdict) + self.dirVirtuals = [grabdict(os.path.join(x, "virtuals")) for x in myvirtdirs] self.dirVirtuals.reverse() if self.user_profile_dir and os.path.exists(self.user_profile_dir+"/virtuals"): @@ -1927,10 +1930,10 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", # Verify checksums at each fetch for fetchonly. verified_ok,reason = portage_checksum.verify_all(mysettings["DISTDIR"]+"/"+myfile, mydigests[myfile]) if not verified_ok: + print reason writemsg("!!! Previously fetched file: "+str(myfile)+"\n") writemsg("!!! Reason: "+reason[0]+"\n") - writemsg("!!! Got: "+reason[1]+"\n") - writemsg("!!! Expected: "+reason[2]+"\n") + writemsg("!!! Got: %s\n!!! Expected: %s\n" % (reason[0], reason[1])) writemsg("Refetching...\n\n") os.unlink(mysettings["DISTDIR"]+"/"+myfile) fetched=0 @@ -2030,10 +2033,10 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", # from another mirror... verified_ok,reason = portage_checksum.verify_all(mysettings["DISTDIR"]+"/"+myfile, mydigests[myfile]) if not verified_ok: + print reason writemsg("!!! Fetched file: "+str(myfile)+" VERIFY FAILED!\n") writemsg("!!! Reason: "+reason[0]+"\n") - writemsg("!!! Got: "+reason[1]+"\n") - writemsg("!!! Expected: "+reason[2]+"\n") + writemsg("!!! Got: %s\n!!! Expected: %s\n" % (reason[0], reason[1])) writemsg("Removing corrupt distfile...\n") os.unlink(mysettings["DISTDIR"]+"/"+myfile) fetched=0 @@ -2149,7 +2152,11 @@ def digestgen(myarchives,mysettings,overwrite=1,manifestonly=0): myolddigest = digestParseFile(digestfn) myarchives.sort() - mydigests=digestCreate(myarchives, basedir, oldDigest=myolddigest) + try: + mydigests=digestCreate(myarchives, basedir, oldDigest=myolddigest) + except portage_exception.DigestException, s: + print "!!!",s + return 0 if mydigests==None: # There was a problem, exit with an errorcode. return 0 @@ -2287,14 +2294,14 @@ def digestCheckFiles(myfiles, mydigests, basedir, note="", strict=0): if not ok: print print red("!!! Digest verification Failed:") - print red("!!!")+" "+str(myfile) + print red("!!!")+" "+str(os.path.realpath(myfile)) print red("!!! Reason: ")+reason[0] - print red("!!! Got: ")+reason[1] - print red("!!! Expected: ")+reason[2] + print red("!!! Got: ")+str(reason[1]) + print red("!!! Expected: ")+str(reason[2]) print return 0 else: - print ">>> checksums "+note+" ;-)",x + writemsg_stdout(">>> checksums "+note+" ;-) %s\n" % x) return 1 @@ -2428,7 +2435,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea global db, actionmap_deps if not tree: - dump_traceback("tree not specified to doebuild") + dump_traceback("Warning: tree not specified to doebuild") tree = "porttree" ebuild_path = os.path.abspath(myebuild) @@ -2494,6 +2501,9 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mysettings["PV"] = mysplit[1] mysettings["PR"] = mysplit[2] mysettings["PREFIX"] = portage_const.PREFIX + if portage_util.noiselimit < 0: + mysettings["PORTAGE_QUIET"] = "1" + if mydo != "depend": try: mysettings["INHERITED"], mysettings["RESTRICT"] = db[root][tree].dbapi.aux_get( \ @@ -2527,7 +2537,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mysettings["BUILD_PREFIX"] = mysettings["PORTAGE_TMPDIR"]+"/portage" mysettings["HOME"] = mysettings["BUILD_PREFIX"]+"/homedir" mysettings["PKG_TMPDIR"] = mysettings["PORTAGE_TMPDIR"]+"/portage-pkg" - mysettings["BUILDDIR"] = mysettings["BUILD_PREFIX"]+"/"+mysettings["PF"] + mysettings["PORTAGE_BUILDDIR"] = mysettings["BUILD_PREFIX"]+"/"+mysettings["PF"] mysettings["PORTAGE_BASHRC"] = EBUILD_SH_ENV_FILE @@ -2571,7 +2581,8 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea os.chmod(mysettings["BUILD_PREFIX"],00775) # Should be ok again to set $T, as sandbox does not depend on it - mysettings["T"]=mysettings["BUILDDIR"]+"/temp" + # XXX Bug. no way in hell this is valid for clean handling. + mysettings["T"]=mysettings["PORTAGE_BUILDDIR"]+"/temp" if cleanup or mydo=="clean": if os.path.exists(mysettings["T"]): shutil.rmtree(mysettings["T"]) @@ -2584,8 +2595,9 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea logdir = mysettings["T"]+"/logging" if not os.path.exists(logdir): os.makedirs(logdir) - os.chown(logdir, portage_uid, portage_gid) - os.chmod(logdir, 0770) + if secpass == 2: + os.chown(logdir, portage_uid, portage_gid) + os.chmod(logdir, 0770) try: # XXX: negative RESTRICT if not (("nouserpriv" in string.split(mysettings["PORTAGE_RESTRICT"])) or \ @@ -2612,10 +2624,10 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea os.makedirs(mysettings["BUILD_PREFIX"]) if (os.getuid() == 0): os.chown(mysettings["BUILD_PREFIX"],portage_uid,portage_gid) - if not os.path.exists(mysettings["BUILDDIR"]): - os.makedirs(mysettings["BUILDDIR"]) + if not os.path.exists(mysettings["PORTAGE_BUILDDIR"]): + os.makedirs(mysettings["PORTAGE_BUILDDIR"]) if (os.getuid() == 0): - os.chown(mysettings["BUILDDIR"],portage_uid,portage_gid) + os.chown(mysettings["PORTAGE_BUILDDIR"],portage_uid,portage_gid) except OSError, e: print "!!! File system problem. (ReadOnly? Out of space?)" print "!!! Perhaps: rm -Rf",mysettings["BUILD_PREFIX"] @@ -2630,7 +2642,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea os.chmod(mysettings["HOME"],02770) except OSError, e: print "!!! File system problem. (ReadOnly? Out of space?)" - print "!!! Failed to create fake home directory in BUILDDIR" + print "!!! Failed to create fake home directory in PORTAGE_BUILDDIR" print "!!!",str(e) return 1 @@ -2695,9 +2707,10 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea features.remove("distcc") mysettings["DISTCC_DIR"]="" - mysettings["WORKDIR"]=mysettings["BUILDDIR"]+"/work" - mysettings["DEST"]=os.path.join(mysettings["BUILDDIR"],"image") - mysettings["D"]=mysettings["BUILDDIR"]+"/image"+portage_const.PREFIX + mysettings["WORKDIR"]=mysettings["PORTAGE_BUILDDIR"]+"/work" + mysettings["DEST"]=os.path.join(mysettings["PORTAGE_BUILDDIR"],"image") + mysettings["D"]=mysettings["PORTAGE_BUILDDIR"]+"/image"+portage_const.PREFIX + if mysettings.has_key("PORT_LOGDIR"): if not os.access(mysettings["PORT_LOGDIR"],os.F_OK): try: @@ -2707,8 +2720,11 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea print "!!!",e if os.access(mysettings["PORT_LOGDIR"]+"/",os.W_OK): try: - os.chown(mysettings["PORT_LOGDIR"],portage_uid,portage_gid) - os.chmod(mysettings["PORT_LOGDIR"],02770) + perms = os.stat(mysettings["PORT_LOGDIR"]) + if perms[stat.ST_UID] != portage_uid or perms[stat.ST_GID] != portage_gid: + os.chown(mysettings["PORT_LOGDIR"],portage_uid,portage_gid) + if stat.S_IMODE(perms[stat.ST_MODE]) != 02770: + os.chmod(mysettings["PORT_LOGDIR"],02770) if not mysettings.has_key("LOG_PF") or (mysettings["LOG_PF"] != mysettings["PF"]): mysettings["LOG_PF"]=mysettings["PF"] mysettings["LOG_COUNTER"]=str(db[myroot]["vartree"].dbapi.get_counter_tick_core("/")) @@ -2788,10 +2804,37 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea # Only try and fetch the files if we are going to need them ... otherwise, # if user has FEATURES=noauto and they run `ebuild clean unpack compile install`, # we will try and fetch 4 times :/ - if (mydo in ["digest","fetch","unpack"] or "noauto" not in features) and \ - not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly): + need_distfiles = (mydo in ("digest", "fetch", "unpack") or + mydo != "manifest" and "noauto" not in features) + if need_distfiles and not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly): return 1 + # inefficient. improve this logic via making actionmap easily searchable to see if we're in the chain of what + # will be executed, either that or forced N doebuild calls instead of a single set of phase calls. + if (mydo not in ("setup", "clean", "postinst", "preinst", "prerm", "fetch", "digest", "manifest") and + "noauto" not in features) or mydo == "unpack": + # remove PORTAGE_ACTUAL_DISTDIR once cvs/svn is supported via SRC_URI + mysettings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir = mysettings["DISTDIR"] + edpath = mysettings["DISTDIR"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "distdir") + if os.path.exists(edpath): + try: + if os.path.isdir(edpath) and not os.path.islink(edpath): + shutil.rmtree(edpath) + else: + os.unlink(edpath) + except OSError: + print "!!! Failed reseting ebuild distdir path, " + edpath + raise + os.mkdir(edpath) + os.chown(edpath, -1, portage_gid) + os.chmod(edpath, 0775) + try: + for file in aalist: + os.symlink(os.path.join(orig_distdir, file), os.path.join(edpath, file)) + except OSError: + print "!!! Failed symlinking in '%s' to ebuild distdir" % file + raise + if mydo=="fetch" and listonly: return 0 @@ -2848,16 +2891,16 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea return spawnebuild(mydo,actionmap,mysettings,debug,logfile=logfile) elif mydo=="qmerge": #check to ensure install was run. this *only* pops up when users forget it and are using ebuild - if not os.path.exists(mysettings["BUILDDIR"]+"/.installed"): + if not os.path.exists(mysettings["PORTAGE_BUILDDIR"]+"/.installed"): print "!!! mydo=qmerge, but install phase hasn't been ran" sys.exit(1) #qmerge is specifically not supposed to do a runtime dep check - return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["DEST"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"],mytree=tree) + return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["DEST"],mysettings["PORTAGE_BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"],mytree=tree) elif mydo=="merge": retval=spawnebuild("install",actionmap,mysettings,debug,alwaysdep=1,logfile=logfile) if retval: return retval - return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["DEST"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"],mytree=tree) + return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["DEST"],mysettings["PORTAGE_BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"],mytree=tree) else: print "!!! Unknown mydo:",mydo sys.exit(1) @@ -3161,7 +3204,7 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0): atoms = dep_zapdeps(dep, satisfied, myroot, use_binaries=use_binaries) else: atoms = [dep] - missing_atoms = [atom for atom in atoms if not db[myroot]["vartree"].dbapi.match(dep_getkey(atom))] + missing_atoms = [atom for atom in atoms if not db[myroot]["vartree"].dbapi.match(atom)] if not missing_atoms: if isinstance(dep, list): @@ -3178,6 +3221,12 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0): if not missing_atoms: target = (dep, satisfied) + if not target: + if isinstance(deps[0], list): + return dep_zapdeps(deps[0], satisfieds[0], myroot, use_binaries=use_binaries) + else: + return [deps[0]] + if isinstance(target, tuple): # Nothing matching installed if isinstance(target[0], list): # ... and the first available was a sublist return dep_zapdeps(target[0], target[1], myroot, use_binaries=use_binaries) @@ -3198,7 +3247,7 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0): available_pkgs[pkg] = atom if not available_pkgs: - return [unreduced[0]] # All masked + return [relevant_atoms[0]] # All masked target_pkg = best(available_pkgs.keys()) suitable_atom = available_pkgs[target_pkg] @@ -3287,10 +3336,7 @@ def dep_check(depstring,mydbapi,mysettings,use="yes",mode=None,myuse=None,use_ca #check_config_instance(mysettings) - if use=="all": - #enable everything (for repoman) - myusesplit=["*"] - elif use=="yes": + if use=="yes": if myuse==None: #default behavior myusesplit = string.split(mysettings["USE"]) @@ -5667,7 +5713,6 @@ class dblink: #process symlinks second-to-last, directories last. mydirs=[] - mysyms=[] modprotect="/lib/modules/" for obj in mykeys: obj=os.path.normpath(obj) @@ -5678,7 +5723,7 @@ class dblink: #we skip this if we're dealing with a symlink #because os.path.exists() will operate on the #link target rather than the link itself. - print "--- !found "+str(pkgfiles[obj][0]), obj + writemsg_stdout("--- !found "+str(pkgfiles[obj][0])+ " %s\n" % obj) continue # next line includes a tweak to protect modules from being unmerged, # but we don't protect modules from being overwritten if they are @@ -5686,134 +5731,75 @@ class dblink: # functionality for /lib/modules. For portage-ng both capabilities # should be able to be independently specified. if self.isprotected(obj) or ((len(obj) > len(modprotect)) and (obj[0:len(modprotect)]==modprotect)): - print "--- cfgpro "+str(pkgfiles[obj][0]), obj + writemsg_stdout("--- cfgpro %s %s\n" % (pkgfiles[obj][0], obj)) continue lstatobj=os.lstat(obj) lmtime=str(lstatobj[stat.ST_MTIME]) - if (pkgfiles[obj][0] not in ("dir","fif","dev","sym")) and (lmtime != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj + if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (lmtime != pkgfiles[obj][1]): + writemsg_stdout("--- !mtime %s %s\n" % (pkgfiles[obj][0], obj)) continue if pkgfiles[obj][0]=="dir": if not os.path.isdir(obj): - print "--- !dir ","dir", obj + writemsg_stdout("--- !dir %s %s\n" % ("dir", obj)) continue mydirs.append(obj) elif pkgfiles[obj][0]=="sym": if not os.path.islink(obj): - print "--- !sym ","sym", obj + writemsg_stdout("--- !sym %s %s\n" % ("sym", obj)) continue - mysyms.append(obj) + try: + os.unlink(obj) + writemsg_stdout("<<< %s %s\n" % ("sym",obj)) + except (OSError,IOError),e: + writemsg_stdout("!!! %s %s\n" % ("sym",obj)) elif pkgfiles[obj][0]=="obj": if not os.path.isfile(obj): - print "--- !obj ","obj", obj + writemsg_stdout("--- !obj %s %s\n" % ("obj", obj)) continue mymd5=portage_checksum.perform_md5(obj, calc_prelink=1) # string.lower is needed because db entries used to be in upper-case. The # string.lower allows for backwards compatibility. if mymd5 != string.lower(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj + writemsg_stdout("--- !md5 %s %s\n" % ("obj", obj)) continue try: os.unlink(obj) except (OSError,IOError),e: pass - print "<<< ","obj",obj + writemsg_stdout("<<< %s %s\n" % ("obj",obj)) elif pkgfiles[obj][0]=="fif": if not stat.S_ISFIFO(lstatobj[stat.ST_MODE]): - print "--- !fif ","fif", obj + writemsg_stdout("--- !fif %s %s\n" % ("fif", obj)) continue try: os.unlink(obj) except (OSError,IOError),e: pass - print "<<< ","fif",obj + writemsg_stdout("<<< %s %s\n" % ("fif",obj)) elif pkgfiles[obj][0]=="dev": - print "--- ","dev",obj + writemsg_stdout("--- %s %s\n" % ("dev",obj)) - #Now, we need to remove symlinks and directories. We'll repeatedly - #remove dead symlinks, then directories until we stop making progress. - #This is how we'll clean up directories containing symlinks pointing to - #directories that are now empty. These cases will require several - #iterations through our two-stage symlink/directory cleaning loop. + mydirs.sort() + mydirs.reverse() + last_non_empty = "" - #main symlink and directory removal loop: - - #progress -- are we making progress? Initialized to 1 so loop will start - progress=1 - while progress: - #let's see if we're able to make progress this iteration... - progress=0 - - #step 1: remove all the dead symlinks we can... - - pos = 0 - while pos0: - #we won't remove this directory (yet), continue - pos += 1 + for obj in mydirs: + if not last_non_empty.startswith(obj) and not listdir(obj): + try: + os.rmdir(obj) + writemsg_stdout("<<< %s %s\n" % ("dir",obj)) + last_non_empty = "" continue - elif (objld != None): - #zappo time - del mydirs[pos] - #we've made progress! - progress = 1 - try: - os.rmdir(obj) - print "<<< ","dir",obj - except (OSError,IOError),e: - #immutable? - pass - #else: - # print "--- !empty","dir", obj - # continue - - #step 3: if we've made progress, we'll give this another go... - - #step 4: otherwise, we'll print out the remaining stuff that we didn't unmerge (and rightly so!) - - #directories that aren't empty: - for x in mydirs: - print "--- !empty dir", x - - #symlinks whose target still exists: - for x in mysyms: - print "--- !targe sym", x + except (OSError,IOError),e: + #immutable? + pass - #step 5: well, removal of package objects is complete, now for package *meta*-objects.... + writemsg_stdout("--- !empty dir %s\n" % obj) + last_non_empty = obj + continue #remove self from vartree database so that our own virtual gets zapped if we're the last node db[self.myroot]["vartree"].zap(self.mycpv) @@ -5903,6 +5889,7 @@ class dblink: mycwd = os.getcwd() os.chdir(srcroot) mysymlinks = filter(os.path.islink, listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False)) + myfilelist.extend(mysymlinks) stopmerge=False starttime=time.time() @@ -5974,7 +5961,7 @@ class dblink: if not os.path.exists(self.dbtmpdir): os.makedirs(self.dbtmpdir) - print ">>> Merging",self.mycpv,"to",destroot + writemsg_stdout(">>> Merging %s %s %s\n" % (self.mycpv,"to",destroot)) # run preinst script if myebuild: @@ -6056,12 +6043,11 @@ class dblink: outfile.flush() outfile.close() - if (oldcontents): - print ">>> Safely unmerging already-installed instance..." - self.dbdir = self.dbpkgdir - self.unmerge(oldcontents,trimworld=0) - self.dbdir = self.dbtmpdir - print ">>> original instance of package unmerged safely." + writemsg_stdout(">>> Safely unmerging already-installed instance...\n") + self.dbdir = self.dbpkgdir + self.unmerge(oldcontents,trimworld=0) + self.dbdir = self.dbtmpdir + writemsg_stdout(">>> original instance of package unmerged safely.\n") # We hold both directory locks. self.dbdir = self.dbpkgdir @@ -6117,7 +6103,7 @@ class dblink: global dircache if dircache.has_key(self.dbcatdir): del dircache[self.dbcatdir] - print ">>>",self.mycpv,"merged." + writemsg_stdout(">>> %s %s\n" % (self.mycpv,"merged.")) # Process ebuild logfiles elog_process(self.mycpv, self.settings) @@ -6256,7 +6242,7 @@ class dblink: if stat.S_ISLNK(mydmode) or stat.S_ISDIR(mydmode): # a symlink to an existing directory will work for us; keep it: - print "---",mydest+"/" + writemsg_stdout("--- %s/\n" % mydest) if bsd_chflags: bsd_chflags.lchflags(mydest, dflags) else: @@ -6274,7 +6260,7 @@ class dblink: bsd_chflags.lchflags(mydest, dflags) os.chmod(mydest,mystat[0]) os.chown(mydest,mystat[4],mystat[5]) - print ">>>",mydest+"/" + writemsg_stdout(">>> %s/\n" % mydest) else: #destination doesn't exist if selinux_enabled: @@ -6286,7 +6272,7 @@ class dblink: if bsd_chflags: bsd_chflags.lchflags(mydest, bsd_chflags.lgetflags(mysrc)) os.chown(mydest,mystat[4],mystat[5]) - print ">>>",mydest+"/" + writemsg_stdout(">>> %s/\n" % mydest) outfile.write("dir "+myrealdest+"\n") # recurse and merge this directory if self.mergeme(srcroot,destroot,outfile,secondhand,offset+x+"/",cfgfiledict,thismtime): @@ -6303,7 +6289,7 @@ class dblink: if stat.S_ISDIR(mydmode): # install of destination is blocked by an existing directory with the same name moveme=0 - print "!!!",mydest + writemsg_stdout("!!! %s\n" % mydest) elif stat.S_ISREG(mydmode) or (stat.S_ISLNK(mydmode) and os.path.exists(mydest) and stat.S_ISREG(os.stat(mydest)[stat.ST_MODE])): cfgprot=0 # install of destination is blocked by an existing regular file, @@ -6407,7 +6393,7 @@ class dblink: if mymtime!=None: zing=">>>" outfile.write("obj "+myrealdest+" "+mymd5+" "+str(mymtime)+"\n") - print zing,mydest + writemsg_stdout("%s %s\n" % (zing,mydest)) else: # we are merging a fifo or device node zing="!!!" @@ -6421,7 +6407,7 @@ class dblink: outfile.write("fif "+myrealdest+"\n") else: sys.exit(1) - print zing+" "+mydest + writemsg_stdout(zing+" "+mydest+"\n") def merge(self,mergeroot,inforoot,myroot,myebuild=None,cleanup=0): return self.treewalk(mergeroot,myroot,inforoot,myebuild,cleanup=cleanup) @@ -6503,7 +6489,7 @@ def pkgmerge(mytbz2,myroot,mysettings): shutil.rmtree(tmploc+"/"+mypkg,1) os.makedirs(pkgloc) os.makedirs(infloc) - print ">>> extracting info" + writemsg_stdout(">>> extracting info\n") xptbz2.unpackinfo(infloc) # run pkg_setup early, so we can bail out early # (before extracting binaries) if there's a problem @@ -6512,7 +6498,7 @@ def pkgmerge(mytbz2,myroot,mysettings): mysettings.configdict["pkg"]["CATEGORY"] = mycat; a=doebuild(myebuild,"setup",myroot,mysettings,tree="bintree") - print ">>> extracting",mypkg + writemsg_stdout(">>> extracting %s\n" % mypkg) notok=spawn("bzip2 -dqc -- '"+mytbz2+"' | tar xpf -",mysettings,free=1) if notok: print "!!! Error extracting",mytbz2 @@ -6889,29 +6875,31 @@ def do_upgrade(mykey): myworld.close() print "" +def commit_mtimedb(): + if mtimedb: + # Store mtimedb + mymfn=mtimedbfile + try: + mtimedb["version"]=VERSION + cPickle.dump(mtimedb, open(mymfn,"w"), -1) + except SystemExit, e: + raise + except Exception, e: + pass + + try: + os.chown(mymfn,uid,portage_gid) + os.chmod(mymfn,0664) + except SystemExit, e: + raise + except Exception, e: + pass + def portageexit(): global uid,portage_gid,portdb,db if secpass and not os.environ.has_key("SANDBOX_ACTIVE"): close_portdbapi_caches() - - if mtimedb: - # Store mtimedb - mymfn=mtimedbfile - try: - mtimedb["version"]=VERSION - cPickle.dump(mtimedb, open(mymfn,"w"), -1) - except SystemExit, e: - raise - except Exception, e: - pass - - try: - os.chown(mymfn,uid,portage_gid) - os.chmod(mymfn,0664) - except SystemExit, e: - raise - except Exception, e: - pass + commit_mtimedb() atexit.register(portageexit) @@ -6937,7 +6925,7 @@ if (secpass==2) and (not os.environ.has_key("SANDBOX_ACTIVE")): (settings["PORTAGE_CALLER"] == "fixpackages"): didupdate=1 do_upgrade(mykey) - portageexit() # This lets us save state for C-c. + commit_mtimedb() # This lets us save state for C-c. except OSError: #directory doesn't exist pass @@ -6964,7 +6952,7 @@ if root!="/": profileroots = [settings["PORTDIR"]+"/profiles/"] for x in settings["PORTDIR_OVERLAY"].split(): profileroots.insert(0, x+"/profiles/") -thirdparty_lists = grab_multiple("thirdpartymirrors", profileroots, grabdict) +thirdparty_lists = [grabdict(os.path.join(x, "thirdpartymirrors")) for x in profileroots] thirdpartymirrors = stack_dictlist(thirdparty_lists, incremental=True) if not os.path.exists(settings["PORTAGE_TMPDIR"]): @@ -6979,10 +6967,9 @@ if not os.path.isdir(settings["PORTAGE_TMPDIR"]): # COMPATABILITY -- This shouldn't be used. pkglines = settings.packages -groups=settings["ACCEPT_KEYWORDS"].split() -archlist=[] -for myarch in grabfile(settings["PORTDIR"]+"/profiles/arch.list"): - archlist += [myarch,"~"+myarch] +groups = settings["ACCEPT_KEYWORDS"].split() +archlist = flatten([[myarch, "~"+myarch] for myarch in settings["PORTAGE_ARCHLIST"].split()]) + for group in groups: if not archlist: writemsg("--- 'profiles/arch.list' is empty or not available. Empty portage tree?\n") diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py index 9f31e0f6c..f837966bc 100644 --- a/pym/portage_checksum.py +++ b/pym/portage_checksum.py @@ -8,6 +8,7 @@ from portage_const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE import os import shutil import stat +import portage_exception import portage_exec import portage_util import portage_locks @@ -142,5 +143,7 @@ def perform_checksum(filename, hash_function=md5hash, calc_prelink=0): def perform_multiple_checksums(filename, hashes=["MD5"], calc_prelink=0): rVal = {} for x in hashes: + if x not in hashfunc_map: + raise portage_exception.DigestException, x+" hash function not available (needs dev-python/pycrypto)" rVal[x] = perform_checksum(filename, hashfunc_map[x], calc_prelink)[0] return rVal diff --git a/pym/portage_const.py b/pym/portage_const.py index b0632942b..29843f887 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -53,6 +53,8 @@ DEFAULT_PATH = ":".join(map(lambda x: os.path.join(PREFIX, x), ["/sbin", "/usr/s EAPI = "prefix" HASHING_BLOCKSIZE = 32768 +# Disabling until behaviour when missing the relevant python module is +# corrected. #116485 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"] # =========================================================================== diff --git a/pym/portage_const_autotool.py b/pym/portage_const_autotool.py index bc3672de0..170bf7dec 100644 --- a/pym/portage_const_autotool.py +++ b/pym/portage_const_autotool.py @@ -14,4 +14,4 @@ portagegroup="@portagegroup@" portageuser="@portageuser@" rootuser="@rootuser@" wheelgid="@wheelgid@" -wheelgroup"@wheelgroup@ +wheelgroup="@wheelgroup@" diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 287366734..99c00d041 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -56,6 +56,15 @@ def paren_reduce(mystr,tokenize=1): mylist = mylist + [subsec] return mylist +def paren_enclose(mylist): + mystrparts = [] + for x in mylist: + if isinstance(x, list): + mystrparts.append("( "+paren_enclose(x)+" )") + else: + mystrparts.append(x) + return " ".join(mystrparts) + def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): """Takes a paren_reduce'd array and reduces the use? conditionals out leaving an array with subarrays @@ -63,19 +72,10 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): # Quick validity checks for x in range(len(deparray)): if deparray[x] in ["||","&&"]: - if len(deparray) - 1 == x: - # Operator is the last element - raise portage_exception.InvalidDependString("INVALID "+deparray[x]+" DEPEND STRING: "+str(deparray)) - if type(deparray[x+1]) != types.ListType: - # Operator is not followed by a list - raise portage_exception.InvalidDependString("INVALID "+deparray[x]+" DEPEND STRING: "+str(deparray)) + if len(deparray) - 1 == x or not isinstance(deparray[x+1], list): + raise portage_exception.InvalidDependString(deparray[x]+" missing atom list in \""+paren_enclose(deparray)+"\"") if deparray and deparray[-1] and deparray[-1][-1] == "?": - # Conditional with no target - raise portage_exception.InvalidDependString("INVALID "+deparray[x]+" DEPEND STRING: "+str(deparray)) - - #XXX: Compatibility -- Still required? - if ("*" in uselist): - matchall=1 + raise portage_exception.InvalidDependString("Conditional without target in \""+paren_enclose(deparray)+"\"") mydeparray = deparray[:] rlist = [] @@ -83,7 +83,11 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): head = mydeparray.pop(0) if type(head) == types.ListType: - rlist = rlist + [use_reduce(head, uselist, masklist, matchall, excludeall)] + additions = use_reduce(head, uselist, masklist, matchall, excludeall) + if additions: + rlist.append(additions) + elif rlist and rlist[-1] == "||": + raise portage_exception.InvalidDependString("No default atom(s) in \""+paren_enclose(deparray)+"\"") else: if head[-1] == "?": # Use reduce next group on fail. @@ -126,7 +130,9 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): if ismatch: target = newdeparray[-1] if isinstance(target, list): - rlist += [use_reduce(target, uselist, masklist, matchall, excludeall)] + additions = use_reduce(target, uselist, masklist, matchall, excludeall) + if additions: + rlist.append(additions) else: rlist += [target] diff --git a/pym/portage_exec.py b/pym/portage_exec.py index ae51f75fb..72621ef1d 100644 --- a/pym/portage_exec.py +++ b/pym/portage_exec.py @@ -16,11 +16,9 @@ try: except ImportError: max_fd_limit = 256 - sandbox_capable = (os.path.isfile(SANDBOX_BINARY) and os.access(SANDBOX_BINARY, os.X_OK)) - def spawn_bash(mycommand, debug=False, opt_name=None, **keywords): args = [BASH_BINARY] if not opt_name: @@ -32,7 +30,6 @@ def spawn_bash(mycommand, debug=False, opt_name=None, **keywords): args.append(mycommand) return spawn(args, opt_name=opt_name, **keywords) - def spawn_sandbox(mycommand, opt_name=None, **keywords): if not sandbox_capable: return spawn_bash(mycommand, opt_name=opt_name, **keywords) @@ -42,7 +39,6 @@ def spawn_sandbox(mycommand, opt_name=None, **keywords): args.append(mycommand) return spawn(args, opt_name=opt_name, **keywords) - # We need to make sure that any processes spawned are killed off when # we exit. spawn() takes care of adding and removing pids to this list # as it creates and cleans up processes. @@ -58,8 +54,8 @@ def cleanup(): # This pid has been cleaned up outside # of spawn(). pass -atexit.register(cleanup) +atexit.register(cleanup) def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, uid=None, gid=None, groups=None, umask=None, logfile=None, @@ -169,7 +165,6 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, # Everything succeeded return 0 - def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask): # If the process we're creating hasn't been given a name @@ -213,7 +208,6 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask): # And switch to the new process. os.execve(binary, myargs, env) - def find_binary(binary): from portage_const import DEFAULT_PATH for path in DEFAULT_PATH.split(":"): diff --git a/pym/portage_util.py b/pym/portage_util.py index 9c521ab8a..ef155b5db 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -4,14 +4,23 @@ import sys,string,shlex,os.path +if not hasattr(__builtins__, "set"): + from sets import Set as set noiselimit = 0 -def writemsg(mystr,noiselevel=0): + +def writemsg(mystr,noiselevel=0,fd=None): """Prints out warning and debug messages based on the noiselimit setting""" global noiselimit + if fd is None: + fd = sys.stderr if noiselevel <= noiselimit: - sys.stderr.write(mystr) - sys.stderr.flush() + fd.write(mystr) + fd.flush() + +def writemsg_stdout(mystr,noiselevel=0): + """Prints messages stdout based on the noiselimit setting""" + writemsg(mystr, noiselevel=noiselevel, fd=sys.stdout) def grabfile(myfilename, compat_level=0, recursive=0): """This function grabs the lines in a file, normalizes whitespace and returns lines in a list; if a line @@ -106,38 +115,32 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0): def stack_lists(lists, incremental=1): """Stacks an array of list-types into one array. Optionally removing - distinct values using '-value' notation. Higher index is preferenced.""" - new_list = [] - for x in lists: - for y in x: - if y: - if incremental and y[0]=='-': - while y[1:] in new_list: - del new_list[new_list.index(y[1:])] - else: - if y not in new_list: - new_list.append(y[:]) - return new_list + distinct values using '-value' notation. Higher index is preferenced. + + all elements must be hashable.""" -def grab_multiple(basename, locations, handler, all_must_exist=0): - mylist = [] - for x in locations: - mylist.append(handler(x+"/"+basename)) - return mylist + new_list = {} + for x in lists: + for y in filter(None, x): + if incremental and y.startswith("-"): + if y[1:] in new_list: + del new_list[y[1:]] + else: + new_list[y] = True + return new_list.keys() -def grabdict(myfilename,juststrings=0,empty=0,recursive=0): +def grabdict(myfilename, juststrings=0, empty=0, recursive=0): """This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary""" newdict={} - mylines=grablines(myfilename,recursive) - for x in mylines: + for x in grablines(myfilename, recursive): #the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line #into single spaces. if x[0] == "#": continue myline=string.split(x) - if len(myline)<2 and empty==0: + if len(myline) < 2 and empty == 0: continue - if len(myline)<1 and empty==1: + if len(myline) < 1 and empty == 1: continue if juststrings: newdict[myline[0]]=string.join(myline[1:]) @@ -145,17 +148,17 @@ def grabdict(myfilename,juststrings=0,empty=0,recursive=0): newdict[myline[0]]=myline[1:] return newdict -def grabdict_package(myfilename,juststrings=0,recursive=0): +def grabdict_package(myfilename, juststrings=0, recursive=0): pkgs=grabdict(myfilename, juststrings, empty=1, recursive=recursive) - for x in pkgs.keys(): + for x in pkgs: if not isvalidatom(x): del(pkgs[x]) writemsg("--- Invalid atom in %s: %s\n" % (myfilename, x)) return pkgs -def grabfile_package(myfilename,compatlevel=0,recursive=0): - pkgs=grabfile(myfilename,compatlevel,recursive=recursive) - for x in range(len(pkgs)-1,-1,-1): +def grabfile_package(myfilename, compatlevel=0, recursive=0): + pkgs=grabfile(myfilename, compatlevel, recursive=recursive) + for x in range(len(pkgs)-1, -1, -1): pkg = pkgs[x] if pkg[0] == "-": pkg = pkg[1:] @@ -166,18 +169,6 @@ def grabfile_package(myfilename,compatlevel=0,recursive=0): del(pkgs[x]) return pkgs -def grabints(myfilename,recursive=0): - newdict={} - mylines=grablines(myfilename,recursive) - for x in mylines: - #the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line - #into single spaces. - myline=string.split(x) - if len(myline)!=2: - continue - newdict[myline[0]]=string.atoi(myline[1]) - return newdict - def grablines(myfilename,recursive=0): mylines=[] if recursive and os.path.isdir(myfilename): @@ -194,34 +185,26 @@ def grablines(myfilename,recursive=0): pass return mylines -def writeints(mydict,myfilename): - try: - myfile=open(myfilename,"w") - except IOError: - return 0 - for x in mydict.keys(): - myfile.write(x+" "+`mydict[x]`+"\n") - myfile.close() - return 1 - -def writedict(mydict,myfilename,writekey=1): +def writedict(mydict,myfilename,writekey=True): """Writes out a dict to a file; writekey=0 mode doesn't write out the key and assumes all values are strings, not lists.""" + myfile = None + myf2 = "%s.%i" % (myfilename, os.getpid()) try: - myfile=open(myfilename,"w") + myfile=open(myf2,"w") + if not writekey: + for x in mydict.values(): + myfile.write(x+"\n") + else: + for x in mydict.keys(): + myfile.write("%s %s\n" % (x, " ".join(mydict[x]))) + myfile.close() + os.rename(myf2, myfilename) + except IOError: - writemsg("Failed to open file for writedict(): "+str(myfilename)+"\n") + if myfile is not None: + os.unlink(myf2) return 0 - if not writekey: - for x in mydict.values(): - myfile.write(x+"\n") - else: - for x in mydict.keys(): - myfile.write(x+" ") - for y in mydict[x]: - myfile.write(y+" ") - myfile.write("\n") - myfile.close() return 1 def getconfig(mycfg,tolerant=0,allow_sourcing=False): @@ -418,49 +401,54 @@ def pickle_read(filename,default=None,debug=0): data = default return data -class ReadOnlyConfig: - def __init__(self,filename,strict_keys=0): - self.__filename = filename[:] - self.__strict_keys = strict_keys - self.__mydict = {} - self.__dict_was_loaded = False - if os.path.isfile(self.__filename): - self.__mydict = getconfig(self.__filename) - self.__dict_was_loaded = True - - def isLoaded(): - return self.__dict_was_loaded - - def __getitem__(self,key): - if self.__mydict.has_key(key): - return self.__mydict[key][:] - if self.__strict_keys: - raise KeyError("%s not found in config: '%s'" % (key,self.__filename)) - return "" - - def __setitem__(self,key,value): - raise KeyError("This class is not modifiable.") - - def keys(self): - return self.__mydict.keys() - - def has_key(self,key): - return self.__mydict.has_key(key) +def dump_traceback(msg, noiselevel=1): + import sys, traceback + info = sys.exc_info() + if not info[2]: + stack = traceback.extract_stack()[:-1] + error = None + else: + stack = traceback.extract_tb(info[2]) + error = str(info[1]) + writemsg("\n====================================\n", noiselevel=noiselevel) + writemsg("%s\n\n" % msg, noiselevel=noiselevel) + for line in traceback.format_list(stack): + writemsg(line, noiselevel=noiselevel) + if error: + writemsg(error+"\n", noiselevel=noiselevel) + writemsg("====================================\n\n", noiselevel=noiselevel) -def unique_array(array): - """Takes an array and makes sure each element is unique.""" - mya = [] - for x in array: - if x not in mya: - mya.append(x) - return mya +def unique_array(s): + """lifted from python cookbook, credit: Tim Peters + Return a list of the elements in s in arbitrary order, sans duplicates""" + n = len(s) + # assume all elements are hashable, if so, it's linear + try: + return list(set(s)) + except TypeError: + pass + # so much for linear. abuse sort. + try: + t = list(s) + t.sort() + except TypeError: + pass + else: + assert n > 0 + last = t[0] + lasti = i = 1 + while i < n: + if t[i] != last: + t[lasti] = last = t[i] + lasti += 1 + i += 1 + return t[:lasti] -def dump_traceback(msg): - import sys, traceback - writemsg("\n====================================\n", noiselevel=1) - writemsg("Warning: %s\n" % msg, noiselevel=1) - for line in traceback.format_list(traceback.extract_stack()[:-1]): - writemsg(line, noiselevel=1) - writemsg("Please file a bug for %s\n" % sys.argv[0], noiselevel=1) - writemsg("====================================\n\n", noiselevel=1) + # blah. back to original portage.unique_array + u = [] + for x in s: + if x not in u: + u.append(x) + return u +