rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

poptBT.c
Go to the documentation of this file.
1
6 #include "system.h"
7
8 #include <rpmio.h>
9 #include <rpmiotypes.h>
10 #include <rpmlog.h>
11
12 #include <rpmtypes.h>
13 #include <rpmtag.h>
14
15 #include <rpmbuild.h>
16
17 #include "build.h"
18
19 #include <rpmcli.h>
20
21 #include "debug.h"
22
23 /*@unchecked@*/
24 struct rpmBuildArguments_s rpmBTArgs;
25
26 #define POPT_USECATALOG -1011
27 #define POPT_NOLANG -1012
28 #define POPT_RMSOURCE -1013
29 #define POPT_RMBUILD -1014
30 /* XXX was POPT_BUILDROOT -1015 */
31
32 #define POPT_NOBUILD -1017
33 #define POPT_SHORTCIRCUIT -1018
34 #define POPT_RMSPEC -1019
35 #define POPT_SIGN -1020
36
37 #define POPT_REBUILD 0x4220
38 #define POPT_RECOMPILE 0x4320
39 #define POPT_BA 0x6261
40 #define POPT_BB 0x6262
41 #define POPT_BC 0x6263
42 #define POPT_BI 0x6269
43 #define POPT_BL 0x626c
44 #define POPT_BP 0x6270
45 #define POPT_BS 0x6273
46 #define POPT_BT 0x6274 /* support "%track" script/section */
47 #define POPT_BF 0x6266
48 #define POPT_TA 0x7461
49 #define POPT_TB 0x7462
50 #define POPT_TC 0x7463
51 #define POPT_TI 0x7469
52 #define POPT_TL 0x746c
53 #define POPT_TP 0x7470
54 #define POPT_TS 0x7473
55
56 /*@unchecked@*/
57 int _rpmbuildFlags = 3;
58
59 /*@-exportlocal@*/
60 /*@unchecked@*/
61 int noLang = 0;
62 /*@=exportlocal@*/
63
64 /*@unchecked@*/
65 static int signIt = 0;
66
67 /*@unchecked@*/
68 static int useCatalog = 0;
69
72 static void buildArgCallback( /*@unused@*/ poptContext con,
73 /*@unused@*/ enum poptCallbackReason reason,
74 const struct poptOption * opt,
75 /*@unused@*/ const char * arg,
76 /*@unused@*/ const void * data)
77 {
78 BTA_t rba = &rpmBTArgs;
79
80 switch (opt->val) {
81 case POPT_REBUILD:
82 case POPT_RECOMPILE:
83 case POPT_BA:
84 case POPT_BB:
85 case POPT_BC:
86 case POPT_BI:
87 case POPT_BL:
88 case POPT_BP:
89 case POPT_BS:
90 case POPT_BT: /* support "%track" script/section */
91 case POPT_BF:
92 case POPT_TA:
93 case POPT_TB:
94 case POPT_TC:
95 case POPT_TI:
96 case POPT_TL:
97 case POPT_TP:
98 case POPT_TS:
99 if (rba->buildMode == '\0' && rba->buildChar == '\0') {
100 rba->buildMode = (char)((((unsigned int)opt->val) >> 8) & 0xff);
101 rba->buildChar = (char)(opt->val & 0xff);
102 }
103 break;
104
105 case POPT_NOBUILD: rba->noBuild = 1; break;
106 case POPT_NOLANG: rba->noLang = 1; break;
107 case POPT_SHORTCIRCUIT: rba->shortCircuit = 1; break;
108 case POPT_SIGN: rba->sign = 1; break;
109 case POPT_USECATALOG: rba->useCatalog = 1; break;
110 case POPT_RMSOURCE: rba->buildAmount |= RPMBUILD_RMSOURCE; break;
111 case POPT_RMSPEC: rba->buildAmount |= RPMBUILD_RMSPEC; break;
112 case POPT_RMBUILD: rba->buildAmount |= RPMBUILD_RMBUILD; break;
113
114 case RPMCLI_POPT_NODIGEST:
115 rba->qva_flags |= VERIFY_DIGEST;
116 break;
117
118 case RPMCLI_POPT_NOSIGNATURE:
119 rba->qva_flags |= VERIFY_SIGNATURE;
120 break;
121
122 case RPMCLI_POPT_NOHDRCHK:
123 rba->qva_flags |= VERIFY_HDRCHK;
124 break;
125
126 case RPMCLI_POPT_NODEPS:
127 rba->noDeps = 1;
128 break;
129
130 }
131 }
132
135 /*@-bitwisesigned -compmempass @*/
136 /*@unchecked@*/
137 struct poptOption rpmBuildPoptTable[] = {
138 /*@-type@*/ /* FIX: cast? */
139 { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
140 buildArgCallback, 0, NULL, NULL },
141 /*@=type@*/
142
143 { "bp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BP,
144 N_("build through %prep (unpack sources and apply patches) from <specfile>"),
145 N_("<specfile>") },
146 { "bc", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BC,
147 N_("build through %build (%prep, then compile) from <specfile>"),
148 N_("<specfile>") },
149 { "bi", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BI,
150 N_("build through %install (%prep, %build, then install) from <specfile>"),
151 N_("<specfile>") },
152 { "bl", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BL,
153 N_("verify %files section from <specfile>"),
154 N_("<specfile>") },
155 { "ba", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BA,
156 N_("build source and binary packages from <specfile>"),
157 N_("<specfile>") },
158 { "bb", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BB,
159 N_("build binary package only from <specfile>"),
160 N_("<specfile>") },
161 { "bs", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BS,
162 N_("build source package only from <specfile>"),
163 N_("<specfile>") },
164 /* support "%track" script/section */
165 { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
166 N_("track versions of sources from <specfile>"),
167 N_("<specfile>") },
168 { "bf", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BF,
169 N_("fetch missing source and patch files"),
170 N_("<specfile>") },
171
172 { "tp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TP,
173 N_("build through %prep (unpack sources and apply patches) from <tarball>"),
174 N_("<tarball>") },
175 { "tc", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TC,
176 N_("build through %build (%prep, then compile) from <tarball>"),
177 N_("<tarball>") },
178 { "ti", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TI,
179 N_("build through %install (%prep, %build, then install) from <tarball>"),
180 N_("<tarball>") },
181 { "tl", 0, POPT_ARGFLAG_ONEDASH|POPT_ARGFLAG_DOC_HIDDEN, NULL, POPT_TL,
182 N_("verify %files section from <tarball>"),
183 N_("<tarball>") },
184 { "ta", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TA,
185 N_("build source and binary packages from <tarball>"),
186 N_("<tarball>") },
187 { "tb", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TB,
188 N_("build binary package only from <tarball>"),
189 N_("<tarball>") },
190 { "ts", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TS,
191 N_("build source package only from <tarball>"),
192 N_("<tarball>") },
193
194 { "rebuild", '\0', 0, NULL, POPT_REBUILD,
195 N_("build binary package from <source package>"),
196 N_("<source package>") },
197 { "recompile", '\0', 0, NULL, POPT_RECOMPILE,
198 N_("build through %install (%prep, %build, then install) from <source package>"),
199 N_("<source package>") },
200
201 { "clean", '\0', 0, NULL, POPT_RMBUILD,
202 N_("remove build tree when done"), NULL},
203 { "nobuild", '\0', 0, NULL, POPT_NOBUILD,
204 N_("do not execute any stages of the build"), NULL },
205 { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
206 N_("do not verify build dependencies"), NULL },
207 { "noautoprov", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 1,
208 N_("disable automagic Provides: extraction"), NULL },
209 { "noautoreq", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 2,
210 N_("disable automagic Requires: extraction"), NULL },
211 { "notinlsb", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 4,
212 N_("disable tags forbidden by LSB"), NULL },
213
214 { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NODIGEST,
215 N_("don't verify package digest(s)"), NULL },
216 { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOHDRCHK,
217 N_("don't verify database header(s) when retrieved"), NULL },
218 { "nosignature", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOSIGNATURE,
219 N_("don't verify package signature(s)"), NULL },
220
221 { "nolang", '\0', POPT_ARGFLAG_DOC_HIDDEN, &noLang, POPT_NOLANG,
222 N_("do not accept i18n msgstr's from specfile"), NULL},
223 { "rmsource", '\0', 0, NULL, POPT_RMSOURCE,
224 N_("remove sources when done"), NULL},
225 { "rmspec", '\0', 0, NULL, POPT_RMSPEC,
226 N_("remove specfile when done"), NULL},
227 { "short-circuit", '\0', 0, NULL, POPT_SHORTCIRCUIT,
228 N_("skip straight to specified stage (only for c,i)"), NULL },
229 { "sign", '\0', POPT_ARGFLAG_DOC_HIDDEN, &signIt, POPT_SIGN,
230 N_("generate PGP/GPG signature"), NULL },
231 { "target", '\0', POPT_ARG_STRING, NULL, RPMCLI_POPT_TARGETPLATFORM,
232 N_("override target platform"), N_("CPU-VENDOR-OS") },
233 { "usecatalog", '\0', POPT_ARGFLAG_DOC_HIDDEN, &useCatalog, POPT_USECATALOG,
234 N_("look up i18n strings in specfile catalog"), NULL},
235
236 POPT_TABLEEND
237 };
238 /*@=bitwisesigned =compmempass @*/