GENHTML = genhtml
SUBDIRS = gnulib/lib include src daemon tools proxy docs gnulib/tests \
- python tests po examples/domain-events/events-c examples/hellolibvirt
+ python tests po examples/domain-events/events-c examples/hellolibvirt \
+ examples/dominfo examples/domsuspend examples/python
ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4
cp -f COPYING.LIB COPYING
AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
- docs/examples/Makefile docs/devhelp/Makefile \
- docs/examples/python/Makefile \
+ docs/devhelp/Makefile \
docs/schemas/Makefile \
gnulib/lib/Makefile \
gnulib/tests/Makefile \
tests/xencapsdata/Makefile \
tests/confdata/Makefile \
examples/domain-events/events-c/Makefile \
+ examples/domsuspend/Makefile \
+ examples/dominfo/Makefile \
+ examples/python/Makefile \
examples/hellolibvirt/Makefile)
AC_MSG_NOTICE([])
## Process this file with automake to produce Makefile.in
-SUBDIRS= schemas examples devhelp
+SUBDIRS= schemas devhelp
# The directory containing the source code (if it contains documentation).
DOC_SOURCE_DIR=../src
+++ /dev/null
-# -*- buffer-read-only: t -*- vi: set ro:
-# Beware this is autogenerated by index.py
-SUBDIRS=python
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include
-DEPS = $(top_builddir)/src/libvirt.la
-LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS)
-
-rebuild: examples.xml index.html
-
-examples.xml: index.py info1.c suspend.c
- -@($(srcdir)/index.py)
-
-index.html: examples.xml examples.xsl $(top_srcdir)/docs/site.xsl
- -@(if [ -x $(XSLTPROC) ] ; then \
- $(XSLTPROC) examples.xsl examples.xml \
- && echo "Rebuilt web page" \
- && xmllint --valid --noout index.html; \
- fi)
-
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
- -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml \
- $(srcdir)/*.xsl $(DESTDIR)$(HTML_DIR)
-
-EXTRA_DIST=examples.xsl index.py examples.xml
-
-noinst_PROGRAMS=info1 suspend
-
-info1_SOURCES=info1.c
-info1_LDFLAGS=
-info1_DEPENDENCIES= $(DEPS)
-info1_LDADD= $(LDADDS)
-
-suspend_SOURCES=suspend.c
-suspend_LDFLAGS=
-suspend_DEPENDENCIES= $(DEPS)
-suspend_LDADD= $(LDADDS)
-
-valgrind:
- $(MAKE) CHECKER='valgrind' tests
-
-tests: $(noinst_PROGRAMS)
- @(echo '## examples regression tests')
- @($(CHECKER) ./info1)
- @($(CHECKER) ./suspend)
+++ /dev/null
-<examples>
- <example filename='info1.c'>
- <synopsis>Extract information about Xen domain 0</synopsis>
- <purpose>Demonstrate the basic use of the library to connect to the hypervisor and extract domain information.</purpose>
- <usage>info1</usage>
- <test>info1</test>
- <author>Daniel Veillard</author>
- <copy>see Copyright for the status of this software. </copy>
- <section>Informations</section>
- <includes>
- </includes>
- <uses>
- <function line='43' file='libvirt' name='virDomainGetInfo'/>
- <function line='53' file='libvirt' name='virDomainFree'/>
- <function line='36' file='libvirt' name='virDomainLookupByID'/>
- <function line='55' file='libvirt' name='virConnectClose'/>
- <struct line='25' file='libvirt' name='virDomainInfo'/>
- <function line='29' file='libvirt' name='virConnectOpenReadOnly'/>
- </uses>
- </example>
- <example filename='suspend.c'>
- <synopsis>Suspend a domain and then resume its execution</synopsis>
- <purpose>Demonstrate the basic use of the library to suspend and resume a domain. If no id is given on the command line this script will suspend and resume the first domain found which is not Domain 0.</purpose>
- <usage>suspend [id]</usage>
- <test>suspend</test>
- <author>Daniel Veillard</author>
- <copy>see Copyright for the status of this software. </copy>
- <section>Scheduling</section>
- <includes>
- </includes>
- <uses>
- <function line='31' file='libvirt' name='virDomainGetInfo'/>
- <function line='111' file='libvirt' name='virConnectListDomains'/>
- <function line='93' file='libvirt' name='virDomainFree'/>
- <function line='73' file='libvirt' name='virDomainResume'/>
- <function line='50' file='libvirt' name='virDomainLookupByID'/>
- <function line='132' file='libvirt' name='virConnectClose'/>
- <struct line='28' file='libvirt' name='virDomainInfo'/>
- <function line='62' file='libvirt' name='virDomainSuspend'/>
- <function line='100' file='libvirt' name='virConnectOpenReadOnly'/>
- </uses>
- </example>
- <symbols>
- <symbol name='virConnectClose'>
- <ref filename='info1.c'/>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virConnectListDomains'>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virConnectOpenReadOnly'>
- <ref filename='info1.c'/>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virDomainFree'>
- <ref filename='info1.c'/>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virDomainGetInfo'>
- <ref filename='info1.c'/>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virDomainInfo'>
- <ref filename='info1.c'/>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virDomainLookupByID'>
- <ref filename='info1.c'/>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virDomainResume'>
- <ref filename='suspend.c'/>
- </symbol>
- <symbol name='virDomainSuspend'>
- <ref filename='suspend.c'/>
- </symbol>
- </symbols>
- <sections>
- <section name='Informations'>
- <example filename='info1.c'/>
- </section>
- <section name='Scheduling'>
- <example filename='suspend.c'/>
- </section>
- </sections>
-</examples>
+++ /dev/null
-<?xml version="1.0"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:exsl="http://exslt.org/common"
- extension-element-prefixes="exsl"
- exclude-result-prefixes="exsl">
-
- <xsl:import href="../site.xsl"/>
-
- <xsl:variable name="href_base">../</xsl:variable>
- <xsl:variable name="menu_name">Examples Menu</xsl:variable>
-
- <xsl:variable name="toc">
- <form action="../search.php"
- enctype="application/x-www-form-urlencoded" method="get">
- <input name="query" type="text" size="20" value=""/>
- <input name="submit" type="submit" value="Search ..."/>
- </form>
- <ul><!-- style="margin-left: -1em" -->
- <li><a href="{$href_base}index.html">Home</a></li>
- <li><a style="font-weight:bold"
- href="{$href_base}docs.html">Developer Menu</a></li>
- <li><a style="font-weight:bold"
- href="{$href_base}html/index.html">API Menu</a></li>
- <xsl:for-each select="/examples/sections/section">
- <li><a href="#{@name}"><xsl:value-of select="@name"/> Examples</a></li>
- </xsl:for-each>
- <li><a href="{$href_base}guidelines.html">XML Guidelines</a></li>
- </ul>
- </xsl:variable>
-
- <xsl:template match="include">
- <xsl:variable name="header" select="substring-before(substring-after(., '/'), '>')"/>
- <xsl:variable name="doc" select="concat('../html/libvirt-', $header, 'tml')"/>
- <li><a href="{$doc}"><xsl:value-of select="."/></a></li>
- </xsl:template>
-
- <xsl:template match="typedef">
- <xsl:variable name="name" select="@name"/>
- <xsl:variable name="header" select="concat(@file, '.h')"/>
- <xsl:variable name="doc" select="concat('../html/libvirt-', @file, '.html#', $name)"/>
- <li> line <xsl:value-of select="@line"/>: Type <a href="{$doc}"><xsl:value-of select="$name"/></a> from <xsl:value-of select="$header"/></li>
- </xsl:template>
-
- <xsl:template match="function">
- <xsl:variable name="name" select="@name"/>
- <xsl:variable name="header" select="concat(@file, '.h')"/>
- <xsl:variable name="doc" select="concat('../html/libvirt-', @file, '.html#', $name)"/>
- <li> line <xsl:value-of select="@line"/>: Function <a href="{$doc}"><xsl:value-of select="$name"/></a> from <xsl:value-of select="$header"/></li>
- </xsl:template>
-
- <xsl:template match="macro">
- <xsl:variable name="name" select="@name"/>
- <xsl:variable name="header" select="concat(@file, '.h')"/>
- <xsl:variable name="doc" select="concat('../html/libvirt-', @file, '.html#', $name)"/>
- <li> line <xsl:value-of select="@line"/>: Macro <a href="{$doc}"><xsl:value-of select="$name"/></a> from <xsl:value-of select="$header"/></li>
- </xsl:template>
-
- <xsl:template match="example">
- <xsl:variable name="filename" select="string(@filename)"/>
- <h3><a name="{$filename}" href="{$filename}"><xsl:value-of select="$filename"/></a>: <xsl:value-of select="synopsis"/></h3>
- <p><xsl:value-of select="purpose"/></p>
- <p>Uses:</p>
- <ul>
- <xsl:for-each select="uses/*">
- <xsl:sort select="@line" data-type="number"/>
- <xsl:apply-templates select='.'/>
- </xsl:for-each>
- </ul>
- <p>Usage:</p>
- <p><xsl:value-of select="usage"/></p>
- <p>Author: <xsl:value-of select="author"/></p>
- </xsl:template>
-
- <xsl:template match="section">
- <li><p> <a href="#{@name}"><xsl:value-of select="@name"/></a> :</p>
- <ul>
- <xsl:for-each select="example">
- <xsl:sort select='.'/>
- <xsl:variable name="filename" select="@filename"/>
- <li> <a href="#{$filename}"><xsl:value-of select="$filename"/></a>: <xsl:value-of select="/examples/example[@filename = $filename]/synopsis"/></li>
- </xsl:for-each>
- </ul>
- </li>
- </xsl:template>
-
- <xsl:template match="sections">
- <p> The examples are stored per section depending on the main focus
- of the example:</p>
- <ul>
- <xsl:for-each select="section">
- <xsl:sort select='.'/>
- <xsl:apply-templates select='.'/>
- </xsl:for-each>
- </ul>
- <p> Getting the compilation options and libraries dependancies needed
-to generate binaries from the examples is best done on Linux/Unix by using
-the pkg-config data which should have been installed as part of <i>make
-install</i> step or when installing the libvirt development package:</p>
-<pre>gcc -o example example.c `pkg-config libvirt --libs`</pre>
- </xsl:template>
-
- <xsl:template name="sections-list">
- <xsl:for-each select="sections/section">
- <xsl:variable name="section" select="@name"/>
- <h2> <a name="{$section}"></a><xsl:value-of select="$section"/> Examples</h2>
- <xsl:apply-templates select='/examples/example[section = $section]'/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="examples">
- <xsl:variable name="title">Libvirt set of C code examples</xsl:variable>
- <xsl:document href="index.html" method="xml" encoding="ISO-8859-1"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <xsl:call-template name="style"/>
- <xsl:element name="title">
- <xsl:value-of select="$title"/>
- </xsl:element>
- </head>
- <body>
- <div id="container">
- <div id="intro">
- <div id="adjustments"/>
- <div id="pageHeader"/>
- <div id="content2">
- <xsl:call-template name="titlebox">
- <xsl:with-param name="title" select="$title"/>
- </xsl:call-template>
- <xsl:apply-templates select="sections"/>
- <xsl:call-template name="sections-list"/>
- </div>
- </div>
- <xsl:call-template name="linkList2"/>
- <xsl:call-template name="bottom"/>
- </div>
- </body>
- </html>
- </xsl:document>
- </xsl:template>
-
-</xsl:stylesheet>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><link rel="stylesheet" type="text/css" href="../libvirt.css" /><link rel="SHORTCUT ICON" href="/32favicon.png" /><title>Libvirt set of C code examples</title></head><body><div id="container"><div id="intro"><div id="adjustments"></div><div id="pageHeader"></div><div id="content2"><h1 class="style1">Libvirt set of C code examples</h1><p> The examples are stored per section depending on the main focus
- of the example:</p><ul><li><p><a href="#Informations">Informations</a> :</p><ul><li><a href="#info1.c">info1.c</a>: Extract information about Xen domain 0</li></ul></li><li><p><a href="#Scheduling">Scheduling</a> :</p><ul><li><a href="#suspend.c">suspend.c</a>: Suspend a domain and then resume its execution</li></ul></li></ul><p> Getting the compilation options and libraries dependancies needed
-to generate binaries from the examples is best done on Linux/Unix by using
-the pkg-config data which should have been installed as part of <i>make
-install</i> step or when installing the libvirt development package:</p><pre>gcc -o example example.c `pkg-config libvirt --libs`</pre><h2><a name="Informations" id="Informations"></a>Informations Examples</h2><h3><a name="info1.c" href="info1.c" id="info1.c">info1.c</a>: Extract information about Xen domain 0</h3><p>Demonstrate the basic use of the library to connect to the hypervisor and extract domain information.</p><p>Uses:</p><ul><li> line 29: Function <a href="../html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a> from libvirt.h</li><li> line 36: Function <a href="../html/libvirt-libvirt.html#virDomainLookupByID">virDomainLookupByID</a> from libvirt.h</li><li> line 43: Function <a href="../html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a> from libvirt.h</li><li> line 53: Function <a href="../html/libvirt-libvirt.html#virDomainFree">virDomainFree</a> from libvirt.h</li><li> line 55: Function <a href="../html/libvirt-libvirt.html#virConnectClose">virConnectClose</a> from libvirt.h</li></ul><p>Usage:</p><p>info1</p><p>Author: Daniel Veillard</p><h2><a name="Scheduling" id="Scheduling"></a>Scheduling Examples</h2><h3><a name="suspend.c" href="suspend.c" id="suspend.c">suspend.c</a>: Suspend a domain and then resume its execution</h3><p>Demonstrate the basic use of the library to suspend and resume a domain. If no id is given on the command line this script will suspend and resume the first domain found which is not Domain 0.</p><p>Uses:</p><ul><li> line 31: Function <a href="../html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a> from libvirt.h</li><li> line 50: Function <a href="../html/libvirt-libvirt.html#virDomainLookupByID">virDomainLookupByID</a> from libvirt.h</li><li> line 62: Function <a href="../html/libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a> from libvirt.h</li><li> line 73: Function <a href="../html/libvirt-libvirt.html#virDomainResume">virDomainResume</a> from libvirt.h</li><li> line 93: Function <a href="../html/libvirt-libvirt.html#virDomainFree">virDomainFree</a> from libvirt.h</li><li> line 100: Function <a href="../html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a> from libvirt.h</li><li> line 111: Function <a href="../html/libvirt-libvirt.html#virConnectListDomains">virConnectListDomains</a> from libvirt.h</li><li> line 132: Function <a href="../html/libvirt-libvirt.html#virConnectClose">virConnectClose</a> from libvirt.h</li></ul><p>Usage:</p><p>suspend [id]</p><p>Author: Daniel Veillard</p></div></div><div class="linkList2"><div class="llinks2"><h3 class="links2"><span>main menu</span></h3><ul><li><a href="../index.html">Home</a></li><li><a href="../html/index.html">API Menu</a></li><li><a href="../examples/index.html">C code examples</a></li><li><a href="../ChangeLog.html">Recent Changes</a></li></ul></div><div class="llinks2"><h3 class="links2"><span>related links</span></h3><ul><li><a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li><li><a href="https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&component=libvirt&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=MODIFIED&short_desc_type=allwordssubstr&short_desc=&long_desc_type=allwordssubstr">Open bugs</a></li><li><a href="http://virt-manager.et.redhat.com/">virt-manager</a></li><li><a href="http://search.cpan.org/~danberr/Sys-Virt-0.1.0/">Perl bindings</a></li><li><a href="http://libvirt.org/ocaml/">OCaml bindings</a></li><li><a href="http://libvirt.org/ruby/">Ruby bindings</a></li><li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li><li><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="12" value="Search..." /><input name="submit" type="submit" value="Go" /></form></li><li><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></li></ul><p class="credits">Graphics and design by <a href="mail:dfong@redhat.com">Diana Fong</a></p></div></div><div id="bottom"><p class="p1"></p></div></div></body></html>
+++ /dev/null
-#!/usr/bin/python -u
-#
-# Indexes the examples and build an XML description
-#
-import string
-import glob
-import sys
-try:
- import libxml2
-except:
- sys.exit(1)
-sys.path.insert(0, "..")
-from apibuild import CParser, escape
-
-examples = []
-extras = ['examples.xsl', 'index.py']
-tests = []
-sections = {}
-symbols = {}
-api_dict = None
-api_doc = None
-
-def load_api():
- global api_dict
- global api_doc
-
- if api_dict != None:
- return
- api_dict = {}
- try:
- print "loading ../libvirt-api.xml"
- api_doc = libxml2.parseFile("../libvirt-api.xml")
- except:
- print "failed to parse ../libvirt-api.xml"
- sys.exit(1)
-
-def find_symbol(name):
- global api_dict
- global api_doc
-
- if api_doc == None:
- load_api()
-
- if name == None:
- return
- if api_dict.has_key(name):
- return api_dict[name]
- ctxt = api_doc.xpathNewContext()
- res = ctxt.xpathEval("/api/symbols/*[@name = '%s']" % (name))
- if type(res) == type([]) and len(res) >= 1:
- if len(res) > 1:
- print "Found %d references to %s in the API" % (len(res), name)
- node = res[0]
- typ = node.name
- file = node.xpathEval("string(@file)")
- info = node.xpathEval("string(info)")
- else:
- print "Reference %s not found in the API" % (name)
- return None
- ret = (typ, file, info)
- api_dict[name] = ret
- return ret
-
-def parse_top_comment(filename, comment):
- res = {}
- lines = string.split(comment, "\n")
- item = None
- for line in lines:
- while line != "" and (line[0] == ' ' or line[0] == '\t'):
- line = line[1:]
- while line != "" and line[0] == '*':
- line = line[1:]
- while line != "" and (line[0] == ' ' or line[0] == '\t'):
- line = line[1:]
- try:
- (it, line) = string.split(line, ":", 1)
- item = it
- while line != "" and (line[0] == ' ' or line[0] == '\t'):
- line = line[1:]
- if res.has_key(item):
- res[item] = res[item] + " " + line
- else:
- res[item] = line
- except:
- if item != None:
- if res.has_key(item):
- res[item] = res[item] + " " + line
- else:
- res[item] = line
- return res
-
-def parse(filename, output):
- global symbols
- global sections
-
- parser = CParser(filename)
- parser.collect_references()
- idx = parser.parse()
- info = parse_top_comment(filename, parser.top_comment)
- output.write(" <example filename='%s'>\n" % filename)
- try:
- synopsis = info['synopsis']
- output.write(" <synopsis>%s</synopsis>\n" % escape(synopsis));
- except:
- print "Example %s lacks a synopsis description" % (filename)
- try:
- purpose = info['purpose']
- output.write(" <purpose>%s</purpose>\n" % escape(purpose));
- except:
- print "Example %s lacks a purpose description" % (filename)
- try:
- usage = info['usage']
- output.write(" <usage>%s</usage>\n" % escape(usage));
- except:
- print "Example %s lacks an usage description" % (filename)
- try:
- test = info['test']
- output.write(" <test>%s</test>\n" % escape(test));
- progname=filename[0:-2]
- command=string.replace(test, progname, './' + progname, 1)
- tests.append(command)
- except:
- pass
- try:
- author = info['author']
- output.write(" <author>%s</author>\n" % escape(author));
- except:
- print "Example %s lacks an author description" % (filename)
- try:
- copy = info['copy']
- output.write(" <copy>%s</copy>\n" % escape(copy));
- except:
- print "Example %s lacks a copyright description" % (filename)
- try:
- section = info['section']
- output.write(" <section>%s</section>\n" % escape(section));
- if sections.has_key(section):
- sections[section].append(filename)
- else:
- sections[section] = [filename]
- except:
- print "Example %s lacks a section description" % (filename)
- for topic in info.keys():
- if topic != "purpose" and topic != "usage" and \
- topic != "author" and topic != "copy" and \
- topic != "section" and topic != "synopsis" and topic != "test":
- str = info[topic]
- output.write(" <extra topic='%s'>%s</extra>\n" % (
- escape(topic), escape(str)))
- output.write(" <includes>\n")
- for include in idx.includes.keys():
- if include.find("libxml") != -1:
- output.write(" <include>%s</include>\n" % (escape(include)))
- output.write(" </includes>\n")
- output.write(" <uses>\n")
- for ref in idx.references.keys():
- id = idx.references[ref]
- name = id.get_name()
- line = id.get_lineno()
- if symbols.has_key(name):
- sinfo = symbols[name]
- refs = sinfo[0]
- # gather at most 5 references per symbols
- if refs > 5:
- continue
- sinfo.append(filename)
- sinfo[0] = refs + 1
- else:
- symbols[name] = [1, filename]
- info = find_symbol(name)
- if info != None:
- type = info[0]
- file = info[1]
- output.write(" <%s line='%d' file='%s' name='%s'/>\n" % (type,
- line, file, name))
- else:
- type = id.get_type()
- output.write(" <%s line='%d' name='%s'/>\n" % (type,
- line, name))
-
- output.write(" </uses>\n")
- output.write(" </example>\n")
-
- return idx
-
-def dump_symbols(output):
- global symbols
-
- output.write(" <symbols>\n")
- keys = symbols.keys()
- keys.sort()
- for symbol in keys:
- output.write(" <symbol name='%s'>\n" % (symbol))
- info = symbols[symbol]
- i = 1
- while i < len(info):
- output.write(" <ref filename='%s'/>\n" % (info[i]))
- i = i + 1
- output.write(" </symbol>\n")
- output.write(" </symbols>\n")
-
-def dump_sections(output):
- global sections
-
- output.write(" <sections>\n")
- keys = sections.keys()
- keys.sort()
- for section in keys:
- output.write(" <section name='%s'>\n" % (section))
- info = sections[section]
- i = 0
- while i < len(info):
- output.write(" <example filename='%s'/>\n" % (info[i]))
- i = i + 1
- output.write(" </section>\n")
- output.write(" </sections>\n")
-
-def dump_Makefile():
- for file in glob.glob('*.xml'):
- extras.append(file)
- Makefile="""# -*- buffer-read-only: t -*- vi: set ro:
-# Beware this is autogenerated by index.py
-SUBDIRS=python
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include
-DEPS = $(top_builddir)/src/libvirt.la
-LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
- $(COVERAGE_LDFLAGS)
-
-rebuild: examples.xml index.html
-
-examples.xml: index.py __C_SOURCES__
- -@($(srcdir)/index.py)
-
-index.html: examples.xml examples.xsl $(top_srcdir)/docs/site.xsl
- -@(if [ -x $(XSLTPROC) ] ; then \\
- $(XSLTPROC) examples.xsl examples.xml \\
- && echo "Rebuilt web page" \\
- && xmllint --valid --noout index.html; \\
- fi)
-
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
- -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml \\
- $(srcdir)/*.xsl $(DESTDIR)$(HTML_DIR)
-
-"""
- EXTRA_DIST= string.join(extras, ' ')
- Makefile = Makefile + "EXTRA_DIST=%s\n\n" % (EXTRA_DIST)
- noinst_PROGRAMS= string.join(examples, ' ')
- Makefile = Makefile + "noinst_PROGRAMS=%s\n\n" % (noinst_PROGRAMS)
- for example in examples:
- Makefile = Makefile + "%s_SOURCES=%s.c\n%s_LDFLAGS=\n%s_DEPENDENCIES= $(DEPS)\n%s_LDADD= $(LDADDS)\n\n" % (example, example, example,
- example, example)
- Makefile = Makefile + "valgrind:\n\t$(MAKE) CHECKER='valgrind' tests\n\n"
- Makefile = Makefile + "tests: $(noinst_PROGRAMS)\n"
- Makefile = Makefile + "\t@(echo '## examples regression tests')\n"
-# Makefile = Makefile + "\t@(echo > .memdump)\n"
- for test in tests:
- Makefile = Makefile + "\t@($(CHECKER) %s)\n" % (test)
-# Makefile = Makefile + '\t@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)\n'
-
- c_src = [("%s.c" % x) for x in examples]
- Makefile = Makefile.replace("__C_SOURCES__", string.join(c_src, ' '))
- try:
- old = open("Makefile.am", "r").read()
- if old != Makefile:
- n = open("Makefile.am", "w").write(Makefile)
- print "Updated Makefile.am"
- except:
- print "Failed to read or save Makefile.am"
- #
- # Autogenerate the .cvsignore too ...
- #
- ignore = """.memdump
-Makefile.in
-Makefile
-.deps
-.libs
-"""
- for example in examples:
- ignore = ignore + "%s\n" % (example)
- try:
- old = open(".cvsignore", "r").read()
- if old != ignore:
- n = open(".cvsignore", "w").write(ignore)
- print "Updated .cvsignore"
- except:
- print "Failed to read or save .cvsignore"
-
-if __name__ == "__main__":
- load_api()
- output = open("examples.xml", "w")
- output.write("<examples>\n")
-
- c_src = glob.glob('*.c')
- c_src.sort()
- for file in c_src:
- parse(file, output)
- examples.append(file[:-2])
-
- dump_symbols(output)
- dump_sections(output)
- output.write("</examples>\n")
- output.close()
- dump_Makefile()
+++ /dev/null
-EXTRA_DIST= \
- README \
- dominfo.py domrestore.py domsave.py domstart.py \
- guava.xml papaya.xml
+++ /dev/null
-<domain type='xen'>
- <name>guava</name>
- <os>
- <type>linux</type>
- <kernel>/var/xen/boot/vmlinuz-2.6.15-1.33_FC5guest</kernel>
- <initrd>/var/xen/boot/initrd-2.6.15-1.33_FC5guest.img</initrd>
- <cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
- </os>
- <memory>262144</memory>
- <vcpu>1</vcpu>
- <devices>
- <disk type='file'>
- <source file='/var/xen/guava'/>
- <target dev='xvda'/>
- </disk>
- <interface type='bridge'>
- <source bridge='xenbr0'/>
- <mac address='00:16:3e:78:a2:42'/>
- <script path='/etc/xen/scripts/vif-bridge'/>
- </interface>
- </devices>
-</domain>
+++ /dev/null
-<domain type='xen'>
- <name>papaya</name>
- <os>
- <type>linux</type>
- <kernel>/var/xen/boot/vmlinuz-2.6.15-1.33_FC5guest</kernel>
- <initrd>/var/xen/boot/initrd-2.6.15-1.33_FC5guest.img</initrd>
- <cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet single</cmdline>
- </os>
- <memory>262144</memory>
- <vcpu>1</vcpu>
- <devices>
- <disk type='file'>
- <source file='/var/xen/papaya'/>
- <target dev='xvda'/>
- </disk>
- <disk type='block'>
- <source dev='/dev/mapper/vg00-lv02'/>
- <target dev='sda1'/>
- </disk>
- <interface type='bridge'>
- <source bridge='xenbr0'/>
- <mac address='00:16:3e:78:a2:0c'/>
- <script path='/etc/xen/scripts/vif-bridge'/>
- </interface>
- </devices>
-</domain>
--- /dev/null
+Makefile.in
+Makefile
+.deps
+.libs
+info1
--- /dev/null
+
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include
+LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS)
+
+noinst_PROGRAMS=info1
+
+info1_SOURCES=info1.c
+info1_LDFLAGS=
+info1_LDADD= $(LDADDS)
+
-.memdump
Makefile.in
Makefile
.deps
.libs
-info1
suspend
--- /dev/null
+
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include
+LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS)
+
+noinst_PROGRAMS=suspend
+
+suspend_SOURCES=suspend.c
+suspend_LDFLAGS=
+suspend_LDADD= $(LDADDS)
+
--- /dev/null
+EXTRA_DIST= \
+ README \
+ dominfo.py domrestore.py domsave.py domstart.py
rm -fr %{buildroot}
%makeinstall
-(cd docs/examples ; make clean ; rm -rf .deps Makefile Makefile.in)
-(cd docs/examples/python ; rm -rf .deps Makefile Makefile.in)
-(cd examples/hellolibvirt ; make clean ; rm -rf .deps .libs Makefile Makefile.in)
-(cd examples/domain-events/events-c ; make clean ;rm -rf .deps .libs Makefile Makefile.in)
+for i in domain-events dominfo domsuspend hellolibvirt python
+do
+ (cd examples/$i ; make clean ; rm -rf .deps .libs Makefile Makefile.in)
+done
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la
%doc %{_datadir}/gtk-doc/html/libvirt/*.css
%doc docs/*.html docs/html docs/*.gif
-%doc docs/examples
%doc docs/libvirt-api.xml
-%doc examples
+%doc examples/hellolibvirt
+%doc examples/domain-events/events-c
+%doc examples/dominfo
+%doc examples/domsuspend
%if %{with_python}
%files python
%doc python/tests/*.py
%doc python/TODO
%doc python/libvirtclass.txt
-%doc docs/examples/python
+%doc examples/python
+%doc examples/domain-events/events-python
%endif
%changelog