Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] eapply: Ensure that files are sorted lexically
Date: Sat, 14 Nov 2015 18:51:10
Message-Id: 56478297.8080804@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] eapply: Ensure that files are sorted lexically by "Michał Górny"
1 On 11/14/2015 10:37 AM, Michał Górny wrote:
2 > Ensure that patch files are sorted lexically even when both *.diff
3 > and *.patch files co-exist within a single directory.
4 > ---
5 > bin/phase-helpers.sh | 11 ++++++++---
6 > 1 file changed, 8 insertions(+), 3 deletions(-)
7 >
8 > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
9 > index b79884f..1d3c976 100644
10 > --- a/bin/phase-helpers.sh
11 > +++ b/bin/phase-helpers.sh
12 > @@ -1043,12 +1043,17 @@ if ___eapi_has_eapply; then
13 > local LC_ALL=POSIX
14 > local prev_shopt=$(shopt -p nullglob)
15 > shopt -s nullglob
16 > - files=( "${f}"/*.{patch,diff} )
17 > + local f
18 > + for f in "${1}"/*; do
19 > + if [[ ${f} == *.diff || ${f} == *.patch ]]; then
20
21 Maybe use [[ ${f} =~ \.(diff|patch)$ ]] instead? Either one is fine, I
22 suppose.
23
24 > + files+=( "${f}" )
25 > + fi
26 > + done
27 > ${prev_shopt}
28 > }
29 >
30 > - local files
31 > - _eapply_get_files
32 > + local files=()
33 > + _eapply_get_files "${f}"
34 > [[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}"
35 >
36 > einfo "Applying patches from ${f} ..."
37 >
38
39 Looks good.
40 --
41 Thanks,
42 Zac

Replies