Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

build/parseBuildInstallClean.c

Go to the documentation of this file.
00001 
00005 #include "system.h"
00006 
00007 #include "rpmbuild.h"
00008 #include "debug.h"
00009 
00010 /*@access StringBuf @*/
00011 
00012 /*@-boundswrite@*/
00013 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00014 {
00015     int nextPart, rc;
00016     StringBuf *sbp = NULL;
00017     const char *name = NULL;
00018 
00019     /*@-branchstate@*/
00020     if (parsePart == PART_BUILD) {
00021         sbp = &(spec->build);
00022         name = "%build";
00023     } else if (parsePart == PART_INSTALL) {
00024         sbp = &(spec->install);
00025         name = "%install";
00026     } else if (parsePart == PART_CLEAN) {
00027         sbp = &(spec->clean);
00028         name = "%clean";
00029     }
00030     /*@=branchstate@*/
00031     
00032     if (*sbp != NULL) {
00033         rpmError(RPMERR_BADSPEC, _("line %d: second %s\n"),
00034                 spec->lineNum, name);
00035         return RPMERR_BADSPEC;
00036     }
00037     
00038     *sbp = newStringBuf();
00039 
00040     /* There are no options to %build, %install, or %clean */
00041     if ((rc = readLine(spec, STRIP_NOTHING)) > 0)
00042         return PART_NONE;
00043     if (rc)
00044         return rc;
00045     
00046     while (! (nextPart = isPart(spec->line))) {
00047         appendStringBuf(*sbp, spec->line);
00048         if ((rc = readLine(spec, STRIP_NOTHING)) > 0)
00049             return PART_NONE;
00050         if (rc)
00051             return rc;
00052     }
00053 
00054     return nextPart;
00055 }
00056 /*@=boundswrite@*/

Generated on Tue Sep 17 15:59:47 2002 for rpm by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002