summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-06-05 21:04:32 +0000
committerjbj <devnull@localhost>2002-06-05 21:04:32 +0000
commite8f1e413309a4df972a029c82f469b4b5b74e3a6 (patch)
tree51de0ede9cabcb68ea4e1e3ec92025606221455a
parent8780c9932c35ce442f2cde96724d9a86e6f8f65a (diff)
downloadlibrpm-tizen-e8f1e413309a4df972a029c82f469b4b5b74e3a6.tar.gz
librpm-tizen-e8f1e413309a4df972a029c82f469b4b5b74e3a6.tar.bz2
librpm-tizen-e8f1e413309a4df972a029c82f469b4b5b74e3a6.zip
Add xmlspec-20020605.diff orphans.
CVS patchset: 5467 CVS date: 2002/06/05 21:04:32
-rw-r--r--xmlspec/XMLMisc.cpp96
-rw-r--r--xmlspec/XMLMisc.h66
-rw-r--r--xmlspec/XMLRPMWrap.cpp72
-rw-r--r--xmlspec/XMLRPMWrap.h49
-rw-r--r--xmlspec/XMLText.cpp23
-rw-r--r--xmlspec/XMLText.h119
-rw-r--r--xmlspec/doc/map_rpm.html360
-rw-r--r--xmlspec/doc/map_spec.html277
-rw-r--r--xmlspec/spec2xml.cpp62
9 files changed, 1124 insertions, 0 deletions
diff --git a/xmlspec/XMLMisc.cpp b/xmlspec/XMLMisc.cpp
new file mode 100644
index 000000000..6265e10d5
--- /dev/null
+++ b/xmlspec/XMLMisc.cpp
@@ -0,0 +1,96 @@
+// standard c includes
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+using namespace std;
+
+char* g_szaDays[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL };
+char* g_szaMonths[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL };
+int g_naLengths[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+char* g_szaBools[] = { "no", "yes", "false", "true", "0", "1", NULL };
+
+char* splitStr(const char* szInput,
+ char cTerm,
+ int& nLen)
+{
+ nLen = 0;
+ while (szInput[nLen] != cTerm && szInput[nLen] != '\0') {
+ nLen++;
+ }
+ char* szTemp = ((char*)szInput)+nLen;
+ while (*szTemp == cTerm && *szTemp != '\0')
+ szTemp++;
+ return szTemp;
+}
+
+int findStr(char* szaMatches[],
+ const char* szValue,
+ int nLen = -1)
+{
+ for (unsigned int i = 0; szaMatches[i] != NULL; i++) {
+ if (strcmp(szaMatches[i], "*") == 0)
+ return i;
+ else if (nLen == -1) {
+ if (strcasecmp(szaMatches[i], szValue) == 0)
+ return i;
+ }
+ else if (strncasecmp(szaMatches[i], szValue, nLen) == 0)
+ return i;
+ }
+ return -1;
+}
+
+bool isInteger(const char* szValue,
+ int nLen = -1)
+{
+ if (nLen == -1)
+ nLen = strlen(szValue);
+ for (unsigned int i = 0; i < strlen(szValue); i++) {
+ if (szValue[i] < '0' || szValue[i] > '9')
+ return false;
+ }
+ return true;
+}
+
+bool isBool(const char* szValue,
+ int nLen = -1)
+{
+ return findStr(g_szaBools, szValue, nLen) != -1 ? true : false;
+}
+
+bool isDate(const char* szValue)
+{
+ int nLen, nPos;
+ char* szTemp = splitStr(szValue, ' ', nLen);
+ if ((nPos = findStr(g_szaDays, szValue, nLen)) != -1) {
+ if ((nPos = findStr(g_szaMonths, szTemp, nLen)) != -1) {
+ szTemp = splitStr(szTemp, ' ', nLen);
+ char* szBuffer = new char[nLen+1];
+ sprintf(szBuffer, "%s", szTemp);
+ szBuffer[nLen] = '\0';
+ if (atoi(szBuffer) <= g_naLengths[nPos]) {
+ delete[] szBuffer;
+ szTemp = splitStr(szTemp, ' ', nLen);
+ return isInteger(szTemp, nLen);
+ }
+ delete[] szBuffer;
+ }
+ }
+ return false;
+}
+
+bool isEmail(const char* szValue)
+{
+ bool bFound = false;
+ for (unsigned int j = 0; j < strlen(szValue); j++) {
+ if (szValue[j] == '@') {
+ if (bFound)
+ return false;
+ else
+ bFound = true;
+ }
+ }
+ return bFound;
+}
diff --git a/xmlspec/XMLMisc.h b/xmlspec/XMLMisc.h
new file mode 100644
index 000000000..d47fa57b6
--- /dev/null
+++ b/xmlspec/XMLMisc.h
@@ -0,0 +1,66 @@
+#ifndef _H_XMLMISC_
+#define _H_XMLMISC_
+
+extern char* g_szaDays[];
+extern char* g_szaMonths[];
+
+/**
+ * Splits the input string according to the terminator, returning
+ * the length and the new search position
+ * .
+ * @param szInput The input string
+ * @param cTerm The terminating character
+ * @param nLen the length buffer
+ * @return The next string position
+ **/
+extern char* splitStr(const char* szInput,
+ char cTerm,
+ int& nLen);
+
+/**
+ * Finds a string in an array of potential matches
+ * .
+ * @param szaMatches The potential matches
+ * @param szValue The value to search for
+ * @return The position on success, -1 if not found
+ **/
+extern int findStr(char* szaMatches[],
+ const char* szValue,
+ int nLen = -1);
+
+/**
+ * Checks if a string contains an integer
+ * .
+ * @param szValue The string to check
+ * @param nLen The length to check, -1 to end of string
+ * @return true if the string is an integer, false otherwise
+ **/
+extern bool isInteger(const char* szValue,
+ int nLen = -1);
+
+/**
+ * Checks if a string contains a boolean value
+ * .
+ * @param szValue The value to check
+ * @return true if we have a boolean, false otherwise
+ **/
+extern bool isBool(const char* szValue,
+ int nLen = -1);
+
+/**
+ * Checks if a string is in a valid date format
+ * .
+ * @param szValue The string to check
+ * @return true is this is a date, false otherwise
+ **/
+extern bool isDate(const char* szValue);
+
+/**
+ * Checks if a string contains a valid e-mail address
+ * .
+ * @param szValue the string to check
+ * @return true if this is an email address, false otherwise
+ **/
+extern bool isEmail(const char* szValue);
+
+#endif
diff --git a/xmlspec/XMLRPMWrap.cpp b/xmlspec/XMLRPMWrap.cpp
new file mode 100644
index 000000000..eaacf4913
--- /dev/null
+++ b/xmlspec/XMLRPMWrap.cpp
@@ -0,0 +1,72 @@
+// standard c++ includes
+#include <string>
+#include <vector>
+
+// rpm includes
+#include <rpmlib.h>
+#include <rpmbuild.h>
+
+// type definitions
+typedef vector<string> t_StrVector;
+
+using namespace std;
+
+bool getRPMHeader(Header header,
+ int_32 nTag,
+ string& rResult)
+{
+ if (headerIsEntry(header, nTag)) {
+ int_32 nCount, nTagType;
+ void* pBuffer;
+ if (!headerGetEntry(header, nTag, &nTagType, &pBuffer, &nCount))
+ return false;
+ char szTemp[32];
+ switch (nTagType) {
+ case RPM_INT32_TYPE:
+ sprintf(szTemp, "%d", *((int_32*)pBuffer));
+ rResult.assign(szTemp);
+ default:
+ rResult.assign((char*)pBuffer);
+ break;
+ }
+ headerFreeData(pBuffer, (rpmTagType_e)nTagType);
+ return true;
+ }
+ else
+ return false;
+}
+
+bool getRPMHeaderArray(Header header,
+ int_32 nTag,
+ t_StrVector& rvResult)
+{
+ rvResult.clear();
+ if (headerIsEntry(header, nTag)) {
+ int_32 nCount, nTagType;
+ void* pBuffer;
+ if (!headerGetEntry(header, nTag, &nTagType, &pBuffer, &nCount))
+ return false;
+ if (nTagType == RPM_STRING_ARRAY_TYPE || nTagType == RPM_I18NSTRING_TYPE) {
+ for (int_32 i = 0; i < nCount; i++)
+ rvResult.push_back(((char**)pBuffer)[i]);
+ }
+ else
+ rvResult.push_back((char*)pBuffer);
+ headerFreeData(pBuffer, (rpmTagType_e)nTagType);
+ return true;
+ }
+ else
+ return false;
+}
+
+bool getRPMMacro(const char* szMacro,
+ string& rResult)
+{
+ char* szValue = rpmExpand(szMacro, NULL);
+ if (szValue) {
+ rResult.assign(szValue);
+ return true;
+ }
+ else
+ return false;
+}
diff --git a/xmlspec/XMLRPMWrap.h b/xmlspec/XMLRPMWrap.h
new file mode 100644
index 000000000..d7417610a
--- /dev/null
+++ b/xmlspec/XMLRPMWrap.h
@@ -0,0 +1,49 @@
+#ifndef _H_XMLRPMWRAP_
+#define _H_XMLRPMWRAP_
+
+// standard C++ includes
+#include <string>
+#include <vector>
+
+// rpm includes
+#include <rpmlib.h>
+
+// type definitions
+typedef vector<string> t_StrVector;
+
+/**
+ * Gets an RPM header after checking that is does exist.
+ * .
+ * @param header The RPM header to interrogate
+ * @param nTag The header tag to extract
+ * @param rResult The string to populate with the result
+ * @return true on success, false otherwise
+ **/
+extern bool getRPMHeader(Header header,
+ int_32 nTag,
+ std::string& rResult);
+
+/**
+ * Gets an RPM header array into a vector after checking that it
+ * does indeed exist
+ * .
+ * @param header The RPM header to interrogate
+ * @param nTag The header tag to extract
+ * @param rvResult The vector<string> to populate with the result
+ * @return true on success, false otherwise
+ **/
+extern bool getRPMHeaderArray(Header header,
+ int_32 nTag,
+ t_StrVector& rvResult);
+
+/**
+ * Gets a specific RPM macro
+ * .
+ * @param szMacro The macro to get the value of
+ * @param rResult The string to populate with the result
+ * @return true on success, false otherwise
+ **/
+extern bool getRPMMacro(const char* szMacro,
+ std::string& rResult);
+
+#endif
diff --git a/xmlspec/XMLText.cpp b/xmlspec/XMLText.cpp
new file mode 100644
index 000000000..3c2b04d5a
--- /dev/null
+++ b/xmlspec/XMLText.cpp
@@ -0,0 +1,23 @@
+// our includes
+#include "XMLText.h"
+
+using namespace std;
+
+XMLText::XMLText(const char* szText,
+ const char* szLang)
+ : XMLBase()
+{
+ setText(szText);
+ setLang(szLang);
+}
+
+XMLText::XMLText(const XMLText& rText)
+ : XMLBase()
+{
+ setText(rText.m_sText.c_str());
+ setLang(rText.m_sLang.c_str());
+}
+
+XMLText::~XMLText()
+{
+}
diff --git a/xmlspec/XMLText.h b/xmlspec/XMLText.h
new file mode 100644
index 000000000..4b0f4dccf
--- /dev/null
+++ b/xmlspec/XMLText.h
@@ -0,0 +1,119 @@
+#ifndef _H_XMLTEXT_
+#define _H_XMLTEXT_
+
+// standard c++ includes
+#include <string>
+
+// our includes
+#include "XMLBase.h"
+
+using namespace std;
+
+class XMLText : public XMLBase
+{
+//
+// constructors/destructor
+//
+public:
+ /**
+ * Default constructor
+ * .
+ * @param szText The text to add
+ * @param szLang The text's language
+ * @return none
+ **/
+ XMLText(const char* szText,
+ const char* szLang = NULL);
+
+ /**
+ * Copy constructor
+ * .
+ * @param rText reference to the text to copy
+ * @return none
+ **/
+ XMLText(const XMLText& rText);
+
+ /**
+ * Default destructor
+ * .
+ * @param none
+ * @return none
+ **/
+ ~XMLText();
+
+//
+// get/set methods for internal variables
+//
+public:
+ /**
+ * Sets the text
+ * .
+ * @param szText The text
+ * @return none
+ **/
+ void setText(const char* szText)
+ {
+ if (szText)
+ m_sText.assign(szText);
+ }
+
+ /**
+ * Gets the text
+ * .
+ * @param none
+ * @return string containing the text
+ **/
+ const char* getText()
+ {
+ return m_sText.c_str();
+ }
+
+ /**
+ * Tests if we have a language for this description
+ * .
+ * @param none
+ * @return true if we have a language, false otherwise
+ **/
+ bool hasLang()
+ {
+ return m_sLang.length() ? true : false;
+ }
+
+ /**
+ * Sets the language
+ * .
+ * @param szLang The language
+ * @return none
+ **/
+ void setLang(const char* szLang)
+ {
+ if (szLang) {
+ // FIXME: We need to get the actual default language as specified
+ // in one of the RPM headers (which I cannot find now) and
+ // substitute it here. (I know the value is "C", bu we should
+ // use the define.)
+ if (strcmp(szLang, "C") != 0)
+ m_sLang.assign(szLang);
+ }
+ }
+
+ /**
+ * Gets the language
+ * .
+ * @param none
+ * @return string containing the language
+ **/
+ const char* getLang()
+ {
+ return m_sLang.c_str();
+ }
+
+//
+// member variables
+//
+public:
+ string m_sText;
+ string m_sLang;
+};
+
+#endif
diff --git a/xmlspec/doc/map_rpm.html b/xmlspec/doc/map_rpm.html
new file mode 100644
index 000000000..d1932c350
--- /dev/null
+++ b/xmlspec/doc/map_rpm.html
@@ -0,0 +1,360 @@
+<html>
+<head><title>RPM XML Specification</title></head>
+<body>
+<h3>XML spec to RPM spec tag mapping</h3>
+<h3>Global Mapping</h3>
+<table with="100%" border="2" cellpadding="2" cellspacing="0">
+<tr>
+ <td><pre><b>RPM Tag</b></pre></td>
+ <td><pre><b>XML Tag/Attribute</b></pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>BuildRoot: <i>path</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec buildroot=&quot;<i>path</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Copyright: <i>GPL</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec copyright=&quot;<i>GPL</i>&quot; /&gt;&nbsp;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Distribution: <i>Wendy&apos;s Linux</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec distribution=&quot;<i>Wendy&apos;s Linux</i>&quot; /&gt;&nbsp;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Epoch: <i>1</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec epoch=&quot;<i>1</i>&quot; /&gt;&nbsp;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>ExcludeArch: <i></i>&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>ExcludeOS: <i></i>&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>ExclusiveArch: <i></i>&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>ExclusiveOS: <i></i>&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Icon: <i></i>&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Name: <i>coolpkg</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec name=&quot;<i>coolpkg</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>NoPatch: <i>donotsend.patch.bz2</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;nopatch name=&quot;<i>donotsend.patch.bz2</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>NoSource: <i>donotdistro.tar.gz</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;nosource name=&quot;<i>donotdistro.tar.bz2</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Packager: <i>Wendy Penguin &lt;wendy@tux.org&gt;</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec packager=&quot;<i>Wendy Penguin</i>&quot;&nbsp;
+ packager-email=&quot;<i>wendy@tux.org</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Patch: <i>patch.bz2</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;patch name=&quot;<i>patch.bz2</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Prefix:&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Release: <i>1</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec release=&quot;<i>1</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Source: <i>ftp://wendy-penguin.org/pub/source.tar.bz2</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;source name=&quot;<i>source.tar.bz2</i>&quot;&gt;&nbsp;
+ &lt;mirror path=&quot;<i>ftp://wendy-penguin.org/pub/</i>&quot;&nbsp;
+ description=&quot;<i>Wendy&apos;s Playpen</i>&quot; /&gt;&nbsp;
+ &lt;/source&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Vendor: <i>Wendy Penguin, Inc.</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec vendor=&quot;<i>Wendy Penguin, Inc.</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Version: <i>1.0</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec version=&quot;<i>1.0</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>URL: <i>http://wendy-penguin.org/example/</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec url=&quot;<i>http://wendy-penguin.org/example/</i>&quot; /&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%build&nbsp;
+<i>make</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;build&gt;&nbsp;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>make</i>&lt;/script&gt;&nbsp;
+ &lt;/build&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%clean&nbsp;
+<i>rm -rf %{buildroot}</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;clean&gt;&nbsp;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>rm -rf %{buildroot}</i>&lt;/script&gt;&nbsp;
+ &lt;/clean&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%define <i>whackall cd / ; rm -rf *</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;macro name=&quot;<i>whackall</i>&quot;&gt;<i>cd / ; rm -rf *</i>&lt;/macro&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%install&nbsp;
+<i>make install</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;install&gt;&nbsp;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>make install</i>&lt;/script&gt;&nbsp;
+ &lt;/install&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%patch&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%prep&nbsp;
+<i>tar -xjvf %{SOURCE0}</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;prep&gt;&nbsp;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>tar -xjvf %{SOURCE0}</i>&lt;/script&gt;&nbsp;
+ &lt;/prep&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%setup&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+</table>
+
+<h3>Package Mapping</h3>
+<table with="100%" border="2" cellpadding="2" cellspacing="0">
+<tr>
+ <td><pre><b>RPM Tag</b></pre></td>
+ <td><pre><b>XML Tag/Attribute</b></pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>AutoReqProv: <i>No</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package autoreqprov=&quot;<i>no</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre>or<pre>&lt;spec&gt;&nbsp;
+ &lt;package autoreq=&quot;<i>no</i>&quot;
+ autoprov=&quot;<i>no</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>BuildRequires: <i>rpm, wendyhouse-devel = 0.5</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;&nbsp;
+ &lt;buildrequires&gt;&nbsp;
+ &lt;package name=&quot;<i>rpm</i>&quot; /&gt;&nbsp;
+ &lt;package name=&quot;<i>wendyhouse-devel</i>&quot; version=&quot;<i>0.5</i>&quot; cmp=&quot;<i>eq</i>&quot; /&gt;&nbsp;
+ &lt;/buildrequires&gt;&nbsp;
+ &lt;/package&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Conflicts: <i>penguin &lt; 1.0, wendyhouse &gt;= 0.6</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;&nbsp;
+ &lt;conflicts&gt;&nbsp;
+ &lt;package name=&quot;<i>penguin</i>&quot; version=&quot;<i>1.0</i>&quot; cmp=&quot;<i>lt</i>&quot; /&gt;&nbsp;
+ &lt;package name=&quot;<i>wendyhouse</i>&quot; version=&quot;<i>0.6</i>&quot; cmp=&quot;<i>ge</i>&quot; /&gt;&nbsp;
+ &lt;/conflicts&gt;&nbsp;
+ &lt;/package&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Group: <i>Applications/Toys</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package group=&quot;<i>Applications/Toys</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Provides: <i>coolpkg, example</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;&nbsp;
+ &lt;provides&gt;&nbsp;
+ &lt;package name=&quot;<i>coolpkg</i>&quot; /&gt;&nbsp;
+ &lt;package name=&quot;<i>example</i>&quot; /&gt;&nbsp;
+ &lt;/provides&gt;&nbsp;
+ &lt;/package&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Requires: <i>XFree86 > 4.1</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;&nbsp;
+ &lt;requires&gt;&nbsp;
+ &lt;package name=&quot;<i>XFree76</i>&quot; version=&quot;<i>4.1</i>&quot; cmp=&quot;<i>gt</i>&quot; /&gt;&nbsp;
+ &lt;/requires&gt;&nbsp;
+ &lt;/package&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Summary: <i>Wendy&apos;s really cool package</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;&nbsp;
+ &lt;summary&gt;<i>Wendy&apos;s really cool package</i>&lt;/summary&gt;&nbsp;
+ &lt;/package&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%description <i>toys</i>&nbsp;
+<i>Wendy&apos;s cool package provides a new way&nbsp;
+of wasting all that extra time at work.<i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package name=&quot;<i>toys</i>&quot;&gt;&nbsp;
+ &lt;description&gt;
+ <i>Wendy&apos;s cool package provides a new way&nbsp;
+ of wasting all that extra time at work.</i>&nbsp;
+ &lt;/description&gt;&nbsp;
+ &lt;/package&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%package -n <i>something-else</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package name=&quot;<i>something-else</i>&quot;&nbsp;
+ sub=&quot;<i>no</i>&quot; /&gt;&nbsp;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%pre&nbsp;
+<i>/sbin/ldconfig</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;pre interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt/pre&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%preun&nbsp;
+<i>/sbin/ldconfig</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;preun interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt/preun&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%post&nbsp;
+<i>/sbin/ldconfig</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;post interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt/post&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%postun&nbsp;
+<i>/sbin/ldconfig</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;postun interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt/postun&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%verifyscript&nbsp;
+<i>/sbin/ldconfig</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;verify interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt/verify&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+</table>
+
+<h3>File Mapping</h3>
+<table with="100%" border="2" cellpadding="2" cellspacing="0">
+<tr>
+ <td><pre><b>RPM Tag</b></pre></td>
+ <td><pre><b>XML Tag/Attribute</b></pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%attr(<i>755,root,root</i>) <i>/usr/bin/coolpkg</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;files&gt;
+ &lt;file attr=&quot;<i>755</i>&quot; uid=&quot;<i>root</i>&quot; gid=&quot;<i>root</i>&quot;&gt;<i>/usr/bin/coolpkg</i>&lt;/file&gt;
+ &lt/files&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%config(<i>noreplace</i>) <i>/etc/coolpkg</i>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;files&gt;
+ &lt;file config=&quot;<i>noreplace</i>&quot;&gt;<i>/etc/coolpkg</i>&lt;/file&gt;
+ &lt/files&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%defattr(<i>-,root,root</i>)&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;files uid=&quot;<i>root</i>&quot; gid=&quot;<i>root</i>&quot; /&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%doc&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%docdir&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%files&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;spec&gt;&nbsp;
+ &lt;package&gt;
+ &lt;files /&gt;
+ &lt;/package&gt;
+&lt;/spec&gt;&nbsp;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%verify&nbsp;</pre></td>
+ <td valign="top"><pre>&nbsp;</pre></td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/xmlspec/doc/map_spec.html b/xmlspec/doc/map_spec.html
new file mode 100644
index 000000000..d7db44f45
--- /dev/null
+++ b/xmlspec/doc/map_spec.html
@@ -0,0 +1,277 @@
+<html>
+<head><title>RPM XML Specification</title></head>
+<body>
+<h3>XML spec to RPM spec tag mappings</h3>
+This provides an as-built documentation of the actual implemented
+functionality. Main things missing: %doc, %dir, %config in %files section;
+%exc*[os,arch] functionality.
+<p>
+<table with="100%" border="2" cellpadding="2" cellspacing="0">
+<tr>
+ <td><pre><b>RPM Tag</b></pre></td>
+ <td><pre><b>XML Tag/Attribute</b></pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>&nbsp;</pre></td>
+ <td valign="top"><pre>&lt;?xml version=&quot;1.0&quot;?&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre># <i>This is just a comment</i></pre></td>
+ <td valign="top"><pre>&lt;!-- <i>This is just a comment</i> --&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>&nbsp;
+Distribution: <i>Wendy&apos;s Own Distro</i>
+Vendor: <i>Wendy&apos;s Toys, Inc.</i>
+Packager: <i>Wendy &lt;wendy@wendys-distro.org&gt;</i>
+
+Name: <i>coolpkg</i>
+Version: <i>1.0</i>
+Release: <i>2</i>
+Epoch: <i>1</i>
+Copyright: <i>GPL</i>
+URL: <i>http://www.coolpkg.org</i>
+BuildRoot: <i>%{tmppath}/wendy-build</i></pre></td>
+ <td valign="top"><pre>&lt;spec&nbsp;
+ distribution=&quot;<i>Wendy&apos;s Own Distro</i>&quot;
+ vendor=&quot;<i>Wendy&apos;s Toys, Inc.</i>&quot;
+ packager=&quot;<i>Wendy</i>&quot;
+ packager-email=&quot;<i>wendy@wendys-distro.org</i>&quot;
+ name=&quot;<i>coolpkg</i>&quot;
+ version=&quot;<i>1.0</i>&quot;
+ release=&quot;<i>2</i>&quot;
+ epoch=&quot;<i>1</i>&quot;
+ copyright=&quot;<i>GPL</i>&quot;
+ url=&quot;<i>http://www.coolpkg.org</i>&quot;
+ buildroot=&quot;<i>%{tmppath}/wendy-build</i>&quot;&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%define <i>whackall cd / ; rm -rf *</i></pre></td>
+ <td valign="top"><pre> &lt;macro name=&quot;<i>whackall</i>&quot;&gt;<i>cd / ; rm -rf *</i>&lt;/macro&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Source: <i>ftp://ftp.coolpkg.org/pub/coolpkg-1.0.tar.bz2</i></pre></td>
+ <td valign="top"><pre> &lt;source name=&quot;<i>coolpkg-1.0.tar.bz2</i>&quot; size=&quot;<i>123456</i>&quot; md5=&quot;<i>bb80a5d06a48623ecbe3f2d41cac15f9</i>&quot;&gt;
+ &lt;mirror=&quot;<i>ftp://ftp.coolpkg.org/pub/</i>&quot; description=&quot;<i>CoolPkg Main Site</i>&quot; /&gt;
+ &lt;mirror=&quot;<i>ftp://ftp.wendys-distro.org/pub/</i>&quot; description=&quot;<i>Wendy&apos; Site</i>&quot; /&gt;
+ &lt;/source&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Source1: <i>coolpkg-toys-1.0.tar.bz2</i></pre></td>
+ <td valign="top"><pre> &lt;source name=&quot;<i>coolpkg-toys-1.0.tar.bz2</i>&quot; num="1" /&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>NoSource23: <i>wendy-cooladdons-1.0.tar.bz2</i></pre></td>
+ <td valign="top"><pre> &lt;nosource name=&quot;<i>wendy-cooladdons-1.0.tar.bz2</i>&quot; num="26" /&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Patch6: <i>ftp://ftp.coolpkg.org/pub/cool.patch.bz2</i></pre></td>
+ <td valign="top"><pre> &lt;patch name=&quot;<i>cool.patch.tar.bz2</i>&quot; num="6"&gt;
+ &lt;mirror=&quot;<i>ftp://ftp.coolpkg.org/pub/</i>&quot; description=&quot;<i>CoolPkg Main Site</i>&quot; /&gt;
+ &lt;/patch&gt;
+ </pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%prep
+<i>cd $RPM_BUILD_ROOT
+tar -xjvf %{SOURCE0}</i></pre></td>
+ <td valign="top"><pre> &lt;prep interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>cd $RPM_BUILD_ROOT</i>&lt;/script&gt;
+ &lt;script&gt;<i>tar -xjvf %{SOURCE0}</i>&lt;/script&gt;
+ &lt;/prep&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%build
+<i>make PREFIX=/usr</i></pre></td>
+ <td valign="top"><pre> &lt;build&gt;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>make</i>&lt;/script&gt;
+ &lt;/build&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%install
+<i>make DESTDIR=%{buildroot} install</i></pre></td>
+ <td valign="top"><pre> &lt;install interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>make DESTDIR=%{buildroot} install</i>&lt;/script&gt;
+ &lt;/install&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%clean
+<i>rm -rf %{buildroot}</pre></td>
+ <td valign="top"><pre> &lt;clean interpreter=&quot;<i>/bin/sh</i>&quot;&gt;
+ &lt;script&gt;<i>rm -rf %{buildroot}</i>&lt;/script&gt;
+ &lt;/clean&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Group: <i>Applications/Toys</i>
+AutoReqProv: <i>No</i></pre></td>
+ <td valign="top"><pre> &lt;package group=&quot;<i>Applications/Toys</i>&quot;
+ autoreqprov=&quot;<i>no</i>&quot;&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>BuildRequires: <i>gcc >= 2.95</i></pre></td>
+ <td valign="top"><pre> &lt;buildrequires&gt;
+ &lt;package name=&quot;<i>gcc</i>&quot; cmp=&quot;<i>ge</i>&quot; version=&quot;<i>2.95</i>&quot; /&gt;
+ &lt;/buildrequires&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Conflicts: <i>othercool &lt; 0.5</i></pre></td>
+ <td valign="top"><pre> &lt;conflicts&gt;
+ &lt;package name=&quot;<i>othercool</i>&quot; cmp=&quot;<i>lt</i>&quot; version=&quot;<i>0.5</i>&quot; /&gt;
+ &lt;/conflicts&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Obsoletes: <i>oldcool</i></pre></td>
+ <td valign="top"><pre> &lt;obsoletes&gt;
+ &lt;package name=&quot;<i>oldcool</i>&quot; /&gt;
+ &lt;/obsoletes&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Summary: <i>Coolpkg is just cool</i></pre></td>
+ <td valign="top"><pre> &lt;summary&gt;<i>Coolpkg is just cool</i>&lt;/summary&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%description
+<i>Coolpkg provides lots of little toys designed
+to keep you unproductive at work.</pre></td></i>
+ <td valign="top"><pre> &lt;description&gt;
+ <i>Coolpkg provides lots of little toys designed
+ to keep you unproductive at work.</i>
+ &lt;/description&gt;</b></pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%files
+%defattr(<i>-,root,root</i>)
+<i>/usr/bin/coolpkg</i>
+%attr(<i>700,-,-</i>) <i>/usr/sbin/cooladmin</i>
+%config(<i>noreplace</i>) <i>/etc/coolpkg</i></pre></td>
+ <td valign="top"><pre> &lt;files&nbsp;
+ uid=&quot;<i>root</i>&quot; uid=&quot;<i>root</i>&quot;&gt;
+ &lt;file&gt;/usr/bin/coolpkg&lt;/file&gt;
+ &lt;file attr=&quot;<i>700</i>&quot;&gt;<i>/usr/sbin/cooladmin</i>&lt;/file&gt;
+ &lt;file config=&quot;<i>noreplace</i>&quot;&gt;<i>/etc/coolpkg</i>&lt;/file&gt;
+ &lt;/files&gt;
+ &lt;/package&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%package <i>devel</i>
+Group: <i>Development/Toys</i></pre></td>
+ <td valign="top"><pre> &lt;package name=&quot;<i>devel</i>&quot;
+ group=&quot;<i>Development/Toys</i>&quot;&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Summary: <i>Coolpkg development headers</i>
+%description <i>devel</i>
+<i>%{summary}</i></pre></td>
+ <td valign="top"><pre> &lt;summary&gt;<i>Coolpkg development headers</i>&lt;/summary&gt;
+ &lt;description&gt;
+ <i>%{summary}</i>
+ &lt;/description&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%files <i>devel</i>
+%attr(<i>644,root,root</i>) <i>/usr/include/coolpkg.h</i></pre></td>
+ <td valign="top"><pre> &lt;files&gt;
+ &lt;file attr=&quot;<i>644</i>&quot; uid=&quot;<i>root</i>&quot; gid=&quot;<i>root</i>&quot;&gt;<i>/usr/include/coolpkg</i>&lt;/file&gt;
+ &lt;/files&gt;
+ &lt;/package&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%package <i>-n wendytoy</i>
+Group: <i>Applications/Toys</i></pre></td>
+ <td valign="top"><pre> &lt;package name=&quot;<i>wendytoy</i>&quot; sub=&quot;<i>no</i>&quot;
+ group=&quot;<i>Applications/Toys</i>&quot;&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Provides: <i>wendy-toys</i></pre></td>
+ <td valign="top"><pre> &lt;provides&gt;
+ &lt;package name=&quot;<i>wendy-toys</i>&quot; /&gt;
+ &lt;/provides&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Requires: <i>coolpkg</i></pre></td>
+ <td valign="top"><pre> &lt;requires&gt;
+ &lt;package name=&quot;<i>coolpkg</i>&quot; /&gt;
+ &lt;/requires&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>Summary: <i>Exciting additions by Wendy</i>
+%description <i>-n wendytoy</i>
+<i>%{summary}
+And Wendy does it again - taking a good
+package to brilliant heights</i></pre></td>
+ <td valign="top"><pre> &lt;summary&gt;<i>Exciting additions by Wendy</i>&lt;/summary&gt;
+ &lt;description&gt;
+ <i>%{summary}
+ And Wendy does it again - taking a good
+ package to brilliant heights</i>
+ &lt;/description&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%files <i>-n wendytoys</i>
+%defattr(<i>-,root,root</i>)
+<i>/usr/bin/wendytoy</i>
+<i>/usr/lib/wendytoy.so.1</i></pre></td>
+ <td valign="top"><pre> &lt;files
+ uid=&quot;<i>root</i>&quot; gid=&quot;<i>root</i>&quot;&gt;
+ &lt;file&gt;<i>/usr/bin/wendytoy</i>&lt;/file&gt;
+ &lt;file&gt;<i>/usr/lib/wendytoy.so.1</i>&lt;/file&gt;
+ &lt;/files&gt;<i></i></pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%pre <i>-n wendytoy</i>
+<i>/usr/bin/coolpkg</i></pre></td>
+ <td valign="top"><pre> &lt;pre&gt;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>/usr/bin/coolpkg</i>&lt;/script&gt;
+ &lt;/pre&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%post <i>-n wendytoy</i>
+<i>/sbin/ldconfig</i></pre></td>
+ <td valign="top"><pre> &lt;post&gt;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt;/post&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%preun <i>-n wendytoy</i>
+<i>/usr/bin/coolpkg</i></pre></td>
+ <td valign="top"><pre> &lt;post&gt;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>/usr/bin/coolpkg</i>&lt;/script&gt;
+ &lt;/preun&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%postun <i>-n wendytoy</i>
+<i>/sbin/ldconfig</i></pre></td>
+ <td valign="top"><pre> &lt;postun&gt;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>/sbin/ldconfig</i>&lt;/script&gt;
+ &lt;/postun&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%verifyscript <i>-n wendytoy</i>
+<i>/sbin/ldconfig -v</i></pre></td>
+ <td valign="top"><pre> &lt;verify&gt;
+ &lt;script interpreter=&quot;<i>/bin/sh</i>&quot;&gt;<i>/sbin/ldconfig -v</i>&lt;/script&gt;
+ &lt;/verify&gt;
+ &lt;/package&gt;</pre></td>
+</tr>
+<tr>
+ <td valign="top"><pre>%changelog
+* <i>Sun May 05 2002 Wendy &lt;wendy@wendys-distro.org&gt; 1.0-2</i>
+- <i>Added some extra files</i>
+- <i>Created the wendytoy package as well</i>
+
+* <i>Thu Feb 28 2002 Wendy &lt;wendy@wendys-distro.org&gt; 1.0-1</i>
+- <i>Initial package created</i></pre></td>
+ <td valign="top"><pre> &lt;changelog&gt;
+ &lt;changes date=&quot;<i>Sun May 05 2002</i>&quot; author=&quot;<i>Wendy</i>&quot; author-email=&quot;<i>wendy@wendys-distro.org</i>&quot; version=&quot;<i>1.0-2</i>&quot;&gt;
+ &lt;change&gt;Added some extra files&lt;/change&gt;
+ &lt;change&gt;Created the wendytoy package as well&lt;/change&gt;
+ &lt;/changes&gt;
+ &lt;changes date=&quot;<i>Thu Feb 28 2002</i>&quot; author=&quot;<i>Wendy</i>&quot; author-email=&quot;<i>wendy@wendys-distro.org</i>&quot; version=&quot;<i>1.0-1</i>&quot;&gt;
+ &lt;change&gt;Initial package created&lt;/change&gt;
+ &lt;/changes&gt;
+ &lt;/changelog&gt;
+&lt;/spec&gt;</pre></td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/xmlspec/spec2xml.cpp b/xmlspec/spec2xml.cpp
new file mode 100644
index 000000000..4f398f123
--- /dev/null
+++ b/xmlspec/spec2xml.cpp
@@ -0,0 +1,62 @@
+// standard C++ includes
+#include <fstream>
+
+// our includes
+#include "XMLSpec.h"
+
+// rpm includes
+#include <rpmbuild.h>
+
+// display some usage
+int usage()
+{
+ printf("Usage: spec2xml input [output]\n");
+ printf("Converts the input pkg.spec file to a pkg.spec.xml\n");
+ printf("file for use in an rpmbuild command.\n\n");
+ return 1;
+}
+
+// program entry point
+int main(int argc,
+ char** argv)
+{
+ printf("\nspec2xml, version 0.01\n");
+ if (argc != 2 && argc != 3) {
+ usage();
+ return 1;
+ }
+
+ Spec pSpec = NULL;
+ printf("Parsing RPM spec %s:\n", argv[1]);
+ if (!parseSpec(&pSpec, argv[1], "/", "/var/tmp", 0, NULL, NULL, 1, 0)) {
+ printf("\tOk, spec parsed.\n");
+ printf("Creating XML structures:\n");
+ XMLSpec* pXSpec = XMLSpec::structCreate(pSpec);
+ if (pXSpec) {
+ printf("\tOk, structures created.\n");
+ if (argc == 3) {
+ printf("Writing XML to %s ... ", argv[2]);
+ ofstream fOut(argv[2]);
+ if (fOut.is_open()) {
+ pXSpec->toXMLFile(fOut);
+ fOut.close();
+ printf("Ok.\n");
+ }
+ else {
+ delete pSpec;
+ printf("Failed.\n");
+ return 2;
+ }
+ }
+ else if (argc == 2) {
+ pXSpec->toXMLFile(cout);
+ }
+
+ delete pSpec;
+ return 0;
+ }
+ }
+
+ printf("\tFailed.\n");
+ return 3;
+}