[gentoo-commits] proj/portage:master commit in: bin/, pym/portage/package/ebuild/
commit: f5f6a6da0db1dfe824c0d4386e6b4458338df179 Author: Michał Górny gentoo org> AuthorDate: Fri Mar 16 08:10:33 2018 + Commit: Michał Górny gentoo org> CommitDate: Fri Mar 16 09:53:19 2018 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5f6a6da Stop crippling metadata for virtual/* There is no technical requirement that virtual/* packages will reliably contain no executable code. Therefore, stop crippling the metadata stored in vdb for them. Closes: https://github.com/gentoo/portage/pull/269 Reviewed-by: Zac Medico gentoo.org> bin/phase-functions.sh | 24 ++-- pym/portage/package/ebuild/doebuild.py | 11 --- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 0ceddb451..6ae61b2f0 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -662,23 +662,19 @@ __dyn_install() { local f x IFS=$' \t\n\r' for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE \ - PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do + PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION \ + ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ + CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ + LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \ + QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do + x=$(echo -n ${!f}) [[ -n $x ]] && echo "$x" > $f done - if [[ $CATEGORY != virtual ]] ; then - for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ - CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ - LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \ - QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do - x=$(echo -n ${!f}) - [[ -n $x ]] && echo "$x" > $f - done - # whitespace preserved - for f in QA_AM_MAINTAINER_MODE ; do - [[ -n ${!f} ]] && echo "${!f}" > $f - done - fi + # whitespace preserved + for f in QA_AM_MAINTAINER_MODE ; do + [[ -n ${!f} ]] && echo "${!f}" > $f + done echo "${USE}" > USE echo "${EAPI:-0}" > EAPI diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 8cec8e4da..8436c0b10 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1930,13 +1930,10 @@ def _post_src_install_write_metadata(settings): if v is not None: write_atomic(os.path.join(build_info_dir, k), v + '\n') - # The following variables are irrelevant for virtual packages. - if settings.get('CATEGORY') != 'virtual': - - for k in ('CHOST',): - v = settings.get(k) - if v is not None: - write_atomic(os.path.join(build_info_dir, k), v + '\n') + for k in ('CHOST',): + v = settings.get(k) + if v is not None: + write_atomic(os.path.join(build_info_dir, k), v + '\n') with io.open(_unicode_encode(os.path.join(build_info_dir, 'BUILD_TIME'), encoding=_encodings['fs'], errors='strict'),
[gentoo-commits] proj/portage:master commit in: bin/, pym/portage/package/ebuild/
commit: b6ac1641c752db48841f671e0ce7c4e1e98e1933 Author: Michał Górny gentoo org> AuthorDate: Tue Aug 15 08:11:10 2017 + Commit: Michał Górny gentoo org> CommitDate: Sat Aug 26 21:16:07 2017 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b6ac1641 Support post-postinst QA checks Extend the QA check mechanics in Portage to support post-postinst QA checks. They are like post-install QA checks, except they are run after pkg_postinst(), and so they can be used to verify that necessary postinst actions were performed (e.g. regenerating caches). Reviewed-by: Zac Medico gentoo.org> bin/misc-functions.sh | 57 ++ pym/portage/package/ebuild/doebuild.py | 5 ++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 079369313..18cddea21 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -256,6 +256,63 @@ install_qa_check() { rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!" } +postinst_qa_check() { + local d f paths qa_checks=() + if ! ___eapi_has_prefix_variables; then + local EPREFIX= EROOT=${ROOT} + fi + + cd "${EROOT}" || die "cd failed" + + # Collect the paths for QA checks, highest prio first. + paths=( + # sysadmin overrides + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/postinst-qa-check.d + # system-wide package installs + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/postinst-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 + ) + done + + paths+=( + # Portage built-in checks + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/postinst-qa-check.d + "${PORTAGE_BIN_PATH}"/postinst-qa-check.d + ) + + # Collect file names of QA checks. We need them early to support + # overrides properly. + for d in "${paths[@]}"; do + for f in "${d}"/*; do + [[ -f ${f} ]] && qa_checks+=( "${f##*/}" ) + done + done + + # Now we need to sort the filenames lexically, and process + # them in order. + while read -r -d '' f; do + # Find highest priority file matching the basename. + for d in "${paths[@]}"; do + [[ -f ${d}/${f} ]] && break + done + + # Run in a subshell to treat it like external script, + # but use 'source' to pass all variables through. + ( + # 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" + ) + done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z) +} + install_mask() { local root="$1" shift diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 14d96f57c..ac697a763 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1738,7 +1738,10 @@ _post_phase_cmds = { "preinst_sfperms", "preinst_selinux_labels", "preinst_suid_scan", - ] + ], + + "postinst" : [ + "postinst_qa_check"], } def _post_phase_userpriv_perms(mysettings):
[gentoo-commits] proj/portage:master commit in: bin/, pym/portage/package/ebuild/
commit: 0c06ff5f8f3e86592bbaeb38f274797505c45b2a Author: Zac Medico gentoo org> AuthorDate: Sat Dec 3 05:21:01 2016 + Commit: Zac Medico gentoo org> CommitDate: Sat Dec 3 20:03:41 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c06ff5f bin/ebuild: fix EBUILD_FORCE_TEST / RESTRICT interaction (bug 601466) Ensure that config adjustments are applied to all relevant config instances, in order to prevent inconsistencies like the one that triggered bug 601466. Move the "Forcing test" message from config to bin/ebuild, in order to avoid duplicate messages. X-Gentoo-Bug: 601466 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=601466 Acked-by: Brian Dolbec gentoo.org> bin/ebuild | 25 ++--- pym/portage/package/ebuild/config.py | 5 - 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/bin/ebuild b/bin/ebuild index 1f99177..7930b41 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -53,6 +53,7 @@ from portage import _unicode_encode from portage.const import VDB_PATH from portage.exception import PermissionDenied, PortageKeyError, \ PortagePackageException, UnsupportedAPIException +from portage.localization import _ import portage.util from _emerge.Package import Package from _emerge.RootConfig import RootConfig @@ -244,7 +245,11 @@ if mytree == "porttree" and build_dir_phases.intersection(pargs): ebuild_changed = \ portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir)[0] is None -tmpsettings = portage.config(clone=portage.settings) +# Make configuration adjustments to portage.portdb.doebuild_settings, +# in order to enforce consistency for EBUILD_FORCE_TEST support +# (see bug 601466). +tmpsettings = portage.portdb.doebuild_settings + tmpsettings["PORTAGE_VERBOSE"] = "1" tmpsettings.backup_changes("PORTAGE_VERBOSE") @@ -265,6 +270,7 @@ if "test" in pargs: tmpsettings["EBUILD_FORCE_TEST"] = "1" tmpsettings.backup_changes("EBUILD_FORCE_TEST") tmpsettings.features.add("test") + portage.writemsg(_("Forcing test.\n"), noiselevel=-1) tmpsettings.features.discard("fail-clean") @@ -272,6 +278,17 @@ if "merge" in pargs and "noauto" in tmpsettings.features: print("Disabling noauto in features... merge disables it. (qmerge doesn't)") tmpsettings.features.discard("noauto") +if 'digest' in tmpsettings.features: + if pargs and pargs[0] not in ("digest", "manifest"): + pargs = ['digest'] + pargs + # We only need to build digests on the first pass. + tmpsettings.features.discard('digest') + +# Now that configuration adjustments are complete, create a clone of +# tmpsettings. The current instance refers to portdb.doebuild_settings, +# and we want to avoid the possibility of unintended side-effects. +tmpsettings = portage.config(clone=tmpsettings) + try: metadata = dict(zip(Package.metadata_keys, portage.db[portage.settings['EROOT']][mytree].dbapi.aux_get( @@ -315,12 +332,6 @@ def stale_env_warning(): open(os.path.join(tmpsettings['PORTAGE_BUILDDIR'], '.ebuild_changed'), 'w').close() -if 'digest' in tmpsettings.features: - if pargs and pargs[0] not in ("digest", "manifest"): - pargs = ['digest'] + pargs - # We only need to build digests on the first pass. - tmpsettings.features.discard('digest') - checked_for_stale_env = False for arg in pargs: diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 505c7a2..4f7e5c9 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -1699,11 +1699,6 @@ class config(object): ebuild_force_test = not restrict_test and \ self.get("EBUILD_FORCE_TEST") == "1" - if ebuild_force_test and \ - not hasattr(self, "_ebuild_force_test_msg_shown"): - self._ebuild_force_test_msg_shown = True - writemsg(_("Forcing test.\n"), noiselevel=-1) - if "test" in explicit_iuse or iuse_implicit_match("test"): if "test" not in self.features: use.discard("test")
[gentoo-commits] proj/portage:master commit in: bin/, pym/portage/package/ebuild/
commit: c9aebae4633a972b78f7f999aa755fa6d25c8451 Author: Zac Medico zmedico AT gentoo DOT org AuthorDate: Sun Mar 22 00:04:12 2015 + Commit: Zac Medico zmedico AT gentoo DOT org CommitDate: Sun Mar 22 19:36:48 2015 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c9aebae4 _post_src_install_soname_symlinks: fix bug 543818 The SonameDepsProcessor.add() method raises AssertionError if the multilib category of an ELF file is not recognized. It's not possible to account for soname dependencies in this case (the file is probably intended for a foreign architecture), so avoid the AssertionError and generate an eqawarn message for this case. The eqawarn message is suppressed for files matched by the QA_PREBUILT variable. X-Gentoo-Bug: 543818 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=543818 Acked-by: Brian Dolbec dolsen AT gentoo.org bin/phase-functions.sh | 2 +- pym/portage/package/ebuild/doebuild.py | 59 +++--- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index def2080..2743e27 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -580,7 +580,7 @@ __dyn_install() { for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_CONFIGURE_OPTIONS \ - QA_DESKTOP_FILE PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do + QA_DESKTOP_FILE QA_PREBUILT PROVIDES_EXCLUDE REQUIRES_EXCLUDE ; do x=$(echo -n ${!f}) [[ -n $x ]] echo $x $f done diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 94785b5..1be83ad 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -8,6 +8,7 @@ __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] import grp import gzip import errno +import fnmatch import io from itertools import chain import logging @@ -2209,24 +2210,29 @@ def _post_src_install_soname_symlinks(mysettings, out): if f is not None: f.close() - qa_no_symlink = - f = None - try: - f = io.open(_unicode_encode(os.path.join( - mysettings[PORTAGE_BUILDDIR], - build-info, QA_SONAME_NO_SYMLINK), - encoding=_encodings['fs'], errors='strict'), - mode='r', encoding=_encodings['repo.content'], - errors='replace') - qa_no_symlink = f.read() - except IOError as e: - if e.errno not in (errno.ENOENT, errno.ESTALE): - raise - finally: - if f is not None: - f.close() + metadata = {} + for k in (QA_PREBUILT, QA_NO_SYMLINK): + try: + with io.open(_unicode_encode(os.path.join( + mysettings[PORTAGE_BUILDDIR], + build-info, k), + encoding=_encodings['fs'], errors='strict'), + mode='r', encoding=_encodings['repo.content'], + errors='replace') as f: + v = f.read() + except IOError as e: + if e.errno not in (errno.ENOENT, errno.ESTALE): + raise + else: + metadata[k] = v + + qa_prebuilt = metadata.get(QA_PREBUILT, ).strip() + if qa_prebuilt: + qa_prebuilt = re.compile(|.join( + fnmatch.translate(x.lstrip(os.sep)) + for x in portage.util.shlex_split(qa_prebuilt))) - qa_no_symlink = qa_no_symlink.split() + qa_no_symlink = metadata.get(QA_NO_SYMLINK, ).split() if qa_no_symlink: if len(qa_no_symlink) 1: qa_no_symlink = |.join((%s) % x for x in qa_no_symlink) @@ -2297,6 +2303,7 @@ def _post_src_install_soname_symlinks(mysettings, out): requires_exclude = missing_symlinks = [] + unrecognized_elf_files = [] soname_deps = SonameDepsProcessor( provides_exclude, requires_exclude) @@ -2326,7 +2333,14 @@ def _post_src_install_soname_symlinks(mysettings, out): entry.multilib_category = compute_multilib_category(elf_header) needed_file.write(_unicode(entry)) - soname_deps.add(entry) + if entry.multilib_category is None: + if not qa_prebuilt or qa_prebuilt.match( + entry.filename[len(mysettings[EPREFIX]):].lstrip( +
[gentoo-commits] proj/portage:master commit in: bin/, pym/portage/package/ebuild/
commit: 58c27aec81262d6840e36f2f56c32bec68c414c1 Author: Zac Medico zmedico AT gentoo DOT org AuthorDate: Sat Nov 29 23:35:47 2014 + Commit: Zac Medico zmedico AT gentoo DOT org CommitDate: Tue Dec 2 18:29:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=58c27aec ebuild.sh: fix pkg_setup env for binary packages (528274) In commit 743b3337644fbb3ea461d3a9137c9ac85e163f03, support for binary packages broke, since binary packages must load the environment from $T/environment. This patch fixes the logic to handle binary packages correctly. Fixes: 743b3337644f (ebuild.sh: force fresh env for pkg_setup (528274)) X-Gentoo-Bug: 528274 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=528274 Acked-by: Brian Dolbec dolsen AT gentoo.org --- bin/ebuild.sh | 6 -- pym/portage/package/ebuild/config.py | 4 +++- pym/portage/package/ebuild/doebuild.py | 7 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 232bf44..2ed1335 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -501,7 +501,8 @@ fi export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)} trap 'exit 1' SIGTERM -if ! has $EBUILD_PHASE clean cleanrm depend setup \ +if ! has $EBUILD_PHASE clean cleanrm depend \ + ! [[ $EMERGE_FROM = ebuild $EBUILD_PHASE = setup ]] \ [ -f ${T}/environment ] ; then # The environment may have been extracted from environment.bz2 or # may have come from another version of ebuild.sh or something. @@ -550,7 +551,8 @@ eval PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS}) # Source the ebuild every time for FEATURES=noauto, so that ebuild # modifications take effect immediately. if ! has $EBUILD_PHASE clean cleanrm ; then - if [[ $EBUILD_PHASE =~ ^(depend|setup)$ || ! -f $T/environment || \ + if [[ $EBUILD_PHASE = setup $EMERGE_FROM = ebuild ]] || \ + [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ -f $PORTAGE_BUILDDIR/.ebuild_changed || \ ${FEATURES} == * noauto * ]] ; then # The bashrcs get an opportunity here to set aliases that will be expanded diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index ca15f81..59e239b 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -2663,9 +2663,11 @@ class config(object): eapi = self.get('EAPI') eapi_attrs = _get_eapi_attrs(eapi) phase = self.get('EBUILD_PHASE') + emerge_from = self.get('EMERGE_FROM') filter_calling_env = False if self.mycpv is not None and \ - phase not in ('clean', 'cleanrm', 'depend', 'fetch', 'setup'): + not (emerge_from == 'ebuild' and phase == 'setup') and \ + phase not in ('clean', 'cleanrm', 'depend', 'fetch'): temp_dir = self.get('T') if temp_dir is not None and \ os.path.exists(os.path.join(temp_dir, 'environment')): diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 6df3c69..bf97660 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -913,12 +913,15 @@ def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, if eapi_exports_merge_type(mysettings[EAPI]) and \ MERGE_TYPE not in mysettings.configdict[pkg]: if tree == porttree: - mysettings.configdict[pkg][EMERGE_FROM] = ebuild mysettings.configdict[pkg][MERGE_TYPE] = source elif tree == bintree: - mysettings.configdict[pkg][EMERGE_FROM] = binary mysettings.configdict[pkg][MERGE_TYPE] = binary + if tree == porttree: + mysettings.configdict[pkg][EMERGE_FROM] = ebuild + elif tree == bintree: + mysettings.configdict[pkg][EMERGE_FROM] = binary + # NOTE: It's not possible to set REPLACED_BY_VERSION for prerm # and postrm here, since we don't necessarily know what # versions are being installed. This could be a problem
[gentoo-commits] proj/portage:master commit in: bin/, pym/portage/package/ebuild/
commit: 743b3337644fbb3ea461d3a9137c9ac85e163f03 Author: Zac Medico zmedico AT gentoo DOT org AuthorDate: Wed Nov 5 06:50:02 2014 + Commit: Zac Medico zmedico AT gentoo DOT org CommitDate: Sat Nov 29 18:28:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=743b3337 ebuild.sh: force fresh env for pkg_setup (528274) In ebuild.sh, $T/environment is loaded for most phases, but it should always start with a fresh environment for pkg_setup. Therefore, skip environment loading for pkg_setup, and force the ebuild to be sourced. This also requires a change in the config.environ method, in order to ensure that the calling environment is inherited by pkg_setup (even though $T/environment may exist). X-Gentoo-Bug: 528274 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=528274 Acked-by: Brian Dolbec dolsen AT gentoo.org --- bin/ebuild.sh| 4 ++-- pym/portage/package/ebuild/config.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 658884a..232bf44 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -501,7 +501,7 @@ fi export EBUILD_MASTER_PID=${BASHPID:-$(__bashpid)} trap 'exit 1' SIGTERM -if ! has $EBUILD_PHASE clean cleanrm depend \ +if ! has $EBUILD_PHASE clean cleanrm depend setup \ [ -f ${T}/environment ] ; then # The environment may have been extracted from environment.bz2 or # may have come from another version of ebuild.sh or something. @@ -550,7 +550,7 @@ eval PORTAGE_ECLASS_LOCATIONS=(${PORTAGE_ECLASS_LOCATIONS}) # Source the ebuild every time for FEATURES=noauto, so that ebuild # modifications take effect immediately. if ! has $EBUILD_PHASE clean cleanrm ; then - if [[ $EBUILD_PHASE = depend || ! -f $T/environment || \ + if [[ $EBUILD_PHASE =~ ^(depend|setup)$ || ! -f $T/environment || \ -f $PORTAGE_BUILDDIR/.ebuild_changed || \ ${FEATURES} == * noauto * ]] ; then # The bashrcs get an opportunity here to set aliases that will be expanded diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index aca27f2..ca15f81 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -2665,7 +2665,7 @@ class config(object): phase = self.get('EBUILD_PHASE') filter_calling_env = False if self.mycpv is not None and \ - phase not in ('clean', 'cleanrm', 'depend', 'fetch'): + phase not in ('clean', 'cleanrm', 'depend', 'fetch', 'setup'): temp_dir = self.get('T') if temp_dir is not None and \ os.path.exists(os.path.join(temp_dir, 'environment')):