On Tue, 22 Jan 2019 at 00:45, Dave Reisner <d...@falconindy.com> wrote: > > On Mon, Jan 21, 2019 at 07:40:14PM -0500, Dave Reisner wrote: > > On Mon, Jan 21, 2019 at 11:59:30PM +0000, morganamilo wrote: > > > This helpers functions allows checking for the existence of a package > > > variable without worrying if it is an array or not. > > > > Seems reasonable, but where would this be used? Is this meant to > > consolidate existing cases of redundant code? Under what circumstances > > do we care about the variable existing without needing to know if it's > > an array or not? > > > > Ok, I see the followup patch where this is used. IMO, the patch using > this function for the first time ought to be also responsible for > defining it. > > > > Signed-off-by: morganamilo <morganam...@gmail.com> > > > --- > > > scripts/libmakepkg/util/pkgbuild.sh.in | 9 +++++++++ > > > 1 file changed, 9 insertions(+) > > > > > > diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in > > > b/scripts/libmakepkg/util/pkgbuild.sh.in > > > index b29229a3..f9fc440b 100644 > > > --- a/scripts/libmakepkg/util/pkgbuild.sh.in > > > +++ b/scripts/libmakepkg/util/pkgbuild.sh.in > > > @@ -98,6 +98,15 @@ extract_function_variable() { > > > return $r > > > } > > > > > > +exists_function_variable() { > > > + # $1: function name > > > + # $2: variable name > > > + > > > + local funcname=$1 attr=$2 out > > > + extract_function_variable "$funcname" "$attr" 0 out || \ > > > > The explicit line continuation isn't needed here -- || at the end of the > > line indicates a compound command that needs more tokens to be lexed > > before bash can complete the input. > > > > > + extract_function_variable "$funcname" "$attr" 1 out > > > +} > > > + > > > get_pkgbuild_attribute() { > > > # $1: package name > > > # $2: attribute name > > > -- > > > 2.20.1
Thanks for the tips. I'll remove the \ and squash it with the next patch once the set has been reviewed.