diff options
-rw-r--r-- | build/spec.c | 14 | ||||
-rw-r--r-- | python/spec-py.c | 28 | ||||
-rw-r--r-- | rpmbuild.c | 14 |
3 files changed, 19 insertions, 37 deletions
diff --git a/build/spec.c b/build/spec.c index 91bc55cd3..a0cd512e1 100644 --- a/build/spec.c +++ b/build/spec.c @@ -314,29 +314,21 @@ rpmSpec freeSpec(rpmSpec spec) int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg) { rpmSpec spec = NULL; - Package pkg; - char * buildRoot = NULL; - int recursing = 0; - int anyarch = 1; - int force = 1; int res = 1; int xx; if (qva->qva_showPackage == NULL) goto exit; - /* FIX: make spec abstract */ - if (parseSpec(ts, arg, NULL, buildRoot, recursing, NULL, - NULL, anyarch, force) - || (spec = rpmtsSetSpec(ts, NULL)) == NULL) - { + spec = rpmSpecParse(arg, (RPMSPEC_ANYARCH|RPMSPEC_FORCE), NULL); + if (spec == NULL) { rpmlog(RPMLOG_ERR, _("query of specfile %s failed, can't parse\n"), arg); goto exit; } res = 0; - for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) + for (Package pkg = spec->packages; pkg != NULL; pkg = pkg->next) xx = qva->qva_showPackage(qva, ts, pkg->header); exit: diff --git a/python/spec-py.c b/python/spec-py.c index 1573ed0f8..af01e1f50 100644 --- a/python/spec-py.c +++ b/python/spec-py.c @@ -213,35 +213,23 @@ static PyGetSetDef spec_getseters[] = { static PyObject *spec_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) { - rpmts ts = NULL; + char * kwlist[] = {"specfile", NULL}; const char * specfile; rpmSpec spec = NULL; - char * buildRoot = NULL; - int recursing = 0; - char * passPhrase = ""; - char *cookie = NULL; - int anyarch = 1; - int force = 1; - char * kwlist[] = {"specfile", NULL}; + /* TODO: add arguments to control these */ + rpmSpecFlags flags = (RPMSPEC_ANYARCH|RPMSPEC_FORCE); if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:spec_new", kwlist, &specfile)) return NULL; - /* - * Just how hysterical can you get? We need to create a transaction - * set to get back the results from parseSpec()... - */ - ts = rpmtsCreate(); - if (parseSpec(ts, specfile, NULL, buildRoot,recursing, passPhrase, - cookie, anyarch, force) == 0) { - spec = rpmtsSpec(ts); - } else { - PyErr_SetString(PyExc_ValueError, "can't parse specfile\n"); + spec = rpmSpecParse(specfile, flags, NULL); + if (spec == NULL) { + PyErr_SetString(PyExc_ValueError, "can't parse specfile\n"); + return NULL; } - rpmtsFree(ts); - return spec ? spec_Wrap(subtype, spec) : NULL; + return spec_Wrap(subtype, spec); } PyTypeObject spec_Type = { diff --git a/rpmbuild.c b/rpmbuild.c index 8ad6c9194..a03b50f35 100644 --- a/rpmbuild.c +++ b/rpmbuild.c @@ -202,6 +202,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) rpmSpec spec = NULL; int rc = 1; /* assume failure */ int justRm = ((buildAmount & ~(RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)) == 0); + rpmSpecFlags specFlags = RPMSPEC_NONE; #ifndef DYING rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS); @@ -274,13 +275,14 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) /* Parse the spec file */ #define _anyarch(_f) \ (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0) - if (parseSpec(ts, specFile, NULL, buildRootURL, 0, NULL, - NULL, _anyarch(buildAmount), ba->force)) - { - goto exit; - } + if (_anyarch(buildAmount)) + specFlags |= RPMSPEC_ANYARCH; + if (ba->force) + specFlags |= RPMSPEC_FORCE; #undef _anyarch - if ((spec = rpmtsSetSpec(ts, NULL)) == NULL) { + + spec = rpmSpecParse(specFile, specFlags, buildRootURL); + if (spec == NULL) { goto exit; } |