From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-842042-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id D1B6D13888F
	for <garchives@archives.gentoo.org>; Fri, 23 Oct 2015 17:31:02 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id DD592E087D;
	Fri, 23 Oct 2015 17:30:55 +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 A6995E0864
	for <gentoo-commits@lists.gentoo.org>; Fri, 23 Oct 2015 17:30:53 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 8272C340B34
	for <gentoo-commits@lists.gentoo.org>; Fri, 23 Oct 2015 17:30:52 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1443816A0
	for <gentoo-commits@lists.gentoo.org>; Fri, 23 Oct 2015 17:30:49 +0000 (UTC)
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" <ulm@gentoo.org>
Message-ID: <1445621138.5c0cf0b11573d0b2f333226975f9ad99d60367eb.ulm@gentoo>
Subject: [gentoo-commits] proj/pms:eapi-6 commit in: /
X-VCS-Repository: proj/pms
X-VCS-Files: pkg-mgr-commands.tex
X-VCS-Directories: /
X-VCS-Committer: ulm
X-VCS-Committer-Name: Ulrich Müller
X-VCS-Revision: 5c0cf0b11573d0b2f333226975f9ad99d60367eb
X-VCS-Branch: eapi-6
Date: Fri, 23 Oct 2015 17:30:49 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: c682743e-a236-4760-bc02-dcb6b6d4328f
X-Archives-Hash: 979281f02defe1161a471d975a62fd68

commit:     5c0cf0b11573d0b2f333226975f9ad99d60367eb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 14 16:44:02 2015 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Oct 23 17:25:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=5c0cf0b1

EAPI 6: Explain eapply behavior.

Bug: 463768

 pkg-mgr-commands.tex | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/pkg-mgr-commands.tex b/pkg-mgr-commands.tex
index 4d80684..df5289a 100644
--- a/pkg-mgr-commands.tex
+++ b/pkg-mgr-commands.tex
@@ -148,14 +148,47 @@ These commands are used during the \t{src\_prepare} phase to apply patches to th
 Ebuilds must not run any of these commands once the current phase function has returned.
 
 \begin{description}
-\item[eapply] \featurelabel{eapply}
+\item[eapply] \featurelabel{eapply} Takes zero or more GNU patch options, followed by one or more
+    file or directory paths. Processes options and applies all patches found in specified locations
+    according to Algorithm~\ref{alg:eapply}. If applying the patches fails, it aborts the build
+    using \t{die}, unless run using \t{nonfatal}, in which case it returns non-zero exit status.
     Only available in EAPIs listed in table~\ref{tab:patch-commands} as supporting \t{eapply}.
 \end{description}
 
 \begin{algorithm}
 \caption{\t{eapply} logic} \label{alg:eapply}
 \begin{algorithmic}[1]
-\STATE \COMMENT{WORK IN PROGRESS}
+\IF{any parameter is equal to \t{"-{}-"}}
+    \STATE collect all parameters before the first \t{"-{}-"} in the \t{options} array
+    \STATE collect all parameters after the first \t{"-{}-"} in the \t{files} array
+\ELSIF{any parameter that begins with a hyphen follows one that does not}
+    \STATE abort the build process with an error
+\ELSE
+    \STATE collect all parameters beginning with a hyphen in the \t{options} array
+    \STATE collect all remaining parameters in the \t{files} array
+\ENDIF
+\IF{the \t{files} array is empty}
+    \STATE abort the build process with an error
+\ENDIF
+\FORALL{\t{x} in the \t{files} array}
+    \IF{\t{\$x} is a directory}
+        \IF{\NOT any files match \t{\$x/*.diff} or \t{\$x/*.patch}}
+            \STATE abort the build process with an error
+        \ENDIF
+        \FORALL{files \t{f} matching \t{\$x/*.diff} or \t{\$x/*.patch}, sorted in POSIX locale}
+            \STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$f"}
+            \IF{child process returned with non-zero exit status}
+                \RETURN immediately with that status
+            \ENDIF
+        \ENDFOR
+    \ELSE
+        \STATE call \t{patch -p1 -f -g0 -{}-no-backup-if-mismatch "\$\{options[@]\}" < "\$x"}
+        \IF{child process returned with non-zero exit status}
+            \RETURN immediately with that status
+        \ENDIF
+    \ENDIF
+\ENDFOR
+\RETURN shell true (0)
 \end{algorithmic}
 \end{algorithm}