[gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
commit: fa3f1ba8153644e07be3215d8862522a0de12134 Author: Michał Górny gentoo org> AuthorDate: Sat May 21 06:54:19 2016 + Commit: Michał Górny gentoo org> CommitDate: Mon Feb 5 19:25:14 2018 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa3f1ba8 portage.package.ebuild.config: Always export filtered USE_EXPAND vars Ensure that all USE_EXPAND variables are always exported with filtered USE flags inside, even if none of those flags are declared in IUSE. This is the behavior required for EAPI 5+ by the PMS. Since the behavior for earlier EAPIs is left undefined and having different behavior would be confusing to users, apply it in earlier EAPIs as well. Bug: https://bugs.gentoo.org/582140 Closes: https://github.com/gentoo/portage/pull/254 Reviewed-by: Zac Medico gentoo.org> bin/ebuild.sh| 8 +- pym/portage/package/ebuild/config.py | 55 ++-- 2 files changed, 4 insertions(+), 59 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 4a80fdd06..d63b0a0ba 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Prevent aliases from causing portage to act inappropriately. @@ -704,12 +704,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then fi fi -# unset USE_EXPAND variables that contain only the special "*" token -for x in ${USE_EXPAND} ; do - [ "${!x}" == "*" ] && unset ${x} -done -unset x - if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} then export DEBUGBUILD=1 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 35cf4f614..432520ba8 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1359,47 +1359,7 @@ class config(object): filtered_var_split.append(x) var_split = filtered_var_split - if var_split: - value = ' '.join(var_split) - else: - # Don't export empty USE_EXPAND vars unless the user config - # exports them as empty. This is required for vars such as - # LINGUAS, where unset and empty have different meanings. - # The special '*' token is understood by ebuild.sh, which - # will unset the variable so that things like LINGUAS work - # properly (see bug #459350). - if has_wildcard: - value = '*' - else: - if has_iuse: - already_set = False - # Skip the first 'env' configdict, in order to - # avoid infinite recursion here, since that dict's - # __getitem__ calls the current __getitem__. - for d in self._settings.lookuplist[1:]: - if key in d: - already_set = True - break - - if not already_set: - for x in self._unfiltered_use: - if x[:prefix_len] == prefix: - already_set = True - break - - if already_set: - value = '' - else: - value = '*' - else: - # It's not in IUSE, so just allow the variable content - # to pass through if it is defined somewhere. This - # allows packages that support LINGUAS but don't - # declare it in IUSE to use the variable outside of the - # USE_EXPAND context. - value = None - - return value + return ' '.join(var_split) def _setcpv_recursion_gate
[gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/postinst-qa-check.d/, bin/preinst-qa-check.d/, ...
commit: 2f01a9fdc68740642cca25c0fcc7f1d1fc14c0ee Author: Zac Medico gentoo org> AuthorDate: Thu Oct 26 06:06:51 2017 + Commit: Zac Medico gentoo org> CommitDate: Fri Oct 27 18:52:08 2017 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f01a9fd postinst_qa_check: initialize preinst state (bug 635474) In order to prevent false-positives during postinst_qa_check, use a preinst_qa_check function to initialize a baseline state for the postinst checks. Bug: https://bugs.gentoo.org/635474 bin/misc-functions.sh | 18 +++--- bin/postinst-qa-check.d/50gnome2-utils | 3 +++ bin/postinst-qa-check.d/50xdg-utils| 6 ++ bin/preinst-qa-check.d/50gnome2-utils | 1 + bin/preinst-qa-check.d/50xdg-utils | 1 + pym/portage/package/ebuild/doebuild.py | 1 + 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index b0506bde7..a02aa3bfd 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -256,8 +256,12 @@ install_qa_check() { rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!" } +preinst_qa_check() { + postinst_qa_check preinst +} + postinst_qa_check() { - local d f paths qa_checks=() + local d f paths qa_checks=() PORTAGE_QA_PHASE=${1:-postinst} if ! ___eapi_has_prefix_variables; then local EPREFIX= EROOT=${ROOT} fi @@ -267,23 +271,23 @@ postinst_qa_check() { # Collect the paths for QA checks, highest prio first. paths=( # sysadmin overrides - "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/postinst-qa-check.d + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/${PORTAGE_QA_PHASE}-qa-check.d # system-wide package installs - "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/postinst-qa-check.d + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/${PORTAGE_QA_PHASE}-qa-check.d ) # Now repo-specific checks. # (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...) for d in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do paths+=( - "${d}"/metadata/postinst-qa-check.d + "${d}"/metadata/${PORTAGE_QA_PHASE}-qa-check.d ) done paths+=( # Portage built-in checks - "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/postinst-qa-check.d - "${PORTAGE_BIN_PATH}"/postinst-qa-check.d + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/${PORTAGE_QA_PHASE}-qa-check.d + "${PORTAGE_BIN_PATH}"/${PORTAGE_QA_PHASE}-qa-check.d ) # Collect file names of QA checks. We need them early to support @@ -308,7 +312,7 @@ postinst_qa_check() { # Allow inheriting eclasses. # XXX: we want this only in repository-wide checks. _IN_INSTALL_QA_CHECK=1 - source "${d}/${f}" || eerror "Post-postinst QA check ${f} failed to run" + source "${d}/${f}" || eerror "Post-${PORTAGE_QA_PHASE} QA check ${f} failed to run" ) done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z) } diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils index 7f1b0b847..80360cf64 100644 --- a/bin/postinst-qa-check.d/50gnome2-utils +++ b/bin/postinst-qa-check.d/50gnome2-utils @@ -33,6 +33,9 @@ gnome2_icon_cache_check() { fi done + # preinst initializes the baseline state for the posinst check + [[ ${PORTAGE_QA_PHASE} == preinst ]] && return + # The eqatag call is prohibitively expensive if the cache is # missing and there are a large number of files. if [[ -z ${missing} && ${all_files[@]} ]]; then diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils index d1285caf4..84f938abd 100644 --- a/bin/postinst-qa-check.d/50xdg-utils +++ b/bin/postinst-qa-check.d/50xdg-utils @@ -29,6 +29,9 @@ xdg_desktop_database_check() { fi done + # preinst initializes the baseline state for the posinst check + [[ ${PORTAGE_QA_PHASE} == preinst ]] && return + # The eqatag call is prohibitively expensive if the cache is # missing and there are a large number of files. if [[ -z ${missing} && ${all_files[@]} ]]; then @@ -66,6 +69,9 @@ xdg_mimeinfo_database_check() { fi done + # preinst initializes the baseline state for the posinst check + [[ ${PORTAGE_QA_PHASE} == preinst ]] && return + # The eqatag call is prohibitively expensive if the cache is # missing and there are a large number of files. if [[ -z ${missing} && ${all_files[@]} ]]; then diff --git a/bin/preinst-qa-check.d/50gnome2-utils b/bin/preinst-qa-check.d/50
[gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/, pym/portage/, pym/portage/util/
commit: 55b2e1c0a51d64a84e5649c135cdbc2c650ce6ca Author: Alexander Berntsen gentoo org> AuthorDate: Fri May 16 14:06:31 2014 + Commit: Alexander Berntsen gentoo org> CommitDate: Sat Jun 14 20:48:42 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=55b2e1c0 Turn a traceback into a graceful error Prior to this patch, the following would traceback: mkdir -p /etc/portage/make.profile/packages emerge foo This patch turns such a traceback into an error by implementing IsADirectory error handling. Signed-off-by: Alexander Berntsen gentoo.org> --- bin/emerge | 9 - pym/portage/exception.py | 4 pym/portage/package/ebuild/config.py | 13 ++--- pym/portage/util/__init__.py | 3 ++- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/bin/emerge b/bin/emerge index bb93d83..7773f7f 100755 --- a/bin/emerge +++ b/bin/emerge @@ -45,12 +45,19 @@ try: from _emerge.main import emerge_main if __name__ == "__main__": - from portage.exception import ParseError, PermissionDenied + from portage.exception import IsADirectory, ParseError, \ + PermissionDenied try: retval = emerge_main() except PermissionDenied as e: sys.stderr.write("Permission denied: '%s'\n" % str(e)) sys.exit(e.errno) + except IsADirectory as e: + sys.stderr.write("'%s' is a directory, but should be a file!\n" + "See portage man page for information on " + "which files may be directories.\n" % + str(e)) + sys.exit(e.errno) except ParseError as e: sys.stderr.write("%s\n" % str(e)) sys.exit(1) diff --git a/pym/portage/exception.py b/pym/portage/exception.py index 6fa5447..ef62e7a 100644 --- a/pym/portage/exception.py +++ b/pym/portage/exception.py @@ -84,6 +84,10 @@ class FileNotFound(InvalidLocation): class DirectoryNotFound(InvalidLocation): """A directory was not found when it was expected to exist""" +class IsADirectory(PortageException): + """A directory was found when it was expected to be a file""" + from errno import EISDIR as errno + class OperationNotPermitted(PortageException): """An operation was not permitted operating system""" from errno import EPERM as errno diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index e104501..f639e14 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -37,7 +37,8 @@ from portage.dep import Atom, isvalidatom, match_from_list, use_reduce, _repo_se from portage.eapi import eapi_exports_AA, eapi_exports_merge_type, \ eapi_supports_prefix, eapi_exports_replace_vars, _get_eapi_attrs from portage.env.loaders import KeyValuePairFileLoader -from portage.exception import InvalidDependString, PortageException +from portage.exception import InvalidDependString, IsADirectory, \ + PortageException from portage.localization import _ from portage.output import colorize from portage.process import fakeroot_capable, sandbox_capable @@ -556,8 +557,14 @@ class config(object): self.profile_path = locations_manager.profile_path self.user_profile_dir = locations_manager.user_profile_dir - packages_list = [grabfile_package(os.path.join(x, "packages"), - verify_eapi=True) for x in self.profiles] + try: + packages_list = [grabfile_package(os.path.join(x, "packages"), + verify_eapi=True) for x in self.profiles] + except IOError as e: + if e.errno == IsADirectory.errno: + raise IsADirectory(os.path.join(self.profile_path, + "packages")) + self.packages = tuple(stack_lists(packages_list, incremental=1)) # revmaskdict diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 614b2b3..4105c19 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -43,7 +43,8 @@ from portage import _unicode_encode from portage import _unicode_decode from portage.const import VCS_DIRS from portage.exception import InvalidAtom, PortageException, FileNotFound, \ - OperationNotPermitted, ParseError, PermissionDenied, ReadOnlyFileSystem + IsADirectory, OperationNotPermitted, ParseError, PermissionD