%useradd

Elan Ruusamäe glen at delfi.ee
Mon Apr 11 17:12:39 CEST 2005


hi

i've implemented the %useradd and %groupadd macros and commited to cvs
(AC-branch and HEAD). they work all fine, but

i wanted to stop whole build process if there's misuse of those macros,
ie missing parameter or argument.

currently the %{error:msg} code really does output error in build process. but
despite that, it also does produce the rpm.

there's patch which makes %{error} macro exit when macro output is returned.
but perhaps all this is unneccesary. ie output from builder perhaps outputs
all lines with "error:" to mail, and considers matches of such lines a sign of
build failure? but if it doesn't perhaps make it so.

or perhaps it is just too much, and just "error: " is sufficent, (with also
returning "exit 1" in %pre macro)

as i understood from jbj at freenode#rpm that this patch isn't much welcome

[15:41:28] < jbj> without this patch, you will not succeed.
[15:41:31] < jbj> Index: rpmio/macro.c
[15:41:31] < jbj> ===================================================================
[15:41:31] < jbj> RCS file: /cvs/devel/rpm/rpmio/macro.c,v
[15:41:31] < jbj> retrieving revision 2.112.2.2
[15:41:31] < jbj> diff -u -b -B -w -p -r2.112.2.2 macro.c
[15:41:32] < jbj> --- rpmio/macro.c       25 Jan 2005 05:24:50 -0000      2.112.2.2
[15:41:34] < jbj> +++ rpmio/macro.c       11 Apr 2005 12:40:52 -0000
[15:41:36] < jbj> @@ -1082,8 +1082,10 @@ doOutput(MacroBuf mb, int waserror, cons
[15:41:38] < jbj>      strncpy(buf, msg, msglen);
[15:41:40] < jbj>      buf[msglen] = '\0';
[15:41:42] < jbj>      (void) expandU(mb, buf, sizeof(buf));
[15:41:44] < jbj> -    if (waserror)
[15:41:48] < jbj> +    if (waserror) {
[15:41:50] < jbj>         rpmError(RPMERR_BADSPEC, "%s\n", buf);
[15:41:52] < jbj> +       exit(1);
[15:41:54] < jbj> +    }
[15:41:56] < jbj>      else
[15:41:58] < jbj>         fprintf(stderr, "%s", buf);
[15:42:01] < jbj>  }
[15:42:02] < jbj> and that patch is noplace except my file system. try a different approach.


-- 
glen




More information about the pld-devel-en mailing list