[Ovirt-devel] [PATCH] Add trivial error() function and change code to use it

Jim Meyering jim at meyering.net
Mon Oct 6 13:39:20 UTC 2008


"Jeff Schroeder" <jeffschroed at gmail.com> wrote:
...
>>  ME=$(basename "$0")
>>  warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
>>  die() { warn "$@"; exit 1; }
>
> Uggg, you write perl in bourne shell! That looks hideous, but you are

Getting it right is its own reward ;-)
And when writing bourne shell code, you can't expect it to be pretty.

> completely right. Good catch. The split up repositories make this more
> difficult, but what do you think of putting obvious helper functions like
> this in a small utility library and sourcing it from the scripts? Is there any
> way we could share these among the various ovirt-* projects? Does
> git have a svn:externals equivalent?

We could put pieces in a git submodule, and use that from the two
affected modules.  But even then, so far, these shared pieces are so
small that it might be hard to justify adding Make rules to init/update
the submodule.  The three uses in node-image/ scripts could be pulled
out, at the expense of making the scripts dependent on being able to
source the factored-out definitions.

For now, I'm inclined to fix these, and just keep a tally.  If the amount
of duplication increases much more, then invest in some factorization
work.  But if you're motivated, go for it.




More information about the ovirt-devel mailing list