fi
# return shell-true/shell-false if exists.
# Takes single depend-type atoms.
- PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
"${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1"
local retval=$?
case "${retval}" in
if [ "${EBUILD_PHASE}" == "depend" ]; then
die "portageq calls are not allowed in the global scope"
fi
- PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
"${PORTAGE_BIN_PATH}/portageq" "$@"
}
fi
# returns the best/most-current match.
# Takes single depend-type atoms.
- PYTHONPATH="${PORTAGE_PYM_PATH}:${PYTHONPATH}" \
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
"${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1"
local retval=$?
case "${retval}" in
eval "default_$x() {
die \"default_$x() is not supported with EAPI='$eapi' during phase $phase_func\"
}"
- for y in 0 1 2 ; do
- eval "eapi${y}_$x() {
- die \"eapi${y}_$x() is not supported with EAPI='$eapi' during phase $phase_func\"
- }"
- done
done
eval "default() {
if hasq $phase_func $default_phases ; then
- eapi0_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; }
- eapi0_src_unpack () { _eapi0_src_unpack "$@" ; }
- eapi0_src_prepare () { die "$FUNCNAME is not supported" ; }
- eapi0_src_configure () { die "$FUNCNAME is not supported" ; }
- eapi0_src_compile () { _eapi0_src_compile "$@" ; }
- eapi0_src_test () { _eapi0_src_test "$@" ; }
- eapi0_src_install () { die "$FUNCNAME is not supported" ; }
-
- eapi1_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; }
- eapi1_src_unpack () { _eapi0_src_unpack "$@" ; }
- eapi1_src_prepare () { die "$FUNCNAME is not supported" ; }
- eapi1_src_configure () { die "$FUNCNAME is not supported" ; }
- eapi1_src_compile () { _eapi1_src_compile "$@" ; }
- eapi1_src_test () { _eapi0_src_test "$@" ; }
- eapi1_src_install () { die "$FUNCNAME is not supported" ; }
-
- eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; }
- eapi2_src_unpack () { _eapi0_src_unpack "$@" ; }
- eapi2_src_prepare () { true ; }
- eapi2_src_configure () { _eapi2_src_configure "$@" ; }
- eapi2_src_compile () { _eapi2_src_compile "$@" ; }
- eapi2_src_test () { _eapi0_src_test "$@" ; }
- eapi2_src_install () { die "$FUNCNAME is not supported" ; }
+ _eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; }
+ _eapi2_src_unpack () { _eapi0_src_unpack "$@" ; }
+ _eapi2_src_prepare () { true ; }
+ _eapi2_src_test () { _eapi0_src_test "$@" ; }
+ _eapi2_src_install () { die "$FUNCNAME is not supported" ; }
for x in $default_phases ; do
- eval "default_$x() { eapi2_$x \"\$@\" ; }"
+ eval "default_$x() { _eapi2_$x \"\$@\" ; }"
done
- eval "default() { eapi2_$phase_func \"\$@\" ; }"
+ eval "default() { _eapi2_$phase_func \"\$@\" ; }"
else
eval "default_$x() {
die \"default_$x() is not supported in phase $default_func\"
}"
- for y in 0 1 2 ; do
- eval "eapi${y}_$x() {
- die \"eapi${y}_$x() is not supported with EAPI='$eapi' during phase $phase_func\"
- }"
- done
done
eval "default() {
for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \
src_compile src_test src_install pkg_preinst pkg_postinst \
pkg_prerm pkg_postrm ; do
- unset -f {,_}default_$x {,_}eapi{0,1,2}_$x
+ unset -f _default_$x _eapi{0,1,2}_$x
done
unset x
tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
bzip2 -f > "$PORTAGE_BINPKG_TMPFILE" || \
die "Failed to create tarball"
- export PYTHONPATH=${PORTAGE_PYM_PATH:-${EPREFIX}/usr/lib/portage/pym}
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \
python -c "from portage import xpak; t=xpak.tbz2('${PORTAGE_BINPKG_TMPFILE}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')"
if [ $? -ne 0 ]; then
rm -f "${PORTAGE_BINPKG_TMPFILE}"
</tbody>
</tgroup>
</table>
- <para>
- The default phase functions for a particular EAPI are also
- accessible as functions having names that start with 'eapi'
- followed by the EAPI value. For example, a call to a function
- named eapi0_src_compile is equivalent to a call to the
- default src_compile implementation that is provided with EAPI 0.
- </para>
- <table><title>Default EAPI Phase Functions</title>
- <tgroup cols='1' align='left' >
- <colspec colname='name'/>
- <thead>
- <row>
- <entry>Function Name</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>eapi0_pkg_nofetch</entry>
- </row>
- <row>
- <entry>eapi0_src_unpack</entry>
- </row>
- <row>
- <entry>eapi0_src_compile</entry>
- </row>
- <row>
- <entry>eapi0_src_test</entry>
- </row>
- <row>
- <entry>eapi1_pkg_nofetch</entry>
- </row>
- <row>
- <entry>eapi1_src_unpack</entry>
- </row>
- <row>
- <entry>eapi1_src_compile</entry>
- </row>
- <row>
- <entry>eapi1_src_test</entry>
- </row>
- <row>
- <entry>eapi2_pkg_nofetch</entry>
- </row>
- <row>
- <entry>eapi2_src_unpack</entry>
- </row>
- <row>
- <entry>eapi2_src_configure</entry>
- </row>
- <row>
- <entry>eapi2_src_compile</entry>
- </row>
- <row>
- <entry>eapi2_src_test</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
</section>
<section id='package-ebuild-eapi-2-phases-default-function-alias'>
<title>Default Phase Function Alias</title>
`tail \-f /var/log/emerge\-fetch.log` in a
terminal to view parallel-fetch progress.
.TP
+.B preserve\-libs
+Preserve libraries when the sonames change during upgrade or downgrade.
+Libraries are preserved only if consumers of those libraries are detected.
+.TP
.B protect\-owned
This is identical to the \fIcollision\-protect\fR feature except that files
may be overwritten if they are not explicitly listed in the contents of a
if isinstance(retval, int):
# spawn failed
os.close(master_fd)
- for f in self.files.values():
+ for f in files.values():
f.close()
self.returncode = retval
self.wait()
if not os.path.exists(myportdir):
print ">>>",myportdir,"not found, creating it."
os.makedirs(myportdir,0755)
- syncuri=settings["SYNC"].rstrip()
+ syncuri = settings.get("SYNC", "").strip()
+ if not syncuri:
+ writemsg_level("!!! SYNC is undefined. Is /etc/make.globals missing?\n",
+ noiselevel=-1, level=logging.ERROR)
+ return 1
+
os.umask(0022)
updatecache_flg = False
if myaction == "metadata":
dosyncuri = syncuri
else:
- print "!!! rsync setting: ",syncuri,"not recognized; exiting."
- sys.exit(1)
+ writemsg_level("!!! Unrecognized protocol: SYNC='%s'\n" % (syncuri,),
+ noiselevel=-1, level=logging.ERROR)
+ return 1
if updatecache_flg and \
myaction != "metadata" and \
print
display_news_notification(root_config, myopts)
+ return os.EX_OK
def action_metadata(settings, portdb, myopts):
portage.writemsg_stdout("\n>>> Updating Portage cache: ")
root_config = trees[settings["ROOT"]]["root_config"]
if "sync" == myaction:
- action_sync(settings, trees, mtimedb, myopts, myaction)
+ return action_sync(settings, trees, mtimedb, myopts, myaction)
elif "metadata" == myaction:
action_metadata(settings, portdb, myopts)
elif myaction=="regen":
import portage.eclass_cache
from portage.localization import _
from portage.update import dep_transform, fixdbentries, grab_updates, \
- parse_updates, update_config_files, update_dbentries
+ parse_updates, update_config_files, update_dbentries, update_dbentry
# Need these functions directly in portage namespace to not break every external tool in existence
from portage.versions import best, catpkgsplit, catsplit, pkgcmp, \
global secpass
if secpass < 2 or "SANDBOX_ACTIVE" in os.environ:
return
+ root = "/"
mysettings = trees["/"]["vartree"].settings
updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates")
for msg in errors:
writemsg("%s\n" % msg, noiselevel=-1)
+ world_file = os.path.join(root, WORLD_FILE)
+ world_list = grabfile(world_file)
+ world_modified = False
+ for update_cmd in myupd:
+ for pos, atom in enumerate(world_list):
+ new_atom = update_dbentry(update_cmd, atom)
+ if atom != new_atom:
+ world_list[pos] = new_atom
+ world_modified = True
+ if world_modified:
+ world_list.sort()
+ write_atomic(world_file,
+ "".join("%s\n" % (x,) for x in world_list))
+
update_config_files("/",
mysettings.get("CONFIG_PROTECT","").split(),
mysettings.get("CONFIG_PROTECT_MASK","").split(),
# Distributed under the terms of the GNU General Public License v2
# $Id$
+__all__ = ["NewsManager", "NewsItem", "DisplayRestriction",
+ "DisplayProfileRestriction", "DisplayKeywordRestriction",
+ "DisplayInstalledRestriction"]
+
import errno
import os
import re
-from portage.const import INCREMENTALS, PROFILE_PATH, NEWS_LIB_PATH
-from portage.util import ensure_dirs, apply_permissions, normalize_path, grabfile, write_atomic
+from portage.util import apply_permissions, ensure_dirs, grabfile, \
+ grablines, normalize_path, write_atomic
from portage.data import portage_gid
-from portage.locks import lockfile, unlockfile, lockdir, unlockdir
-from portage.exception import FileNotFound, OperationNotPermitted
+from portage.locks import lockfile, unlockfile
+from portage.exception import OperationNotPermitted
class NewsManager(object):
"""
if os.access(os.path.dirname(unreadfile), os.W_OK):
# TODO: implement shared readonly locks
unread_lock = lockfile(unreadfile)
- try:
- f = open(unreadfile)
- try:
- unread = f.readlines()
- finally:
- f.close()
- except EnvironmentError, e:
- if e.errno != errno.ENOENT:
- raise
- del e
- return 0
- if len(unread):
- return len(unread)
+
+ return len(grablines(unreadfile))
+
finally:
if unread_lock:
unlockfile(unread_lock)
del file_contents[x]
continue
- worldlist = grabfile(os.path.join(config_root, WORLD_FILE))
- modified = False
- for update_cmd in update_iter:
- for pos, atom in enumerate(worldlist):
- new_atom = update_dbentry(update_cmd, atom)
- if atom != new_atom:
- worldlist[pos] = new_atom
- modified = True
- if modified:
- worldlist.sort()
- write_atomic(os.path.join(config_root, WORLD_FILE),
- "\n".join(worldlist)+"\n")
-
# update /etc/portage/packages.*
ignore_line_re = re.compile(r'^#|^\s*$')
for update_cmd in update_iter: