From: Fabian Groffen Date: Sat, 27 Sep 2008 15:53:48 +0000 (-0000) Subject: Merged from trunk -r11505:11515 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d8860a7072f9a5e7b2dd88ffe44bb7188622b604;p=portage.git Merged from trunk -r11505:11515 | 11506 | Document FEATURES=preserve-libs. | | zmedico | | | 11508 | Move the world file update code out of update_config_files() | | zmedico | since it should not be relative to PORTAGE_CONFIGROOT. | | | Thanks to grobian for reporting. | | 11509 | Define __all__ and remove unused imports found by pyflakes. | | zmedico | | | 11510 | Bug #237526 - Use portage.util.grablines() for exception | | zmedico | handling when reading the unread file. | | 11511 | Fix PYTHONPATH adjustments to only insert a colon when | | zmedico | necessary. This is necessary since having a stray colon | | | causes python to interpret the empty path entry as "." which | | | triggers the following message if cwd happens to contain a | | | directory names "os": warning: Not importing directory 'os': | | | missing __init__.py Thanks to Joe Peterson for | | | reporting. | | 11512 | Remove unneeded quotes from PYTHONPATH assignments and also | | zmedico | fix one more potential redundant colon inside | | | misc-functions.sh. | | 11513 | Improve error messages for issues with the SYNC variable | | zmedico | inside action_sync(). | | 11514 | Fix broken reference to self.files inside | | zmedico | SpawnProcess._start(). | | 11515 | Remove everything related to the eapi* default phase | | zmedico | functions since they are not included in the current EAPI 2 | | | draft. | svn path=/main/branches/prefix/; revision=11568 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 41eba7696..93c675865 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -166,7 +166,7 @@ has_version() { 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 @@ -186,7 +186,7 @@ portageq() { 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" "$@" } @@ -202,7 +202,7 @@ best_version() { 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 @@ -1458,11 +1458,6 @@ _ebuild_phase_funcs() { 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() { @@ -1481,35 +1476,17 @@ _ebuild_phase_funcs() { 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 @@ -1517,11 +1494,6 @@ _ebuild_phase_funcs() { 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() { diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index b509aceb7..87ac8ac2f 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -561,7 +561,7 @@ save_ebuild_env() { 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 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 9ec86329b..cdb3f44bb 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -749,7 +749,7 @@ dyn_package() { 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}" diff --git a/doc/package/ebuild/eapi/2.docbook b/doc/package/ebuild/eapi/2.docbook index b1c6ae511..ceec15ccf 100644 --- a/doc/package/ebuild/eapi/2.docbook +++ b/doc/package/ebuild/eapi/2.docbook @@ -203,64 +203,6 @@ src_compile() { - - 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. - - Default EAPI Phase Functions - - - - - Function Name - - - - - eapi0_pkg_nofetch - - - eapi0_src_unpack - - - eapi0_src_compile - - - eapi0_src_test - - - eapi1_pkg_nofetch - - - eapi1_src_unpack - - - eapi1_src_compile - - - eapi1_src_test - - - eapi2_pkg_nofetch - - - eapi2_src_unpack - - - eapi2_src_configure - - - eapi2_src_compile - - - eapi2_src_test - - - -
Default Phase Function Alias diff --git a/man/make.conf.5 b/man/make.conf.5 index 9adc07682..054d83d1c 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -269,6 +269,10 @@ Fetch in the background while compiling. Run `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 diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index e16621ab5..bde4a6ca3 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2160,7 +2160,7 @@ class SpawnProcess(SubProcess): 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() @@ -11120,7 +11120,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): 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": @@ -11571,8 +11576,9 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): 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 \ @@ -11617,6 +11623,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): print display_news_notification(root_config, myopts) + return os.EX_OK def action_metadata(settings, portdb, myopts): portage.writemsg_stdout("\n>>> Updating Portage cache: ") @@ -13836,7 +13843,7 @@ def emerge_main(): 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": diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 663feb746..218e5351b 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -118,7 +118,7 @@ try: 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, \ @@ -7154,6 +7154,7 @@ def _global_updates(trees, prev_mtimes): 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") @@ -7187,6 +7188,20 @@ def _global_updates(trees, prev_mtimes): 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(), diff --git a/pym/portage/news.py b/pym/portage/news.py index dd90f40d3..e366287bb 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -3,14 +3,18 @@ # 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): """ @@ -138,19 +142,9 @@ 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) diff --git a/pym/portage/update.py b/pym/portage/update.py index 36108dd22..85d07f5a3 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -177,19 +177,6 @@ def update_config_files(config_root, protect, protect_mask, update_iter): 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: