Merged from trunk -r11505:11515
authorFabian Groffen <grobian@gentoo.org>
Sat, 27 Sep 2008 15:53:48 +0000 (15:53 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 27 Sep 2008 15:53:48 +0000 (15:53 -0000)
   | 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 <lavajoe@g.o> 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

bin/ebuild.sh
bin/isolated-functions.sh
bin/misc-functions.sh
doc/package/ebuild/eapi/2.docbook
man/make.conf.5
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/news.py
pym/portage/update.py

index 41eba7696a8d4fc09977647fd32c9c80a5309e07..93c67586524d92f16eb198720fcda5431b81db0c 100755 (executable)
@@ -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() {
index b509aceb7e6e7a166b2831324681d1aa2dde0f50..87ac8ac2fe08c64537a4de13deea5b2cf0e59377 100755 (executable)
@@ -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
 
index 9ec86329b19f8f1f7ee13e53f57aa1863d7d0c41..cdb3f44bb69ff67da9801adc6bb27f7dadeae3fb 100644 (file)
@@ -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}"
index b1c6ae511ea40a7e5f563d15d3a27fc03e7c6a97..ceec15ccf308ea89346c0e81302902eb44d19329 100644 (file)
@@ -203,64 +203,6 @@ src_compile() {
                                </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>
index 9adc076826b525964e219c5e420764e2202fffa5..054d83d1cdcebfbeddd52fedb40a3847cc5733ba 100644 (file)
@@ -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
index e16621ab51ed576007ba914c5f7dc07c729ff9cf..bde4a6ca3c7069973bc1004e47baaf1caa1d1d42 100644 (file)
@@ -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":
index 663feb7469c9f06acccf691eb2f7bb86a9c70df5..218e5351b7198a78462d0c6ade17e38fd70b640d 100644 (file)
@@ -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(),
index dd90f40d30350c1aaee3b45861bfc169f5469803..e366287bb3b668ba60cc73d445ed6577e5709ae2 100644 (file)
@@ -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)
index 36108dd22b5392ad5a36cb9bb13cf8d71f4ddba9..85d07f5a39795a4f8ab9db0af87e5ca811aeb6b8 100644 (file)
@@ -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: