diff options
author | ewt <devnull@localhost> | 1998-03-04 16:51:06 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1998-03-04 16:51:06 +0000 |
commit | d29004dc6918935f3a6916e59f373874a5f6ab85 (patch) | |
tree | d5faec19f0fc89fc5c33871f000516e2524b88d4 /build/parsePrep.c | |
parent | 25231c427210c21570097a10f4782850a02246ff (diff) | |
download | librpm-tizen-d29004dc6918935f3a6916e59f373874a5f6ab85.tar.gz librpm-tizen-d29004dc6918935f3a6916e59f373874a5f6ab85.tar.bz2 librpm-tizen-d29004dc6918935f3a6916e59f373874a5f6ab85.zip |
1) include cleanups for portability
2) pulled popt structures and variables out of functions -- they need to
be global due to stupid compilers
3) modified the Makefile to use relative dependencies, and make dependencies
optional
CVS patchset: 2020
CVS date: 1998/03/04 16:51:06
Diffstat (limited to 'build/parsePrep.c')
-rw-r--r-- | build/parsePrep.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c index 12a403d14..ba9a26aba 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -2,7 +2,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <string.h> -#include <malloc.h> +#include <stdlib.h> #include <errno.h> #include "spec.h" @@ -15,6 +15,21 @@ #include "misc.h" #include "config.h" +/* These have to be global to make up for stupid compilers */ + static int leaveDirs, skipDefaultAction; + static int createDir, quietly; + static char * dirName; + static struct poptOption optionsTable[] = { + { NULL, 'a', POPT_ARG_STRING, NULL, 'a' }, + { NULL, 'b', POPT_ARG_STRING, NULL, 'b' }, + { NULL, 'c', 0, &createDir, 0 }, + { NULL, 'D', 0, &leaveDirs, 0 }, + { NULL, 'n', POPT_ARG_STRING, &dirName, 0 }, + { NULL, 'T', 0, &skipDefaultAction, 0 }, + { NULL, 'q', 0, &quietly, 0 }, + { 0, 0, 0, 0, 0 } + }; + static int doSetupMacro(Spec spec, char *line); static int doPatchMacro(Spec spec, char *line); static char *doPatch(Spec spec, int c, int strip, char *db, @@ -82,9 +97,6 @@ int parsePrep(Spec spec) static int doSetupMacro(Spec spec, char *line) { char *version, *name; - int leaveDirs = 0, skipDefaultAction = 0; - int createDir = 0, quietly = 0; - char * dirName = NULL; char buf[BUFSIZ]; StringBuf before; StringBuf after; @@ -96,16 +108,10 @@ static int doSetupMacro(Spec spec, char *line) char * chptr; int rc; int num; - struct poptOption optionsTable[] = { - { NULL, 'a', POPT_ARG_STRING, NULL, 'a' }, - { NULL, 'b', POPT_ARG_STRING, NULL, 'b' }, - { NULL, 'c', 0, &createDir, 0 }, - { NULL, 'D', 0, &leaveDirs, 0 }, - { NULL, 'n', POPT_ARG_STRING, &dirName, 0 }, - { NULL, 'T', 0, &skipDefaultAction, 0 }, - { NULL, 'q', 0, &quietly, 0 }, - { 0, 0, 0, 0, 0 } - }; + + leaveDirs = skipDefaultAction = 0; + createDir = quietly = 0; + dirName = NULL; if ((rc = poptParseArgvString(line, &argc, &argv))) { rpmError(RPMERR_BADSPEC, "Error parsing %%setup: %s", @@ -181,7 +187,7 @@ static int doSetupMacro(Spec spec, char *line) /* if necessary, create and cd into the proper dir */ if (createDir) { - sprintf(buf, "mkdir -p %s\ncd %s", + sprintf(buf, MKDIR_P " %s\ncd %s", spec->buildSubdir, spec->buildSubdir); appendLineStringBuf(spec->prep, buf); } @@ -217,7 +223,7 @@ static int doSetupMacro(Spec spec, char *line) /* clean up permissions etc */ if (!geteuid()) { appendLineStringBuf(spec->prep, "chown -R root ."); - appendLineStringBuf(spec->prep, "chgrp -R root ."); + appendLineStringBuf(spec->prep, "chgrp -R " ROOT_GROUP " ."); } if (rpmGetVar(RPMVAR_FIXPERMS)) { |