Merged from trunk 9094:9118
authorFabian Groffen <grobian@gentoo.org>
Sun, 30 Dec 2007 17:19:05 +0000 (17:19 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 30 Dec 2007 17:19:05 +0000 (17:19 -0000)
   | 9096    | Move XARGS initialization from portage.data to               |
   | zmedico | isolated-functions.sh.                                       |

   | 9097    | Move XARGS initialization from portage.data to               |
   | zmedico | isolated-functions.sh.                                       |

   | 9099    | Remove redundant lchown() compatibility code since the       |
   | zmedico | getattr(os, "lchown", None) call already handles it.         |

   | 9100    | Simplify the userland detection code in portage.data and add |
   | zmedico | a bash version of it to isolated-functions.sh.               |

   | 9101    | Add back support for silent definition of the dummy lchown() |
   | zmedico | function when ostype == Darwin.                              |

   | 9103    | Remove redundant USERLAND sanity check code from doebuild()  |
   | zmedico | since it's handled in isolated-functions.sh now.             |

   | 9105    | Make the global counter file correspond to the total number  |
   | zmedico | of installation actions that have occurred in the history of |
   |         | this package database.                                       |

   | 9107    | Rely on USERLAND since it's automatically generated by       |
   | zmedico | isolated-functions.sh when necessary.                        |

   | 9109    | Document that docinto works for dohtml.                      |
   | zmedico |                                                              |

   | 9111    | Make the ecompressdir vecho output show a leading / on the   |
   | zmedico | directory path. Thanks to armin76.                           |

   | 9112    | Fix handling of leading / charactes some more.               |
   | zmedico |                                                              |

   | 9114    | Add PKGDIR to the config.environ() whitelist so that         |
   | zmedico | people's bashrc's don't break.                               |

   | 9116    | Fix broken Darwin USERLAND detection.                        |
   | zmedico |                                                              |

   | 9117    | Fix USERLAND references to handle Darwin like BSD.           |
   | zmedico |                                                              |

   | 9118    | As suggested by grobian, treat Darwin just like USERLAND=gnu |
   | zmedico | since they seem to be switching commands to gnu anyway.      |

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

bin/ecompressdir
bin/emerge-webrsync
bin/etc-update
bin/isolated-functions.sh
man/ebuild.5
pym/portage/__init__.py
pym/portage/data.py
pym/portage/dbapi/vartree.py

index 75b6059abfa995df60ef69328b32b553e5a029db..7933322a30ec9dfac799f3f558e89300284e53dd 100755 (executable)
@@ -97,9 +97,10 @@ ret=0
 rm -rf "${T}"/ecompress-skip
 
 for dir in "$@" ; do
+       dir=${dir#/}
        dir="${ED}${dir}"
        if [[ ! -d ${dir} ]] ; then
-               vecho "${0##*/}: ${dir#${ED}} does not exist!"
+               vecho "${0##*/}: /${dir#${ED}} does not exist!"
                continue
        fi
        cd "${dir}"
@@ -125,7 +126,7 @@ for dir in "$@" ; do
 
        # now lets do our work
        [[ -z ${suffix} ]] && continue
-       vecho "${0##*/}: $(ecompress --bin) ${actual_dir#${D}}"
+       vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}"
        funk_up_dir "compress" "${suffix}" "ecompress"
 
        # finally, restore the skipped stuff
index 807acae56180f6ad15ddfa05794d43af5def40d9..6c3ad19169711cb36d2f55d2008aa4776deae702 100755 (executable)
@@ -30,10 +30,6 @@ fi
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
-# ${USERLAND} is unreliable since the portage tree might be empty, so test
-# success of the -r option to distinguish between gnu and bsd date.
-date -r 0 >&/dev/null && DATE_ARGS="BSD" || DATE_ARGS="GNU"
-
 do_verbose=0
 
 if hasq webrsync-gpg ${FEATURES} ; then
@@ -54,7 +50,7 @@ get_date_part() {
        local utc_time_in_secs="$1"
        local part="$2"
 
-       if [ "${DATE_ARGS}" = "BSD" ]; then
+       if      [[ ${USERLAND} == BSD ]] || ; then
                date -r ${utc_time_in_secs} -u +"${part}"
        else
                date -d @${utc_time_in_secs} -u +"${part}"
index 68bc065afd2417d3f1191a54d9820d051f742c54..e554d44679211cb6723bfdd3d58f19aa2585f93f 100755 (executable)
@@ -401,12 +401,12 @@ Please select from the menu above (-1 to exit, losing this merge): "
                        my_input=$(read_int)
                        case ${my_input} in
                                1) echo "Replacing ${ofile} with ${mfile}"
-                                  if [[ ${USERLAND:-GNU} == GNU ]]; then
-                                      chown --reference="${ofile}" "${mfile}"
-                                      chmod --reference="${ofile}" "${mfile}"
-                                  else
+                                  if  [[ ${USERLAND} == BSD ]] ; then
                                       chown "$(stat -f %Su:%Sg "${ofile}")" "${mfile}"
                                       chmod $(stat -f %Mp%Lp "${ofile}") "${mfile}"
+                                  else
+                                      chown --reference="${ofile}" "${mfile}"
+                                      chmod --reference="${ofile}" "${mfile}"
                                   fi
                                   mv ${mv_opts} "${mfile}" "${ofile}"
                                   rm ${rm_opts} "${file}"
index 90fc0f59ac0f2d84b38ceac2247f5af441cb0f4f..d38125fb15c230b3269221d93f053a5735a5e7e0 100755 (executable)
@@ -377,6 +377,28 @@ case "${NOCOLOR:-false}" in
                ;;
 esac
 
+if [[ -z ${USERLAND} ]] ; then
+       case $(uname -s) in
+       *BSD|DragonFly)
+               export USERLAND="BSD"
+               ;;
+       *)
+               export USERLAND="GNU"
+               ;;
+       esac
+fi
+
+if [[ -z ${XARGS} ]] ; then
+       case ${USERLAND} in
+       BSD)
+               export XARGS="xargs"
+               ;;
+       *)
+               export XARGS="xargs -r"
+               ;;
+       esac
+fi
+
 has() {
        hasq "$@"
 }
index c52145bbbf7ca4f6936091e9e60624bdb8479c04..cbd9e95286075c9ced7dbf3e2951e71f5701cc71 100644 (file)
@@ -851,7 +851,8 @@ Installs executables into the path controlled by \fBexecinto\fR.  This function
 uses \fBinstall\fR(1).  Creates all necessary dirs.
 .TP
 \fBdocinto\fR \fI[path]\fR
-Sets the subdir used by \fBdodoc\fR when installing into the document tree
+Sets the subdir used by \fBdodoc\fR and \fBdohtml\fR
+when installing into the document tree
 (based in /usr/share/doc/${PF}/).  Default is no subdir, or just "".
 .TP
 \fBdodoc\fR \fI<document> [list of more documents]\fR
index 160ba4d253c047bca60e059642be771bf9307571..ece610ee92a4a3a1185b8e7b22e182d848c0e48e 100644 (file)
@@ -879,6 +879,7 @@ class config(object):
                "EBUILD_EXIT_STATUS_FILE", "EBUILD_FORCE_TEST",
                "EBUILD_PHASE", "ECLASSDIR", "ECLASS_DEPTH", "EMERGE_FROM",
                "FEATURES", "FILESDIR", "HOME", "PATH",
+               "PKGDIR",
                "PKGUSE", "PKG_LOGDIR", "PKG_TMPDIR",
                "PORTAGE_ACTUAL_DISTDIR", "PORTAGE_ARCHLIST",
                "PORTAGE_BASHRC",
@@ -2680,8 +2681,6 @@ class config(object):
                        phase = self.get("EBUILD_PHASE")
                        if phase:
                                whitelist = []
-                               if "package" == phase:
-                                       whitelist.append("PKGDIR")
                                if "rpm" == phase:
                                        whitelist.append("RPMDIR")
                                for k in whitelist:
@@ -4588,13 +4587,10 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        if env_stat:
                                mysettings._filter_calling_env = True
                        else:
-                               for var in "ARCH", "USERLAND", "XARGS":
+                               for var in ("ARCH", ):
                                        value = mysettings.get(var)
                                        if value and value.strip():
                                                continue
-                                       if var == "USERLAND" and userland:
-                                               mysettings["USERLAND"] = userland
-                                               continue
                                        msg = ("%s is not set... " % var) + \
                                                ("Are you missing the '%setc/make.profile' symlink? " % \
                                                mysettings["PORTAGE_CONFIGROOT"]) + \
index 88735d5e6c704536c4a860fc8494a5883c12090f..fa441d375133d56a6c7ddd70a77315be4d4e2f2b 100644 (file)
@@ -11,21 +11,18 @@ from portage.output import create_color_func
 bad = create_color_func("BAD")
 
 ostype=os.uname()[0]
-
 userland = None
-lchown = getattr(os, "lchown", None)
-os.environ.setdefault("XARGS", "xargs -r")
-os.environ["XARGS"]="xargs -r"
+if ostype == "DragonFly" or ostype.endswith("BSD"):
+       userland = "BSD"
+else:
+       userland = "GNU"
 
-# "fix" for lchown on Darwin
-if ostype == "Darwin":
-       def lchown(*pos_args, **key_args):
-               pass
+lchown = getattr(os, "lchown", None)
 
 if not lchown:
-       if "lchown" in dir(os):
-               # Included in python-2.3
-               lchown = os.lchown
+       if ostype == "Darwin":
+               def lchown(*pos_args, **key_args):
+                       pass
        else:
                try:
                        import missingos
index 5efdcc40e56318c88c76cfdaf1f5342f8998b560..f4d6d625e26d1b2e039c30aa0fc03d7813fdeec4 100644 (file)
@@ -199,6 +199,8 @@ class vardbapi(dbapi):
                self._aux_cache_version = "1"
                self._aux_cache_filename = os.path.join(self.root,
                        CACHE_PATH.lstrip(os.path.sep), "vdb_metadata.pickle")
+               self._counter_path = os.path.join(root,
+                       CACHE_PATH.lstrip(os.path.sep), "counter")
 
                self.libmap = LibraryPackageMap(os.path.join(self.root, CACHE_PATH.lstrip(os.sep), "library_consumers"), self)
                try:
@@ -609,6 +611,13 @@ class vardbapi(dbapi):
                calls should only take a short time, so performance
                is sufficient without having to rely on a potentially
                corrupt global counter file.
+
+               The global counter file located at
+               $CACHE_PATH/counter serves to record the
+               counter of the last installed package and
+               it also corresponds to the total number of
+               installation actions that have occurred in
+               the history of this package database.
                """
                cp_list = self.cp_list
                max_counter = 0
@@ -620,48 +629,52 @@ class vardbapi(dbapi):
                                        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."
-               cpath = os.path.join(myroot, CACHE_PATH.lstrip(os.sep), "counter")
-               changed = False
                counter = -1
                try:
-                       cfile = open(cpath, "r")
-               except EnvironmentError:
-                       writemsg("!!! COUNTER file is missing: '%s'\n" % cpath,
-                               noiselevel=-1)
+                       cfile = open(self._counter_path, "r")
+               except EnvironmentError, e:
+                       writemsg("!!! Unable to read COUNTER file: '%s'\n" % \
+                               self._counter_path, noiselevel=-1)
+                       writemsg("!!! %s\n" % str(e), noiselevel=-1)
+                       del e
                else:
                        try:
                                try:
                                        counter = long(cfile.readline().strip())
                                finally:
                                        cfile.close()
-                       except (OverflowError, ValueError):
-                               writemsg("!!! COUNTER file is corrupt: '%s'\n" % cpath,
-                                       noiselevel=-1)
+                       except (OverflowError, ValueError), e:
+                               writemsg("!!! COUNTER file is corrupt: '%s'\n" % \
+                                       self._counter_path, noiselevel=-1)
+                               writemsg("!!! %s\n" % str(e), noiselevel=-1)
+                               del e
 
-               real_counter = self.get_counter_tick_core(myroot, mycpv=mycpv) - 1
+               # We must ensure that we return a counter
+               # value that is at least as large as the
+               # highest one from the installed packages,
+               # since having a corrupt value that is too low
+               # can trigger incorrect AUTOCLEAN behavior due
+               # to newly installed packages having lower
+               # COUNTERs than the previous version in the
+               # same slot.
+               if counter > max_counter:
+                       max_counter = counter
 
                if counter < 0:
-                       changed = True
                        writemsg("!!! Initializing COUNTER to " + \
-                               "value of %d\n" % counter, noiselevel=-1)
+                               "value of %d\n" % max_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:
+               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."
+               counter = self.get_counter_tick_core(myroot, mycpv=mycpv) - 1
+               if incrementing:
                        #increment counter
                        counter += 1
                        # update new global counter file
-                       write_atomic(cpath, str(counter))
+                       write_atomic(self._counter_path, str(counter))
                return counter
 
 class vartree(object):