From e86da40510039b6b1b44d2e0f6025c72ef0d64ed Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 8 Jan 2009 19:57:19 +0000 Subject: [PATCH] Merged from trunk -r12352:12367 | 12359 | Bug #252727 - Use `git diff-index --name-only | | zmedico | --diff-filter=M HEAD` instead of `git ls-files -m | | | --with-tree=HEAD` since the latter doesn't behave like we | | | want for files that have been added to the index. Also, use | | | `git diff-index` instead of `git diff` since the latter is | | | considered a high-level "porcelain" command which means that | | | it's interface may not be reliable. | | 12360 | Inside git_sync_timestamps(), use git-diff-index for the | | zmedico | same reason that repoman now uses it since bug #252727. | | 12361 | Wrap lines to 80 columns and remove extra blank lines. | | zmedico | | | 12362 | Add notes about FEATURES=protect-owned and move the note | | zmedico | about --complete-graph to NEWS. | | 12363 | Bug #252840 - Fix TypeError which is triggered by a broken | | zmedico | override of varnings.formatwarning(). Override | | | warnings.showwarning() instead since the api docs say it may | | | be overriden while they do not say this about | | | formatwarning(). | | 12364 | Inside _showwarning(), import sys since otherwise it's None | | zmedico | for some reason. | | 12365 | Bug #253002 - Add a new variable.invalidchar check for | | zmedico | metadata variables that contain characters that are not part | | | of the ASCII character set. | | 12366 | Fix 'TypeError: not all arguments converted during string | | zmedico | formatting' triggered by repoman -v. Thanks to Javier | | | Villavicencio for reporting. | | 12367 | Specify that metadata variable values should only contain | | zmedico | ASCII as per GLEP 31. | svn path=/main/branches/prefix/; revision=12391 --- NEWS | 10 +++++++ RELEASE-NOTES | 50 +++++++++++++++------------------ bin/repoman | 43 ++++++++++++++++++++++------ man/ebuild.5 | 3 ++ man/repoman.1 | 4 +++ pym/_emerge/__init__.py | 2 +- pym/portage_compat_namespace.py | 14 ++++++--- 7 files changed, 85 insertions(+), 41 deletions(-) diff --git a/NEWS b/NEWS index 2e8942a37..a64b40602 100644 --- a/NEWS +++ b/NEWS @@ -32,10 +32,20 @@ portage-2.1.6 * Namespace sanitizing: move all portage related code into portage.* namespace, rename portage_foo modules to portage.foo (but keep symlinks for compability) * Add support for news items (GLEP 42) +* Add FEATURES=protect-owned which is identical to the collision-protect + feature except that files may be overwritten if they are not explicitly + listed in the contents of a currently installed package. portage-2.1.5 ------------- +* For extra careful dependency handling, emerge has a new --complete-graph + option that causes it to consider the deep dependencies of all packages from + the system and world sets. With this option enabled, emerge will bail out + if it determines that the given operation will break any dependencies of + the packages that have been added to the graph. Unlike the --deep option, + the --complete-graph option does not cause any more packages to be updated + than would have otherwise been updated with the option disabled. * Blockers are now resolved automatically in many more cases than before. When it's safe, blocked packages are uninstalled automatically so that users are no longer inconvenienced with the diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 47627acd6..540809a43 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -4,19 +4,20 @@ Features/major bugfixes are listed in NEWS portage-2.2 ================================== -* Portage now warns if an ebuild repository does not have a name, as several new - features in 2.2 make use of or require named repositories. The repository name - is stored in profiles/repo_name in each repository. -* Package set support: There are several important notes regarding package sets: - - setnames have to be prefixed with @ (exceptions: 'world' and 'system' can be - used without the prefix) - - they may currently only include simple and versioned atoms or other sets, use - conditionals or any-of constructs aren't possible yet - - sets can be referenced either in other file-based sets or as argument to emerge, but - not in ebuilds, config files or other tools at this time. +* Portage now warns if an ebuild repository does not have a name, as several + new features in 2.2 make use of or require named repositories. The repository + name is stored in profiles/repo_name in each repository. +* Package set support: There are several important notes regarding package + sets: + - setnames have to be prefixed with @ (exceptions: 'world' and 'system' can + be used without the prefix) + - they may currently only include simple and versioned atoms or other sets, + use conditionals or any-of constructs aren't possible yet + - sets can be referenced either in other file-based sets or as argument to + emerge, but not in ebuilds, config files or other tools at this time. - packages won't be unmerged if they are referenced by an installed package set (with the exception of the world set, and installed being determined - by the world_sets file). + by the world_sets file). * "world" does no longer include "system" unconditionally, but you can add "@system" to the world_sets file to restore the old state. @@ -25,16 +26,21 @@ portage-2.1.6 * FEATURES=fixpackages is now enabled by default via make.globals. Set FEATURES="-fixpackages" in make.conf if you'd like to disable it. +* File collision protection is now enabled by default via make.globals with + FEATURES=protect-owned. In order to protect files from be overwritten or + removed a inappropriate times, it is recommended to leave protect-owned + (or the similar collision-protect feature) enabled at all times. * The python namespace for portage has been sanitized, all portage related code - is now contained within the portage namespace. External script should be updated - accordingly, though links exist for backward compability. + is now contained within the portage namespace. External script should be + updated accordingly, though links exist for backward compability. * -* support in package.keywords was changed as it was inconsistent with - ACCEPT_KEYWORDS behavior (also see http://dev.gentoo.org/~genone/docs/KEYWORDS.stupid). - Previously having -* in package.keywords matched packages with KEYWORDS="-*", + ACCEPT_KEYWORDS behavior (also see + http://dev.gentoo.org/~genone/docs/KEYWORDS.stupid). + Previously having -* in package.keywords matched packages with KEYWORDS="-*", now it resets the ACCEPT_KEYWORDS list for the given atom like it does when used in ACCEPT_KEYWORDS. - For packages that don't specify any other KEYWORDS you can use the new ** token - as documented in portage(5) to disable KEYWORDS filtering completely. + For packages that don't specify any other KEYWORDS you can use the new ** + token as documented in portage(5) to disable KEYWORDS filtering completely. portage-2.1.5 ================================== @@ -47,7 +53,6 @@ portage-2.1.5 earlier phase (such as pkg_preinst) and store the result in a global variable to be accessed by pkg_postinst when it is called. Bug #226505 tracks all issues related to this phase execution order change. - * The metadata-transfer feature is now disabled by default. This disables the "Updating Portage cache" routine that used to run at the tail end of each `emerge --sync` operation. If you use something like the sqlite module and @@ -57,21 +62,12 @@ portage-2.1.5 that override eclasses from PORTDIR (in this case, you may have disabled a relevant warning message by setting PORTAGE_ECLASS_WARNING_ENABLE="0" in make.conf). - * The parallel-fetch feature is now enabled by default. It is optimized to avoid doing redundant checksums for previously downloaded files that have the correct size. Run `tail -f /var/log/emerge-fetch.log` in a terminal to view parallel-fetch progress. Add FEATURES="-parallel-fetch" to /etc/make.conf if you want to disable this feature. -* For extra careful dependency handling, emerge has a new --complete-graph - option that causes it to consider the deep dependencies of all packages from - the system and world sets. With this option enabled, emerge will bail out - if it determines that the given operation will break any dependencies of - the packages that have been added to the graph. Unlike the --deep option, - the --complete-graph option does not cause any more packages to be updated - than would have otherwise been updated with the option disabled. - portage-2.1.4.1 ================================== diff --git a/bin/repoman b/bin/repoman index 2a1cafc90..f088b31be 100755 --- a/bin/repoman +++ b/bin/repoman @@ -296,6 +296,7 @@ qahelp={ "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure", "ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.", "ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.", + "variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set", "variable.readonly":"Assigning a readonly variable", "LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.", "IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file", @@ -358,6 +359,8 @@ qawarnings = set(( "LIVEVCS.stable" )) +non_ascii_re = re.compile(r'[^\x00-\x7f]') + missingvars=["KEYWORDS","LICENSE","DESCRIPTION","HOMEPAGE","SLOT"] allvars = set(x for x in portage.auxdbkeys if not x.startswith("UNUSED_")) allvars.discard("CDEPEND") @@ -746,10 +749,15 @@ if vcs == "svn": mychanged = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem and elem[:1] in "MR" ] mynew = [ "./" + elem.split()[-1:][0] for elem in svnstatus if elem.startswith("A") ] elif vcs == "git": - mychanged = os.popen("git ls-files -m --with-tree=HEAD").readlines() - mychanged = [ "./" + elem[:-1] for elem in mychanged ] - mynew = os.popen("git diff --cached --name-only --diff-filter=A").readlines() strip_levels = repolevel - 1 + + mychanged = os.popen("git diff-index --name-only --diff-filter=M HEAD").readlines() + if strip_levels: + mychanged = [elem[repo_subdir_len:] for elem in mychanged \ + if elem[:repo_subdir_len] == repo_subdir] + mychanged = ["./" + elem[:-1] for elem in mychanged] + + mynew = os.popen("git diff-index --name-only --diff-filter=A HEAD").readlines() if strip_levels: mynew = [elem[repo_subdir_len:] for elem in mynew \ if elem[:repo_subdir_len] == repo_subdir] @@ -1095,6 +1103,17 @@ for x in scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) + for k, v in myaux.iteritems(): + if not isinstance(v, basestring): + continue + m = non_ascii_re.search(v) + if m is not None: + stats["variable.invalidchar"] += 1 + fails["variable.invalidchar"].append( + ("%s: %s variable contains non-ASCII " + \ + "character at position %s") % \ + (relative_path, k, m.start() + 1)) + if not src_uri_error: # Check that URIs don't reference a server from thirdpartymirrors. for uri in portage.flatten(portage.dep.use_reduce( @@ -1742,15 +1761,21 @@ else: for prop in props if " - " in prop) elif vcs == "git": - mychanged = os.popen("git ls-files -m --with-tree=HEAD").readlines() - mychanged = [ "./" + elem[:-1] for elem in mychanged ] - mynew = os.popen("git diff --cached --name-only --diff-filter=A").readlines() strip_levels = repolevel - 1 + + mychanged = os.popen("git diff-index --name-only --diff-filter=M HEAD").readlines() + if strip_levels: + mychanged = [elem[repo_subdir_len:] for elem in mychanged \ + if elem[:repo_subdir_len] == repo_subdir] + mychanged = ["./" + elem[:-1] for elem in mychanged] + + mynew = os.popen("git diff-index --name-only --diff-filter=A HEAD").readlines() if strip_levels: mynew = [elem[repo_subdir_len:] for elem in mynew \ if elem[:repo_subdir_len] == repo_subdir] mynew = ["./" + elem[:-1] for elem in mynew] - myremoved = os.popen("git diff --cached --name-only --diff-filter=D").readlines() + + myremoved = os.popen("git diff-index --name-only --diff-filter=D HEAD").readlines() if strip_levels: myremoved = [elem[repo_subdir_len:] for elem in myremoved \ if elem[:repo_subdir_len] == repo_subdir] @@ -1807,8 +1832,8 @@ else: print "%s have headers that will change." % green(str(len(myheaders))) print "* Files with headers will cause the " + \ "manifests to be made and recommited." - logging.info("myupdates:", str(myupdates)) - logging.info("myheaders:", str(myheaders)) + logging.info("myupdates: %s", myupdates) + logging.info("myheaders: %s", myheaders) commitmessage = options.commitmsg if options.commitmsgfile: diff --git a/man/ebuild.5 b/man/ebuild.5 index e71d9282a..50a54a0b0 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -55,6 +55,9 @@ ebuilds (such as the PORTAGE* and PORTDIR* variables) .br \- When assigning values to variables in ebuilds, you \fBcannot have a space\fR between the variable name and the equal sign. +.br +\- Variable values should only contain characters that are members of the +\fBascii\fR(7) character set. This requirement is mandated by \fBGLEP 31\fR. .TP .B P This variable contains the package name without the ebuild revision. diff --git a/man/repoman.1 b/man/repoman.1 index dde0d15d2..0380adfd6 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -270,6 +270,10 @@ tracked in bugs.gentoo.org .B usage.obsolete The ebuild makes use of an obsolete construct .TP +.B variable.invalidchar +A variable contains an invalid character that is not part of the ASCII +character set. +.TP .B variable.readonly Assigning a readonly variable .TP diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index ac7523f0c..b7dc2ee89 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -12370,7 +12370,7 @@ def git_sync_timestamps(settings, portdir): return 1 args = [portage.const.BASH_BINARY, "-c", - "cd %s && git ls-files -m --with-tree=HEAD" % \ + "cd %s && git diff-index --name-only --diff-filter=M HEAD" % \ portage._shell_quote(portdir)] import subprocess proc = subprocess.Popen(args, stdout=subprocess.PIPE) diff --git a/pym/portage_compat_namespace.py b/pym/portage_compat_namespace.py index 07f22a95e..736b67833 100644 --- a/pym/portage_compat_namespace.py +++ b/pym/portage_compat_namespace.py @@ -31,10 +31,16 @@ try: except (ImportError, AttributeError): raise ImportError("No module named %s" % __oldname) -def _formatwarning(message, category, filename, lineno): - return "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) - -warnings.formatwarning = _formatwarning +def _showwarning(message, category, filename, lineno, file=None, line=None): + if file is None: + import sys + file = sys.stderr + try: + file.write("%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)) + except IOError: + pass + +warnings.showwarning = _showwarning warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname), DeprecationWarning) sys.modules[__oldname] = __realmodule -- 2.26.2