Merged from trunk 9049:9056
authorFabian Groffen <grobian@gentoo.org>
Thu, 27 Dec 2007 19:48:54 +0000 (19:48 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 27 Dec 2007 19:48:54 +0000 (19:48 -0000)
   | 9050    | - small UI cleanups. *should* not cause problems with lack   |
   | solar   | of missing newlines.                                         |

   | 9051    | Bug #203239 - With FEATURES=noauto, always source ${EBUILD}. |
   | zmedico | This will load the ${T}/environment file if available and    |
   |         | then source ${EBUILD} to overwrite any functions that have   |
   |         | changed.                                                     |

   | 9052    | Bug #203090 - Do not trust the global counter file that can  |
   | zmedico | lead to invalid COUNTER generation.                          |

   | 9053    | Fix "Initializing counter" message to show the correct       |
   | zmedico | value.                                                       |

   | 9054    | In getconfig(), pass the infile attribute into the shlex     |
   | zmedico | constructor so that shlex.sourcehook() properly joins        |
   |         | relative paths.                                              |

   | 9055    | Fix sync_local() to return 0 when a appropriate. Thanks to   |
   | zmedico | Alon Bar-Lev" <alonbl@gentoo.org>                            |

   | 9056    | Fix broken handling of the tuple that's returned from        |
   | zmedico | verify_all(). Thanks to Betelgeuse.                          |

svn path=/main/branches/prefix/; revision=9058

bin/ebuild.sh
bin/emerge-webrsync
bin/repoman
pym/_emerge/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py
pym/portage/util.py

index 45f084bfe0f018b7b34b22a99514c186d3d6a477..c955a8a55b60d69ce709bcc7d450242018235fc2 100755 (executable)
@@ -1623,9 +1623,8 @@ if hasq "depend" "${EBUILD_SH_ARGS}"; then
        unset BIN_PATH BIN BODY FUNC_SRC
 fi
 
-if hasq ${EBUILD_SH_ARGS} clean ; then
-       true
-elif ! hasq ${EBUILD_PHASE} depend && [ -f "${T}"/environment ] ; then
+if ! hasq ${EBUILD_PHASE} clean depend && \
+       [ -f "${T}"/environment ] ; then
        # The environment may have been extracted from environment.bz2 or
        # may have come from another version of ebuild.sh or something.
        # In any case, preprocess it to prevent any potential interference.
@@ -1656,8 +1655,10 @@ elif ! hasq ${EBUILD_PHASE} depend && [ -f "${T}"/environment ] ; then
        export SANDBOX_ON=${PORTAGE_SANDBOX_ON}
        unset PORTAGE_SANDBOX_ON
        source_all_bashrcs
-else
+fi
 
+if ! hasq ${EBUILD_PHASE} clean && \
+       ( [ ! -f "${T}"/environment ] || hasq noauto ${FEATURES} ) ; then
        # The bashrcs get an opportunity here to set aliases that will be expanded
        # during sourcing of ebuilds and eclasses.
        source_all_bashrcs
index be0acb7221f71a0550f91f700f815de74502164f..807acae56180f6ad15ddfa05794d43af5def40d9 100755 (executable)
@@ -192,6 +192,7 @@ sync_local() {
                emerge --metadata
        fi
        [ -x "${EPREFIX}"/etc/portage/bin/post_sync ] && "${EPREFIX}"/etc/portage/bin/post_sync
+       return 0
 }
 
 do_snapshot() {
index 1106246a11da20262fb7b9e660118f7e979bb3a2..7396b3b6a9e3adb0a8f2da0fbc3f064d02c4300d 100755 (executable)
@@ -1205,7 +1205,7 @@ for x in scanlist:
                                                                fails["digest.partial"].append(y+"::"+myf)
                                                elif "assume-digests" not in repoman_settings.features:
                                                        if os.path.exists(myff):
-                                                               if not portage.checksum.verify_all(myff, mydigests[myf]):
+                                                               if not portage.checksum.verify_all(myff, mydigests[myf])[0]:
                                                                        stats["digest.fail"] += 1
                                                                        fails["digest.fail"].append(y+"::"+myf)
                                                        elif repolevel == 3:
index c8c852bcb60455a76e1197a6e96f2d2ab9943f13..c5e59834d8d281fb75b65da2746f0a5e44353043 100644 (file)
@@ -5131,7 +5131,8 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                print " "+yellow("*")+" Processed",icount,"info files;",badcount,"errors."
                                print errmsg
                        else:
-                               print " "+green("*")+" Processed",icount,"info files."
+                               if icount > 0:
+                                       print " "+green("*")+" Processed",icount,"info files."
 
 
 def display_news_notification(trees):
@@ -5909,7 +5910,7 @@ def action_regen(settings, portdb):
        xterm_titles = "notitles" not in settings.features
        emergelog(xterm_titles, " === regen")
        #regenerate cache entries
-       print "Regenerating cache entries... "
+       portage.writemsg_stdout("Regenerating cache entries...\n")
        try:
                os.close(sys.stdin.fileno())
        except SystemExit, e:
@@ -5924,14 +5925,14 @@ def action_regen(settings, portdb):
                try:
                        dead_nodes[mytree] = set(portdb.auxdb[mytree].iterkeys())
                except CacheError, e:
-                       print "\n  error listing cache entries for " + \
+                       print "Error listing cache entries for " + \
                                "'%s': %s, continuing..." % (mytree, e)
                        del e
                        dead_nodes = None
                        break
        for x in mynodes:
                mymatches = portdb.cp_list(x)
-               portage.writemsg_stdout("processing %s\n" % x)
+               portage.writemsg_stdout("Processing %s\n" % x)
                for y in mymatches:
                        try:
                                foo = portdb.aux_get(y,["DEPEND"])
@@ -5939,7 +5940,7 @@ def action_regen(settings, portdb):
                                # sys.exit is an exception... And consequently, we can't catch it.
                                raise
                        except Exception, e:
-                               print "\n  error processing %(cpv)s, continuing... (%(e)s)" % {"cpv":y,"e":str(e)}
+                               print "Error processing %(cpv)s, continuing... (%(e)s)" % {"cpv":y,"e":str(e)}
                        if dead_nodes:
                                for mytree in portdb.porttrees:
                                        if portdb.findname2(y, mytree=mytree)[0]:
@@ -5952,7 +5953,7 @@ def action_regen(settings, portdb):
                                        del auxdb[y]
                                except (KeyError, CacheError):
                                        pass
-       print "done!"
+       portage.writemsg_stdout("done!\n")
 
 def action_config(settings, trees, myopts, myfiles):
        if len(myfiles) != 1:
index 21617844ce63de4fd8e1e2742fa56c35d1af1b10..d48bd8541350afc332b3d0612548ee34c6728ee1 100644 (file)
@@ -647,11 +647,11 @@ class binarytree(object):
                                        chunk_size = 8
                        except (ValueError, KeyError):
                                chunk_size = 3000
-                       writemsg_stdout("\n\n")
-                       writemsg_stdout(green("Fetching binary packages info...\n"))
+                       writemsg_stdout("\n")
+                       writemsg_stdout(green("Fetching bininfo from ")+base_url+"\n")
                        self.remotepkgs = portage.getbinpkg.dir_get_metadata(
                                self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size)
-                       writemsg(green("  -- DONE!\n\n"))
+                       #writemsg(green("  -- DONE!\n\n"))
 
                        for mypkg in self.remotepkgs.keys():
                                if not self.remotepkgs[mypkg].has_key("CATEGORY"):
index 5bd1bbf7efcc1152bdb735cf10b8079ae47e1f43..59eb67a37cfc552dd2624b8c7090966f358037ae 100644 (file)
@@ -597,7 +597,28 @@ class vardbapi(dbapi):
                return self.counter_tick_core(myroot, incrementing=1, mycpv=mycpv)
 
        def get_counter_tick_core(self, myroot, mycpv=None):
-               return self.counter_tick_core(myroot, incrementing=0, mycpv=mycpv) + 1
+               """
+               Use this method to retrieve the counter instead
+               of having to trust the value of a global counter
+               file that can lead to invalid COUNTER
+               generation. When cache is valid, the package COUNTER
+               files are not read and we rely on the timestamp of
+               the package directory to validate cache. The stat
+               calls should only take a short time, so performance
+               is sufficient without having to rely on a potentially
+               corrupt global counter file.
+               """
+               cp_list = self.cp_list
+               max_counter = 0
+               for cp in self.cp_all():
+                       for cpv in cp_list(cp):
+                               try:
+                                       counter = int(self.aux_get(cpv, ["COUNTER"])[0])
+                               except (KeyError, OverflowError, ValueError):
+                                       continue
+                               if counter > max_counter:
+                                       max_counter = counter
+               return max_counter + 1
 
        def counter_tick_core(self, myroot, incrementing=1, mycpv=None):
                "This method will grab the next COUNTER value and record it back to the global file.  Returns new counter value."
@@ -619,22 +640,25 @@ class vardbapi(dbapi):
                                writemsg("!!! COUNTER file is corrupt: '%s'\n" % cpath,
                                        noiselevel=-1)
 
+               real_counter = self.get_counter_tick_core(myroot, mycpv=mycpv) - 1
+
                if counter < 0:
                        changed = True
-                       max_counter = 0
-                       cp_list = self.cp_list
-                       for cp in self.cp_all():
-                               for cpv in cp_list(cp):
-                                       try:
-                                               counter = int(self.aux_get(cpv, ["COUNTER"])[0])
-                                       except (KeyError, OverflowError, ValueError):
-                                               continue
-                                       if counter > max_counter:
-                                               max_counter = counter
-                       counter = max_counter
                        writemsg("!!! Initializing COUNTER to " + \
                                "value of %d\n" % counter, noiselevel=-1)
 
+               if counter != real_counter:
+                       changed = True
+                       writemsg("!!! Initializing COUNTER to " + \
+                               "value of %d\n" % real_counter, noiselevel=-1)
+
+               # Never trust the counter file, since having a
+               # corrupt value that is too low there can trigger
+               # incorrect AUTOCLEAN behavior due to newly installed
+               # packages having lower counters than the previous
+               # version in the same slot.
+               counter = real_counter
+
                if incrementing or changed:
 
                        #increment counter
index 9cf7fff7d7a63a821313bca20125a8ab37ba929d..db4611814dd9186d72de74702e3a233a3596715a 100644 (file)
@@ -315,7 +315,10 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
                        raise
                return None
        try:
-               lex = shlex.shlex(f, posix=True)
+               # The default shlex.sourcehook() implementation
+               # only joins relative paths when the infile
+               # attribute is properly set.
+               lex = shlex.shlex(f, infile=mycfg, posix=True)
                lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}"     
                lex.quotes="\"'"
                if allow_sourcing: