+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.
-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.
#!@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 $
#!@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 $
#!@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 $
#!@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 $
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':
#!@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 $
#!@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 $
#!@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 $
#!@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
#!@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 $
#!@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 $
#!@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 $
#!@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 $
pfx = basename
if prefix: pfx = prefix + "/" + pfx
install(i, dirname, options, pfx)
+ else:
+ return False
+ return True
+
class OptionsClass:
def __init__(self):
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()
#!@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 $
#!@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 $
#!@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 $
#!@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 <karltk@gentoo.org>
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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}"
+
#!@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 $
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"
#!@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}"
return 0
}
-add-ebuild-death-hook() {
+register_die_hook() {
export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*"
}
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
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
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}"
[ -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
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}"
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
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
}
[ "${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"
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
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
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
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
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
}
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
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"
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
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
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
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
}
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
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
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
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
from copy import copy
from optparse import OptionParser, OptionValueError
-
+import re
import os, portage, portage_const
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)
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:
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:
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"
#!@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 $
#
#!@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 $
"--onlydeps", "--pretend",
"--quiet", "--resume",
"--searchdesc", "--selective",
-"--skipfirst",
+"--skipfirst", "--skip-first",
"--tree",
"--update", "--upgradeonly",
"--usepkg", "--usepkgonly",
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:
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
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
#
# 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)
newlist.append(atom)
mylist = newlist
+ missing_atoms = []
for mydep in mylist:
try:
if not self.select_dep(portage.root, mydep, raise_on_missing=True):
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):
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:
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
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
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"
#!@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 <karltk@gentoo.org>
#!@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 $
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)
#!@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 $
#!@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 $
#!/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 $
#!@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 $
#!@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 $
#!@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 $
#!@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}}"
#!@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}}"
-# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$
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
}
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
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
sys.exit(1)
except KeyError:
sys.exit(1)
+has_version.uses_root = True
def best_version(argv):
print portage.best(mylist)
except KeyError:
sys.exit(1)
+best_version.uses_root = True
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):
print portage.best(mylist)
except KeyError:
sys.exit(1)
+best_visible.uses_root = True
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):
mybest=portage.best(portage.db[argv[0]]["porttree"].dbapi.match(pkg))
if mybest:
print mybest
+all_best_visible.uses_root = True
+
def match(argv):
"""<root> <category/package>
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):
"""
print portage.root+portage.VDB_PATH
+
def gentoo_mirrors(argv):
"""
Returns the mirrors set to use in the portage configuration.
Returns a specific environment variable as exists prior to ebuild.sh.
Similar to: emerge --verbose --info | @EGREP@ '^<variable>='
"""
- 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] +"'"
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)
#!@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 $
if [[ -n ${f} ]] ; then
echo -e "\n\aQA Notice: the following shared libraries lack a SONAME\a"
echo "${f}"
+ echo
sleep 1
fi
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
+
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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 $
#!@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
#!@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 $
#!@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}
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
#!@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 $
#!@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 $
#!@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 $
import portage_checksum
import portage_const
import portage_dep
+import portage_exception
import cvstree
import time
import codecs
"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)",
"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.",
"DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev",
"DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
"IUSE.invalid",
+"KEYWORDS.stupid",
"ebuild.minorsyn",
"ebuild.badheader",
"file.size",
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"),"]"
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
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
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:
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
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
#!@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 $
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# '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
#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)
# Minimal CONFIG_PROTECT
CONFIG_PROTECT="/etc"
+# Disable auto-use
+USE_ORDER="env:pkg:conf:defaults"
+
# *****************************
# ** DO NOT EDIT THIS FILE **
# ***************************************************
\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
\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
\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
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
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"
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
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.
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
.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
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
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'.
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
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
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).
# 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
.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
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:
# $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
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"
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
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"]
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)
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:
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:
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"]
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)
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])
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
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()
# 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"):
# 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
# 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
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
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
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)
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( \
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
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"])
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 \
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"]
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
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:
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("/"))
# 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
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)
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):
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)
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]
#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"])
#process symlinks second-to-last, directories last.
mydirs=[]
- mysyms=[]
modprotect="/lib/modules/"
for obj in mykeys:
obj=os.path.normpath(obj)
#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
# 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 pos<len(mysyms):
- obj=mysyms[pos]
- if os.path.exists(obj):
- pos += 1
- else:
- #we have a dead symlink; remove it from our list, then from existence
- del mysyms[pos]
- #we've made progress!
- progress = 1
- try:
- os.unlink(obj)
- print "<<< ","sym",obj
- except (OSError,IOError),e:
- print "!!! ","sym",obj
- #immutable?
- pass
-
- #step 2: remove all the empty directories we can...
-
- pos = 0
- while pos<len(mydirs):
- obj=mydirs[pos]
- objld=listdir(obj)
-
- if objld == None:
- print "mydirs["+str(pos)+"]",mydirs[pos]
- print "obj",obj
- print "objld",objld
- # the directory doesn't exist yet, continue
- pos += 1
- continue
-
- if len(objld)>0:
- #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)
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()
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:
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
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)
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:
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:
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):
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,
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="!!!"
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)
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
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
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)
(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
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"]):
# 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")
import os
import shutil
import stat
+import portage_exception
import portage_exec
import portage_util
import portage_locks
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
EAPI = "prefix"
HASHING_BLOCKSIZE = 32768
+# Disabling until behaviour when missing the relevant python module is
+# corrected. #116485
MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
# ===========================================================================
portageuser="@portageuser@"
rootuser="@rootuser@"
wheelgid="@wheelgid@"
-wheelgroup"@wheelgroup@
+wheelgroup="@wheelgroup@"
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
# 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 = []
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.
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]
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:
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)
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.
# 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,
# 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
# 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(":"):
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
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:])
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:]
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):
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):
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
+