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