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