From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CAC801389E2 for ; Thu, 4 Dec 2014 14:01:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C5388E08AC; Thu, 4 Dec 2014 14:01:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 31694E08A6 for ; Thu, 4 Dec 2014 14:01:50 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 779F034063D for ; Thu, 4 Dec 2014 14:01:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AEFFBB8F4 for ; Thu, 4 Dec 2014 14:01:46 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1417701695.eb192ed4f307517851214baf94a6bfd792338711.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/eapi.sh bin/phase-helpers.sh X-VCS-Directories: bin/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: eb192ed4f307517851214baf94a6bfd792338711 X-VCS-Branch: master Date: Thu, 4 Dec 2014 14:01:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ece48578-7183-4ec2-a664-5ea399ecbb38 X-Archives-Hash: 7932ff5172c55b0a673d1504257c25f4 commit: eb192ed4f307517851214baf94a6bfd792338711 Author: Michał Górny gentoo org> AuthorDate: Sun Aug 17 20:42:15 2014 +0000 Commit: Michał Górny gentoo org> CommitDate: Thu Dec 4 14:01:35 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=eb192ed4 Add tentative support for EAPI6 eapply function Add the eapply patch applying function. --- bin/eapi.sh | 4 ++++ bin/phase-helpers.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/bin/eapi.sh b/bin/eapi.sh index 978a410..8ffffbb 100644 --- a/bin/eapi.sh +++ b/bin/eapi.sh @@ -72,6 +72,10 @@ ___eapi_has_einstalldocs() { [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] } +___eapi_has_eapply() { + [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] +} + ___eapi_has_master_repositories() { [[ ${1-${EAPI}} =~ ^(5-progress)$ ]] } diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index e401676..e9fbbb4 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -924,6 +924,68 @@ if ___eapi_has_einstalldocs; then } fi +if ___eapi_has_eapply; then + eapply() { + _eapply_patch() { + local f=${1} + local prefix=${2} + + started_applying=1 + ebegin "${prefix:-Applying }${f##*/}" + # -p1 as a sane default + # -f to avoid interactivity + # -s to silence progress output + patch -p1 -f -s "${patch_options[@]}" < "${f}" + if ! eend ${?}; then + __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}" + failed=1 + fi + } + + local f patch_options=() failed started_applying options_terminated + for f; do + if [[ ${f} == -* && -z ${options_terminated} ]]; then + if [[ -n ${started_applying} ]]; then + die "eapply: options need to be specified before files" + fi + if [[ ${f} == -- ]]; then + options_terminated=1 + else + patch_options+=( ${f} ) + fi + elif [[ -d ${f} ]]; then + _eapply_get_files() { + local LC_ALL=POSIX + local prev_shopt=$(shopt -p nullglob) + shopt -s nullglob + files=( "${f}"/*.{patch,diff} ) + ${prev_shopt} + } + + local files + _eapply_get_files + [[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}" + + einfo "Applying patches from ${f} ..." + local f2 + for f2 in "${files[@]}"; do + _eapply_patch "${f2}" ' ' + + # in case of nonfatal + [[ -n ${failed} ]] && return 1 + done + else + _eapply_patch "${f}" + + # in case of nonfatal + [[ -n ${failed} ]] && return 1 + fi + done + + return 0 + } +fi + if ___eapi_has_master_repositories; then master_repositories() { local output repository=$1 retval