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