rpm 5.3.7

build/poptBT.c

Go to the documentation of this file.
00001 
00006 #include "system.h"
00007 
00008 #include <rpmio.h>
00009 #include <rpmiotypes.h>
00010 #include <rpmlog.h>
00011 
00012 #include <rpmtypes.h>
00013 #include <rpmtag.h>
00014 
00015 #include <rpmbuild.h>
00016 
00017 #include "build.h"
00018 
00019 #include <rpmcli.h>
00020 
00021 #include "debug.h"
00022 
00023 /*@unchecked@*/
00024 extern int _pkg_debug;
00025 /*@unchecked@*/
00026 extern int _spec_debug;
00027 
00028 /*@unchecked@*/
00029 struct rpmBuildArguments_s         rpmBTArgs;
00030 
00031 #define POPT_NOLANG             -1012
00032 
00033 #define POPT_REBUILD            0x4220
00034 #define POPT_RECOMPILE          0x4320
00035 #define POPT_BA                 0x6261
00036 #define POPT_BB                 0x6262
00037 #define POPT_BC                 0x6263
00038 #define POPT_BI                 0x6269
00039 #define POPT_BL                 0x626c
00040 #define POPT_BP                 0x6270
00041 #define POPT_BS                 0x6273
00042 #define POPT_BT                 0x6274  /* support "%track" script/section */
00043 #define POPT_BF                 0x6266
00044 #define POPT_TA                 0x7461
00045 #define POPT_TB                 0x7462
00046 #define POPT_TC                 0x7463
00047 #define POPT_TI                 0x7469
00048 #define POPT_TL                 0x746c
00049 #define POPT_TP                 0x7470
00050 #define POPT_TS                 0x7473
00051 
00052 /*@unchecked@*/
00053 int _rpmbuildFlags = 3;
00054 
00055 /*@-exportlocal@*/
00056 /*@unchecked@*/
00057 int noLang = 0;
00058 /*@=exportlocal@*/
00059 
00062 static void buildArgCallback( /*@unused@*/ poptContext con,
00063                 /*@unused@*/ enum poptCallbackReason reason,
00064                 const struct poptOption * opt,
00065                 /*@unused@*/ const char * arg,
00066                 /*@unused@*/ const void * data)
00067 {
00068     BTA_t rba = &rpmBTArgs;
00069 
00070     switch (opt->val) {
00071     case POPT_REBUILD:
00072     case POPT_RECOMPILE:
00073     case POPT_BA:
00074     case POPT_BB:
00075     case POPT_BC:
00076     case POPT_BI:
00077     case POPT_BL:
00078     case POPT_BP:
00079     case POPT_BS:
00080     case POPT_BT:       /* support "%track" script/section */
00081     case POPT_BF:
00082     case POPT_TA:
00083     case POPT_TB:
00084     case POPT_TC:
00085     case POPT_TI:
00086     case POPT_TL:
00087     case POPT_TP:
00088     case POPT_TS:
00089         if (rba->buildMode == '\0' && rba->buildChar == '\0') {
00090             rba->buildMode = (char)((((unsigned int)opt->val) >> 8) & 0xff);
00091             rba->buildChar = (char)(opt->val & 0xff);
00092         }
00093         break;
00094 
00095     case POPT_NOLANG: rba->noLang = 1; break;
00096 
00097     case RPMCLI_POPT_NODIGEST:
00098         rba->qva_flags |= VERIFY_DIGEST;
00099         break;
00100 
00101     case RPMCLI_POPT_NOSIGNATURE:
00102         rba->qva_flags |= VERIFY_SIGNATURE;
00103         break;
00104 
00105     case RPMCLI_POPT_NOHDRCHK:
00106         rba->qva_flags |= VERIFY_HDRCHK;
00107         break;
00108 
00109     case RPMCLI_POPT_NODEPS:
00110         rba->noDeps = 1;
00111         break;
00112     }
00113 }
00114 
00117 /*@-bitwisesigned -compmempass @*/
00118 /*@unchecked@*/
00119 struct poptOption rpmBuildPoptTable[] = {
00120 /*@-type@*/ /* FIX: cast? */
00121  { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
00122         buildArgCallback, 0, NULL, NULL },
00123 /*@=type@*/
00124 
00125  { "bp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BP,
00126         N_("build through %prep (unpack sources and apply patches) from <specfile>"),
00127         N_("<specfile>") },
00128  { "bc", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BC,
00129         N_("build through %build (%prep, then compile) from <specfile>"),
00130         N_("<specfile>") },
00131  { "bi", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BI,
00132         N_("build through %install (%prep, %build, then install) from <specfile>"),
00133         N_("<specfile>") },
00134  { "bl", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BL,
00135         N_("verify %files section from <specfile>"),
00136         N_("<specfile>") },
00137  { "ba", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BA,
00138         N_("build source and binary packages from <specfile>"),
00139         N_("<specfile>") },
00140  { "bb", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BB,
00141         N_("build binary package only from <specfile>"),
00142         N_("<specfile>") },
00143  { "bs", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_BS,
00144         N_("build source package only from <specfile>"),
00145         N_("<specfile>") },
00146     /* support "%track" script/section */
00147  { "bt", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BT,
00148         N_("track versions of sources from <specfile>"),
00149         N_("<specfile>") },
00150  { "bf", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BF,
00151         N_("fetch missing source and patch files"),
00152         N_("<specfile>") },
00153 
00154  { "tp", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TP,
00155         N_("build through %prep (unpack sources and apply patches) from <tarball>"),
00156         N_("<tarball>") },
00157  { "tc", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TC,
00158         N_("build through %build (%prep, then compile) from <tarball>"),
00159         N_("<tarball>") },
00160  { "ti", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TI,
00161         N_("build through %install (%prep, %build, then install) from <tarball>"),
00162         N_("<tarball>") },
00163  { "tl", 0, POPT_ARGFLAG_ONEDASH|POPT_ARGFLAG_DOC_HIDDEN, NULL, POPT_TL,
00164         N_("verify %files section from <tarball>"),
00165         N_("<tarball>") },
00166  { "ta", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TA,
00167         N_("build source and binary packages from <tarball>"),
00168         N_("<tarball>") },
00169  { "tb", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TB,
00170         N_("build binary package only from <tarball>"),
00171         N_("<tarball>") },
00172  { "ts", 0, POPT_ARGFLAG_ONEDASH, NULL, POPT_TS,
00173         N_("build source package only from <tarball>"),
00174         N_("<tarball>") },
00175 
00176  { "rebuild", '\0', 0, NULL, POPT_REBUILD,
00177         N_("build binary package from <source package>"),
00178         N_("<source package>") },
00179  { "recompile", '\0', 0, NULL, POPT_RECOMPILE,
00180         N_("build through %install (%prep, %build, then install) from <source package>"),
00181         N_("<source package>") },
00182 
00183  { "clean", '\0', POPT_BIT_SET, &rpmBTArgs.buildAmount, RPMBUILD_RMBUILD,
00184         N_("remove build tree when done"), NULL},
00185  { "nobuild", '\0', POPT_ARG_VAL, &rpmBTArgs.noBuild, 1,
00186         N_("do not execute any stages of the build"), NULL },
00187  { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
00188         N_("do not verify build dependencies"), NULL },
00189 
00190  { "noautoprov", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 1,
00191         N_("disable automagic Provides: extraction"), NULL },
00192  { "noautoreq", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 2,
00193         N_("disable automagic Requires: extraction"), NULL },
00194  { "notinlsb", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmbuildFlags, 4,
00195         N_("disable tags forbidden by LSB"), NULL },
00196 
00197  { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NODIGEST,
00198         N_("don't verify package digest(s)"), NULL },
00199  { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOHDRCHK,
00200         N_("don't verify database header(s) when retrieved"), NULL },
00201  { "nosignature", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOSIGNATURE,
00202         N_("don't verify package signature(s)"), NULL },
00203 
00204  { "pkgdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_pkg_debug, -1,
00205         N_("Debug Package objects"), NULL},
00206  { "specdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_spec_debug, -1,
00207         N_("Debug Spec objects"), NULL},
00208 
00209  { "nolang", '\0', POPT_ARGFLAG_DOC_HIDDEN, &noLang, POPT_NOLANG,
00210         N_("do not accept i18n msgstr's from specfile"), NULL},
00211  { "rmsource", '\0', POPT_BIT_SET, &rpmBTArgs.buildAmount, RPMBUILD_RMSOURCE,
00212         N_("remove sources when done"), NULL},
00213  { "rmspec", '\0', POPT_BIT_SET, &rpmBTArgs.buildAmount, RPMBUILD_RMSPEC,
00214         N_("remove specfile when done"), NULL},
00215  { "short-circuit", '\0', POPT_ARG_VAL, &rpmBTArgs.shortCircuit,  1,
00216         N_("skip straight to specified stage (only for c,i)"), NULL },
00217  { "sign", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &rpmBTArgs.sign, 1,
00218         N_("generate PGP/GPG signature"), NULL },
00219  { "target", '\0', POPT_ARG_STRING, NULL,  RPMCLI_POPT_TARGETPLATFORM,
00220         N_("override target platform"), N_("CPU-VENDOR-OS") },
00221 
00222    POPT_TABLEEND
00223 };
00224 /*@=bitwisesigned =compmempass @*/