Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 138384 Details for
Bug 202068
sys-apps/portage-2.1.4_rc9: Deletes line of code from eclass function
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
detect bash here-documents and leave them intact
here_docs.patch (text/plain), 2.79 KB, created by
Zac Medico
on 2007-12-13 08:55:15 UTC
(
hide
)
Description:
detect bash here-documents and leave them intact
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2007-12-13 08:55:15 UTC
Size:
2.79 KB
patch
obsolete
>Index: bin/filter-bash-environment.py >=================================================================== >--- bin/filter-bash-environment.py (revision 0) >+++ bin/filter-bash-environment.py (revision 8899) >@@ -0,0 +1,52 @@ >+#!/usr/bin/env python >+# Copyright 1999-2007 Gentoo Foundation >+# Distributed under the terms of the GNU General Public License v2 >+# $Id$ >+ >+import os, re, sys >+ >+egrep_compat_map = { >+ "[:alnum:]" : r'\w', >+ "[:space:]" : r'\s', >+} >+ >+here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$') >+ >+def compile_egrep_pattern(s): >+ for k, v in egrep_compat_map.iteritems(): >+ s = s.replace(k, v) >+ return re.compile(s) >+ >+def filter_bash_environment(pattern, file_in, file_out): >+ here_doc_delim = None >+ for line in file_in: >+ if here_doc_delim is not None: >+ if here_doc_delim.match(line): >+ here_doc_delim = None >+ file_out.write(line) >+ continue >+ here_doc = here_doc_re.match(line) >+ if here_doc is not None: >+ here_doc_delim = re.compile("^%s$" % here_doc.group(1)) >+ file_out.write(line) >+ continue >+ if pattern.match(line) is None: >+ file_out.write(line) >+ >+if __name__ == "__main__": >+ description = "Filter out any lines that match a given PATTERN " + \ >+ "while leaving bash here-documents intact. The PATTERN should " + \ >+ "use python regular expression syntax but [:space:] and " + \ >+ "[:alnum:] character classes will be automatically translated " + \ >+ "for compatibility with egrep syntax." >+ usage = "usage: %s PATTERN" % os.path.basename(sys.argv[0]) >+ from optparse import OptionParser >+ parser = OptionParser(description=description, usage=usage) >+ options, args = parser.parse_args(sys.argv[1:]) >+ if len(args) != 1: >+ parser.error("Missing required PATTERN argument.") >+ file_in = sys.stdin >+ file_out = sys.stdout >+ filter_bash_environment( >+ compile_egrep_pattern(args[0]), file_in, file_out) >+ file_out.flush() > >Property changes on: bin/filter-bash-environment.py >___________________________________________________________________ >Name: svn:executable > + * >Name: svn:keywords > + Id > >Index: bin/ebuild.sh >=================================================================== >--- bin/ebuild.sh (revision 8898) >+++ bin/ebuild.sh (revision 8899) >@@ -1425,9 +1425,9 @@ > # listed in READONLY_EBUILD_METADATA, since having any readonly attributes > # persisting in the saved environment can be inconvenient when it > # eventually needs to be reloaded. >- egrep -v -e "${var_grep}" | sed \ >- -e 's:^declare[[:space:]]\+-r[[:space:]]\+::' \ >- -e 's:^declare[[:space:]]\+-\([[:alnum:]]*\)r\([[:alnum:]]*\)[[:space:]]\+:declare -\1\2 :' >+ "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${var_grep}" | sed -r \ >+ -e 's:^declare[[:space:]]+-r[[:space:]]+:declare :' \ >+ -e 's:^declare[[:space:]]+-([[:alnum:]]*)r([[:alnum:]]*)[[:space:]]+:declare -\1\2 :' > } > > # @FUNCTION: preprocess_ebuild_env
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 202068
: 138384