rpm  5.4.14
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 extern int _pkg_debug;
25 /*@unchecked@*/
26 extern int _spec_debug;
27 
28 /*@unchecked@*/
30 
31 #define POPT_NOLANG -1012
32 
33 #define POPT_REBUILD 0x4220
34 #define POPT_RECOMPILE 0x4320
35 #define POPT_BA 0x6261
36 #define POPT_BB 0x6262
37 #define POPT_BC 0x6263
38 #define POPT_BI 0x6269
39 #define POPT_BL 0x626c
40 #define POPT_BP 0x6270
41 #define POPT_BS 0x6273
42 #define POPT_BT 0x6274 /* support "%track" script/section */
43 #define POPT_BF 0x6266
44 #define POPT_TA 0x7461
45 #define POPT_TB 0x7462
46 #define POPT_TC 0x7463
47 #define POPT_TI 0x7469
48 #define POPT_TL 0x746c
49 #define POPT_TP 0x7470
50 #define POPT_TS 0x7473
51 
52 /*@unchecked@*/
54 
55 /*@-exportlocal@*/
56 /*@unchecked@*/
57 int noLang = 0;
58 /*@=exportlocal@*/
59 
62 static void buildArgCallback( /*@unused@*/ poptContext con,
63  /*@unused@*/ enum poptCallbackReason reason,
64  const struct poptOption * opt,
65  /*@unused@*/ const char * arg,
66  /*@unused@*/ const void * data)
67 {
68  BTA_t rba = &rpmBTArgs;
69 
70  switch (opt->val) {
71  case POPT_REBUILD:
72  case POPT_RECOMPILE:
73  case POPT_BA:
74  case POPT_BB:
75  case POPT_BC:
76  case POPT_BI:
77  case POPT_BL:
78  case POPT_BP:
79  case POPT_BS:
80  case POPT_BT: /* support "%track" script/section */
81  case POPT_BF:
82  case POPT_TA:
83  case POPT_TB:
84  case POPT_TC:
85  case POPT_TI:
86  case POPT_TL:
87  case POPT_TP:
88  case POPT_TS:
89  if (rba->buildMode == '\0' && rba->buildChar == '\0') {
90  rba->buildMode = (char)((((unsigned int)opt->val) >> 8) & 0xff);
91  rba->buildChar = (char)(opt->val & 0xff);
92  }
93  break;
94 
95  case POPT_NOLANG: rba->noLang = 1; break;
96 
98  rba->qva_flags |= VERIFY_DIGEST;
99  break;
100 
102  rba->qva_flags |= VERIFY_SIGNATURE;
103  break;
104 
106  rba->qva_flags |= VERIFY_HDRCHK;
107  break;
108 
109  case RPMCLI_POPT_NODEPS:
110  rba->noDeps = 1;
111  break;
112  }
113 }
114 
117 /*@-bitwisesigned -compmempass @*/
118 /*@unchecked@*/
119 struct poptOption rpmBuildPoptTable[] = {
120 /*@-type@*/ /* FIX: cast? */
121  { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
122  buildArgCallback, 0, NULL, NULL },
123 /*@=type@*/
124 
125  { "bp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BP,
126  N_("build through %prep (unpack sources and apply patches) from <specfile>"),
127  N_("<specfile>") },
128  { "bc", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BC,
129  N_("build through %build (%prep, then compile) from <specfile>"),
130  N_("<specfile>") },
131  { "bi", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BI,
132  N_("build through %install (%prep, %build, then install) from <specfile>"),
133  N_("<specfile>") },
134  { "bl", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BL,
135  N_("verify %files section from <specfile>"),
136  N_("<specfile>") },
137  { "ba", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BA,
138  N_("build source and binary packages from <specfile>"),
139  N_("<specfile>") },
140  { "bb", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BB,
141  N_("build binary package only from <specfile>"),
142  N_("<specfile>") },
143  { "bs", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BS,
144  N_("build source package only from <specfile>"),
145  N_("<specfile>") },
146  /* support "%track" script/section */
147  { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
148  N_("track versions of sources from <specfile>"),
149  N_("<specfile>") },
150  { "bf", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BF,
151  N_("fetch missing source and patch files"),
152  N_("<specfile>") },
153 
154  { "tp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TP,
155  N_("build through %prep (unpack sources and apply patches) from <tarball>"),
156  N_("<tarball>") },
157  { "tc", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TC,
158  N_("build through %build (%prep, then compile) from <tarball>"),
159  N_("<tarball>") },
160  { "ti", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TI,
161  N_("build through %install (%prep, %build, then install) from <tarball>"),
162  N_("<tarball>") },
163  { "tl", 0, POPT_ARGFLAG_ONEDASH|POPT_ARGFLAG_DOC_HIDDEN, NULL, POPT_TL,
164  N_("verify %files section from <tarball>"),
165  N_("<tarball>") },
166  { "ta", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TA,
167  N_("build source and binary packages from <tarball>"),
168  N_("<tarball>") },
169  { "tb", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TB,
170  N_("build binary package only from <tarball>"),
171  N_("<tarball>") },
172  { "ts", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TS,
173  N_("build source package only from <tarball>"),
174  N_("<tarball>") },
175 
176  { "rebuild", '\0', 0, NULL, POPT_REBUILD,
177  N_("build binary package from <source package>"),
178  N_("<source package>") },
179  { "recompile", '\0', 0, NULL, POPT_RECOMPILE,
180  N_("build through %install (%prep, %build, then install) from <source package>"),
181  N_("<source package>") },
182 
183  { "clean", '\0', POPT_BIT_SET, &rpmBTArgs.buildAmount, RPMBUILD_RMBUILD,
184  N_("remove build tree when done"), NULL},
185  { "nobuild", '\0', POPT_ARG_VAL, &rpmBTArgs.noBuild, 1,
186  N_("do not execute any stages of the build"), NULL },
187  { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
188  N_("do not verify build dependencies"), NULL },
189 
190  { "noautoprov", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 1,
191  N_("disable automagic Provides: extraction"), NULL },
192  { "noautoreq", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 2,
193  N_("disable automagic Requires: extraction"), NULL },
194  { "notinlsb", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 4,
195  N_("disable tags forbidden by LSB"), NULL },
196 
197  { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NODIGEST,
198  N_("don't verify package digest(s)"), NULL },
199  { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOHDRCHK,
200  N_("don't verify database header(s) when retrieved"), NULL },
201  { "nosignature", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOSIGNATURE,
202  N_("don't verify package signature(s)"), NULL },
203 
204  { "pkgdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_pkg_debug, -1,
205  N_("Debug Package objects"), NULL},
206  { "specdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_spec_debug, -1,
207  N_("Debug Spec objects"), NULL},
208 
209  { "nolang", '\0', POPT_ARGFLAG_DOC_HIDDEN, &noLang, POPT_NOLANG,
210  N_("do not accept i18n msgstr's from specfile"), NULL},
211  { "rmsource", '\0', POPT_BIT_SET, &rpmBTArgs.buildAmount, RPMBUILD_RMSOURCE,
212  N_("remove sources when done"), NULL},
213  { "rmspec", '\0', POPT_BIT_SET, &rpmBTArgs.buildAmount, RPMBUILD_RMSPEC,
214  N_("remove specfile when done"), NULL},
215  { "short-circuit", '\0', POPT_ARG_VAL, &rpmBTArgs.shortCircuit, 1,
216  N_("skip straight to specified stage (only for c,i)"), NULL },
217  { "sign", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &rpmBTArgs.sign, 1,
218  N_("generate PGP/GPG signature"), NULL },
219  { "target", '\0', POPT_ARG_STRING, NULL, RPMCLI_POPT_TARGETPLATFORM,
220  N_("override target platform"), N_("CPU-VENDOR-OS") },
221 
222  POPT_TABLEEND
223 };
224 /*@=bitwisesigned =compmempass @*/
#define RPMCLI_POPT_TARGETPLATFORM
Definition: rpmcli.h:103
struct poptOption rpmBuildPoptTable[]
Definition: poptBT.c:119
#define POPT_BA
Definition: poptBT.c:35
int _rpmbuildFlags
Definition: poptBT.c:53
struct rpmBuildArguments_s rpmBTArgs
Definition: poptBT.c:29
#define POPT_TA
Definition: poptBT.c:44
#define POPT_BB
Definition: poptBT.c:36
#define RPMCLI_POPT_NODIGEST
Definition: rpmcli.h:100
#define POPT_TB
Definition: poptBT.c:45
#define POPT_REBUILD
Definition: poptBT.c:33
Yet Another syslog(3) API clone.
#define POPT_BP
Definition: poptBT.c:40
#define RPMCLI_POPT_NOHDRCHK
Definition: rpmcli.h:101
#define POPT_BC
Definition: poptBT.c:37
int _pkg_debug
Definition: spec.c:23
#define POPT_BI
Definition: poptBT.c:38
#define N_(Text)
Definition: system.h:531
#define POPT_BS
Definition: poptBT.c:41
#define POPT_BT
Definition: poptBT.c:42
#define POPT_TS
Definition: poptBT.c:50
static void buildArgCallback(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, const void *data)
Definition: poptBT.c:62
#define POPT_NOLANG
Definition: poptBT.c:31
#define POPT_BF
Definition: poptBT.c:43
#define POPT_BL
Definition: poptBT.c:39
#define POPT_TL
Definition: poptBT.c:48
#define RPMCLI_POPT_NOSIGNATURE
Definition: rpmcli.h:99
This is the only module users of librpmbuild should need to include.
#define RPMCLI_POPT_NODEPS
Common/global popt tokens used for command line option tables.
Definition: rpmcli.h:96
#define POPT_TP
Definition: poptBT.c:49
int noLang
Definition: poptBT.c:57
#define POPT_TC
Definition: poptBT.c:46
return NULL
Definition: poptALL.c:613
#define POPT_TI
Definition: poptBT.c:47
#define POPT_RECOMPILE
Definition: poptBT.c:34
poptContext
Definition: poptALL.c:525
Describe build command line request.
Definition: rpmcli.h:718
rpmQueryFlags qva_flags
Definition: rpmcli.h:719
int _spec_debug
Definition: spec.c:26