[pacman-dev] [PATCH 07/11] makepkg: less code repetition when sanitizing variable contents

Andres P aepd87 at gmail.com
Thu Jun 17 10:18:40 EDT 2010

On Thu, Jun 17, 2010 at 9:46 AM, Allan McRae <allan at archlinux.org> wrote:
> The new error message is much less descriptive;  "pkgname is not allowed to
> start with a hyphen" is very clear, while "'-foo' is an invalid value for
> pkgname" does not tell me what is wrong.
> Using the regex in the error message is just going to confuse the hell out
> of people too.  Reading an error message should not require you know
> regexes.
It is a two character regex; how are people expected to use makepkg and not
know what ^- means? Besides that, the message in place *isn't* a regex.

> And your quest to reduce code duplication can go to the point of being
> nonsensical.  e.g. in this patch:
>> +
>> +     local i
>> +     for i in 'pkgver' 'pkgrel'; do
>> +             var_lint '-' $i "${!i}" || return
>> +     done
> That would be two lines without the loop...
You're thinking in line count whereas code repetition is about duplicating

What if you add a new field, do you copy paste it or add it to the loop?

Quoting a slice of the patch when the vast majority of the changes are
happening elsewere isn't helping things either.

You missed a quote from that diff that's right on the top:
 1 files changed, 28 insertions(+), 42 deletions(-)

In other words, there's less lines, Allan.

Andres P

More information about the pacman-dev mailing list