rpm
4.5
|
00001 00006 #include "system.h" 00007 00008 #include <rpmcli.h> 00009 #include <rpmbuild.h> 00010 00011 #include "build.h" 00012 #include "debug.h" 00013 00014 /*@unchecked@*/ 00015 struct rpmBuildArguments_s rpmBTArgs; 00016 00017 #define POPT_USECATALOG -1011 00018 #define POPT_NOLANG -1012 00019 #define POPT_RMSOURCE -1013 00020 #define POPT_RMBUILD -1014 00021 /* XXX was POPT_BUILDROOT -1015 */ 00022 00023 #define POPT_NOBUILD -1017 00024 #define POPT_SHORTCIRCUIT -1018 00025 #define POPT_RMSPEC -1019 00026 #define POPT_SIGN -1020 00027 00028 #define POPT_REBUILD 0x4220 00029 #define POPT_RECOMPILE 0x4320 00030 #define POPT_BA 0x6261 00031 #define POPT_BB 0x6262 00032 #define POPT_BC 0x6263 00033 #define POPT_BI 0x6269 00034 #define POPT_BL 0x626c 00035 #define POPT_BP 0x6270 00036 #define POPT_BS 0x6273 00037 #define POPT_TA 0x7461 00038 #define POPT_TB 0x7462 00039 #define POPT_TC 0x7463 00040 #define POPT_TI 0x7469 00041 #define POPT_TL 0x746c 00042 #define POPT_TP 0x7470 00043 #define POPT_TS 0x7473 00044 00045 /*@-redecl@*/ 00046 /*@unchecked@*/ 00047 extern int _fsm_debug; 00048 /*@=redecl@*/ 00049 00050 /*@-exportlocal@*/ 00051 /*@unchecked@*/ 00052 int noLang = 0; 00053 /*@=exportlocal@*/ 00054 00055 /*@unchecked@*/ 00056 static int noBuild = 0; 00057 00058 /*@unchecked@*/ 00059 static int signIt = 0; 00060 00061 /*@unchecked@*/ 00062 static int useCatalog = 0; 00063 00066 /*@-boundswrite@*/ 00067 static void buildArgCallback( /*@unused@*/ poptContext con, 00068 /*@unused@*/ enum poptCallbackReason reason, 00069 const struct poptOption * opt, 00070 /*@unused@*/ 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 00107 case RPMCLI_POPT_NODIGEST: 00108 rba->qva_flags |= VERIFY_DIGEST; 00109 break; 00110 00111 case RPMCLI_POPT_NOSIGNATURE: 00112 rba->qva_flags |= VERIFY_SIGNATURE; 00113 break; 00114 00115 case RPMCLI_POPT_NOHDRCHK: 00116 rba->qva_flags |= VERIFY_HDRCHK; 00117 break; 00118 00119 case RPMCLI_POPT_NODEPS: 00120 rba->noDeps = 1; 00121 break; 00122 00123 case RPMCLI_POPT_FORCE: 00124 rba->force = 1; 00125 break; 00126 00127 } 00128 } 00129 /*@=boundswrite@*/ 00130 00133 /*@-bitwisesigned -compmempass @*/ 00134 /*@unchecked@*/ 00135 struct poptOption rpmBuildPoptTable[] = { 00136 /*@-type@*/ /* FIX: cast? */ 00137 { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, 00138 buildArgCallback, 0, NULL, NULL }, 00139 /*@=type@*/ 00140 00141 { "bp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BP, 00142 N_("build through %prep (unpack sources and apply patches) from <specfile>"), 00143 N_("<specfile>") }, 00144 { "bc", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BC, 00145 N_("build through %build (%prep, then compile) from <specfile>"), 00146 N_("<specfile>") }, 00147 { "bi", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BI, 00148 N_("build through %install (%prep, %build, then install) from <specfile>"), 00149 N_("<specfile>") }, 00150 { "bl", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BL, 00151 N_("verify %files section from <specfile>"), 00152 N_("<specfile>") }, 00153 { "ba", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BA, 00154 N_("build source and binary packages from <specfile>"), 00155 N_("<specfile>") }, 00156 { "bb", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BB, 00157 N_("build binary package only from <specfile>"), 00158 N_("<specfile>") }, 00159 { "bs", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BS, 00160 N_("build source package only from <specfile>"), 00161 N_("<specfile>") }, 00162 00163 { "tp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TP, 00164 N_("build through %prep (unpack sources and apply patches) from <tarball>"), 00165 N_("<tarball>") }, 00166 { "tc", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TC, 00167 N_("build through %build (%prep, then compile) from <tarball>"), 00168 N_("<tarball>") }, 00169 { "ti", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TI, 00170 N_("build through %install (%prep, %build, then install) from <tarball>"), 00171 N_("<tarball>") }, 00172 { "tl", 0, POPT_ARGFLAG_ONEDASH|POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_TL, 00173 N_("verify %files section from <tarball>"), 00174 N_("<tarball>") }, 00175 { "ta", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TA, 00176 N_("build source and binary packages from <tarball>"), 00177 N_("<tarball>") }, 00178 { "tb", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TB, 00179 N_("build binary package only from <tarball>"), 00180 N_("<tarball>") }, 00181 { "ts", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_TS, 00182 N_("build source package only from <tarball>"), 00183 N_("<tarball>") }, 00184 00185 { "rebuild", '\0', 0, 0, POPT_REBUILD, 00186 N_("build binary package from <source package>"), 00187 N_("<source package>") }, 00188 { "recompile", '\0', 0, 0, POPT_RECOMPILE, 00189 N_("build through %install (%prep, %build, then install) from <source package>"), 00190 N_("<source package>") }, 00191 00192 { "clean", '\0', 0, 0, POPT_RMBUILD, 00193 N_("remove build tree when done"), NULL}, 00194 { "force", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmBTArgs.force, RPMCLI_POPT_FORCE, 00195 N_("ignore ExcludeArch: directives from spec file"), NULL}, 00196 { "fsmdebug", '\0', (POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN), &_fsm_debug, -1, 00197 N_("debug file state machine"), NULL}, 00198 { "nobuild", '\0', 0, &noBuild, POPT_NOBUILD, 00199 N_("do not execute any stages of the build"), NULL }, 00200 { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS, 00201 N_("do not verify build dependencies"), NULL }, 00202 00203 { "nodigest", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NODIGEST, 00204 N_("don't verify package digest(s)"), NULL }, 00205 { "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOHDRCHK, 00206 N_("don't verify database header(s) when retrieved"), NULL }, 00207 { "nosignature", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOSIGNATURE, 00208 N_("don't verify package signature(s)"), NULL }, 00209 00210 { "nolang", '\0', POPT_ARGFLAG_DOC_HIDDEN, &noLang, POPT_NOLANG, 00211 N_("do not accept i18N msgstr's from specfile"), NULL}, 00212 { "rmsource", '\0', 0, 0, POPT_RMSOURCE, 00213 N_("remove sources when done"), NULL}, 00214 { "rmspec", '\0', 0, 0, POPT_RMSPEC, 00215 N_("remove specfile when done"), NULL}, 00216 { "short-circuit", '\0', 0, 0, POPT_SHORTCIRCUIT, 00217 N_("skip straight to specified stage (only for c,i)"), NULL }, 00218 { "sign", '\0', POPT_ARGFLAG_DOC_HIDDEN, &signIt, POPT_SIGN, 00219 N_("generate PGP/GPG signature"), NULL }, 00220 { "target", '\0', POPT_ARG_STRING, 0, RPMCLI_POPT_TARGETPLATFORM, 00221 N_("override target platform"), N_("CPU-VENDOR-OS") }, 00222 { "usecatalog", '\0', POPT_ARGFLAG_DOC_HIDDEN, &useCatalog, POPT_USECATALOG, 00223 N_("lookup i18N strings in specfile catalog"), NULL}, 00224 00225 POPT_TABLEEND 00226 }; 00227 /*@=bitwisesigned =compmempass @*/