Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > by-pkgid > 2269bb274471fd2722517c2c0b740d7f > files > 196

rpm-devel-4.0.4-19mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>build/parseScript.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.17 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; </center>
<hr><h1>build/parseScript.c</h1><a href="parseScript_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00006 <span class="preprocessor">#include "<a class="code" href="system_8h.html">system.h</a>"</span>
00007 
00008 <span class="preprocessor">#include "<a class="code" href="rpmbuild_8h.html">rpmbuild.h</a>"</span>
00009 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>
00010 
00011 <span class="comment">/*@access StringBuf@*/</span>  <span class="comment">/* XXX compared with NULL */</span>
00012 <span class="comment">/*@access poptContext @*/</span>       <span class="comment">/* compared with NULL */</span>
00013 
<a name="l00016"></a><a class="code" href="parseScript_8c.html#a4">00016</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="parseScript_8c.html#a4">addTriggerIndex</a>(<a class="code" href="structPackageStruct.html">Package</a> pkg, <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="parseScript_8c.html#a2">file</a>,
00017         <span class="keyword">const</span> <span class="keywordtype">char</span> *script, <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="parseScript_8c.html#a1">prog</a>)
00018         <span class="comment">/*@modifies pkg-&gt;triggerFiles @*/</span>
00019 {
00020     <span class="keyword">struct </span><a class="code" href="structTriggerFileEntry.html">TriggerFileEntry</a> *tfe;
00021     <span class="keyword">struct </span><a class="code" href="structTriggerFileEntry.html">TriggerFileEntry</a> *list = pkg-&gt;<a class="code" href="structPackageStruct.html#m11">triggerFiles</a>;
00022     <span class="keyword">struct </span><a class="code" href="structTriggerFileEntry.html">TriggerFileEntry</a> *last = NULL;
00023     <span class="keywordtype">int</span> index = 0;
00024 
00025     <span class="keywordflow">while</span> (list) {
00026         last = list;
00027         list = list-&gt;<a class="code" href="structTriggerFileEntry.html#m4">next</a>;
00028     }
00029 
00030     <span class="keywordflow">if</span> (last)
00031         index = last-&gt;<a class="code" href="structTriggerFileEntry.html#m0">index</a> + 1;
00032 
00033     tfe = <a class="code" href="rpmmalloc_8c.html#a2">xcalloc</a>(1, <span class="keyword">sizeof</span>(*tfe));
00034 
00035     tfe-&gt;<a class="code" href="structTriggerFileEntry.html#m1">fileName</a> = (file) ? <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a2">file</a>) : NULL;
00036     tfe-&gt;<a class="code" href="structTriggerFileEntry.html#m2">script</a> = (script &amp;&amp; *script != <span class="charliteral">'\0'</span>) ? <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(script) : NULL;
00037     tfe-&gt;<a class="code" href="structTriggerFileEntry.html#m3">prog</a> = <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a1">prog</a>);
00038     tfe-&gt;<a class="code" href="structTriggerFileEntry.html#m0">index</a> = index;
00039     tfe-&gt;<a class="code" href="structTriggerFileEntry.html#m4">next</a> = NULL;
00040 
00041     <span class="keywordflow">if</span> (last)
00042         last-&gt;<a class="code" href="structTriggerFileEntry.html#m4">next</a> = tfe;
00043     <span class="keywordflow">else</span>
00044         pkg-&gt;<a class="code" href="structPackageStruct.html#m11">triggerFiles</a> = tfe;
00045 
00046     <span class="keywordflow">return</span> index;
00047 }
00048 
00049 <span class="comment">/* these have to be global because of stupid compilers */</span>
00050 <span class="comment">/*@unchecked@*/</span>
<a name="l00051"></a><a class="code" href="parseScript_8c.html#a0">00051</a>     <span class="comment">/*@observer@*/</span> <span class="comment">/*@null@*/</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="parseScript_8c.html#a0">name</a> = NULL;
00052 <span class="comment">/*@unchecked@*/</span>
<a name="l00053"></a><a class="code" href="parseScript_8c.html#a1">00053</a>     <span class="comment">/*@observer@*/</span> <span class="comment">/*@null@*/</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="parseScript_8c.html#a1">prog</a> = NULL;
00054 <span class="comment">/*@unchecked@*/</span>
<a name="l00055"></a><a class="code" href="parseScript_8c.html#a2">00055</a>     <span class="comment">/*@observer@*/</span> <span class="comment">/*@null@*/</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="parseScript_8c.html#a2">file</a> = NULL;
00056 <span class="comment">/*@unchecked@*/</span>
<a name="l00057"></a><a class="code" href="parseScript_8c.html#a3">00057</a>     <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="structpoptOption.html">poptOption</a> optionsTable[] = {
00058         { NULL, <span class="charliteral">'p'</span>, <a class="code" href="group__popt.html#a34">POPT_ARG_STRING</a>, &amp;<a class="code" href="parseScript_8c.html#a1">prog</a>, <span class="charliteral">'p'</span>,       NULL, NULL},
00059         { NULL, <span class="charliteral">'n'</span>, <a class="code" href="group__popt.html#a34">POPT_ARG_STRING</a>, &amp;<a class="code" href="parseScript_8c.html#a0">name</a>, <span class="charliteral">'n'</span>,       NULL, NULL},
00060         { NULL, <span class="charliteral">'f'</span>, <a class="code" href="group__popt.html#a34">POPT_ARG_STRING</a>, &amp;<a class="code" href="parseScript_8c.html#a2">file</a>, <span class="charliteral">'f'</span>,       NULL, NULL},
00061         { 0, 0, 0, 0, 0,        NULL, NULL}
00062     };
00063 
00064 <span class="comment">/* %trigger is a strange combination of %pre and Requires: behavior */</span>
00065 <span class="comment">/* We can handle it by parsing the args before "--" in parseScript. */</span>
00066 <span class="comment">/* We then pass the remaining arguments to parseRCPOT, along with   */</span>
00067 <span class="comment">/* an index we just determined.                                     */</span>
00068 
<a name="l00069"></a><a class="code" href="group__rpmbuild.html#a34">00069</a> <span class="keywordtype">int</span> <a class="code" href="group__rpmbuild.html#a34">parseScript</a>(<a class="code" href="structSpecStruct.html">Spec</a> spec, <span class="keywordtype">int</span> parsePart)
00070 {
00071     <span class="comment">/* There are a few options to scripts: */</span>
00072     <span class="comment">/*  &lt;pkg&gt;                              */</span>
00073     <span class="comment">/*  -n &lt;pkg&gt;                           */</span>
00074     <span class="comment">/*  -p &lt;sh&gt;                            */</span>
00075     <span class="comment">/*  -p "&lt;sh&gt; &lt;args&gt;..."                */</span>
00076     <span class="comment">/*  -f &lt;file&gt;                          */</span>
00077 
00078     <span class="keywordtype">char</span> *p;
00079     <span class="keyword">const</span> <span class="keywordtype">char</span> **progArgv = NULL;
00080     <span class="keywordtype">int</span> progArgc;
00081     <span class="keywordtype">char</span> *partname = NULL;
00082     <span class="keywordtype">int</span> reqtag = 0;
00083     <span class="keywordtype">int</span> tag = 0;
00084     <span class="keywordtype">int</span> tagflags = 0;
00085     <span class="keywordtype">int</span> progtag = 0;
00086     <span class="keywordtype">int</span> flag = <a class="code" href="rpmbuild_8h.html#a2">PART_SUBNAME</a>;
00087     <a class="code" href="structPackageStruct.html">Package</a> pkg;
00088     <a class="code" href="structStringBufRec.html">StringBuf</a> sb = NULL;
00089     <span class="keywordtype">int</span> nextPart;
00090     <span class="keywordtype">int</span> index;
00091     <span class="keywordtype">char</span> reqargs[BUFSIZ];
00092 
00093     <span class="keywordtype">int</span> rc, argc;
00094     <span class="keywordtype">int</span> arg;
00095     <span class="keyword">const</span> <span class="keywordtype">char</span> **argv = NULL;
00096     <a class="code" href="structpoptContext__s.html">poptContext</a> optCon = NULL;
00097     
00098     reqargs[0] = <span class="charliteral">'\0'</span>;
00099     <span class="comment">/*@-mods@*/</span>
00100     <a class="code" href="parseScript_8c.html#a0">name</a> = NULL;
00101     <a class="code" href="parseScript_8c.html#a1">prog</a> = <span class="stringliteral">"/bin/sh"</span>;
00102     <a class="code" href="parseScript_8c.html#a2">file</a> = NULL;
00103     <span class="comment">/*@=mods@*/</span>
00104     
00105     <span class="comment">/*@-branchstate@*/</span>
00106     <span class="keywordflow">switch</span> (parsePart) {
00107       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a29">PART_PRE</a>:
00108         tag = <a class="code" href="rpmlib_8h.html#a494a136">RPMTAG_PREIN</a>;
00109         tagflags = <a class="code" href="rpmlib_8h.html#a497a263">RPMSENSE_SCRIPT_PRE</a>;
00110         progtag = <a class="code" href="rpmlib_8h.html#a494a189">RPMTAG_PREINPROG</a>;
00111         partname = <span class="stringliteral">"%pre"</span>;
00112         <span class="keywordflow">break</span>;
00113       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a30">PART_POST</a>:
00114         tag = <a class="code" href="rpmlib_8h.html#a494a137">RPMTAG_POSTIN</a>;
00115         tagflags = <a class="code" href="rpmlib_8h.html#a497a264">RPMSENSE_SCRIPT_POST</a>;
00116         progtag = <a class="code" href="rpmlib_8h.html#a494a190">RPMTAG_POSTINPROG</a>;
00117         partname = <span class="stringliteral">"%post"</span>;
00118         <span class="keywordflow">break</span>;
00119       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a31">PART_PREUN</a>:
00120         tag = <a class="code" href="rpmlib_8h.html#a494a138">RPMTAG_PREUN</a>;
00121         tagflags = <a class="code" href="rpmlib_8h.html#a497a265">RPMSENSE_SCRIPT_PREUN</a>;
00122         progtag = <a class="code" href="rpmlib_8h.html#a494a191">RPMTAG_PREUNPROG</a>;
00123         partname = <span class="stringliteral">"%preun"</span>;
00124         <span class="keywordflow">break</span>;
00125       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a32">PART_POSTUN</a>:
00126         tag = <a class="code" href="rpmlib_8h.html#a494a139">RPMTAG_POSTUN</a>;
00127         tagflags = <a class="code" href="rpmlib_8h.html#a497a266">RPMSENSE_SCRIPT_POSTUN</a>;
00128         progtag = <a class="code" href="rpmlib_8h.html#a494a192">RPMTAG_POSTUNPROG</a>;
00129         partname = <span class="stringliteral">"%postun"</span>;
00130         <span class="keywordflow">break</span>;
00131       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a37">PART_VERIFYSCRIPT</a>:
00132         tag = <a class="code" href="rpmlib_8h.html#a494a183">RPMTAG_VERIFYSCRIPT</a>;
00133         tagflags = <a class="code" href="rpmlib_8h.html#a497a267">RPMSENSE_SCRIPT_VERIFY</a>;
00134         progtag = <a class="code" href="rpmlib_8h.html#a494a195">RPMTAG_VERIFYSCRIPTPROG</a>;
00135         partname = <span class="stringliteral">"%verifyscript"</span>;
00136         <span class="keywordflow">break</span>;
00137       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a35">PART_TRIGGERIN</a>:
00138         tag = <a class="code" href="rpmlib_8h.html#a494a178">RPMTAG_TRIGGERSCRIPTS</a>;
00139         tagflags = 0;
00140         reqtag = <a class="code" href="rpmlib_8h.html#a494a204">RPMTAG_TRIGGERIN</a>;
00141         progtag = <a class="code" href="rpmlib_8h.html#a494a196">RPMTAG_TRIGGERSCRIPTPROG</a>;
00142         partname = <span class="stringliteral">"%triggerin"</span>;
00143         <span class="keywordflow">break</span>;
00144       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a36">PART_TRIGGERUN</a>:
00145         tag = <a class="code" href="rpmlib_8h.html#a494a178">RPMTAG_TRIGGERSCRIPTS</a>;
00146         tagflags = 0;
00147         reqtag = <a class="code" href="rpmlib_8h.html#a494a205">RPMTAG_TRIGGERUN</a>;
00148         progtag = <a class="code" href="rpmlib_8h.html#a494a196">RPMTAG_TRIGGERSCRIPTPROG</a>;
00149         partname = <span class="stringliteral">"%triggerun"</span>;
00150         <span class="keywordflow">break</span>;
00151       <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a39">PART_TRIGGERPOSTUN</a>:
00152         tag = <a class="code" href="rpmlib_8h.html#a494a178">RPMTAG_TRIGGERSCRIPTS</a>;
00153         tagflags = 0;
00154         reqtag = <a class="code" href="rpmlib_8h.html#a494a206">RPMTAG_TRIGGERPOSTUN</a>;
00155         progtag = <a class="code" href="rpmlib_8h.html#a494a196">RPMTAG_TRIGGERSCRIPTPROG</a>;
00156         partname = <span class="stringliteral">"%triggerpostun"</span>;
00157         <span class="keywordflow">break</span>;
00158     }
00159     <span class="comment">/*@=branchstate@*/</span>
00160 
00161     <span class="keywordflow">if</span> (tag == <a class="code" href="rpmlib_8h.html#a494a178">RPMTAG_TRIGGERSCRIPTS</a>) {
00162         <span class="comment">/* break line into two */</span>
00163         p = strstr(spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>, <span class="stringliteral">"--"</span>);
00164         <span class="keywordflow">if</span> (!p) {
00165             <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: triggers must have --: %s\n"</span>),
00166                      spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>, spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>);
00167             <span class="keywordflow">return</span> <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00168         }
00169 
00170         *p = <span class="charliteral">'\0'</span>;
00171         strcpy(reqargs, p + 2);
00172     }
00173     
00174     <span class="keywordflow">if</span> ((rc = <a class="code" href="group__popt.html#a2">poptParseArgvString</a>(spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>, &amp;argc, &amp;argv))) {
00175         <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: Error parsing %s: %s\n"</span>),
00176                  spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>, partname, poptStrerror(rc));
00177         <span class="keywordflow">return</span> <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00178     }
00179     
00180     optCon = <a class="code" href="group__popt.html#a5">poptGetContext</a>(NULL, argc, argv, optionsTable, 0);
00181     <span class="keywordflow">while</span> ((arg = <a class="code" href="group__popt.html#a7">poptGetNextOpt</a>(optCon)) &gt; 0) {
00182         <span class="keywordflow">switch</span> (arg) {
00183         <span class="keywordflow">case</span> <span class="charliteral">'p'</span>:
00184             <span class="keywordflow">if</span> (<a class="code" href="parseScript_8c.html#a1">prog</a>[0] != <span class="charliteral">'/'</span>) {
00185                 <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>,
00186                          <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: script program must begin "</span>
00187                          <span class="stringliteral">"with \'/\': %s\n"</span>), spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>, <a class="code" href="parseScript_8c.html#a1">prog</a>);
00188                 rc = <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00189                 <span class="keywordflow">goto</span> exit;
00190             }
00191             <span class="comment">/*@switchbreak@*/</span> <span class="keywordflow">break</span>;
00192         <span class="keywordflow">case</span> <span class="charliteral">'n'</span>:
00193             flag = <a class="code" href="rpmbuild_8h.html#a3">PART_NAME</a>;
00194             <span class="comment">/*@switchbreak@*/</span> <span class="keywordflow">break</span>;
00195         }
00196     }
00197     
00198     <span class="keywordflow">if</span> (arg &lt; -1) {
00199         <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: Bad option %s: %s\n"</span>),
00200                  spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>,
00201                  poptBadOption(optCon, <a class="code" href="group__popt.html#a32">POPT_BADOPTION_NOALIAS</a>), 
00202                  spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>);
00203         rc = <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00204         <span class="keywordflow">goto</span> exit;
00205     }
00206 
00207     <span class="keywordflow">if</span> (<a class="code" href="group__popt.html#a10">poptPeekArg</a>(optCon)) {
00208         <span class="comment">/*@-mods@*/</span>
00209         <span class="keywordflow">if</span> (<a class="code" href="parseScript_8c.html#a0">name</a> == NULL)
00210             <a class="code" href="parseScript_8c.html#a0">name</a> = <a class="code" href="group__popt.html#a9">poptGetArg</a>(optCon);
00211         <span class="comment">/*@=mods@*/</span>
00212         <span class="keywordflow">if</span> (<a class="code" href="group__popt.html#a10">poptPeekArg</a>(optCon)) {
00213             <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: Too many names: %s\n"</span>),
00214                      spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>,
00215                      spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>);
00216             rc = <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00217             <span class="keywordflow">goto</span> exit;
00218         }
00219     }
00220     
00221     <span class="keywordflow">if</span> (<a class="code" href="group__rpmbuild.html#a8">lookupPackage</a>(spec, <a class="code" href="parseScript_8c.html#a0">name</a>, flag, &amp;pkg)) {
00222         <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: Package does not exist: %s\n"</span>),
00223                  spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>, spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>);
00224         rc = <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00225         <span class="keywordflow">goto</span> exit;
00226     }
00227 
00228     <span class="keywordflow">if</span> (tag != <a class="code" href="rpmlib_8h.html#a494a178">RPMTAG_TRIGGERSCRIPTS</a>) {
00229         <span class="keywordflow">if</span> (<a class="code" href="group__header.html#a34">headerIsEntry</a>(pkg-&gt;<a class="code" href="structPackageStruct.html#m0">header</a>, progtag)) {
00230             <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: Second %s\n"</span>),
00231                      spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>, partname);
00232             rc = <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00233             <span class="keywordflow">goto</span> exit;
00234         }
00235     }
00236 
00237     <span class="keywordflow">if</span> ((rc = <a class="code" href="group__popt.html#a2">poptParseArgvString</a>(<a class="code" href="parseScript_8c.html#a1">prog</a>, &amp;progArgc, &amp;progArgv))) {
00238         <a class="code" href="rpmerr_8h.html#a5">rpmError</a>(<a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>, <a class="code" href="system_8h.html#a18">_</a>(<span class="stringliteral">"line %d: Error parsing %s: %s\n"</span>),
00239                  spec-&gt;<a class="code" href="structSpecStruct.html#m12">lineNum</a>, partname, poptStrerror(rc));
00240         rc = <a class="code" href="rpmerr_8h.html#a91a60">RPMERR_BADSPEC</a>;
00241         <span class="keywordflow">goto</span> exit;
00242     }
00243 
00244     sb = <a class="code" href="stringbuf_8c.html#a3">newStringBuf</a>();
00245     <span class="keywordflow">if</span> ((rc = <a class="code" href="group__rpmbuild.html#a21">readLine</a>(spec, <a class="code" href="rpmbuild_8h.html#a4">STRIP_NOTHING</a>)) &gt; 0) {
00246         nextPart = <a class="code" href="group__rpmbuild.html#a57a22">PART_NONE</a>;
00247     } <span class="keywordflow">else</span> {
00248         <span class="keywordflow">if</span> (rc)
00249             <span class="keywordflow">goto</span> exit;
00250         <span class="keywordflow">while</span> (! (nextPart = <a class="code" href="group__rpmbuild.html#a24">isPart</a>(spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>))) {
00251             <a class="code" href="stringbuf_8h.html#a0">appendStringBuf</a>(sb, spec-&gt;<a class="code" href="structSpecStruct.html#m11">line</a>);
00252             <span class="keywordflow">if</span> ((rc = <a class="code" href="group__rpmbuild.html#a21">readLine</a>(spec, <a class="code" href="rpmbuild_8h.html#a4">STRIP_NOTHING</a>)) &gt; 0) {
00253                 nextPart = <a class="code" href="group__rpmbuild.html#a57a22">PART_NONE</a>;
00254                 <span class="keywordflow">break</span>;
00255             }
00256             <span class="keywordflow">if</span> (rc)
00257                 <span class="keywordflow">goto</span> exit;
00258         }
00259     }
00260     <a class="code" href="stringbuf_8c.html#a6">stripTrailingBlanksStringBuf</a>(sb);
00261     p = <a class="code" href="stringbuf_8c.html#a7">getStringBuf</a>(sb);
00262 
00263     (void) <a class="code" href="group__rpmbuild.html#a42">addReqProv</a>(spec, pkg-&gt;<a class="code" href="structPackageStruct.html#m0">header</a>, (tagflags | <a class="code" href="rpmlib_8h.html#a497a262">RPMSENSE_INTERP</a>), progArgv[0], NULL, 0);
00264 
00265     <span class="comment">/* Trigger script insertion is always delayed in order to */</span>
00266     <span class="comment">/* get the index right.                                   */</span>
00267     <span class="keywordflow">if</span> (tag == <a class="code" href="rpmlib_8h.html#a494a178">RPMTAG_TRIGGERSCRIPTS</a>) {
00268         <span class="comment">/* Add file/index/prog triple to the trigger file list */</span>
00269         index = <a class="code" href="parseScript_8c.html#a4">addTriggerIndex</a>(pkg, <a class="code" href="parseScript_8c.html#a2">file</a>, p, progArgv[0]);
00270 
00271         <span class="comment">/* Generate the trigger tags */</span>
00272         <span class="keywordflow">if</span> ((rc = <a class="code" href="group__rpmbuild.html#a33">parseRCPOT</a>(spec, pkg, reqargs, reqtag, index, tagflags)))
00273             <span class="keywordflow">goto</span> exit;
00274     } <span class="keywordflow">else</span> {
00275         <span class="keywordflow">if</span> (progArgc == 1)
00276             (void) <a class="code" href="group__header.html#a45">headerAddEntry</a>(pkg-&gt;<a class="code" href="structPackageStruct.html#m0">header</a>, progtag, <a class="code" href="group__header.html#a93a71">RPM_STRING_TYPE</a>,
00277                         *progArgv, progArgc);
00278         <span class="keywordflow">else</span> {
00279             (void) <a class="code" href="group__rpmbuild.html#a43">rpmlibNeedsFeature</a>(pkg-&gt;<a class="code" href="structPackageStruct.html#m0">header</a>,
00280                         <span class="stringliteral">"ScriptletInterpreterArgs"</span>, <span class="stringliteral">"4.0.3-1"</span>);
00281             (void) <a class="code" href="group__header.html#a45">headerAddEntry</a>(pkg-&gt;<a class="code" href="structPackageStruct.html#m0">header</a>, progtag, <a class="code" href="group__header.html#a93a73">RPM_STRING_ARRAY_TYPE</a>,
00282                         progArgv, progArgc);
00283         }
00284 
00285         <span class="keywordflow">if</span> (*p != <span class="charliteral">'\0'</span>)
00286             (void) <a class="code" href="group__header.html#a45">headerAddEntry</a>(pkg-&gt;<a class="code" href="structPackageStruct.html#m0">header</a>, tag, <a class="code" href="group__header.html#a93a71">RPM_STRING_TYPE</a>, p, 1);
00287 
00288         <span class="keywordflow">if</span> (file) {
00289             <span class="keywordflow">switch</span> (parsePart) {
00290               <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a29">PART_PRE</a>:
00291                 pkg-&gt;<a class="code" href="structPackageStruct.html#m5">preInFile</a> = <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a2">file</a>);
00292                 <span class="keywordflow">break</span>;
00293               <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a30">PART_POST</a>:
00294                 pkg-&gt;<a class="code" href="structPackageStruct.html#m6">postInFile</a> = <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a2">file</a>);
00295                 <span class="keywordflow">break</span>;
00296               <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a31">PART_PREUN</a>:
00297                 pkg-&gt;<a class="code" href="structPackageStruct.html#m7">preUnFile</a> = <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a2">file</a>);
00298                 <span class="keywordflow">break</span>;
00299               <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a32">PART_POSTUN</a>:
00300                 pkg-&gt;<a class="code" href="structPackageStruct.html#m8">postUnFile</a> = <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a2">file</a>);
00301                 <span class="keywordflow">break</span>;
00302               <span class="keywordflow">case</span> <a class="code" href="group__rpmbuild.html#a57a37">PART_VERIFYSCRIPT</a>:
00303                 pkg-&gt;<a class="code" href="structPackageStruct.html#m9">verifyFile</a> = <a class="code" href="rpmmalloc_8c.html#a4">xstrdup</a>(<a class="code" href="parseScript_8c.html#a2">file</a>);
00304                 <span class="keywordflow">break</span>;
00305             }
00306         }
00307     }
00308     rc = nextPart;
00309     
00310 exit:
00311     sb = <a class="code" href="stringbuf_8c.html#a4">freeStringBuf</a>(sb);
00312     progArgv = <a class="code" href="poptint_8h.html#a14">_free</a>(progArgv);
00313     argv = <a class="code" href="poptint_8h.html#a14">_free</a>(argv);
00314     optCon = <a class="code" href="group__popt.html#a13">poptFreeContext</a>(optCon);
00315     
00316     <span class="keywordflow">return</span> rc;
00317 }
</pre></div><hr><address style="align: right;"><small>Generated on Thu Sep 12 22:14:55 2002 for rpm by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.17 </small></address>
</body>
</html>