From f2272162413716154a2b725f3f6b962f67968584 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 6 Jan 2007 10:39:59 +0000 Subject: [PATCH] Merged from trunk 5460:5471 As a workaround for bug #147625, spawn `id -g portage` in order to get a list of groups for the portage user without the need to call grp.getgrall(). (prefix uses portage_const.portageuser instead of hardcoded value) Use -G instead of -g (typo from the previous commit). Make repoman use portage.normalize_path instead of os.path.normpath. This might solve an issue with incorrect repolevel detection that was reported by drizzt. For python-2.3 compatibility, don't pass an iterable into dict.update(). For bug #160299, make sure that emerge sees a somewhat valid COUNTER even when the counter is missing. Fix shell glob logic that leads to false positives. Thanks to Flameeyes for reporting. Fix one more potential false glob match. revert previous changes ... ruby.eclass is wrongly polluting env with nullglob (SpankMan) force C locale for now when parsing gcc log files #160234 (SpankMan) For bug #160310, allow \ inside `` quotes in order to prevent a false Line continuation ("\") Syntax Error. For bug #160310, remove the line continuation syntax check since it's still possible for it to generate false positives. svn path=/main/branches/prefix/; revision=5476 --- bin/emerge | 1 + bin/misc-functions.sh | 7 ++++--- bin/repoman | 32 +++++++------------------------- pym/portage.py | 3 ++- pym/portage_data.py | 17 +++++++++++++---- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/bin/emerge b/bin/emerge index a314fb441..7ea044164 100755 --- a/bin/emerge +++ b/bin/emerge @@ -745,6 +745,7 @@ class FakeVartree(portage.vartree): mycounter = long(metadata["COUNTER"]) except ValueError: mycounter = 0 + metadata["COUNTER"] = str(mycounter) other_counter = slot_counters.get(myslot_atom, None) if other_counter is not None: if other_counter > mycounter: diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 1975e72e0..49f392b56 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -274,7 +274,7 @@ install_qa_check() { s=${s%usr/*}${s##*/usr/} if [[ -e ${s} ]] ; then vecho -ne '\a\n' - vecho "QA Notice: missing gen_usr_ldscript for ${s##*/}\a" + vecho "QA Notice: missing gen_usr_ldscript for ${s##*/}" abort="yes" fi fi @@ -285,7 +285,7 @@ install_qa_check() { f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null) if [[ -n ${f} ]] ; then vecho -ne '\a\n' - vecho "QA Notice: excessive files found in the / partition\a" + vecho "QA Notice: excessive files found in the / partition" vecho "${f}" vecho -ne '\a\n' die "static archives (*.a) and libtool library files (*.la) do not belong in /" @@ -317,7 +317,8 @@ install_qa_check() { i=0 while [[ -n ${msgs[${i}]} ]] ; do m=${msgs[$((i++))]} - f=$(grep "${m}" "${PORTAGE_LOG_FILE}") + # force C locale to work around slow unicode locales #160234 + f=$(LC_ALL=C grep "${m}" "${PORTAGE_LOG_FILE}") if [[ -n ${f} ]] ; then vecho -ne '\a\n' vecho "QA Notice: Package has poor programming practices which may compile" diff --git a/bin/repoman b/bin/repoman index 9c95e06cc..d28fd2849 100755 --- a/bin/repoman +++ b/bin/repoman @@ -398,6 +398,7 @@ if mymode == "commit": while "--ignore-masked" in myoptions: myoptions.remove("--ignore-masked") +from portage import normalize_path isCvs=False myreporoot=None if os.path.isdir("CVS"): @@ -475,8 +476,8 @@ if not "--pretend" in myoptions and not isCvs and not isSvn: def have_profile_dir(path, maxdepth=3): while path != "/" and maxdepth: if os.path.exists(path + "/profiles/package.mask"): - return path - path = os.path.normpath(path + "/..") + return normalize_path(path) + path = normalize_path(path + "/..") maxdepth -= 1 portdir=None @@ -488,7 +489,8 @@ if "PWD" in os.environ and os.environ["PWD"] != mydir and \ # orient itself if the user has symlinks in their portage tree structure. # We use os.environ["PWD"], if available, to get the non-canonical path of # the current working directory (from the shell). - mydir = os.path.normpath(os.environ["PWD"]) + mydir = os.environ["PWD"] +mydir = normalize_path(mydir) if mydir[-1] != "/": mydir += "/" @@ -519,10 +521,8 @@ if not portdir_overlay: if not portdir: portdir = repoman_settings["PORTDIR"] -if portdir[-1] == "/": - portdir = portdir[:-1] -if portdir_overlay[-1] == "/": - portdir_overlay = portdir_overlay[:-1] +portdir = normalize_path(portdir) +portdir_overlay = normalize_path(portdir_overlay) os.environ["PORTDIR"] = portdir if portdir_overlay != portdir: @@ -1412,8 +1412,6 @@ for x in scanlist: leading_spaces = re.compile(r'^[\S\t]') trailing_whitespace = re.compile(r'.*([\S]$)') readonly_assignment = re.compile(r'^\s*(export\s+)?(A|CATEGORY|P|PV|PN|PR|PVR|PF|D|WORKDIR|FILESDIR|FEATURES|USE)=') - continuation_symbol = re.compile(r'(.*[ ]+[\\][ ].*)') - line_continuation_quoted = re.compile(r'(\"|\')(([\w ,:;#\[\]\.`=/|\$\^\*{}()\'-])|(\\.))*\1') line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$') linenum=0 previous_line = None @@ -1467,22 +1465,6 @@ for x in scanlist: myerrormsg = "Readonly variable assignment to %s on line %d" % (match.group(2), linenum) stats["variable.readonly"] += 1 fails["variable.readonly"].append(x+"/"+y+".ebuild: %s" % myerrormsg) - # Line continuation check - match = continuation_symbol.match(line) - if match: - #Excluded lines not even containing a " \" match. Good! - line = re.sub(line_continuation_quoted,"\"\"",line) - #line has been edited to collapsed "" and '' quotes to "". Good! - match = continuation_symbol.match(line) - if match: - #Again exclude lines not even containing a " \" match. Good! - #This repetition is done for a slight performance increase - match = line_continuation.match(line) - if not match: - #Line has a line continuation error. Bad! - myerrormsg = "Line continuation (\"\\\") Syntax Error. Line %d" % linenum - stats["ebuild.majorsyn"] +=1 - fails["ebuild.majorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg) previous_line = line del previous_line diff --git a/pym/portage.py b/pym/portage.py index 17ead0138..cdac6bda0 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5144,7 +5144,8 @@ class vardbapi(dbapi): if pull_me: # pull any needed data and cache it aux_keys = list(pull_me) - mydata.update(izip(aux_keys, self._aux_get(mycpv, aux_keys))) + for k, v in izip(aux_keys, self._aux_get(mycpv, aux_keys)): + mydata[k] = v if not cache_valid: cache_data = {} for aux_key in self._aux_cache_keys: diff --git a/pym/portage_data.py b/pym/portage_data.py index 76316bd2e..71aefacf6 100644 --- a/pym/portage_data.py +++ b/pym/portage_data.py @@ -121,7 +121,16 @@ except KeyError: userpriv_groups = [portage_gid] if secpass >= 2: - for g in grp.getgrall(): - if "portage" in g[3]: - userpriv_groups.append(g[2]) - userpriv_groups = list(set(userpriv_groups)) + # Get a list of group IDs for the portage user. Do not use grp.getgrall() + # since it is known to trigger spurious SIGPIPE problems with nss_ldap. + from commands import getstatusoutput + mystatus, myoutput = getstatusoutput("id -G " + portage_const.portageuser) + if mystatus == os.EX_OK: + for x in myoutput.split(): + try: + userpriv_groups.append(int(x)) + except ValueError: + pass + del x + userpriv_groups = list(set(userpriv_groups)) + del getstatusoutput, mystatus, myoutput -- 2.26.2