build/poptBT.c

Go to the documentation of this file.
00001 
00006 #include "system.h"
00007 
00008 #include <rpmcli.h>
00009 #include <rpmbuild.h>
00010 
00011 #include "build.h"
00012 #include "legacy.h"     /* XXX _noDirTokens */
00013 #include "debug.h"
00014 
00015 /*@unchecked@*/
00016 struct rpmBuildArguments_s         rpmBTArgs;
00017 
00018 #define POPT_USECATALOG         -1011
00019 #define POPT_NOLANG             -1012
00020 #define POPT_RMSOURCE           -1013
00021 #define POPT_RMBUILD            -1014
00022 #define POPT_BUILDROOT          -1015
00023 #define POPT_TARGETPLATFORM     -1016
00024 #define POPT_NOBUILD            -1017
00025 #define POPT_SHORTCIRCUIT       -1018
00026 #define POPT_RMSPEC             -1019
00027 #define POPT_SIGN               -1020
00028 
00029 #define POPT_REBUILD            0x4220
00030 #define POPT_RECOMPILE          0x4320
00031 #define POPT_BA                 0x6261
00032 #define POPT_BB                 0x6262
00033 #define POPT_BC                 0x6263
00034 #define POPT_BI                 0x6269
00035 #define POPT_BL                 0x626c
00036 #define POPT_BP                 0x6270
00037 #define POPT_BS                 0x6273
00038 #define POPT_TA                 0x7461
00039 #define POPT_TB                 0x7462
00040 #define POPT_TC                 0x7463
00041 #define POPT_TI                 0x7469
00042 #define POPT_TL                 0x746c
00043 #define POPT_TP                 0x7470
00044 #define POPT_TS                 0x7473
00045 
00046 /*@-redecl@*/
00047 /*@unchecked@*/
00048 extern int _fsm_debug;
00049 /*@=redecl@*/
00050 
00051 /*@-exportlocal@*/
00052 /*@unchecked@*/
00053 int noLang = 0;
00054 /*@=exportlocal@*/
00055 
00056 /*@unchecked@*/
00057 static int noBuild = 0;
00058 
00059 /*@unchecked@*/
00060 static int signIt = 0;
00061 
00062 /*@unchecked@*/
00063 static int useCatalog = 0;
00064 
00067 /*@-boundswrite@*/
00068 static void buildArgCallback( /*@unused@*/ poptContext con,
00069         /*@unused@*/ enum poptCallbackReason reason,
00070         const struct poptOption * opt, const char * arg,
00071         /*@unused@*/ const void * data)
00072 {
00073     BTA_t rba = &rpmBTArgs;
00074 
00075     switch (opt->val) {
00076     case POPT_REBUILD:
00077     case POPT_RECOMPILE:
00078     case POPT_BA:
00079     case POPT_BB:
00080     case POPT_BC:
00081     case POPT_BI:
00082     case POPT_BL:
00083     case POPT_BP:
00084     case POPT_BS:
00085     case POPT_TA:
00086     case POPT_TB:
00087     case POPT_TC:
00088     case POPT_TI:
00089     case POPT_TL:
00090     case POPT_TP:
00091     case POPT_TS:
00092         if (rba->buildMode == '\0' && rba->buildChar == '\0') {
00093             rba->buildMode = (((unsigned)opt->val) >> 8) & 0xff;
00094             rba->buildChar = (opt->val     ) & 0xff;
00095         }
00096         break;
00097 
00098     case POPT_NOBUILD: rba->noBuild = 1; break;
00099     case POPT_NOLANG: rba->noLang = 1; break;
00100     case POPT_SHORTCIRCUIT: rba->shortCircuit = 1; break;
00101     case POPT_SIGN: rba->sign = 1; break;
00102     case POPT_USECATALOG: rba->useCatalog = 1; break;
00103     case POPT_RMSOURCE: rba->buildAmount |= RPMBUILD_RMSOURCE; break;
00104     case POPT_RMSPEC: rba->buildAmount |= RPMBUILD_RMSPEC; break;
00105     case POPT_RMBUILD: rba->buildAmount |= RPMBUILD_RMBUILD; break;
00106     case POPT_BUILDROOT:
00107         if (rba->buildRootOverride) {
00108             rpmError(RPMERR_BUILDROOT, _("buildroot already specified, ignoring %s\n"), arg);
00109             break;
00110         }
00111         rba->buildRootOverride = xstrdup(arg);
00112         break;
00113     case POPT_TARGETPLATFORM:
00114         if (rba->targets) {
00115             int len = strlen(rba->targets) + 1 + strlen(arg) + 1;
00116             rba->targets = xrealloc(rba->targets, len);
00117             strcat(rba->targets, ",");
00118         } else {
00119             rba->targets = xmalloc(strlen(arg) + 1);
00120             rba->targets[0] = '\0';
00121         }
00122         strcat(rba->targets, arg);
00123         break;
00124 
00125     case RPMCLI_POPT_NODIGEST:
00126         rba->qva_flags |= VERIFY_DIGEST;
00127         break;
00128 
00129     case RPMCLI_POPT_NOSIGNATURE:
00130         rba->qva_flags |= VERIFY_SIGNATURE;
00131         break;
00132 
00133     case RPMCLI_POPT_NOHDRCHK:
00134         rba->qva_flags |= VERIFY_HDRCHK;
00135         break;
00136 
00137     case RPMCLI_POPT_NODEPS:
00138         rba->noDeps = 1;
00139         break;
00140 
00141     case RPMCLI_POPT_FORCE:
00142         rba->force = 1;
00143         break;
00144 
00145     }
00146 }
00147 /*@=boundswrite@*/
00148 
00151 /*@-bitwisesigned -compmempass @*/
00152 /*@unchecked@*/
00153 struct poptOption rpmBuildPoptTable[] = {
00154 /*@-type@*/ /* FIX: cast? */
00155  { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
00156         buildArgCallback, 0, NULL, NULL },
00157 /*@=type@*/
00158 
00159  { "bp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BP,
00160         N_("build through %prep (unpack sources and apply patches) from <specfile>"),
00161         N_("<specfile>") },
00162  { "bc", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BC,
00163         N_("build through %build (%prep, then compile) from <specfile>"),
00164         N_("<specfile>") },
00165  { "bi", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BI,
00166         N_("build through %install (%prep, %build, then install) from <specfile>"),
00167         N_("<specfile>") },
00168  { "bl", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BL,
00169         N_("verify %files section from <specfile>"),
00170         N_("<specfile>") },
00171  { "ba", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BA,
00172         N_("build source and binary packages from <specfile>"),
00173         N_("<specfile>") },
00174  { "bb", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BB,
00175         N_("build binary package only from <specfile>"),
00176         N_("<specfile>") },
00177  { "bs", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BS,
00178         N_("build source package only from <specfile>"),
00179         N_("<specfile>") },
00180 
00181  { "tp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TP,
00182         N_("build through %prep (unpack sources and apply patches) from <tarball>"),
00183         N_("<tarball>") },
00184  { "tc", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TC,
00185         N_("build through %build (%prep, then compile) from <tarball>"),
00186         N_("<tarball>") },
00187  { "ti", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TI,
00188         N_("build through %install (%prep, %build, then install) from <tarball>"),
00189         N_("<tarball>") },
00190  { "tl", 0, POPT_ARGFLAG_ONEDASH|POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_TL,
00191         N_("verify %files section from <tarball>"),
00192         N_("<tarball>") },
00193  { "ta", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TA,
00194         N_("build source and binary packages from <tarball>"),
00195         N_("<tarball>") },
00196  { "tb", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TB,
00197         N_("build binary package only from <tarball>"),
00198         N_("<tarball>") },
00199  { "ts", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TS,
00200         N_("build source package only from <tarball>"),
00201         N_("<tarball>") },
00202 
00203  { "rebuild", '\0', 0, 0, POPT_REBUILD,
00204         N_("build binary package from <source package>"),
00205         N_("<source package>") },
00206  { "recompile", '\0', 0, 0, POPT_RECOMPILE,
00207         N_("build through %install (%prep, %build, then install) from <source package>"),
00208         N_("<source package>") },
00209 
00210  { "buildroot", '\0', POPT_ARG_STRING, 0,  POPT_BUILDROOT,
00211         N_("override build root"), "DIRECTORY" },
00212  { "clean", '\0', 0, 0, POPT_RMBUILD,
00213         N_("remove build tree when done"), NULL},
00214  { "dirtokens", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_noDirTokens, 0,
00215         N_("generate headers compatible with rpm4 packaging"), NULL},
00216  { "force", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmBTArgs.force, RPMCLI_POPT_FORCE,
00217         N_("ignore ExcludeArch: directives from spec file"), NULL},
00218  { "fsmdebug", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN), &_fsm_debug, -1,
00219         N_("debug file state machine"), NULL},
00220  { "nobuild", '\0', 0, &noBuild,  POPT_NOBUILD,
00221         N_("do not execute any stages of the build"), NULL },
00222  { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
00223         N_("do not verify build dependencies"), NULL },
00224  { "nodirtokens", '\0', POPT_ARG_VAL, &_noDirTokens, 1,
00225         N_("generate package header(s) compatible with (legacy) rpm[23] packaging"),
00226         NULL},
00227 
00228  { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NODIGEST,
00229         N_("don't verify package digest(s)"), NULL },
00230  { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOHDRCHK,
00231         N_("don't verify database header(s) when retrieved"), NULL },
00232  { "nosignature", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOSIGNATURE,
00233         N_("don't verify package signature(s)"), NULL },
00234 
00235  { "nolang", '\0', POPT_ARGFLAG_DOC_HIDDEN, &noLang, POPT_NOLANG,
00236         N_("do not accept i18N msgstr's from specfile"), NULL},
00237  { "rmsource", '\0', 0, 0, POPT_RMSOURCE,
00238         N_("remove sources when done"), NULL},
00239  { "rmspec", '\0', 0, 0, POPT_RMSPEC,
00240         N_("remove specfile when done"), NULL},
00241  { "short-circuit", '\0', 0, 0,  POPT_SHORTCIRCUIT,
00242         N_("skip straight to specified stage (only for c,i)"), NULL },
00243  { "sign", '\0', POPT_ARGFLAG_DOC_HIDDEN, &signIt, POPT_SIGN,
00244         N_("generate PGP/GPG signature"), NULL },
00245  { "target", '\0', POPT_ARG_STRING, 0,  POPT_TARGETPLATFORM,
00246         N_("override target platform"), "CPU-VENDOR-OS" },
00247  { "usecatalog", '\0', POPT_ARGFLAG_DOC_HIDDEN, &useCatalog, POPT_USECATALOG,
00248         N_("lookup i18N strings in specfile catalog"), NULL},
00249 
00250    POPT_TABLEEND
00251 };
00252 /*@=bitwisesigned =compmempass @*/

Generated on Fri Oct 12 08:44:53 2007 for rpm by  doxygen 1.5.2