summaryrefslogtreecommitdiff
path: root/xmlspec/xmlbuild.c
blob: b2456c6ec8489e1f67804c09b93394b460fa5915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include "stringbuf.h"
#include "rpmbuild.h"

#include "xml2rpm.h"
#include "xmlbuild.h"
#include "xmlparse.h"
#include "xmlstruct.h"

extern Spec g_pSpec;

int buildXMLSpec(t_structXMLSpec* pXMLSpec,
		 int nWhat,
		 int nTest)
{
	Spec pRPMSpec = NULL;
	int nRet = 0;

	if ((pRPMSpec = toRPMStruct(pXMLSpec))) {
		nRet = buildSpec(pRPMSpec, nWhat, nTest);
		if (g_pSpec)
			freeSpec(g_pSpec);
		g_pSpec = NULL;
	}
	else
		nRet = -1;
		
	return nRet;
}

int parseBuildXMLSpec(const char* szXMLSpec,
		      int nWhat,
		      int nTest,
		      int nVerbose)
{
	t_structXMLSpec* pXMLSpec = NULL;
	int nRet = 0;

	if ((pXMLSpec = parseXMLSpec(szXMLSpec, nVerbose))) {
		nRet = buildXMLSpec(pXMLSpec, nWhat, 0);
		freeXMLSpec(&pXMLSpec);
	}
	else
		nRet = -1;

	return nRet;
}