From b3e908bf9bf2776c69b8b748957c3e09b0c90879 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 12 Jan 2007 22:20:33 +0000 Subject: [PATCH] Merged from trunk 5508:5521 make.globals has no business in profiles (genone) create symlinks to html documentation if DOC_SYMLINK_DIR is set, original patch by TGL (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 | 1 + bin/misc-functions.sh | 24 ++++++++++++++++++++++++ man/emerge.1 | 5 +++-- pym/portage.py | 7 ++----- pym/portage_dep.py | 33 ++++++++++++++++++++++++++++----- 5 files changed, 58 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 2cee62dc2..1413cb317 100644 --- 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 ------------ diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 584ed9b45..f2f54f6ba 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -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 diff --git a/man/emerge.1 b/man/emerge.1 index 44f641c6f..5c2110ee6 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -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 diff --git a/pym/portage.py b/pym/portage.py index 80c7dd91f..7283286eb 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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=[] diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 8f7ed0051..c8074bb55 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -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 -- 2.26.2