Permit file objects in python header constructor
[platform/upstream/rpm.git] / build / poptBT.c
index 07ac2cf..d484ca9 100644 (file)
@@ -5,17 +5,13 @@
 
 #include "system.h"
 
-#include <rpmcli.h>
-#include <rpmbuild.h>
+#include <rpm/rpmbuild.h>
+#include <rpm/rpmlog.h>
 
-#include "build.h"
-#include "legacy.h"    /* XXX _noDirTokens */
 #include "debug.h"
 
-/*@unchecked@*/
 struct rpmBuildArguments_s         rpmBTArgs;
 
-#define        POPT_USECATALOG         -1011
 #define        POPT_NOLANG             -1012
 #define        POPT_RMSOURCE           -1013
 #define        POPT_RMBUILD            -1014
@@ -43,32 +39,20 @@ struct rpmBuildArguments_s         rpmBTArgs;
 #define        POPT_TP                 0x7470
 #define        POPT_TS                 0x7473
 
-/*@-redecl@*/
-/*@unchecked@*/
 extern int _fsm_debug;
-/*@=redecl@*/
 
-/*@-exportlocal@*/
-/*@unchecked@*/
 int noLang = 0;
-/*@=exportlocal@*/
 
-/*@unchecked@*/
 static int noBuild = 0;
 
-/*@unchecked@*/
 static int signIt = 0;
 
-/*@unchecked@*/
-static int useCatalog = 0;
-
 /**
  */
-/*@-boundswrite@*/
-static void buildArgCallback( /*@unused@*/ poptContext con,
-       /*@unused@*/ enum poptCallbackReason reason,
+static void buildArgCallback( poptContext con,
+       enum poptCallbackReason reason,
        const struct poptOption * opt, const char * arg,
-       /*@unused@*/ const void * data)
+       const void * data)
 {
     BTA_t rba = &rpmBTArgs;
 
@@ -89,6 +73,8 @@ static void buildArgCallback( /*@unused@*/ poptContext con,
     case POPT_TL:
     case POPT_TP:
     case POPT_TS:
+       if (opt->val == POPT_BS || opt->val == POPT_TS)
+           rba->noDeps = 1;
        if (rba->buildMode == '\0' && rba->buildChar == '\0') {
            rba->buildMode = (((unsigned)opt->val) >> 8) & 0xff;
            rba->buildChar = (opt->val     ) & 0xff;
@@ -99,27 +85,18 @@ static void buildArgCallback( /*@unused@*/ poptContext con,
     case POPT_NOLANG: rba->noLang = 1; break;
     case POPT_SHORTCIRCUIT: rba->shortCircuit = 1; break;
     case POPT_SIGN: rba->sign = 1; break;
-    case POPT_USECATALOG: rba->useCatalog = 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) {
-           rpmError(RPMERR_BUILDROOT, _("buildroot already specified, ignoring %s\n"), arg);
+           rpmlog(RPMLOG_ERR, _("buildroot already specified, ignoring %s\n"), arg);
            break;
        }
        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);
+       rstrscat(&rba->targets, rba->targets ? "," : "", arg, NULL);
        break;
 
     case RPMCLI_POPT_NODIGEST:
@@ -144,17 +121,13 @@ static void buildArgCallback( /*@unused@*/ poptContext con,
 
     }
 }
-/*@=boundswrite@*/
 
 /**
  */
-/*@-bitwisesigned -compmempass @*/
-/*@unchecked@*/
 struct poptOption rpmBuildPoptTable[] = {
-/*@-type@*/ /* FIX: cast? */
+/* FIX: cast? */
  { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE,
        buildArgCallback, 0, NULL, NULL },
-/*@=type@*/
 
  { "bp", 0, POPT_ARGFLAG_ONEDASH, 0, POPT_BP,
        N_("build through %prep (unpack sources and apply patches) from <specfile>"),
@@ -244,9 +217,5 @@ struct poptOption rpmBuildPoptTable[] = {
        N_("generate PGP/GPG signature"), NULL },
  { "target", '\0', POPT_ARG_STRING, 0,  POPT_TARGETPLATFORM,
        N_("override target platform"), "CPU-VENDOR-OS" },
- { "usecatalog", '\0', POPT_ARGFLAG_DOC_HIDDEN, &useCatalog, POPT_USECATALOG,
-       N_("lookup i18N strings in specfile catalog"), NULL},
-
    POPT_TABLEEND
 };
-/*@=bitwisesigned =compmempass @*/