Merged from trunk 5508:5521
authorFabian Groffen <grobian@gentoo.org>
Fri, 12 Jan 2007 22:20:33 +0000 (22:20 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 12 Jan 2007 22:20:33 +0000 (22:20 -0000)
make.globals has no business in profiles (genone)

create symlinks to html documentation if DOC_SYMLINK_DIR is set,
original patch by TGL <degrenier@easyconnect.fr> (bug #67130) (genone)

Make env variable example about USE shell independent (genone)

Always use vercmp for cpv comparisons (genone)

Stupid me, shouldn't jsut move a part of the patch (genone)

Attach the problematic data to the exception for debugging (genone)

Make the =* operator more robust (genone)

Documenting the loop a bit (genone)

=* operator sucks (genone)

also sanitize mycpv for =* handling (genone)

minor performance improvement (genone)

I hate this thing (genone)

Minor fixes for the =* operator (I hope we're done now :). (finally,
just dad again)

Use startwith to simplify =* matching.

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

NEWS
bin/misc-functions.sh
man/emerge.1
pym/portage.py
pym/portage_dep.py

diff --git a/NEWS b/NEWS
index 2cee62dc2331f402b6479e9eb01564ad5ecd101d..1413cb31713c5c205c8899cecbb623b19db3d112 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ portage-2.1.2
   file/mail.
 * New QA loglevel and matching eqawarn function
 * `ebuild foo test` now always runs src_test if available
+* If DOC_SYMLINK_DIR is set portage installs symlinks to html documention there
 
 portage-2.1.1
 ------------
index 584ed9b45971552be34bcd06df196f1617997dfb..f2f54f6bad3c9f68d87a027bebd064e6b2ceb32c 100644 (file)
@@ -17,6 +17,30 @@ shift $#
 
 source @PORTAGE_BASE@/bin/ebuild.sh
 
+install_symlink_html_docs() {
+       cd "${ED}" || die "cd failed"
+       #symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
+       if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
+               local mydocdir docdir
+               for docdir in "${HTMLDOC_DIR:-does/not/exist}" "${PF}/html" "${PF}/HTML" "${P}/html" "${P}/HTML" ; do
+                       if [ -d "usr/share/doc/${docdir}" ] ; then
+                               mydocdir="${EPREFIX}/usr/share/doc/${docdir}"
+                       fi
+               done
+               if [ -n "${mydocdir}" ] ; then
+                       local mysympath
+                       if [ -z "${SLOT}" -o "${SLOT}" = "0" ] ; then
+                               mysympath="${DOC_SYMLINKS_DIR}/${CATEGORY}/${PN}"
+                       else
+                               mysympath="${DOC_SYMLINKS_DIR}/${CATEGORY}/${PN}-${SLOT}"
+                       fi
+                       einfo "Symlinking ${mysympath} to the HTML documentation"
+                       dodir "${DOC_SYMLINKS_DIR}/${CATEGORY}"
+                       dosym "${mydocdir}" "${mysympath}"
+               fi
+       fi
+}
+
 install_qa_check() {
        cd "${ED}" || die "cd failed"
        prepall
index 44f641c6fa9cbc388003e8e22e7931917351b066..5c2110ee6d3ab1a807a34496efc5f5aa8e811ee7 100644 (file)
@@ -489,8 +489,9 @@ parameters to \fBemerge\fR.
 override those specified in the default locations, letting you
 avoid using some dependencies you may not want to have.  \fBUSE
 flags specified on the command line are NOT remembered\fR.  For
-example, \fBUSE="\-X \-gnome" emerge mc\fR will emerge mc with
-those USE settings.  If you want those USE settings to be more 
+example, \fBenv USE="\-X \-gnome" emerge mc\fR will emerge mc with
+those USE settings (on Bourne-compatible shells you may omit the \fBenv\fR
+part).  If you want those USE settings to be more 
 permanent, you can put them in /etc/portage/package.use instead.
 .LP
 If \fBemerge \-\-update system\fR or \fBemerge \-\-update world\fR
index 80c7dd91f14476179fd6cf041f672682e55c5105..7283286ebcec8f3ab40b6a5a0d9c8fb46189cf06 100644 (file)
@@ -1127,9 +1127,7 @@ class config:
                        del rawpuseforce
 
                        try:
-                               mygcfg_dlists = [getconfig(os.path.join(x, "make.globals")) \
-                                       for x in self.profiles + [os.path.join(config_root + EPREFIX, "etc")]]
-                               self.mygcfg   = stack_dicts(mygcfg_dlists, incrementals=portage_const.INCREMENTALS, ignore_none=1)
+                               self.mygcfg   = getconfig(os.path.join(config_root + EPREFIX, "etc", "make.globals"))
 
                                if self.mygcfg is None:
                                        self.mygcfg = {}
@@ -2847,7 +2845,7 @@ def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None):
                                        apply_secpass_permissions(fpath, uid=myuid, gid=mygid,
                                                mode=mystat.st_mode, stat_cached=mystat,
                                                follow_links=False)
-                       mycommand = " ".join([MISC_SH_BINARY, "install_qa_check"])
+                       mycommand = " ".join([MISC_SH_BINARY, "install_qa_check", "install_symlink_html_docs"])
                        qa_retval = spawn(mycommand, mysettings, debug=debug, logfile=logfile, **kwargs)
                        if qa_retval:
                                writemsg("!!! install_qa_check failed; exiting.\n",
@@ -3827,7 +3825,6 @@ def getCPFromCPV(mycpv):
        """Calls pkgsplit on a cpv and returns only the cp."""
        return pkgsplit(mycpv)[0]
 
-
 def dep_virtual(mysplit, mysettings):
        "Does virtual dependency conversion"
        newsplit=[]
index 8f7ed0051621e8657b580f5e54d72f7eabeda1a9..c8074bb5530b0f4d8e64bcd2e0cbe70959b83ea3 100644 (file)
@@ -22,6 +22,18 @@ import re, string, sys, types
 import portage_exception
 from portage_versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify
 
+def cpvequal(cpv1, cpv2):
+       split1 = catpkgsplit(cpv1)
+       split2 = catpkgsplit(cpv2)
+       
+       if not split1 or not split2:
+               raise portage_exception.PortageException("Invalid data '%s, %s', parameter was not a CPV" % (cpv1, cpv2))
+       
+       if split1[0] != split2[0]:
+               return False
+       
+       return (pkgcmp(split1[1:], split2[1:]) == 0)
+
 def strip_empty(myarr):
        """
        Strip all empty elements from an array
@@ -568,19 +580,30 @@ def match_from_list(mydep, candidate_list):
                        mylist.append(x)
 
        elif operator == "=": # Exact match
-               if mycpv in candidate_list:
-                       mylist = [mycpv]
+               mylist = [cpv for cpv in candidate_list if cpvequal(cpv, mycpv)]
 
        elif operator == "=*": # glob match
-               # The old verion ignored _tag suffixes... This one doesn't.
+               # XXX: Nasty special casing for leading zeros
+               # Required as =* is a literal prefix match, so can't 
+               # use vercmp
+               mysplit = catpkgsplit(mycpv)
+               myver = mysplit[2].lstrip("0")
+               if not myver or not myver[0].isdigit():
+                       myver = "0"+myver
+               mycpv = mysplit[0]+"/"+mysplit[1]+"-"+myver
                for x in candidate_list:
-                       if x[0:len(mycpv)] == mycpv:
+                       xs = catpkgsplit(x)
+                       myver = xs[2].lstrip("0")
+                       if not myver or not myver[0].isdigit():
+                               myver = "0"+myver
+                       xcpv = xs[0]+"/"+xs[1]+"-"+myver
+                       if xcpv.startswith(mycpv):
                                mylist.append(x)
 
        elif operator == "~": # version, any revision, match
                for x in candidate_list:
                        xs = catpkgsplit(x)
-                       if xs[0:2] != mycpv_cps[0:2]:
+                       if not cpvequal(xs[0]+"/"+xs[1]+"-"+xs[2], mycpv_cps[0]+"/"+mycpv_cps[1]+"-"+mycpv_cps[2]):
                                continue
                        if xs[2] != ver:
                                continue