From 48e61ebf96d2b24c28ba006be5e601930335c75e Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 5 Oct 2007 20:23:50 +0000 Subject: [PATCH] Merged from trunk 7918:7951 | 7919 | In portdbapi.aux_get(), simplify code by using string | | zmedico | manipulation instead of int conversion to manipulate | | | negative EAPI when deciding whether or not regen is | | | necessary. | | 7942 | Make the EbuildQuote check ignore lines beginning with local | | zmedico | or export builtins since unquoted assignments are okay | | | there. | | 7944 | Bug #194764 - All the match* functions can raise a | | zmedico | ValueError if cpv_expand() receives an ambiguous atom. | | | Therefore, move the ValueError handling code out of match() | | | and use it to handle all such errors when appropriate. | | 7946 | copy of gentoolkit r451 | | genone | | | 7947 | add TODO list for portage-2.2 | | genone | | | 7948 | ignore missing files | | genone | | | 7949 | Document the EAPI variable. | | zmedico | | | 7950 | Fix spelling of backward. | | zmedico | | | 7951 | Documnet EAPI in the MASKED PACKAGES section. | | zmedico | | svn path=/main/branches/prefix/; revision=7960 --- TODO | 4 ++++ bin/portageq | 15 +++++++++++++-- man/ebuild.5 | 11 +++++++++++ man/emerge.1 | 5 +++++ pym/portage/dbapi/porttree.py | 11 ++--------- pym/portage/env/loaders.py | 5 +++-- pym/portage/glsa.py | 2 +- pym/repoman/checks.py | 2 +- 8 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 000000000..ab35be793 --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +TODO for portage-2.2 release: +============================= +- package set integration in emerge (genone) +- user interface for preserve-libs FEATURE (genone, fuzzyray?) diff --git a/bin/portageq b/bin/portageq index 936324c36..7b0281e57 100755 --- a/bin/portageq +++ b/bin/portageq @@ -183,8 +183,6 @@ def match(argv): sys.exit(2) try: print "\n".join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1])) - except KeyError: - sys.exit(1) match.uses_root = True @@ -379,6 +377,19 @@ def main(): except portage.exception.PermissionDenied, e: sys.stderr.write("Permission denied: '%s'\n" % str(e)) sys.exit(e.errno) + except ValueError, e: + if not e.args or \ + not hasattr(e.args[0], "__len__") or \ + len(e.args[0]) < 2: + raise + # Multiple matches thrown from cpv_expand + pkgs = e.args[0] + # An error has occurred so we writemsg to stderr and exit nonzero. + portage.writemsg("The following packages available:\n", noiselevel=-1) + for pkg in pkgs: + portage.writemsg("* %s\n" % pkg, noiselevel=-1) + portage.writemsg("\nPlease use a more specific atom.\n", noiselevel=-1) + sys.exit(1) main() diff --git a/man/ebuild.5 b/man/ebuild.5 index 86d1be700..0eb1b32d9 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -126,6 +126,17 @@ the tree prefixed by ${ROOT}. Do not modify this variable. \fBDESCRIPTION\fR = \fI"A happy little package"\fR Should contain a short description of the package. .TP +\fBEAPI\fR = \fI"0"\fR +Defines the ebuild API version to which this package conforms. If not +defined then it defaults to "0". If portage does not recognize the +EAPI value then it will mask the package and refuse to perform any +operations with it since this means that a newer version of portage +needs to be installed first. For maximum backward compatiblity, a +package should conform to the lowest possible EAPI. Note that anyone +who uses the \fBebuild\fR(1) and \fBrepoman\fR(1) commands with this +package will be required to have a version of portage that recognizes +the EAPI to which this package conforms. +.TP \fBSRC_URI\fR = \fI"http://happy.com/little/${P}.tar.gz"\fR Contains a list of URI's for the required source files. It can contain multiple URI's for a single source file. The list is processed in order diff --git a/man/emerge.1 b/man/emerge.1 index 9642c9efa..c86d1f5f6 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -543,6 +543,11 @@ The \fBpackage.mask\fR file primarily blocks the use of packages that cause problems or are known to have issues on different systems. It resides in \fI/usr/portage/profiles\fR. .TP +.BR EAPI +The \fBEAPI\fR variable in an \fBebuild\fR(5) file is used to mask packages +that are not supported by the current version of portage. Packages masked by +\fBEAPI\fR can only be installed after portage has been upgraded. +.TP .BR KEYWORDS The \fBKEYWORDS\fR variable in an \fBebuild\fR file is also used for masking a package still in testing. There are architecture\-specific keywords for diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 824d1afc4..03550033a 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -284,15 +284,8 @@ class portdbapi(dbapi): mydata = self.auxdb[mylocation][mycpv] eapi = mydata.get("EAPI","").strip() if not eapi: - eapi = 0 - try: - eapi = int(eapi) - except ValueError: - # Non-integer EAPI isn't supported. In case it's supported in - # the future, assume that it's valid (rather than trigger a - # regen). - eapi = None - if eapi is not None and eapi < 0 and eapi_is_supported(-eapi): + eapi = "0" + if eapi.startswith("-") and eapi_is_supported(eapi[1:]): doregen = True elif emtime != long(mydata.get("_mtime_", 0)): doregen = True diff --git a/pym/portage/env/loaders.py b/pym/portage/env/loaders.py index 1d0ca01aa..61bb69126 100644 --- a/pym/portage/env/loaders.py +++ b/pym/portage/env/loaders.py @@ -36,8 +36,9 @@ def RecursiveFileLoader(filename): @rtype: list @returns: List of files to process """ - - if os.path.isdir(filename): + if not os.path.exists(filename): + return + elif os.path.isdir(filename): for root, dirs, files in os.walk(filename): if 'CVS' in dirs: dirs.remove('CVS') diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index 5e2d5f081..7e205d63a 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -177,7 +177,7 @@ def getText(node, format): if format == "strip": rValue = rValue.strip(" \n\t") rValue = re.sub("[\s]{2,}", " ", rValue) - return str(rValue) + return rValue.encode("utf_8") def getMultiTagsText(rootnode, tagname, format): """ diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index d30785aed..d956b83f8 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -118,7 +118,7 @@ class EbuildQuote(ContentCheck): """Ensure ebuilds have valid quoting around things like D,FILESDIR, etc...""" repoman_check_name = 'ebuild.minorsyn' - ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)') + ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)|(^\s*(local|export)\s+)') var_names = r'(D|S|T|ROOT|FILESDIR|WORKDIR)' var_reference = re.compile(r'\$({'+var_names+'}|' + \ r'\$' + var_names + '\W)') -- 2.26.2