From 511c8b64b0b2e820b7fcc99f32a7f5168415ae52 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 20 Mar 2010 18:31:13 +0000 Subject: [PATCH] Merged from trunk -r15825:15835 | 15826 | Update SIGPIPE comments to refer to "[Errno 32] Broken pipe" | | zmedico | exceptions since this is signal hander now set automatically | | | for subprocesses after the fork in portage.process.spawn(). | | 15827 | Revert tar error handling changes from bug #309001 since we | | zmedico | can't necessarily trust tar exist status alone (reverts | | | r15820 and r15821). | | 15828 | Bug #299095 - Always use UTF-8 codec when opening ebuilds, | | zmedico | to avoid UnicodeDecodeError with python3. | | 15829 | Add a TODO note about adding a registration interface for | | zmedico | eclasses to register phase hooks, in order to migrate away | | | from global scope useq() calls. | | 15830 | Fix breakage from previous commit. | | zmedico | | | 15831 | Bug #309699 - Update --emptytree docs. Thanks to Ben Kohler | | zmedico | for wording suggestions. | | 15832 | Bug #309907 - Fix update_config_files() to handle | | zmedico | package.license. | | 15833 | Bug #310135 - Skip the changelog.ebuildadded for all | | zmedico | distributed SCMs. | | 15834 | Note that use.local.desc is automatically generated, and | | zmedico | refer to GLEP 56. | | 15835 | Fix typo. | | zmedico | | svn path=/main/branches/prefix/; revision=15837 --- bin/ebuild | 3 ++- bin/ebuild.sh | 20 ++++++++++++-------- bin/emerge | 3 ++- bin/repoman | 23 +++++++++++++++-------- man/emerge.1 | 8 ++++---- man/make.conf.5 | 2 +- man/portage.5 | 7 +++++-- pym/_emerge/BinpkgExtractorAsync.py | 8 +++++++- pym/_emerge/help.py | 10 ++++++---- pym/portage/update.py | 2 +- 10 files changed, 55 insertions(+), 31 deletions(-) diff --git a/bin/ebuild b/bin/ebuild index 9c6b8fefb..30f75f246 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -17,7 +17,8 @@ try: signal.signal(signal.SIGINT, exithandler) signal.signal(signal.SIGTERM, exithandler) - # Quiet killing of subprocesses by SIGPIPE (see bug #309001). + # Prevent "[Errno 32] Broken pipe" exceptions when + # writing to a pipe. signal.signal(signal.SIGPIPE, signal.SIG_DFL) except KeyboardInterrupt: diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 5e217b731..3e127ac3a 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -140,12 +140,14 @@ useq() { fi if [[ $EBUILD_PHASE = depend ]] ; then - # Skip this for older EAPIs since lots of ebuilds/eclasses - # have stuff in global scope that really belongs somewhere - # like pkg_setup or src_configure. - if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 3_pre2 ; then - die "use() called during invalid phase: $EBUILD_PHASE" - fi + # TODO: Add a registration interface for eclasses to register + # any number of phase hooks, so that global scope eclass + # initialization can by migrated to phase hooks in new EAPIs. + # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup + #if [[ -n $EAPI ]] && ! hasq "$EAPI" 0 1 2 3 ; then + # die "use() called during invalid phase: $EBUILD_PHASE" + #fi + true # Make sure we have this USE flag in IUSE elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then @@ -362,7 +364,8 @@ unpack() { _unpack_tar() { if [ "${y}" == "tar" ]; then - $1 -dc "$srcdir$x" | tar xof - || die "$myfail" + $1 -dc "$srcdir$x" | tar xof - + assert "$myfail" else $1 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail" fi @@ -377,7 +380,8 @@ unpack() { tar xozf "$srcdir$x" || die "$myfail" ;; tbz|tbz2) - bzip2 -dc "$srcdir$x" | tar xof - || die "$myfail" + bzip2 -dc "$srcdir$x" | tar xof - + assert "$myfail" ;; ZIP|zip|jar) unzip -qo "${srcdir}${x}" || die "$myfail" diff --git a/bin/emerge b/bin/emerge index e88d43e04..5321a9440 100755 --- a/bin/emerge +++ b/bin/emerge @@ -17,7 +17,8 @@ try: signal.signal(signal.SIGINT, exithandler) signal.signal(signal.SIGTERM, exithandler) - # Quiet killing of subprocesses by SIGPIPE (see bug #309001). + # Prevent "[Errno 32] Broken pipe" exceptions when + # writing to a pipe. signal.signal(signal.SIGPIPE, signal.SIG_DFL) except KeyboardInterrupt: diff --git a/bin/repoman b/bin/repoman index 13beaa29e..b43f90297 100755 --- a/bin/repoman +++ b/bin/repoman @@ -497,6 +497,12 @@ elif os.path.isdir(os.path.join(portdir_overlay, ".bzr")): elif os.path.isdir(os.path.join(portdir_overlay, ".hg")): vcs = "hg" +# Note: We don't use ChangeLogs in distributed SCMs. +# It will be generated on server side from scm log, +# before package moves to the rsync server. +# This is needed because we try to avoid merge collisions. +check_changelog = vcs in ('CVS', 'SVN') + vcs_local_opts = repoman_settings.get("REPOMAN_VCS_LOCAL_OPTS", "").split() vcs_global_opts = repoman_settings.get("REPOMAN_VCS_GLOBAL_OPTS") if vcs_global_opts is None: @@ -1275,11 +1281,8 @@ for x in scanlist: relative_path + ': %s' % error_match.group(1)) del mydigests - # Note: We don't use ChangeLogs in distributed SCMs. - # It will be generated on server side from scm log, - # before package moves to the rsync server. - # This is needed because we try to avoid merge collisions. - if vcs not in ("git", "hg") and "ChangeLog" not in checkdirlist: + + if check_changelog and "ChangeLog" not in checkdirlist: stats["changelog.missing"]+=1 fails["changelog.missing"].append(x+"/ChangeLog") @@ -1337,7 +1340,8 @@ for x in scanlist: if repolevel < 2: ebuild_path = os.path.join(catdir, ebuild_path) ebuild_path = os.path.join(".", ebuild_path) - if not changelog_modified and ebuild_path in new_ebuilds: + if check_changelog and not changelog_modified \ + and ebuild_path in new_ebuilds: stats['changelog.ebuildadded'] += 1 fails['changelog.ebuildadded'].append(relative_path) @@ -2318,7 +2322,9 @@ else: from portage.util import write_atomic cvs_header = re.compile(r'^#\s*\$Header.*\$$') for x in myheaders: - f = open(x) + f = codecs.open(_unicode_encode(x, + encoding=_encodings['fs'], errors='strict'), + mode='r', encoding=_encodings['repo.content'], errors='strict') mylines = f.readlines() f.close() modified = False @@ -2327,7 +2333,8 @@ else: mylines[i] = line.replace("/Attic/", "/") modified = True if modified: - write_atomic(x, "".join(mylines)) + write_atomic(x, "".join(mylines), + encoding=_encodings['repo.content'], errors='strict') manifest_commit_required = True if vcs in ('cvs', 'svn') and (myupdates or myremoved): diff --git a/man/emerge.1 b/man/emerge.1 index b93d0b08f..82fe9c216 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -354,10 +354,10 @@ behavior with respect to build time dependencies that are not strictly required. .TP .BR "\-\-emptytree " (\fB\-e\fR) -Reinstalls all world packages and their dependencies to the current USE -specifications while differing from the installed set of packages as -little as possible. You should run with \fB\-\-pretend\fR first to make -sure the result is what you expect. +Reinstalls target atoms and their entire deep +dependency tree, as though no packages are currently +installed. You should run this with \fB\-\-pretend\fR +first to make sure the result is what you expect. .TP .BR "\-\-fail\-clean[=n]" Clean up temporary files after a build failure. This is diff --git a/man/make.conf.5 b/man/make.conf.5 index ecf6c153e..68b163d88 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -38,7 +38,7 @@ Defaults to the value of $ARCH. .TP \fBACCEPT_LICENSE\fR = \fI[space delimited list of licenses or groups]\fR This variable is used to mask packages based on licensing restrictions. It -make contain both license and group names, where group names are prefixed +may contain both license and group names, where group names are prefixed with the '@' symbol. License groups are defined in the \fIlicense_groups\fR file (see \fBportage\fR(5)). In addition to license and group names, the \fI*\fR and \fI-*\fR wildcard tokens are also supported. Refer to GLEP 23 diff --git a/man/portage.5 b/man/portage.5 index 40bf89f4e..fb354c220 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -811,8 +811,11 @@ doc \- Adds extra documentation .fi .TP .BR use.local.desc -All local USE flags must be listed here along with the package and a -description. +All local USE flags are listed here along with the package and a +description. This file is automatically generated from the +metadata.xml files that are included with each individual package. +Refer to GLEP 56 for further information: +\fIhttp://www.gentoo.org/proj/en/glep/glep-0056.html\fR. .nf .I Format: diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py index e646d9c1b..45af54136 100644 --- a/pym/_emerge/BinpkgExtractorAsync.py +++ b/pym/_emerge/BinpkgExtractorAsync.py @@ -20,7 +20,13 @@ class BinpkgExtractorAsync(SpawnProcess): def _start(self): self.args = [self._shell_binary, "-c", - ("bzip2 -dqc -- %s | tar -xp -C %s -f -") % \ + ("bzip2 -dqc -- %s | tar -xp -C %s -f - ; " + \ + "p=(${PIPESTATUS[@]}) ; " + \ + "if [ ${p[0]} != 0 ] ; then " + \ + "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \ + "if [ ${p[1]} != 0 ] ; then " + \ + "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \ + "exit 0 ;") % \ (portage._shell_quote(self.pkg_path), portage._shell_quote(self.image_dir))] diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 409bbe290..0a3cf3e6e 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -372,10 +372,12 @@ def help(myopts, havecolor=1): print(" dependencies that are not strictly required.") print() print(" "+green("--emptytree")+" ("+green("-e")+" short option)") - print(" Virtually tweaks the tree of installed packages to contain") - print(" nothing. This is great to use together with --pretend. This makes") - print(" it possible for developers to get a complete overview of the") - print(" complete dependency tree of a certain package.") + desc = "Reinstalls target atoms and their entire deep " + \ + "dependency tree, as though no packages are currently " + \ + "installed. You should run this with --pretend " + \ + "first to make sure the result is what you expect." + for line in wrap(desc, desc_width): + print(desc_indent + line) print() print(" "+green("--fail-clean[=n]")) desc = "Clean up temporary files after a build failure. This is " + \ diff --git a/pym/portage/update.py b/pym/portage/update.py index 762917935..c55741473 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -194,7 +194,7 @@ def update_config_files(config_root, protect, protect_mask, update_iter): update_files = {} file_contents = {} myxfiles = ["package.mask", "package.unmask", \ - "package.keywords", "package.use"] + "package.keywords", "package.license", "package.use"] myxfiles += [os.path.join("profile", x) for x in myxfiles] abs_user_config = os.path.join(config_root, USER_CONFIG_PATH) recursivefiles = [] -- 2.26.2