1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
/** \file poptBT.c
* Popt tables for build modes.
*/
#include "system.h"
#include <rpmbuild.h>
#include <rpmurl.h>
#include "build.h"
struct rpmBuildArguments rpmBTArgs;
#define POPT_USECATALOG 1000
#define POPT_NOLANG 1001
#define POPT_RMSOURCE 1002
#define POPT_RMBUILD 1003
#define POPT_BUILDROOT 1004
#define POPT_TARGETPLATFORM 1007
#define POPT_NOBUILD 1008
#define POPT_SHORTCIRCUIT 1009
#define POPT_RMSPEC 1010
#define POPT_REBUILD 0x4220
#define POPT_RECOMPILE 0x4320
#define POPT_BA 0x6261
#define POPT_BB 0x6262
#define POPT_BC 0x6263
#define POPT_BI 0x6269
#define POPT_BL 0x626c
#define POPT_BP 0x6270
#define POPT_BS 0x6273
#define POPT_TA 0x7461
#define POPT_TB 0x7462
#define POPT_TC 0x7463
#define POPT_TI 0x7469
#define POPT_TL 0x746c
#define POPT_TP 0x7470
#define POPT_TS 0x7473
int noLang = 0;
static int noBuild = 0;
static int useCatalog = 0;
static void buildArgCallback( /*@unused@*/ poptContext con,
/*@unused@*/ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg, const void * data)
{
struct rpmBuildArguments * rba = (struct rpmBuildArguments *) data;
switch (opt->val) {
case POPT_REBUILD:
case POPT_RECOMPILE:
case POPT_BA:
case POPT_BB:
case POPT_BC:
case POPT_BI:
case POPT_BL:
case POPT_BP:
case POPT_BS:
case POPT_TA:
case POPT_TB:
case POPT_TC:
case POPT_TI:
case POPT_TL:
case POPT_TP:
case POPT_TS:
if (rba->buildMode == ' ') {
rba->buildMode = (opt->val >> 8) & 0xff;
rba->buildChar = (opt->val ) & 0xff;
}
break;
case POPT_USECATALOG: rba->useCatalog = 1; break;
case POPT_NOBUILD: rba->noBuild = 1; break;
case POPT_NOLANG: rba->noLang = 1; break;
case POPT_SHORTCIRCUIT: rba->shortCircuit = 1; break;
case POPT_RMSOURCE: rba->buildAmount |= RPMBUILD_RMSOURCE; break;
case POPT_RMSPEC: rba->buildAmount |= RPMBUILD_RMSPEC; break;
case POPT_RMBUILD: rba->buildAmount |= RPMBUILD_RMBUILD; break;
case POPT_BUILDROOT:
if (rba->buildRootOverride) {
fprintf(stderr, _("buildroot already specified"));
exit(EXIT_FAILURE);
/*@notreached@*/
}
rba->buildRootOverride = xstrdup(arg);
break;
case POPT_TARGETPLATFORM:
if (rba->targets) {
int len = strlen(rba->targets) + 1 + strlen(arg) + 1;
rba->targets = xrealloc(rba->targets, len);
strcat(rba->targets, ",");
} else {
rba->targets = xmalloc(strlen(arg) + 1);
rba->targets[0] = '\0';
}
strcat(rba->targets, arg);
break;
}
}
/** */
struct poptOption rpmBuildPoptTable[] = {
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
buildArgCallback, 0, NULL, NULL },
{ "bp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BP,
N_("build through %%prep stage from spec file"), NULL},
{ "bc", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BC,
N_("build through %%build stage from spec file"), NULL},
{ "bi", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BI,
N_("build through %%install stage from spec file"), NULL},
{ "bl", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BL,
N_("verify %%files section from spec file"), NULL},
{ "ba", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BA,
N_("build source and binary package from spec file"), NULL},
{ "bb", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BB,
N_("build binary package from spec file"), NULL},
{ "bs", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BS,
N_("build source package from spec file"), NULL},
{ "tp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TP,
N_("build through %%prep stage from tar ball"), NULL},
{ "tc", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TC,
N_("build through %%build stage from tar ball"), NULL},
{ "ti", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TI,
N_("build through %%install stage from tar ball"), NULL},
{ "tl", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TL,
N_("verify %%files section from tar ball"), NULL},
{ "ta", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TA,
N_("build source and binary package from tar ball"), NULL},
{ "tb", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TB,
N_("build binary package from tar ball"), NULL},
{ "ts", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TS,
N_("build source package from tar ball"), NULL},
{ "rebuild", '\0', 0, 0, POPT_REBUILD,
N_("build binary package from source package"), NULL},
{ "recompile", '\0', 0, 0, POPT_REBUILD,
N_("build through %%install stage from source package"), NULL},
{ "buildroot", '\0', POPT_ARG_STRING, 0, POPT_BUILDROOT,
N_("override build root"), "DIRECTORY" },
{ "clean", '\0', 0, 0, POPT_RMBUILD,
N_("remove build tree when done"), NULL},
{ "nobuild", '\0', 0, &noBuild, POPT_NOBUILD,
N_("do not execute any stages of the build"), NULL },
{ "nolang", '\0', 0, &noLang, POPT_NOLANG,
N_("do not accept I18N msgstr's from specfile"), NULL},
{ "rmsource", '\0', 0, 0, POPT_RMSOURCE,
N_("remove sources when done"), NULL},
{ "rmspec", '\0', 0, 0, POPT_RMSPEC,
N_("remove specfile when done"), NULL},
{ "short-circuit", '\0', 0, 0, POPT_SHORTCIRCUIT,
N_("skip straight to specified stage (only for c,i)"), NULL },
{ "target", '\0', POPT_ARG_STRING, 0, POPT_TARGETPLATFORM,
N_("override target platform"), "CPU-VENDOR-OS" },
{ "usecatalog", '\0', 0, &useCatalog, POPT_USECATALOG,
N_("lookup I18N strings in specfile catalog"), NULL},
{ 0, 0, 0, 0, 0, NULL, NULL }
};
|