Zypp Commits
Threads by month
- ----- 2024 -----
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
May 2007
- 8 participants
- 191 discussions
[zypp-commit] r5595 - in /trunk/libzypp/zypp/parser: IniParser.h TagParser.h
by mlandres@svn.opensuse.org 23 May '07
by mlandres@svn.opensuse.org 23 May '07
23 May '07
Author: mlandres
Date: Wed May 23 08:28:44 2007
New Revision: 5595
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5595&view=rev
Log:
typo
Modified:
trunk/libzypp/zypp/parser/IniParser.h
trunk/libzypp/zypp/parser/TagParser.h
Modified: trunk/libzypp/zypp/parser/IniParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/IniParser.h?…
==============================================================================
--- trunk/libzypp/zypp/parser/IniParser.h (original)
+++ trunk/libzypp/zypp/parser/IniParser.h Wed May 23 08:28:44 2007
@@ -46,7 +46,7 @@
/** Dtor */
virtual ~IniParser();
/** Parse the stream.
- * \throw ParseExcetion on errors. Invoke \ref consume
+ * \throw ParseException on errors. Invoke \ref consume
* for each tag. \ref consume might throw other exceptions
* as well.
*/
Modified: trunk/libzypp/zypp/parser/TagParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/TagParser.h?…
==============================================================================
--- trunk/libzypp/zypp/parser/TagParser.h (original)
+++ trunk/libzypp/zypp/parser/TagParser.h Wed May 23 08:28:44 2007
@@ -82,7 +82,7 @@
/** Dtor */
virtual ~TagParser();
/** Parse the stream.
- * \throw ParseExcetion on errors.
+ * \throw ParseException on errors.
* \throws AbortRequestException on user request.
* Invokes \ref consume for each tag. \ref consume might throw
* other exceptions as well.
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
23 May '07
Author: mlandres
Date: Wed May 23 08:26:39 2007
New Revision: 5594
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5594&view=rev
Log:
add RW_pointer traits for scoped_ptr
Modified:
trunk/libzypp/zypp/base/PtrTypes.h
Modified: trunk/libzypp/zypp/base/PtrTypes.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/PtrTypes.h?rev…
==============================================================================
--- trunk/libzypp/zypp/base/PtrTypes.h (original)
+++ trunk/libzypp/zypp/base/PtrTypes.h Wed May 23 08:26:39 2007
@@ -183,7 +183,25 @@
long use_count( const _Ptr & ptr_r ) const
{ return ptr_r ? ptr_r->refCount() : 0; }
};
- }
+
+ template<class _D>
+ struct Scoped
+ {
+ typedef scoped_ptr<_D> _Ptr;
+ typedef scoped_ptr<const _D> _constPtr;
+ /** Check whether pointer is not shared. */
+ bool unique( const _constPtr & ptr_r )
+ { return true; }
+ bool unique( const _Ptr & ptr_r )
+ { return true; }
+ /** Return number of references. */
+ long use_count( const _constPtr & ptr_r ) const
+ { return ptr_r ? 1 : 0; }
+ long use_count( const _Ptr & ptr_r ) const
+ { return ptr_r ? 1 : 0; }
+ };
+
+ }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5593 - in /trunk/libzypp/zypp/target: hal/Hal.cc modalias/Modalias.cc
by mlandres@svn.opensuse.org 22 May '07
by mlandres@svn.opensuse.org 22 May '07
22 May '07
Author: mlandres
Date: Tue May 22 23:10:45 2007
New Revision: 5593
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5593&view=rev
Log:
fix gcc warning
Modified:
trunk/libzypp/zypp/target/hal/Hal.cc
trunk/libzypp/zypp/target/modalias/Modalias.cc
Modified: trunk/libzypp/zypp/target/hal/Hal.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/hal/Hal.cc?r…
==============================================================================
--- trunk/libzypp/zypp/target/hal/Hal.cc (original)
+++ trunk/libzypp/zypp/target/hal/Hal.cc Tue May 22 23:10:45 2007
@@ -11,6 +11,7 @@
*/
#include <iostream>
+#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "HAL"
#include "zypp/base/Logger.h"
Modified: trunk/libzypp/zypp/target/modalias/Modalias.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/modalias/Mod…
==============================================================================
--- trunk/libzypp/zypp/target/modalias/Modalias.cc (original)
+++ trunk/libzypp/zypp/target/modalias/Modalias.cc Tue May 22 23:10:45 2007
@@ -11,6 +11,7 @@
*/
#include <iostream>
+#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "MODALIAS"
#include "zypp/base/Logger.h"
@@ -106,14 +107,14 @@
goto out;
}
if ((entry->modalias = strdup(modalias)) == NULL) {
- free(entry);
+ free(entry);
ret = -1;
goto out;
}
entry->next = *list;
*list = entry;
XXX << "system modalias: " << entry->modalias << endl;
-
+
out:
(void) close(fd);
return 0;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5592 - /trunk/libzypp/devel/devel.jkupec/yum/products-example.xml
by jkupec@svn.opensuse.org 22 May '07
by jkupec@svn.opensuse.org 22 May '07
22 May '07
Author: jkupec
Date: Tue May 22 22:54:27 2007
New Revision: 5592
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5592&view=rev
Log:
backup
Added:
trunk/libzypp/devel/devel.jkupec/yum/products-example.xml
Added: trunk/libzypp/devel/devel.jkupec/yum/products-example.xml
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/yum/p…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/yum/products-example.xml (added)
+++ trunk/libzypp/devel/devel.jkupec/yum/products-example.xml Tue May 22 22:54:27 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- valid against products.rnc r5591 -->
+<products
+ xmlns="http://novell.com/package/metadata/suse/products"
+ xmlns:rpm="http://linux.duke.edu/metadata/rpm">
+ <product type="type">
+ <vendor>Novell, Inc.</vendor>
+ <name>SLES10-SP1</name>
+ <version epoch="0" ver="10.0.15" rel="1"/>
+ <displayname lang="en">SUSE Linux Enterprise Server 10 SP1</displayname>
+ <shortname lang="en">SLES 10 SP1</shortname>
+ <description lang="en">The best server OS so far</description>
+ <description lang="sk">Doposiaľ najlepšà OS pre servery</description>
+ <rpm:requires>
+ <rpm:entry kind="package" name="pikaball" epoch="0" ver="3.0" rel="3" flags="GE" pre="1"/>
+ <rpm:entry kind="package" name="base" epoch="0" ver="3.0" rel="3" flags="GE"/>
+ </rpm:requires>
+ <rpm:provides>
+ <rpm:entry kind="product" name="SLES10-SP1"/>
+ </rpm:provides>
+ </product>
+</products>
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5591 - in /trunk/libzypp: zypp/ zypp/parser/yum/ zypp/parser/yum/schema/ zypp/source/yum/ zypp2/parser/yum/
by jkupec@svn.opensuse.org 22 May '07
by jkupec@svn.opensuse.org 22 May '07
22 May '07
Author: jkupec
Date: Tue May 22 22:45:46 2007
New Revision: 5591
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5591&view=rev
Log:
products.xml parser complete
Added:
trunk/libzypp/zypp/parser/yum/ProductFileReader.cc
trunk/libzypp/zypp/parser/yum/ProductFileReader.h
trunk/libzypp/zypp/parser/yum/schema/products.rnc
- copied, changed from r5589, trunk/libzypp/zypp/parser/yum/schema/product.rnc
trunk/libzypp/zypp/parser/yum/schema/products.rng
- copied, changed from r5589, trunk/libzypp/zypp/parser/yum/schema/product.rng
Removed:
trunk/libzypp/zypp/parser/yum/schema/product.rnc
trunk/libzypp/zypp/parser/yum/schema/product.rng
Modified:
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/parser/yum/FileReaderBase.h
trunk/libzypp/zypp/parser/yum/schema/repomd.rnc
trunk/libzypp/zypp/parser/yum/schema/repomd.rng
trunk/libzypp/zypp/source/yum/YUMResourceType.cc
trunk/libzypp/zypp/source/yum/YUMResourceType.h
trunk/libzypp/zypp2/parser/yum/YUMParser.cc
trunk/libzypp/zypp2/parser/yum/YUMParser.h
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=…
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Tue May 22 22:45:46 2007
@@ -560,6 +560,7 @@
parser/yum/FilelistsFileReader.cc
parser/yum/PatchFileReader.cc
parser/yum/PatternFileReader.cc
+ parser/yum/ProductFileReader.cc
)
SET( zypp_parser_yum_HEADERS
@@ -582,6 +583,7 @@
parser/yum/FilelistsFileReader.h
parser/yum/PatchFileReader.h
parser/yum/PatternFileReader.h
+ parser/yum/ProductFileReader.h
parser/yum/schemanames.h
)
Modified: trunk/libzypp/zypp/parser/yum/FileReaderBase.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileRead…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBase.h (original)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBase.h Tue May 22 22:45:46 2007
@@ -45,7 +45,8 @@
tag_pkgfiles,
tag_deltarpm,
tag_patchrpm,
- tag_pattern
+ tag_pattern,
+ tag_product
};
/**
Added: trunk/libzypp/zypp/parser/yum/ProductFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/ProductF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/ProductFileReader.cc (added)
+++ trunk/libzypp/zypp/parser/yum/ProductFileReader.cc Tue May 22 22:45:46 2007
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include "zypp/base/Logger.h"
+#include "zypp/parser/yum/ProductFileReader.h"
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+
+using namespace std;
+using namespace zypp::xml;
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ ProductFileReader::ProductFileReader(const Pathname & product_file, ProcessProduct callback)
+ : _callback(callback)
+ {
+ Reader reader(product_file);
+ MIL << "Reading " << product_file << endl;
+ reader.foreachNode(bind(&ProductFileReader::consumeNode, this, _1));
+ }
+
+ // --------------------------------------------------------------------------
+
+ /*
+ * xpath and multiplicity of processed nodes are included in the code
+ * for convenience:
+ *
+ * // xpath: <xpath> (?|*|+)
+ *
+ * if multiplicity is ommited, then the node has multiplicity 'one'.
+ */
+
+ // --------------------------------------------------------------------------
+
+ bool ProductFileReader::consumeNode(Reader & reader_r)
+ {
+ // dependency block nodes
+ if (_product && consumeDependency(reader_r, _product->deps))
+ return true;
+
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ // xpath: /products/product
+ if (reader_r->name() == "product")
+ {
+ tag(tag_product); // just for the case of reuse somewhere/sometimes
+ _product = new data::Product;
+ return true;
+ }
+
+ // xpath: /products/product/name
+ if (reader_r->name() == "name")
+ {
+ _product->name = reader_r.nodeText().asString();
+ // TODO what's this?
+ // _product->? = reader_r->getAttribute("type").asString();
+ return true;
+ }
+
+ // xpath: /products/product/vendor
+ if (reader_r->name() == "vendor")
+ {
+ _product->vendor = reader_r.nodeText().asString();
+ }
+
+ // xpath: /products/product/version
+ if (reader_r->name() == "version")
+ {
+ _product->edition = Edition(reader_r->getAttribute("ver").asString(),
+ reader_r->getAttribute("rel").asString(),
+ reader_r->getAttribute("epoch").asString());
+ }
+
+ // xpath: /products/product/displayname (+)
+ if (reader_r->name() == "displayname")
+ {
+ Locale locale(reader_r->getAttribute("lang").asString());
+ _product->longName.setText(reader_r.nodeText().asString(), locale);
+ return true;
+ }
+
+ // xpath: /products/product/shortname (*)
+ if (reader_r->name() == "shortname")
+ {
+ Locale locale(reader_r->getAttribute("lang").asString());
+ _product->shortName.setText(reader_r.nodeText().asString(), locale);
+ return true;
+ }
+
+ // xpath: /products/product/description (+)
+ if (reader_r->name() == "description")
+ {
+ Locale locale(reader_r->getAttribute("lang").asString());
+ _product->description.setText(reader_r.nodeText().asString(), locale);
+ return true;
+ }
+ }
+
+ else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
+ {
+ // xpath: /products/product
+ if (reader_r->name() == "product")
+ {
+ if (_callback)
+ _callback(handoutProduct());
+
+ toParentTag(); // just for the case of reuse somewhere/sometimes
+
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ // --------------------------------------------------------------------------
+
+ data::Product_Ptr ProductFileReader::handoutProduct()
+ {
+ data::Product_Ptr ret;
+ ret.swap(_product);
+ return ret;
+ }
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/ProductFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/ProductF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/ProductFileReader.h (added)
+++ trunk/libzypp/zypp/parser/yum/ProductFileReader.h Tue May 22 22:45:46 2007
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_PARSER_YUM_PRODUCTFILEREADER_H_
+#define ZYPP_PARSER_YUM_PRODUCTFILEREADER_H_
+
+#include "zypp/base/Function.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/parser/yum/FileReaderBase.h"
+#include "zypp/data/ResolvableData.h"
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ /**
+ * Reader of products.xml file conforming to RNC definition located
+ * in zypp/parser/yum/schema/products.rnc
+ *
+ * \see zypp::data::Product
+ * \see zypp::parser::xml::Reader
+ */
+ class ProductFileReader : FileReaderBase
+ {
+ public:
+
+ /**
+ * Consumer callback definition. Function which will process the read
+ * data must be of this type.
+ */
+ typedef function<bool(const data::Product_Ptr &)> ProcessProduct;
+
+ /**
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
+ * \param products_file products.xml file to read.
+ * \param callback Function which will process read data.
+ */
+ ProductFileReader(const Pathname & products_file, ProcessProduct callback);
+
+ private:
+
+ /**
+ * Callback provided to the XML reader.
+ *
+ * \param the xml reader object reading the file
+ * \return true to tell the reader to continue, false to tell it to stop
+ *
+ * \see PrimaryFileReader::consumeNode(xml::Reader)
+ */
+ bool consumeNode(xml::Reader & reader_r);
+
+ /**
+ * Creates a new \ref data::Product_Ptr, swaps its contents with \ref _product
+ * and returns it. Used to hand-out the data object to its consumer
+ * (a \ref ProcessProduct function) after it has been read.
+ */
+ data::Product_Ptr handoutProduct();
+
+ private:
+ /**
+ * Callback for processing product metadata.
+ */
+ ProcessProduct _callback;
+
+ /**
+ * Pointer to the \ref zypp::data::Product object for storing the product
+ * metada.
+ */
+ data::Product_Ptr _product;
+ };
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+#endif /*ZYPP_PARSER_YUM_PRODUCTFILEREADER_H_*/
Copied: trunk/libzypp/zypp/parser/yum/schema/products.rnc (from r5589, trunk/libzypp/zypp/parser/yum/schema/product.rnc)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/p…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/product.rnc (original)
+++ trunk/libzypp/zypp/parser/yum/schema/products.rnc Tue May 22 22:45:46 2007
@@ -1,80 +1,25 @@
default namespace = "http://linux.duke.edu/metadata/rpm"
-namespace ns1 = "http://novell.com/package/metadata/suse/product"
+namespace ns1 = "http://novell.com/package/metadata/suse/products"
-include "rpm-ns.rnc"
+include "suse-primary.rnc" {
+ start = products
+}
-start =
-element ns1:product {
- attribute type { text },
- element ns1:vendor { text },
- element ns1:name { text },
- element ns1:version {
- attribute epoch { xsd:nonNegativeInteger },
- attribute ver { text },
- attribute rel { text }
- },
- element ns1:displayname {
- attribute lang { text },
- text
- }+,
- element ns1:shortname {
- attribute lang { text },
- text
- }*,
- element ns1:description {
- attribute lang { text },
- text
- }+,
- element provides {
- (
- element entry {
- attribute-kind?,
- attribute-name,
- (
- shared-entry-attributes,
- attribute-flags-provides
- )?,
- empty
- } |
- element-capability
- )+
- }?,
- element conflicts {
- usual-entry-or-capability+
- }?,
- element obsoletes {
- (
- element entry {
- attribute-kind?,
- attribute-name,
- (
- shared-entry-attributes,
- attribute-flags-obsoletes
- )?,
- empty
- } |
- element-capability
- )+
- }?,
- element requires {
- (
- element entry {
- attribute pre { "1" | "0" }?,
- usual-entry-content
- } |
- element-capability
- )*
- }?,
- element recommends {
- usual-entry-or-capability*
- }?,
- element enhances {
- usual-entry-or-capability*
- }?,
- element supplements {
- usual-entry-or-capability*
- }?,
- element suggests {
- usual-entry-or-capability*
- }?
+products = element ns1:products {
+ element ns1:product {
+ attribute type { text },
+ element ns1:vendor { text },
+ element ns1:name { text },
+ element ns1:version {
+ attribute epoch { xsd:nonNegativeInteger },
+ attribute ver { text },
+ attribute rel { text }
+ },
+ element ns1:displayname { localized-string }+,
+ element ns1:shortname { localized-string }*,
+ element ns1:description { localized-string }+,
+ dependencies
+ }+
}
+
+
Copied: trunk/libzypp/zypp/parser/yum/schema/products.rng (from r5589, trunk/libzypp/zypp/parser/yum/schema/product.rng)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/p…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/product.rng (original)
+++ trunk/libzypp/zypp/parser/yum/schema/products.rng Tue May 22 22:45:46 2007
@@ -1,135 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
-<grammar xmlns:ns1="http://novell.com/package/metadata/suse/product" ns="http://linux.duke.edu/metadata/rpm" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <include href="rpm-ns.rng"/>
- <start>
- <element name="ns1:product">
- <attribute name="type"/>
- <element name="ns1:vendor">
- <text/>
- </element>
- <element name="ns1:name">
- <text/>
- </element>
- <element name="ns1:version">
- <attribute name="epoch">
- <data type="nonNegativeInteger"/>
- </attribute>
- <attribute name="ver"/>
- <attribute name="rel"/>
- </element>
+<grammar xmlns:ns1="http://novell.com/package/metadata/suse/products" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <include href="suse-primary.rng">
+ <start>
+ <ref name="products"/>
+ </start>
+ </include>
+ <define name="products">
+ <element name="ns1:products">
<oneOrMore>
- <element name="ns1:displayname">
- <attribute name="lang"/>
- <text/>
- </element>
- </oneOrMore>
- <zeroOrMore>
- <element name="ns1:shortname">
- <attribute name="lang"/>
- <text/>
- </element>
- </zeroOrMore>
- <oneOrMore>
- <element name="ns1:description">
- <attribute name="lang"/>
- <text/>
- </element>
- </oneOrMore>
- <optional>
- <element name="provides">
- <oneOrMore>
- <choice>
- <element name="entry">
- <optional>
- <ref name="attribute-kind"/>
- </optional>
- <ref name="attribute-name"/>
- <optional>
- <ref name="shared-entry-attributes"/>
- <ref name="attribute-flags-provides"/>
- </optional>
- <empty/>
- </element>
- <ref name="element-capability"/>
- </choice>
- </oneOrMore>
- </element>
- </optional>
- <optional>
- <element name="conflicts">
+ <element name="ns1:product">
+ <attribute name="type"/>
+ <element name="ns1:vendor">
+ <text/>
+ </element>
+ <element name="ns1:name">
+ <text/>
+ </element>
+ <element name="ns1:version">
+ <attribute name="epoch">
+ <data type="nonNegativeInteger"/>
+ </attribute>
+ <attribute name="ver"/>
+ <attribute name="rel"/>
+ </element>
<oneOrMore>
- <ref name="usual-entry-or-capability"/>
+ <element name="ns1:displayname">
+ <ref name="localized-string"/>
+ </element>
</oneOrMore>
- </element>
- </optional>
- <optional>
- <element name="obsoletes">
- <oneOrMore>
- <choice>
- <element name="entry">
- <optional>
- <ref name="attribute-kind"/>
- </optional>
- <ref name="attribute-name"/>
- <optional>
- <ref name="shared-entry-attributes"/>
- <ref name="attribute-flags-obsoletes"/>
- </optional>
- <empty/>
- </element>
- <ref name="element-capability"/>
- </choice>
- </oneOrMore>
- </element>
- </optional>
- <optional>
- <element name="requires">
- <zeroOrMore>
- <choice>
- <element name="entry">
- <optional>
- <attribute name="pre">
- <choice>
- <value>1</value>
- <value>0</value>
- </choice>
- </attribute>
- </optional>
- <ref name="usual-entry-content"/>
- </element>
- <ref name="element-capability"/>
- </choice>
- </zeroOrMore>
- </element>
- </optional>
- <optional>
- <element name="recommends">
- <zeroOrMore>
- <ref name="usual-entry-or-capability"/>
- </zeroOrMore>
- </element>
- </optional>
- <optional>
- <element name="enhances">
- <zeroOrMore>
- <ref name="usual-entry-or-capability"/>
- </zeroOrMore>
- </element>
- </optional>
- <optional>
- <element name="supplements">
- <zeroOrMore>
- <ref name="usual-entry-or-capability"/>
- </zeroOrMore>
- </element>
- </optional>
- <optional>
- <element name="suggests">
<zeroOrMore>
- <ref name="usual-entry-or-capability"/>
+ <element name="ns1:shortname">
+ <ref name="localized-string"/>
+ </element>
</zeroOrMore>
+ <oneOrMore>
+ <element name="ns1:description">
+ <ref name="localized-string"/>
+ </element>
+ </oneOrMore>
+ <ref name="dependencies"/>
</element>
- </optional>
+ </oneOrMore>
</element>
- </start>
+ </define>
</grammar>
Modified: trunk/libzypp/zypp/parser/yum/schema/repomd.rnc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/r…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/repomd.rnc (original)
+++ trunk/libzypp/zypp/parser/yum/schema/repomd.rnc Tue May 22 22:45:46 2007
@@ -2,7 +2,7 @@
element repomd {
element data {
- attribute type { "other" | "filelists" | "primary" | "group" | "product" | "patches" | "patterns" }&
+ attribute type { "other" | "filelists" | "primary" | "group" | "products" | "patches" | "patterns" }&
element location {
attribute xml:base { xsd:anyURI }?,
attribute href { xsd:anyURI },
Modified: trunk/libzypp/zypp/parser/yum/schema/repomd.rng
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/r…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/repomd.rng (original)
+++ trunk/libzypp/zypp/parser/yum/schema/repomd.rng Tue May 22 22:45:46 2007
@@ -10,7 +10,7 @@
<value>filelists</value>
<value>primary</value>
<value>group</value>
- <value>product</value>
+ <value>products</value>
<value>patches</value>
<value>patterns</value>
</choice>
Modified: trunk/libzypp/zypp/source/yum/YUMResourceType.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.cc (original)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.cc Tue May 22 22:45:46 2007
@@ -28,8 +28,8 @@
const YUMResourceType YUMResourceType::GROUP(YUMResourceType::GROUP_e);
const YUMResourceType YUMResourceType::PATCHES(YUMResourceType::PATCHES_e);
const YUMResourceType YUMResourceType::PATCH(YUMResourceType::PATCH_e);
- const YUMResourceType YUMResourceType::PRODUCT(YUMResourceType::PRODUCT_e);
- const YUMResourceType YUMResourceType::PATTERN(YUMResourceType::PATTERN_e);
+ const YUMResourceType YUMResourceType::PRODUCTS(YUMResourceType::PRODUCTS_e);
+ const YUMResourceType YUMResourceType::PATTERNS(YUMResourceType::PATTERNS_e);
YUMResourceType::YUMResourceType(const std::string & strval_r)
@@ -48,8 +48,8 @@
_table["group"] = YUMResourceType::GROUP_e;
_table["patches"] = YUMResourceType::PATCHES_e;
_table["patch"] = YUMResourceType::PATCH_e;
- _table["product"] = YUMResourceType::PRODUCT_e;
- _table["patterns"] = YUMResourceType::PATTERN_e;
+ _table["products"] = YUMResourceType::PRODUCTS_e;
+ _table["patterns"] = YUMResourceType::PATTERNS_e;
_table["NONE"] = _table["none"] = YUMResourceType::NONE_e;
}
@@ -77,8 +77,8 @@
_table[GROUP_e] = "group";
_table[PATCHES_e] = "patches";
_table[PATCH_e] = "patch";
- _table[PRODUCT_e] = "product";
- _table[PATTERN_e] = "patterns";
+ _table[PRODUCTS_e] = "products";
+ _table[PATTERNS_e] = "patterns";
_table[NONE_e] = "NONE";
}
return _table[_type];
Modified: trunk/libzypp/zypp/source/yum/YUMResourceType.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.h (original)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.h Tue May 22 22:45:46 2007
@@ -33,8 +33,8 @@
static const YUMResourceType GROUP;
static const YUMResourceType PATCHES; // suse extension
static const YUMResourceType PATCH; // suse extension
- static const YUMResourceType PRODUCT; // suse extension
- static const YUMResourceType PATTERN; // suse extension
+ static const YUMResourceType PRODUCTS; // suse extension
+ static const YUMResourceType PATTERNS; // suse extension
enum Type
{
@@ -46,8 +46,8 @@
GROUP_e,
PATCHES_e,
PATCH_e,
- PRODUCT_e,
- PATTERN_e
+ PRODUCTS_e,
+ PATTERNS_e
};
YUMResourceType(Type type) : _type(type) {}
Modified: trunk/libzypp/zypp2/parser/yum/YUMParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/parser/yum/YUMPars…
==============================================================================
--- trunk/libzypp/zypp2/parser/yum/YUMParser.cc (original)
+++ trunk/libzypp/zypp2/parser/yum/YUMParser.cc Tue May 22 22:45:46 2007
@@ -7,8 +7,7 @@
| |
\---------------------------------------------------------------------*/
-#include "zypp/ZYpp.h"
-#include "zypp/ZYppFactory.h"
+#include <iostream>
#include "zypp/base/Logger.h"
#include "zypp/parser/yum/RepomdFileReader.h"
@@ -16,6 +15,7 @@
#include "zypp/parser/yum/PatchesFileReader.h"
#include "zypp/parser/yum/PatchFileReader.h"
#include "zypp/parser/yum/PatternFileReader.h"
+#include "zypp/parser/yum/ProductFileReader.h"
#include "zypp/parser/yum/OtherFileReader.h"
#include "zypp/parser/yum/FilelistsFileReader.h"
@@ -35,7 +35,7 @@
// TODO make this through ZYppCallbacks.h
bool progress_function(ProgressData::value_type p)
{
- cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
+ std::cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
// cout << "\rParsing $name_would_come_in_handy [" << p << "%]" << flush;
return true;
}
@@ -143,14 +143,23 @@
// -------------------------------------------------------------------------
- bool YUMParser::pattern_CB(const data::Pattern_Ptr & pattern_ptr)
+ bool YUMParser::pattern_CB(const data::Pattern_Ptr & product_ptr)
{
- _consumer.consumePattern(_catalog_id, pattern_ptr);
+ _consumer.consumePattern(_catalog_id, product_ptr);
- DBG << "got pattern "
- << pattern_ptr->name << pattern_ptr->edition << " "
- << pattern_ptr->arch
- << endl;
+ MIL << "got pattern " << product_ptr->name << endl;
+
+ return true;
+ }
+
+ // -------------------------------------------------------------------------
+
+ bool YUMParser::product_CB(const data::Product_Ptr & product_ptr)
+ {
+ _consumer.consumeProduct(_catalog_id, product_ptr);
+
+ MIL << "got product " << product_ptr->name
+ << "-" << product_ptr->edition << endl;
return true;
}
@@ -235,7 +244,7 @@
break;
}
- case YUMResourceType::PATTERN_e:
+ case YUMResourceType::PATTERNS_e:
{
zypp::parser::yum::PatternFileReader(
cache_dir + job.filename(),
@@ -243,6 +252,14 @@
break;
}
+ case YUMResourceType::PRODUCTS_e:
+ {
+ zypp::parser::yum::ProductFileReader(
+ cache_dir + job.filename(),
+ bind(&YUMParser::product_CB, this, _1));
+ break;
+ }
+
default:
{
WAR << "Don't know how to read "
Modified: trunk/libzypp/zypp2/parser/yum/YUMParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/parser/yum/YUMPars…
==============================================================================
--- trunk/libzypp/zypp2/parser/yum/YUMParser.h (original)
+++ trunk/libzypp/zypp2/parser/yum/YUMParser.h Tue May 22 22:45:46 2007
@@ -72,6 +72,7 @@
*
* \see RepomdFileReader, PrimaryFileReader, OtherFileReader
* \see FilelistsFileReader, PatchesFileReader, PatchFileReader
+ * \see PatternFileReader, ProductFileReader
*/
class YUMParser
{
@@ -169,6 +170,14 @@
*/
bool pattern_CB(const data::Pattern_Ptr & pattern_ptr);
+ /**
+ * Callback for processing data returned from \ref ProductFileReader.
+ * Uses \ref _consumer to process read product.
+ *
+ * \param product_ptr pointer to product data object
+ */
+ bool product_CB(const data::Product_Ptr & product_ptr);
+
private:
/** Object for processing the read data */
data::ResolvableDataConsumer & _consumer;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5590 - in /trunk/libzypp: devel/devel.jkupec/yum/ zypp/ zypp/data/ zypp/parser/yum/ zypp/parser/yum/schema/ zypp/source/yum/ zypp2/parser/yum/
by jkupec@svn.opensuse.org 22 May '07
by jkupec@svn.opensuse.org 22 May '07
22 May '07
Author: jkupec
Date: Tue May 22 20:48:46 2007
New Revision: 5590
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5590&view=rev
Log:
pattern.xml parser complete. pattern schema changed.
Added:
trunk/libzypp/devel/devel.jkupec/yum/
trunk/libzypp/devel/devel.jkupec/yum/patterns-example.xml
trunk/libzypp/zypp/parser/yum/PatternFileReader.cc
trunk/libzypp/zypp/parser/yum/PatternFileReader.h
Modified:
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/data/ResolvableData.h
trunk/libzypp/zypp/data/ResolvableDataConsumer.h
trunk/libzypp/zypp/parser/yum/FileReaderBase.h
trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
trunk/libzypp/zypp/parser/yum/schema/patterns.rnc
trunk/libzypp/zypp/parser/yum/schema/patterns.rng
trunk/libzypp/zypp/parser/yum/schema/repomd.rnc
trunk/libzypp/zypp/parser/yum/schema/repomd.rng
trunk/libzypp/zypp/source/yum/YUMResourceType.cc
trunk/libzypp/zypp/source/yum/YUMResourceType.h
trunk/libzypp/zypp2/parser/yum/YUMParser.cc
trunk/libzypp/zypp2/parser/yum/YUMParser.h
Added: trunk/libzypp/devel/devel.jkupec/yum/patterns-example.xml
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/yum/p…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/yum/patterns-example.xml (added)
+++ trunk/libzypp/devel/devel.jkupec/yum/patterns-example.xml Tue May 22 20:48:46 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- valid against patterns.rnc r5590 -->
+<patterns
+ xmlns="http://novell.com/package/metadata/suse/pattern"
+ xmlns:rpm="http://linux.duke.edu/metadata/rpm"
+ count="2">
+ <pattern>
+ <name>example pattern</name>
+ <summary lang="en">Just an example pattern</summary>
+ <summary lang="sk">Toto je len prÃklad patternu</summary>
+ <description lang="en">Description of the example pattern</description>
+ <description lang="sk">Detailnejšà popis patternu</description>
+ <!-- <default/> -->
+ <uservisible/>
+ <category lang="en">Services</category>
+ <category lang="sk">Služby</category>
+ <icon>repodata/example-pattern.png</icon>
+ <rpm:requires>
+ <rpm:entry kind="package" name="pikaball" epoch="0" ver="3.0" rel="3" flags="GE"/>
+ </rpm:requires>
+ </pattern>
+ <pattern>
+ <name>funky apps</name>
+ <summary lang="en">Just an example of funky pattern</summary>
+ <summary lang="sk">PrÃklad funky patternu</summary>
+ <description lang="en">The best apps</description>
+ <description lang="sk">NajsamlepjÅ¡ie programÄoke</description>
+ <default/>
+ <uservisible/>
+ <category lang="en">Desktop Apps</category>
+ <category lang="sk">Klientské aplikácie</category>
+ <icon>repodata/funky-apps-pattern.png</icon>
+ <rpm:requires>
+ <rpm:entry kind="product" name="konsole" epoch="0" ver="2.1.5" rel="1" flags="GE"/>
+ </rpm:requires>
+ </pattern>
+</patterns>
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=…
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Tue May 22 20:48:46 2007
@@ -559,6 +559,7 @@
parser/yum/OtherFileReader.cc
parser/yum/FilelistsFileReader.cc
parser/yum/PatchFileReader.cc
+ parser/yum/PatternFileReader.cc
)
SET( zypp_parser_yum_HEADERS
@@ -580,6 +581,7 @@
parser/yum/OtherFileReader.h
parser/yum/FilelistsFileReader.h
parser/yum/PatchFileReader.h
+ parser/yum/PatternFileReader.h
parser/yum/schemanames.h
)
Modified: trunk/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData…
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.h (original)
+++ trunk/libzypp/zypp/data/ResolvableData.h Tue May 22 20:48:46 2007
@@ -232,7 +232,7 @@
{}
// Flags
- /** */
+ /** Should the pattern be installed by default? */
DefaultIntegral<bool,false> isDefault;
/** Visible or hidden at the UI. */
DefaultIntegral<bool,false> userVisible;
@@ -240,7 +240,7 @@
/** Category */
TranslatedText category;
- /** Icon path. */
+ /** Icon path relative to repository URL. */
std::string icon;
/** UI order string */
std::string order;
Modified: trunk/libzypp/zypp/data/ResolvableDataConsumer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData…
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableDataConsumer.h (original)
+++ trunk/libzypp/zypp/data/ResolvableDataConsumer.h Tue May 22 20:48:46 2007
@@ -33,6 +33,7 @@
virtual void consumePatch( const data::RecordId &catalog_id, data::Patch_Ptr ) = 0;
virtual void consumeMessage( const data::RecordId &catalog_id, data::Message_Ptr ) = 0;
virtual void consumeScript( const data::RecordId &catalog_id, data::Script_Ptr ) = 0;
+ virtual void consumePattern( const data::RecordId &catalog_id, data::Pattern_Ptr ) = 0;
virtual void consumeChangelog( const data::RecordId & catalog_id, const data::Resolvable_Ptr &, const Changelog & ) = 0;
virtual void consumeFilelist( const data::RecordId & catalog_id, const data::Resolvable_Ptr &, const data::Filenames & ) = 0;
Modified: trunk/libzypp/zypp/parser/yum/FileReaderBase.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileRead…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBase.h (original)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBase.h Tue May 22 20:48:46 2007
@@ -44,7 +44,8 @@
tag_message,
tag_pkgfiles,
tag_deltarpm,
- tag_patchrpm
+ tag_patchrpm,
+ tag_pattern
};
/**
Modified: trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PatchFileReader.cc Tue May 22 20:48:46 2007
@@ -274,7 +274,6 @@
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
- // TODO package extensions -> pkg-files, license-to-confirm
// xpath: /patch/atoms/package/pkgfiles
if (reader_r->name() == "pkgfiles")
{
@@ -623,11 +622,12 @@
return true;
}
- // TODO xpath: /patch/atoms/script/do-location
+ // xpath: /patch/atoms/script/do-location
if (reader_r->name() == "do-location")
{
- // xsd:anyURI do script file path base (is this used at all?)
+ // xsd:anyURI do script file path base (not used)
// ignoring reader_r->getAttribute("xml:base").asString();
+
// xsd:anyURI do script file path
script->doScriptLocation.filePath = reader_r->getAttribute("href").asString();
return true;
@@ -642,11 +642,12 @@
return true;
}
- // TODO xpath: /patch/atoms/script/undo-location
+ // xpath: /patch/atoms/script/undo-location
if (reader_r->name() == "undo-location")
{
- // xsd:anyURI undo script file path base (is this used at all?)
+ // xsd:anyURI undo script file path base (not used)
// ignoring reader_r->getAttribute("xml:base").asString();
+
// xsd:anyURI undo script file path
script->undoScriptLocation.filePath = reader_r->getAttribute("href").asString();
return true;
Added: trunk/libzypp/zypp/parser/yum/PatternFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatternF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatternFileReader.cc (added)
+++ trunk/libzypp/zypp/parser/yum/PatternFileReader.cc Tue May 22 20:48:46 2007
@@ -0,0 +1,154 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include "zypp/base/Logger.h"
+#include "zypp/parser/yum/PatternFileReader.h"
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+
+using namespace std;
+using namespace zypp::xml;
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ PatternFileReader::PatternFileReader(const Pathname & pattern_file, ProcessPattern callback)
+ : _callback(callback)
+ {
+ Reader reader(pattern_file);
+ MIL << "Reading " << pattern_file << endl;
+ reader.foreachNode(bind(&PatternFileReader::consumeNode, this, _1));
+ }
+
+ // --------------------------------------------------------------------------
+
+ /*
+ * xpath and multiplicity of processed nodes are included in the code
+ * for convenience:
+ *
+ * // xpath: <xpath> (?|*|+)
+ *
+ * if multiplicity is ommited, then the node has multiplicity 'one'.
+ */
+
+ // --------------------------------------------------------------------------
+
+ bool PatternFileReader::consumeNode(Reader & reader_r)
+ {
+ // dependency block nodes
+ if (consumeDependency(reader_r, _pattern->deps))
+ return true;
+
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ // xpath: /patterns/pattern
+ if (reader_r->name() == "pattern")
+ {
+ tag(tag_pattern); // just for the case of reuse somewhere/sometimes
+ _pattern = new data::Pattern;
+ return true;
+ }
+
+ // xpath: /patterns/pattern/name
+ if (reader_r->name() == "name")
+ {
+ _pattern->name = reader_r.nodeText().asString();
+ return true;
+ }
+
+ // xpath: /patterns/pattern/summary (+)
+ if (reader_r->name() == "summary")
+ {
+ Locale locale(reader_r->getAttribute("lang").asString());
+ _pattern->summary.setText(reader_r.nodeText().asString(), locale);
+ return true;
+ }
+
+ // xpath: /patterns/pattern/description (+)
+ if (reader_r->name() == "description")
+ {
+ Locale locale(reader_r->getAttribute("lang").asString());
+ _pattern->description.setText(reader_r.nodeText().asString(), locale);
+ return true;
+ }
+
+ // xpath: /patterns/pattern/default (?)
+ if (reader_r->name() == "default")
+ {
+ _pattern->isDefault = true;
+ }
+
+ // xpath: /patterns/pattern/uservisible (?)
+ if (reader_r->name() == "uservisible")
+ {
+ _pattern->userVisible = true;
+ return true;
+ }
+
+ // xpath: /patterns/pattern/category
+ if (reader_r->name() == "category")
+ {
+ Locale locale(reader_r->getAttribute("lang").asString());
+ _pattern->category.setText(reader_r.nodeText().asString(), locale);
+ return true;
+ }
+
+ // xpath: /patterns/pattern/icon (?)
+ if (reader_r->name() == "icon")
+ {
+ _pattern->icon = reader_r.nodeText().asString();
+ return true;
+ }
+
+ // xpath: /patterns/pattern/script (?)
+ if (reader_r->name() == "script")
+ {
+ _pattern->script = reader_r.nodeText().asString();
+ return true;
+ }
+ }
+
+ else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
+ {
+ // xpath: /patterns/pattern
+ if (reader_r->name() == "pattern")
+ {
+ if (_callback)
+ _callback(handoutPattern());
+
+ toParentTag(); // just for the case of reuse somewhere/sometimes
+
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ // --------------------------------------------------------------------------
+
+ data::Pattern_Ptr PatternFileReader::handoutPattern()
+ {
+ data::Pattern_Ptr ret;
+ ret.swap(_pattern);
+ return ret;
+ }
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/PatternFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatternF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatternFileReader.h (added)
+++ trunk/libzypp/zypp/parser/yum/PatternFileReader.h Tue May 22 20:48:46 2007
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef PATTERNFILEREADER_H_
+#define PATTERNFILEREADER_H_
+
+#include "zypp/base/Function.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/parser/yum/FileReaderBase.h"
+#include "zypp/data/ResolvableData.h"
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ /**
+ * Reader of pattern.xml files conforming to RNC/RNG definition located
+ * in zypp/parser/yum/schema/pattern.rn(c|g).
+ *
+ * \see zypp::data::Pattern
+ * \see zypp::parser::xml::Reader
+ */
+ class PatternFileReader : FileReaderBase
+ {
+ public:
+
+ /**
+ * Consumer callback definition. Function which will process the read
+ * data must be of this type.
+ */
+ typedef function<bool(const data::Pattern_Ptr &)> ProcessPattern;
+
+ /**
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
+ * \param pattern_file pattern.xml file to read.
+ * \param callback Function which will process read data.
+ */
+ PatternFileReader(const Pathname & pattern_file, ProcessPattern callback);
+
+ private:
+
+ /**
+ * Callback provided to the XML reader.
+ *
+ * \param the xml reader object reading the file
+ * \return true to tell the reader to continue, false to tell it to stop
+ *
+ * \see PrimaryFileReader::consumeNode(xml::Reader)
+ */
+ bool consumeNode(xml::Reader & reader_r);
+
+ /**
+ * Creates a new \ref data::Pattern_Ptr, swaps its contents with \ref _pattern
+ * and returns it. Used to hand-out the data object to its consumer
+ * (a \ref ProcessPattern function) after it has been read.
+ */
+ data::Pattern_Ptr handoutPattern();
+
+ private:
+ /**
+ * Callback for processing pattern metadata.
+ */
+ ProcessPattern _callback;
+
+ /**
+ * Pointer to the \ref zypp::data::Pattern object for storing the pattern
+ * metada.
+ */
+ data::Pattern_Ptr _pattern;
+ };
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+#endif /*PATTERNFILEREADER_H_*/
Modified: trunk/libzypp/zypp/parser/yum/schema/patterns.rnc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/p…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/patterns.rnc (original)
+++ trunk/libzypp/zypp/parser/yum/schema/patterns.rnc Tue May 22 20:48:46 2007
@@ -1,28 +1,47 @@
+# Elements:
+#
+# name
+# summary
+# short summary
+# description
+# detailed description
+# default
+# if present, this element indicates that the pattern should be installed
+# by default
+# uservisible
+# if present, this element indicates that the pattern should be presented
+# to user in the UI.
+# category
+# one of defined categories to which the pattern belongs
+# (e.g Graphical Environments, Desktop Functions)
+# icon
+# path to icon (relative to installation source URL) file representing
+# the pattern
+# script
+# ?
+# dependencies
+# see rpm-ns.rnc
+
default namespace = "http://novell.com/package/metadata/suse/pattern"
include "suse-primary.rnc" {
- start = element-pattern
- # names in dependencies can include a "kind". Should not be used for packages.
- attribute-name =
- attribute kind { "package" | "patch" | "script" | "message" | "product" }?,
- attribute name { text }
+ start = element-patterns
+}
+
+element-patterns = element patterns {
+ attribute count { xsd:nonNegativeInteger }?,
+ element-pattern+
}
element-pattern = element pattern { pattern }
pattern =
element name { text },
- element summary {
- attribute lang { text }?,
- text
- }+,
- element default { "true" | "false" }?,
- element uservisible { "true" | "false" },
- element category { text },
- element icon { text },
+ element summary { localized-string }+,
+ element description { localized-string }+,
+ element default { empty }?,
+ element uservisible { empty }?,
+ element category { localized-string }+,
+ element icon { text }?,
element script { text }?,
- element description {
- attribute lang { text }?,
- text
- }+, dependencies
-
+ dependencies
Modified: trunk/libzypp/zypp/parser/yum/schema/patterns.rng
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/p…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/patterns.rng (original)
+++ trunk/libzypp/zypp/parser/yum/schema/patterns.rng Tue May 22 20:48:46 2007
@@ -1,25 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
-<grammar ns="http://novell.com/package/metadata/suse/pattern" xmlns="http://relaxng.org/ns/structure/1.0">
+<!--
+ Elements:
+
+ name
+ summary
+ short summary
+ description
+ detailed description
+ default
+ if present, this element indicates that the pattern should be installed
+ by default
+ uservisible
+ if present, this element indicates that the pattern should be presented
+ to user in the UI.
+ category
+ one of defined categories to which the pattern belongs
+ (e.g Graphical Environments, Desktop Functions)
+ icon
+ path to icon (relative to installation source URL) file representing
+ the pattern
+ script
+ ?
+ dependencies
+ see rpm-ns.rnc
+-->
+<grammar ns="http://novell.com/package/metadata/suse/pattern" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href="suse-primary.rng">
<start>
- <ref name="element-pattern"/>
+ <ref name="element-patterns"/>
</start>
- <!-- names in dependencies can include a "kind". Should not be used for packages. -->
- <define name="attribute-name">
+ </include>
+ <define name="element-patterns">
+ <element name="patterns">
<optional>
- <attribute name="kind">
- <choice>
- <value>package</value>
- <value>patch</value>
- <value>script</value>
- <value>message</value>
- <value>product</value>
- </choice>
+ <attribute name="count">
+ <data type="nonNegativeInteger"/>
</attribute>
</optional>
- <attribute name="name"/>
- </define>
- </include>
+ <oneOrMore>
+ <ref name="element-pattern"/>
+ </oneOrMore>
+ </element>
+ </define>
<define name="element-pattern">
<element name="pattern">
<ref name="pattern"/>
@@ -31,45 +53,39 @@
</element>
<oneOrMore>
<element name="summary">
- <optional>
- <attribute name="lang"/>
- </optional>
- <text/>
+ <ref name="localized-string"/>
+ </element>
+ </oneOrMore>
+ <oneOrMore>
+ <element name="description">
+ <ref name="localized-string"/>
</element>
</oneOrMore>
<optional>
<element name="default">
- <choice>
- <value>true</value>
- <value>false</value>
- </choice>
+ <empty/>
</element>
</optional>
- <element name="uservisible">
- <choice>
- <value>true</value>
- <value>false</value>
- </choice>
- </element>
- <element name="category">
- <text/>
- </element>
- <element name="icon">
- <text/>
- </element>
<optional>
- <element name="script">
- <text/>
+ <element name="uservisible">
+ <empty/>
</element>
</optional>
<oneOrMore>
- <element name="description">
- <optional>
- <attribute name="lang"/>
- </optional>
- <text/>
+ <element name="category">
+ <ref name="localized-string"/>
</element>
</oneOrMore>
+ <optional>
+ <element name="icon">
+ <text/>
+ </element>
+ </optional>
+ <optional>
+ <element name="script">
+ <text/>
+ </element>
+ </optional>
<ref name="dependencies"/>
</define>
</grammar>
Modified: trunk/libzypp/zypp/parser/yum/schema/repomd.rnc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/r…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/repomd.rnc (original)
+++ trunk/libzypp/zypp/parser/yum/schema/repomd.rnc Tue May 22 20:48:46 2007
@@ -2,7 +2,7 @@
element repomd {
element data {
- attribute type { "other" | "filelists" | "primary" | "group" | "product" | "patches" | "pattern" }&
+ attribute type { "other" | "filelists" | "primary" | "group" | "product" | "patches" | "patterns" }&
element location {
attribute xml:base { xsd:anyURI }?,
attribute href { xsd:anyURI },
Modified: trunk/libzypp/zypp/parser/yum/schema/repomd.rng
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/schema/r…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/schema/repomd.rng (original)
+++ trunk/libzypp/zypp/parser/yum/schema/repomd.rng Tue May 22 20:48:46 2007
@@ -12,7 +12,7 @@
<value>group</value>
<value>product</value>
<value>patches</value>
- <value>pattern</value>
+ <value>patterns</value>
</choice>
</attribute>
<element name="location">
Modified: trunk/libzypp/zypp/source/yum/YUMResourceType.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.cc (original)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.cc Tue May 22 20:48:46 2007
@@ -8,11 +8,8 @@
\---------------------------------------------------------------------*/
#include <map>
-
#include "zypp/base/Exception.h"
-
#include "YUMResourceType.h"
-//#include <iostream>
namespace zypp
{
@@ -32,6 +29,7 @@
const YUMResourceType YUMResourceType::PATCHES(YUMResourceType::PATCHES_e);
const YUMResourceType YUMResourceType::PATCH(YUMResourceType::PATCH_e);
const YUMResourceType YUMResourceType::PRODUCT(YUMResourceType::PRODUCT_e);
+ const YUMResourceType YUMResourceType::PATTERN(YUMResourceType::PATTERN_e);
YUMResourceType::YUMResourceType(const std::string & strval_r)
@@ -51,6 +49,7 @@
_table["patches"] = YUMResourceType::PATCHES_e;
_table["patch"] = YUMResourceType::PATCH_e;
_table["product"] = YUMResourceType::PRODUCT_e;
+ _table["patterns"] = YUMResourceType::PATTERN_e;
_table["NONE"] = _table["none"] = YUMResourceType::NONE_e;
}
@@ -79,12 +78,15 @@
_table[PATCHES_e] = "patches";
_table[PATCH_e] = "patch";
_table[PRODUCT_e] = "product";
+ _table[PATTERN_e] = "patterns";
_table[NONE_e] = "NONE";
}
return _table[_type];
}
- }
- }
-}
+ } // ns yum
+ } // ns source
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp/source/yum/YUMResourceType.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.h (original)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.h Tue May 22 20:48:46 2007
@@ -34,6 +34,7 @@
static const YUMResourceType PATCHES; // suse extension
static const YUMResourceType PATCH; // suse extension
static const YUMResourceType PRODUCT; // suse extension
+ static const YUMResourceType PATTERN; // suse extension
enum Type
{
@@ -45,7 +46,8 @@
GROUP_e,
PATCHES_e,
PATCH_e,
- PRODUCT_e
+ PRODUCT_e,
+ PATTERN_e
};
YUMResourceType(Type type) : _type(type) {}
@@ -68,9 +70,11 @@
inline bool operator==(const YUMResourceType & obj1, const YUMResourceType & obj2)
{ return obj1._type == obj2._type; }
- }
- }
-}
+
+ } // ns yum
+ } // ns source
+} // ns zypp
+
#endif /*YUMRESOURCETYPE_H_*/
// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp2/parser/yum/YUMParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/parser/yum/YUMPars…
==============================================================================
--- trunk/libzypp/zypp2/parser/yum/YUMParser.cc (original)
+++ trunk/libzypp/zypp2/parser/yum/YUMParser.cc Tue May 22 20:48:46 2007
@@ -15,6 +15,7 @@
#include "zypp/parser/yum/PrimaryFileReader.h"
#include "zypp/parser/yum/PatchesFileReader.h"
#include "zypp/parser/yum/PatchFileReader.h"
+#include "zypp/parser/yum/PatternFileReader.h"
#include "zypp/parser/yum/OtherFileReader.h"
#include "zypp/parser/yum/FilelistsFileReader.h"
@@ -142,6 +143,20 @@
// -------------------------------------------------------------------------
+ bool YUMParser::pattern_CB(const data::Pattern_Ptr & pattern_ptr)
+ {
+ _consumer.consumePattern(_catalog_id, pattern_ptr);
+
+ DBG << "got pattern "
+ << pattern_ptr->name << pattern_ptr->edition << " "
+ << pattern_ptr->arch
+ << endl;
+
+ return true;
+ }
+
+ // -------------------------------------------------------------------------
+
void YUMParser::start(const Pathname &cache_dir)
{
zypp::parser::yum::RepomdFileReader(
@@ -201,10 +216,13 @@
case YUMResourceType::OTHER_e:
{
+ WAR << "ignoring other.xml.gz for now..." << endl;
+ /*
zypp::parser::yum::OtherFileReader(
cache_dir + job.filename(),
bind(&YUMParser::other_CB, this, _1, _2),
&progress_function);
+ */
break;
}
@@ -217,6 +235,14 @@
break;
}
+ case YUMResourceType::PATTERN_e:
+ {
+ zypp::parser::yum::PatternFileReader(
+ cache_dir + job.filename(),
+ bind(&YUMParser::pattern_CB, this, _1));
+ break;
+ }
+
default:
{
WAR << "Don't know how to read "
Modified: trunk/libzypp/zypp2/parser/yum/YUMParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/parser/yum/YUMPars…
==============================================================================
--- trunk/libzypp/zypp2/parser/yum/YUMParser.h (original)
+++ trunk/libzypp/zypp2/parser/yum/YUMParser.h Tue May 22 20:48:46 2007
@@ -161,6 +161,14 @@
*/
bool filelist_CB(const data::Resolvable_Ptr & res_ptr, const data::Filenames & filenames);
+ /**
+ * Callback for processing data returned from \ref PatternFileReader.
+ * Uses \ref _consumer to process read pattern.
+ *
+ * \param pattern_ptr pointer to pattern data object
+ */
+ bool pattern_CB(const data::Pattern_Ptr & pattern_ptr);
+
private:
/** Object for processing the read data */
data::ResolvableDataConsumer & _consumer;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5589 - /trunk/libzypp/zypp/parser/yum/FileReaderBase.cc
by jkupec@svn.opensuse.org 22 May '07
by jkupec@svn.opensuse.org 22 May '07
22 May '07
Author: jkupec
Date: Tue May 22 20:26:31 2007
New Revision: 5589
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5589&view=rev
Log:
feeding rpm:entry kind attribute (default to "package") as 'refers'
argument to cap factory when reading dependencies
Modified:
trunk/libzypp/zypp/parser/yum/FileReaderBase.cc
Modified: trunk/libzypp/zypp/parser/yum/FileReaderBase.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileRead…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBase.cc (original)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBase.cc Tue May 22 20:26:31 2007
@@ -240,14 +240,22 @@
reader_r->getAttribute("rel").asString(),
reader_r->getAttribute("epoch").asString()
);
+
+ string kind_str = reader_r->getAttribute("kind").asString();
+ Resolvable::Kind kind;
+ if (kind_str.empty())
+ kind = ResTraits<Package>::kind;
+ else
+ kind = Resolvable::Kind(kind_str);
+
/*
DBG << "got rpm:entry for " << _dtype << ": "
<< reader_r->getAttribute("name").asString()
- << " " << edition << endl;
+ << " " << edition << " (" << kind << ")" << endl;
*/
deps_r[_dtype].insert(
zypp::capability::parse(
- ResTraits<Package>::kind,
+ kind,
reader_r->getAttribute("name").asString(),
Rel(reader_r->getAttribute("flags").asString()),
edition
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5588 - in /trunk/libzypp: devel/devel.dmacvicar/ zypp2/ zypp2/repository/memory/
by dmacvicar@svn.opensuse.org 22 May '07
by dmacvicar@svn.opensuse.org 22 May '07
22 May '07
Author: dmacvicar
Date: Tue May 22 18:04:40 2007
New Revision: 5588
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5588&view=rev
Log:
- class to create resolvables from data, for unit tests.
Added:
trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc
trunk/libzypp/zypp2/repository/memory/DPackageImpl.cc
trunk/libzypp/zypp2/repository/memory/DPackageImpl.h
trunk/libzypp/zypp2/repository/memory/DPatternImpl.cc
trunk/libzypp/zypp2/repository/memory/DPatternImpl.h
trunk/libzypp/zypp2/repository/memory/DProductImpl.cc
trunk/libzypp/zypp2/repository/memory/DProductImpl.h
trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.cc
trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.h
Removed:
trunk/libzypp/zypp2/repository/memory/DataPackageImpl.cc
trunk/libzypp/zypp2/repository/memory/DataPackageImpl.h
Modified:
trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
trunk/libzypp/zypp2/CMakeLists.txt
Modified: trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CM…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt Tue May 22 18:04:40 2007
@@ -24,6 +24,10 @@
TARGET_LINK_LIBRARIES(yum-downloader zypp )
TARGET_LINK_LIBRARIES(yum-downloader zypp2 )
+ADD_EXECUTABLE(yum-reader YUMReader_tp.cc)
+TARGET_LINK_LIBRARIES(yum-reader zypp )
+TARGET_LINK_LIBRARIES(yum-reader zypp2 )
+
ADD_EXECUTABLE(cachedsource CachedSource_tp.cc)
TARGET_LINK_LIBRARIES(cachedsource zypp )
TARGET_LINK_LIBRARIES(cachedsource zypp2 )
Added: trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/YU…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc (added)
+++ trunk/libzypp/devel/devel.dmacvicar/YUMReader_tp.cc Tue May 22 18:04:40 2007
@@ -0,0 +1,129 @@
+#include "zypp/ZYpp.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/base/Logger.h"
+#include "zypp/base/LogControl.h"
+#include "zypp/CapFactory.h"
+#include "zypp/data/ResolvableDataConsumer.h"
+#include "zypp/base/Measure.h"
+#include "zypp/detail/ResObjectFactory.h"
+#include "zypp2/parser/yum/YUMParser.h"
+#include "zypp2/repository/memory/DPackageImpl.h"
+
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "yumparsertest"
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::parser::yum;
+using zypp::debug::Measure;
+using namespace zypp::repository::memory;
+
+bool progress_function(ProgressData::value_type p)
+{
+ cout << "Parsing YUM source [" << p << "%]" << endl;
+// cout << "\rParsing YUM source [" << p << "%]" << flush;
+ return true;
+}
+
+class ResolvableConsumer : public data::ResolvableDataConsumer
+{
+ public:
+
+ typedef detail::ResImplTraits<DPackageImpl>::Ptr PkgImplPtr;
+ typedef detail::ResImplTraits<DPackageImpl>::Ptr SrcPkgImplPtr;
+
+ ResolvableConsumer()
+ {
+
+ }
+
+ void collectDeps( Dependencies &deps, const data::Dependencies &data_deps)
+ {
+ CapFactory factory;
+ for ( data::Dependencies::const_iterator i = data_deps.begin(); i != data_deps.end(); ++i )
+ {
+ data::DependencyList list(i->second);
+ zypp::Dep deptype(i->first);
+ for ( data::DependencyList::const_iterator it = list.begin(); it != list.end(); ++it )
+ {
+ deps[deptype].insert(factory.fromImpl(*it));
+ }
+ }
+ }
+
+ virtual ~ResolvableConsumer()
+ {
+
+ }
+
+ virtual void consumePackage( const data::RecordId &catalog_id, data::Package_Ptr ptr )
+ {
+ PkgImplPtr impl = PkgImplPtr( new DPackageImpl(ptr) );
+ Dependencies deps;
+ collectDeps( deps, ptr->deps );
+
+ Package::Ptr pkg = detail::makeResolvableFromImpl( NVRAD( ptr->name, ptr->edition, ptr->arch, deps), impl );
+ _store.insert(pkg);
+ }
+ virtual void consumeProduct( const data::RecordId &catalog_id, data::Product_Ptr )
+ {
+ }
+ virtual void consumePatch( const data::RecordId &catalog_id, data::Patch_Ptr )
+ {
+ }
+ virtual void consumeMessage( const data::RecordId &catalog_id, data::Message_Ptr )
+ {
+
+ }
+
+ virtual void consumeScript( const data::RecordId &catalog_id, data::Script_Ptr )
+ {
+
+ }
+
+ virtual void consumeChangelog( const data::RecordId & catalog_id, const data::Resolvable_Ptr &, const Changelog & )
+ {
+
+ }
+
+ virtual void consumeFilelist( const data::RecordId & catalog_id, const data::Resolvable_Ptr &, const data::Filenames & )
+ {}
+
+ //virtual void consumeSourcePackage( const data::SrcPackage_Ptr ) = 0;
+ ResStore _store;
+};
+
+
+int main(int argc, char **argv)
+{
+ base::LogControl::instance().logfile("yumparsertest.log");
+
+ if (argc < 2)
+ {
+ cout << "usage: yumparsertest path/to/yumsourcedir" << endl << endl;
+ return 1;
+ }
+
+ try
+ {
+ ZYpp::Ptr z = getZYpp();
+
+ MIL << "creating PrimaryFileParser" << endl;
+ Measure parse_primary_timer("primary.xml.gz parsing");
+ ResolvableConsumer store;
+ parser::yum::YUMParser parser( 0, store, &progress_function);
+ parser.start(argv[1]);
+ parse_primary_timer.stop();
+
+ cout << endl;
+ }
+ catch ( const Exception &e )
+ {
+ cout << "Oops! " << e.msg() << std::endl;
+ }
+
+ return 0;
+}
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev…
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Tue May 22 18:04:40 2007
@@ -99,11 +99,17 @@
)
SET( zypp2_repository_data_SRCS
- repository/memory/DataPackageImpl.cc
+ repository/memory/DPackageImpl.cc
+ repository/memory/DPatternImpl.cc
+ repository/memory/DProductImpl.cc
+ repository/memory/DSrcPackageImpl.cc
)
SET( zypp2_repository_data_HEADERS
- repository/memory/DataPackageImpl.h
+ repository/memory/DPackageImpl.h
+ repository/memory/DPatternImpl.h
+ repository/memory/DProductImpl.h
+ repository/memory/DSrcPackageImpl.h
)
SET( zypp2_parser_yum_SRCS
Added: trunk/libzypp/zypp2/repository/memory/DPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DPackageImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/memory/DPackageImpl.cc Tue May 22 18:04:40 2007
@@ -0,0 +1,242 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DPackageImpl.cc
+ *
+*/
+
+#include "zypp2/repository/memory/DPackageImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repository
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : PackageImpl::PackageImpl
+// METHOD TYPE : Ctor
+//
+DPackageImpl::DPackageImpl(data::Package_Ptr ptr)
+ :
+ _summary(ptr->summary),
+ _description(ptr->description),
+ _insnotify(ptr->insnotify),
+ _delnotify(ptr->delnotify),
+ _license_to_confirm(ptr->licenseToConfirm),
+ _group(ptr->group),
+ _keywords(),
+ _authors(ptr->authors),
+ _size(ptr->installedSize),
+ _archivesize(ptr->repositoryLocation.fileSize),
+ _vendor(ptr->vendor),
+ _license(ptr->license),
+ _buildtime(ptr->buildTime),
+ _media_number(ptr->repositoryLocation.mediaNr),
+ _location(ptr->repositoryLocation.filePath),
+ _diskusage(),
+ _checksum(ptr->repositoryLocation.fileChecksum)
+{
+}
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : PackageImpl::~PackageImpl
+// METHOD TYPE : Dtor
+//
+DPackageImpl::~DPackageImpl()
+{}
+
+TranslatedText DPackageImpl::summary() const
+{
+ return _summary;
+}
+
+TranslatedText DPackageImpl::description() const
+{
+ return _description;
+}
+
+TranslatedText DPackageImpl::insnotify() const
+{
+ return _insnotify;
+}
+
+TranslatedText DPackageImpl::delnotify() const
+{
+ return _delnotify;
+}
+
+TranslatedText DPackageImpl::licenseToConfirm() const
+{
+ return _license_to_confirm;
+}
+
+Source_Ref DPackageImpl::source() const
+{
+ return Source_Ref::noSource;
+}
+
+unsigned DPackageImpl::sourceMediaNr() const
+{
+ return _media_number;
+}
+
+CheckSum DPackageImpl::checksum() const
+{
+ return _checksum;
+}
+
+Date DPackageImpl::buildtime() const
+{
+ return _buildtime;
+}
+
+string DPackageImpl::buildhost() const
+{
+ return string();
+}
+
+Date DPackageImpl::installtime() const
+{
+ return Date();
+} // it was never installed
+
+string DPackageImpl::distribution() const
+{
+ return string();
+}
+
+Vendor DPackageImpl::vendor() const
+{
+ return string();
+}
+
+Label DPackageImpl::license() const
+{
+ return _license;
+}
+
+string DPackageImpl::packager() const
+{
+ return string();
+}
+
+PackageGroup DPackageImpl::group() const
+{
+ return _group;
+}
+
+DPackageImpl::Keywords DPackageImpl::keywords() const
+{
+ return _keywords;
+}
+
+Changelog DPackageImpl::changelog() const
+{
+ return Changelog();
+}
+
+Pathname DPackageImpl::location() const
+{
+ return _location;
+}
+
+string DPackageImpl::url() const
+{
+ return string();
+}
+
+string DPackageImpl::os() const
+{
+ return string();
+}
+
+Text DPackageImpl::prein() const
+{
+ return Text();
+}
+
+Text DPackageImpl::postin() const
+{
+ return Text();
+}
+
+Text DPackageImpl::preun() const
+{
+ return Text();
+}
+
+Text DPackageImpl::postun() const
+{
+ return Text();
+}
+
+ByteCount DPackageImpl::size() const
+{
+ return _size;
+}
+
+ByteCount DPackageImpl::sourcesize() const
+// FIXME
+{
+ return 0;
+}
+
+ByteCount DPackageImpl::archivesize() const
+{
+ return _archivesize;
+}
+
+DiskUsage DPackageImpl::diskusage() const
+{
+ return _diskusage;
+}
+
+list<string> DPackageImpl::authors() const
+{
+ return list<string>();
+}
+
+list<string> DPackageImpl::filenames() const
+{
+ return list<string>();
+}
+
+list<detail::PackageImplIf::DeltaRpm> DPackageImpl::deltaRpms() const
+{
+ return detail::PackageImplIf::deltaRpms();
+}
+
+list<detail::PackageImplIf::PatchRpm> DPackageImpl::patchRpms() const
+{
+ return detail::PackageImplIf::patchRpms();
+}
+
+bool DPackageImpl::installOnly() const
+{
+ return false;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace memory
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/repository/memory/DPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DPackageImpl.h (added)
+++ trunk/libzypp/zypp2/repository/memory/DPackageImpl.h Tue May 22 18:04:40 2007
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/source/memory/DPackageImpl.h
+ *
+*/
+#ifndef ZYPP_SOURCE_MEMORYPACKAGEIMPL_H
+#define ZYPP_SOURCE_MEMORYPACKAGEIMPL_H
+
+#include "zypp/detail/PackageImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/DiskUsage.h"
+#include "zypp/CheckSum.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ namespace memory
+ { /////////////////////////////////////////////////////////////////
+
+ DEFINE_PTR_TYPE(DImpl);
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PackageImpl
+ //
+ /**
+ */
+ struct DPackageImpl : public zypp::detail::PackageImplIf
+ {
+ DPackageImpl( data::Package_Ptr ptr );
+ virtual ~DPackageImpl();
+
+ /** \name ResObject attributes. */
+ //@{
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual TranslatedText insnotify() const;
+ virtual TranslatedText delnotify() const;
+ virtual TranslatedText licenseToConfirm() const;
+ virtual Source_Ref source() const;
+ virtual unsigned sourceMediaNr() const;
+ //@}
+
+ virtual CheckSum checksum() const;
+ virtual Date buildtime() const;
+ virtual std::string buildhost() const;
+ virtual Date installtime() const;
+ virtual std::string distribution() const;
+ virtual Vendor vendor() const;
+ virtual Label license() const;
+ virtual std::string packager() const;
+ virtual PackageGroup group() const;
+ virtual Keywords keywords() const;
+ virtual Changelog changelog() const;
+ virtual Pathname location() const;
+ virtual std::string url() const;
+ virtual std::string os() const;
+ virtual Text prein() const;
+ virtual Text postin() const;
+ virtual Text preun() const;
+ virtual Text postun() const;
+ virtual ByteCount size() const;
+ virtual ByteCount sourcesize() const;
+ virtual ByteCount archivesize() const;
+ virtual DiskUsage diskusage() const;
+ virtual std::list<std::string> authors() const;
+ virtual std::list<std::string> filenames() const;
+ virtual std::list<DeltaRpm> deltaRpms() const;
+ virtual std::list<PatchRpm> patchRpms() const;
+ virtual bool installOnly() const;
+
+ TranslatedText _summary;
+ TranslatedText _description;
+ TranslatedText _insnotify;
+ TranslatedText _delnotify;
+ TranslatedText _license_to_confirm;
+
+ PackageGroup _group;
+ Keywords _keywords;
+ std::list<std::string> _authors;
+ ByteCount _size;
+ ByteCount _archivesize;
+ Vendor _vendor;
+ Label _license;
+ Date _buildtime;
+ unsigned _media_number;
+ Pathname _location;
+ DiskUsage _diskusage;
+ CheckSum _checksum;
+private:
+ };
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+ } // namespace memory
+ /////////////////////////////////////////////////////////////////
+ } // namespace repository
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PACKAGEIMPL_H
Added: trunk/libzypp/zypp2/repository/memory/DPatternImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DPatternImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/memory/DPatternImpl.cc Tue May 22 18:04:40 2007
@@ -0,0 +1,81 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DPatternImpl.cc
+ *
+*/
+#include "zypp2/repository/memory/DPatternImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repository
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : PatternImpl::PatternImpl
+// METHOD TYPE : Ctor
+//
+DPatternImpl::DPatternImpl(data::Pattern_Ptr ptr)
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : PatternImpl::~PatternImpl
+// METHOD TYPE : Dtor
+//
+DPatternImpl::~DPatternImpl()
+{}
+
+Source_Ref DPatternImpl::source() const
+{
+ return Source_Ref::noSource;
+}
+
+TranslatedText DPatternImpl::summary() const
+{
+ return _summary;
+}
+
+TranslatedText DPatternImpl::description() const
+{
+ return _description;
+}
+
+TranslatedText DPatternImpl::category() const
+{
+ return _category;
+}
+
+bool DPatternImpl::userVisible() const
+{
+ return _visible;
+}
+
+Label DPatternImpl::order() const
+{
+ return _order;
+}
+
+Pathname DPatternImpl::icon() const
+{
+ return _icon;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace detail
+///////////////////////////////////////////////////////////////////
+}
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/repository/memory/DPatternImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DPatternImpl.h (added)
+++ trunk/libzypp/zypp2/repository/memory/DPatternImpl.h Tue May 22 18:04:40 2007
@@ -0,0 +1,64 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DPatternImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_MEMORY_PATTERNIMPL_H
+#define ZYPP_DETAIL_MEMORY_PATTERNIMPL_H
+
+#include "zypp/detail/PatternImplIf.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/Source.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ namespace memory
+ {
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatternImpl
+ //
+ /**
+ */
+ struct DPatternImpl : public zypp::detail::PatternImplIf
+ {
+public:
+ DPatternImpl(data::Pattern_Ptr ptr);
+ virtual ~DPatternImpl();
+
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual TranslatedText category() const;
+ virtual bool userVisible() const;
+ virtual Label order() const;
+ virtual Pathname icon() const;
+ virtual Source_Ref source() const;
+
+ TranslatedText _summary;
+ TranslatedText _description;
+ TranslatedText _category;
+ bool _visible;
+ std::string _order;
+ Pathname _icon;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace memory
+ ///////////////////////////////////////////////////////////////////
+ } // namespace repository
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PATTERNIMPL_H
Added: trunk/libzypp/zypp2/repository/memory/DProductImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DProductImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/memory/DProductImpl.cc Tue May 22 18:04:40 2007
@@ -0,0 +1,111 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DProductImpl.cc
+ *
+*/
+#include "zypp2/repository/memory/DProductImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace memory
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : DProductImpl::DProductImpl
+ // METHOD TYPE : Ctor
+ //
+ DProductImpl::DProductImpl(data::Product_Ptr ptr)
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : DProductImpl::~DProductImpl
+ // METHOD TYPE : Dtor
+ //
+ DProductImpl::~DProductImpl()
+ {}
+
+
+ std::string DProductImpl::category() const
+ {
+ return _category;
+ }
+
+ Label DProductImpl::vendor() const
+ {
+ return _vendor;
+ }
+
+ TranslatedText DProductImpl::summary() const
+ {
+ return _summary;
+ }
+
+ Source_Ref DProductImpl::source() const
+ {
+ return Source_Ref::noSource;
+ }
+
+ Url DProductImpl::releaseNotesUrl() const
+ {
+ return _release_notes_url;
+ }
+
+ std::list<Url> DProductImpl::updateUrls() const
+ {
+ return _update_urls;
+ }
+
+ std::list<Url> DProductImpl::extraUrls() const
+ {
+ return _extra_urls;
+ }
+
+ std::list<Url> DProductImpl::optionalUrls() const
+ {
+ return _optional_urls;
+ }
+
+ std::list<std::string> DProductImpl::flags() const
+ {
+ return _flags;
+ }
+
+ TranslatedText DProductImpl::shortName() const
+ {
+ return TranslatedText(_shortlabel);
+ }
+
+ std::string DProductImpl::distributionName() const
+ {
+ return _dist_name;
+ }
+
+ Edition DProductImpl::distributionEdition() const
+ {
+ return _dist_version;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace memory
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+ } // namespace repository
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/repository/memory/DProductImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DProductImpl.h (added)
+++ trunk/libzypp/zypp2/repository/memory/DProductImpl.h Tue May 22 18:04:40 2007
@@ -0,0 +1,102 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DProductImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_MEMORY_PRODUCTIMPL_H
+#define ZYPP_DETAIL_MEMORY_PRODUCTIMPL_H
+
+#include <map>
+
+#include "zypp/CheckSum.h"
+#include "zypp/CapSet.h"
+#include "zypp/detail/ProductImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/TranslatedText.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace memory
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ProductImpl
+ //
+ /**
+ */
+ struct DProductImpl : public zypp::detail::ProductImplIf
+ {
+ public:
+ DProductImpl(data::Product_Ptr ptr);
+ virtual ~DProductImpl();
+
+ virtual std::string category() const;
+ virtual Label vendor() const;
+ virtual TranslatedText summary() const;
+ virtual Source_Ref source() const;
+ virtual Url releaseNotesUrl() const;
+
+ virtual std::list<Url> updateUrls() const;
+ virtual std::list<Url> extraUrls() const;
+ virtual std::list<Url> optionalUrls() const;
+
+ virtual std::list<std::string> flags() const;
+ virtual TranslatedText shortName() const;
+ virtual std::string distributionName() const;
+ virtual Edition distributionEdition() const;
+
+ std::string _category;
+
+ std::string _name;
+ std::string _version;
+ std::string _dist_name;
+ Edition _dist_version;
+
+ std::string _base_product;
+ std::string _base_version;
+ std::string _you_type;
+ std::string _shortlabel;
+ std::string _vendor;
+ Url _release_notes_url;
+
+ std::list<Url> _update_urls;
+ std::list<Url> _extra_urls;
+ std::list<Url> _optional_urls;
+
+ std::map< std::string, std::list<std::string> > _arch; // map of 'arch : "arch1 arch2 arch3"', arch1 being 'best', arch3 being 'noarch' (ususally)
+ std::string _default_base;
+ Dependencies _deps;
+ std::list<std::string> _languages;
+ TranslatedText _summary;
+ std::string _description_dir;
+ std::string _data_dir;
+ std::list<std::string> _flags;
+ std::string _language;
+ std::string _timezone;
+
+ std::map<std::string, CheckSum> _descr_files_checksums;
+ std::map<std::string, CheckSum> _signing_keys;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace memory
+ ///////////////////////////////////////////////////////////////////
+ } // namespace repository
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PRODUCTIMPL_H
Added: trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.cc Tue May 22 18:04:40 2007
@@ -0,0 +1,77 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DSrcPackageImpl.cc
+ *
+*/
+#include "zypp2/repository/memory/DSrcPackageImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repository
+{ /////////////////////////////////////////////////////////////////
+namespace memory
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : SrcPackageImpl::SrcPackageImpl
+// METHOD TYPE : Ctor
+//
+DSrcPackageImpl::DSrcPackageImpl(data::SrcPackage_Ptr ptr)
+ : _media_number( 1 )
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : SrcPackageImpl::~SrcPackageImpl
+// METHOD TYPE : Dtor
+//
+DSrcPackageImpl::~DSrcPackageImpl()
+{}
+
+
+Pathname DSrcPackageImpl::location() const
+{
+ return _location;
+}
+
+ByteCount DSrcPackageImpl::archivesize() const
+{
+ return _archivesize;
+}
+
+DiskUsage DSrcPackageImpl::diskusage() const
+{
+ return _diskusage;
+}
+
+Source_Ref DSrcPackageImpl::source() const
+{
+ return Source_Ref::noSource;
+}
+
+unsigned DSrcPackageImpl::sourceMediaNr() const
+{
+ return _media_number;
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace memory
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/memory/…
==============================================================================
--- trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.h (added)
+++ trunk/libzypp/zypp2/repository/memory/DSrcPackageImpl.h Tue May 22 18:04:40 2007
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp2/repository/memory/DSrcPackageImpl.h
+ *
+*/
+#ifndef ZYPP_SOURCE_MEMORYSRCPackageIMPL_H
+#define ZYPP_SOURCE_MEMORYSRCPackageIMPL_H
+
+#include "zypp/detail/SrcPackageImplIf.h"
+#include "zypp/Source.h"
+#include "zypp/DiskUsage.h"
+#include "zypp/data/ResolvableData.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ namespace memory
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : SrcPackageImpl
+ //
+ /**
+ */
+ struct DSrcPackageImpl : public zypp::detail::SrcPackageImplIf
+ {
+ DSrcPackageImpl(data::SrcPackage_Ptr ptr);
+ virtual ~DSrcPackageImpl();
+
+ /** */
+ virtual Pathname location() const;
+ /** */
+ virtual ByteCount archivesize() const;
+ /** */
+ virtual DiskUsage diskusage() const;
+ /** */
+ virtual unsigned sourceMediaNr() const;
+
+private:
+ ByteCount _archivesize;
+ unsigned _media_number;
+ Pathname _location;
+ DiskUsage _diskusage;
+public:
+ Source_Ref source() const;
+ };
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+ } // namespace memory
+ /////////////////////////////////////////////////////////////////
+ } // namespace repository
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_MEMORY_SRCPACKAGEIMPL_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5587 - in /trunk/libzypp/zypp: CMakeLists.txt Fetcher.cc Fetcher.h FileChecker.cc FileChecker.h source/yum/YUMDownloader.cc source/yum/YUMResourceType.h
by dmacvicar@svn.opensuse.org 22 May '07
by dmacvicar@svn.opensuse.org 22 May '07
22 May '07
Author: dmacvicar
Date: Tue May 22 18:04:20 2007
New Revision: 5587
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5587&view=rev
Log:
- make FileChecker use exceptions instead of bool
- Move it out of Fetcher
- port..
Added:
trunk/libzypp/zypp/FileChecker.cc
trunk/libzypp/zypp/FileChecker.h
Modified:
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/Fetcher.cc
trunk/libzypp/zypp/Fetcher.h
trunk/libzypp/zypp/source/yum/YUMDownloader.cc
trunk/libzypp/zypp/source/yum/YUMResourceType.h
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=…
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Tue May 22 18:04:20 2007
@@ -86,6 +86,7 @@
ProvideFilePolicy.cc
OnMediaLocation.cc
Fetcher.cc
+ FileChecker.cc
)
SET( zypp_HEADERSZ
@@ -182,6 +183,7 @@
ZYppCommitPolicy.h
ZYppCommitResult.h
ZYppFactory.h
+ FileChecker.h
)
INSTALL( FILES ${zypp_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/zypp" )
Modified: trunk/libzypp/zypp/Fetcher.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Fetcher.cc?rev=5587…
==============================================================================
--- trunk/libzypp/zypp/Fetcher.cc (original)
+++ trunk/libzypp/zypp/Fetcher.cc Tue May 22 18:04:20 2007
@@ -14,9 +14,7 @@
#include "zypp/base/Logger.h"
#include "zypp/base/DefaultIntegral.h"
-#include "zypp/ZYppFactory.h"
#include "zypp/Fetcher.h"
-#include "zypp/KeyRing.h"
using namespace std;
@@ -24,96 +22,9 @@
namespace zypp
{ /////////////////////////////////////////////////////////////////
- Fetcher::ChecksumFileChecker::ChecksumFileChecker( const CheckSum &checksum )
- : _checksum(checksum)
- {
- }
-
- bool Fetcher::ChecksumFileChecker::operator()( const Pathname &file ) const
- {
- callback::SendReport<DigestReport> report;
- CheckSum real_checksum( _checksum.type(), filesystem::checksum( file, _checksum.type() ));
-
- if ( _checksum.empty() )
- {
- MIL << "File " << file << " has no checksum available." << std::endl;
- if ( report->askUserToAcceptNoDigest(file) )
- {
- MIL << "User accepted " << file << " with no checksum." << std::endl;
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- if ( (real_checksum == _checksum) )
- {
- if ( report->askUserToAcceptWrongDigest( file, _checksum.checksum(), real_checksum.checksum() ) )
- {
- WAR << "User accepted " << file << " with WRONG CHECKSUM." << std::endl;
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
-
- bool Fetcher::NullFileChecker::operator()(const Pathname &file ) const
- {
- return true;
- }
-
- bool Fetcher::CompositeFileChecker::operator()(const Pathname &file ) const
- {
- bool result = true;
- for ( list<Fetcher::FileChecker>::const_iterator it = _checkers.begin(); it != _checkers.end(); ++it )
- {
- result = result && (*it)(file);
- }
- return result;
- }
-
- void Fetcher::CompositeFileChecker::add( const FileChecker &checker )
- {
- _checkers.push_back(checker);
- }
-
- Fetcher::SignatureFileChecker::SignatureFileChecker( const Pathname &signature )
- : _signature(signature)
- {
- }
-
- Fetcher::SignatureFileChecker::SignatureFileChecker()
- {
- }
-
- void Fetcher::SignatureFileChecker::addPublicKey( const Pathname &publickey )
- {
- ZYpp::Ptr z = getZYpp();
- z->keyRing()->importKey(publickey, false);
- }
-
- bool Fetcher::SignatureFileChecker::operator()(const Pathname &file ) const
- {
- ZYpp::Ptr z = getZYpp();
- MIL << "checking " << file << " file validity using digital signature.." << endl;
- bool valid = z->keyRing()->verifyFileSignatureWorkflow( file, string(), _signature);
- return valid;
- }
-
/**
* Class to encapsulate the \ref OnMediaLocation object
- * and the \ref Fetcher::FileChcker together
+ * and the \ref FileChcker together
*/
struct FetcherJob
{
@@ -124,7 +35,7 @@
}
OnMediaLocation location;
- Fetcher::CompositeFileChecker checkers;
+ CompositeFileChecker checkers;
};
///////////////////////////////////////////////////////////////////
@@ -137,8 +48,8 @@
public:
- void enqueue( const OnMediaLocation &resource, const Fetcher::FileChecker &checker );
- void enqueueDigested( const OnMediaLocation &resource, const Fetcher::FileChecker &checker );
+ void enqueue( const OnMediaLocation &resource, const FileChecker &checker );
+ void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker );
void addCachePath( const Pathname &cache_dir );
void reset();
void start( const Pathname &dest_dir, MediaSetAccess &media );
@@ -275,13 +186,21 @@
// no matter where did we got the file, try to validate it:
Pathname localfile = dest_dir + (*it_res).location.filename();
// call the checker function
- bool good = (*it_res).checkers(localfile);
- if (!good)
+ try {
+ (*it_res).checkers(localfile);
+ }
+ catch ( const FileCheckException &e )
{
- //FIXME better message
- ZYPP_THROW(Exception("File " + (*it_res).location.filename().asString() + " does not validate." ));
+ ZYPP_RETHROW(e);
+ }
+ catch ( const Exception &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+ catch (...)
+ {
+ ZYPP_THROW(Exception("Unknown error while validating " + (*it_res).location.filename().asString()));
}
-
} // for each job
}
@@ -314,12 +233,12 @@
Fetcher::~Fetcher()
{}
- void Fetcher::enqueueDigested( const OnMediaLocation &resource, const Fetcher::FileChecker &checker )
+ void Fetcher::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker )
{
_pimpl->enqueue(resource, checker);
}
- void Fetcher::enqueue( const OnMediaLocation &resource, const Fetcher::FileChecker &checker )
+ void Fetcher::enqueue( const OnMediaLocation &resource, const FileChecker &checker )
{
_pimpl->enqueue(resource, checker);
}
Modified: trunk/libzypp/zypp/Fetcher.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Fetcher.h?rev=5587&…
==============================================================================
--- trunk/libzypp/zypp/Fetcher.h (original)
+++ trunk/libzypp/zypp/Fetcher.h Tue May 22 18:04:20 2007
@@ -21,6 +21,7 @@
#include "zypp/OnMediaLocation.h"
#include "zypp/Digest.h"
#include "zypp/MediaSetAccess.h"
+#include "zypp/FileChecker.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -66,106 +67,6 @@
public:
/** Implementation */
class Impl;
-
- /**
- * Functor signature used to check files.
- * \param file File to check.
- */
- typedef boost::function<bool ( const Pathname &file )> FileChecker;
-
- /**
- * Built in file checkers
- */
-
- /**
- * \short Checks for a valid checksum and interacts with the user.
- */
- class ChecksumFileChecker
- {
- public:
- /**
- * Constructor.
- * \param checksum Checksum that validates the file
- */
- ChecksumFileChecker( const CheckSum &checksum );
- /**
- * \short Try to validate the file
- * \param file File to validate.
- */
- bool operator()( const Pathname &file ) const;
-
- private:
- CheckSum _checksum;
- };
-
- /**
- * \short Checks for the validity of a signature
- */
- class SignatureFileChecker
- {
- public:
- /**
- * Constructor.
- * \param signature Signature that validates the file
- */
- SignatureFileChecker( const Pathname &signature );
-
- /**
- * Default Constructor.
- * \short Signature for unsigned files
- * Use it when you dont have a signature but you want
- * to check the user to accept an unsigned file.
- */
- SignatureFileChecker();
-
-
- /**
- * add a public key to the list of known keys
- */
- void addPublicKey( const Pathname &publickey );
- /**
- * \short Try to validate the file
- * \param file File to validate.
- */
- bool operator()( const Pathname &file ) const;
-
- private:
- Pathname _signature;
- };
-
- /**
- * \short Checks for nothing
- * Used as the default checker
- */
- class NullFileChecker
- {
- public:
- bool operator()( const Pathname &file ) const;
- };
-
- /**
- * \short Checker composed of more checkers.
- *
- * Allows to create a checker composed of various
- * checkers altothether. It will only
- * validate if all the checkers validate.
- *
- * \code
- * CompositeFileChecker com;
- * com.add(checker1);
- * com.add(checker2);
- * fetcher.enqueue(location, com);
- * \endcode
- */
- class CompositeFileChecker
- {
- public:
- void add( const FileChecker &checker );
- bool operator()( const Pathname &file ) const;
- private:
- std::list<FileChecker> _checkers;
- };
-
public:
/** Default ctor */
Fetcher();
Added: trunk/libzypp/zypp/FileChecker.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/FileChecker.cc?rev=…
==============================================================================
--- trunk/libzypp/zypp/FileChecker.cc (added)
+++ trunk/libzypp/zypp/FileChecker.cc Tue May 22 18:04:20 2007
@@ -0,0 +1,119 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/FileChecker.cc
+ *
+*/
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/FileChecker.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/Digest.h"
+#include "zypp/KeyRing.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ChecksumFileChecker::ChecksumFileChecker( const CheckSum &checksum )
+ : _checksum(checksum)
+ {
+ }
+
+ void ChecksumFileChecker::operator()( const Pathname &file ) const
+ {
+ callback::SendReport<DigestReport> report;
+ CheckSum real_checksum( _checksum.type(), filesystem::checksum( file, _checksum.type() ));
+
+ if ( _checksum.empty() )
+ {
+ MIL << "File " << file << " has no checksum available." << std::endl;
+ if ( report->askUserToAcceptNoDigest(file) )
+ {
+ MIL << "User accepted " << file << " with no checksum." << std::endl;
+ return;
+ }
+ else
+ {
+ ZYPP_THROW(FileCheckException("No checksum available"));
+ }
+ }
+ else
+ {
+ if ( (real_checksum == _checksum) )
+ {
+ if ( report->askUserToAcceptWrongDigest( file, _checksum.checksum(), real_checksum.checksum() ) )
+ {
+ WAR << "User accepted " << file << " with WRONG CHECKSUM." << std::endl;
+ return;
+ }
+ else
+ {
+ ZYPP_THROW(FileCheckException("Wrong checksum"));
+ }
+ }
+ }
+ }
+
+ void NullFileChecker::operator()(const Pathname &file ) const
+ {
+ return;
+ }
+
+ void CompositeFileChecker::operator()(const Pathname &file ) const
+ {
+ for ( list<FileChecker>::const_iterator it = _checkers.begin(); it != _checkers.end(); ++it )
+ {
+ (*it)(file);
+ }
+ }
+
+ void CompositeFileChecker::add( const FileChecker &checker )
+ {
+ _checkers.push_back(checker);
+ }
+
+ SignatureFileChecker::SignatureFileChecker( const Pathname &signature )
+ : _signature(signature)
+ {
+ }
+
+ SignatureFileChecker::SignatureFileChecker()
+ {
+ }
+
+ void SignatureFileChecker::addPublicKey( const Pathname &publickey )
+ {
+ ZYpp::Ptr z = getZYpp();
+ z->keyRing()->importKey(publickey, false);
+ }
+
+ void SignatureFileChecker::operator()(const Pathname &file ) const
+ {
+ ZYpp::Ptr z = getZYpp();
+ MIL << "checking " << file << " file validity using digital signature.." << endl;
+ bool valid = z->keyRing()->verifyFileSignatureWorkflow( file, string(), _signature);
+ if (!valid)
+ ZYPP_THROW(FileCheckException("Signature verification failed"));
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const FileChecker & obj )
+ {
+ return str;
+ }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/FileChecker.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/FileChecker.h?rev=5…
==============================================================================
--- trunk/libzypp/zypp/FileChecker.h (added)
+++ trunk/libzypp/zypp/FileChecker.h Tue May 22 18:04:20 2007
@@ -0,0 +1,158 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/FileChecker.h
+ *
+*/
+#ifndef ZYPP_FILECHECKER_H
+#define ZYPP_FILECHECKER_H
+
+#include <iosfwd>
+#include <list>
+#include "zypp/base/Exception.h"
+#include "zypp/base/Function.h"
+#include "zypp/Pathname.h"
+#include "zypp/CheckSum.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ /**
+ * Functor signature used to check files.
+ * \param file File to check.
+ *
+ * \throws FileCheckException when the file does not
+ * validate and the user don't want to continue.
+ */
+ typedef function<void ( const Pathname &file )> FileChecker;
+
+ class FileCheckException : public Exception
+ {
+ public:
+ FileCheckException(const std::string &msg)
+ : Exception(msg)
+ {}
+ };
+
+ class CheckSumCheckException : public FileCheckException
+ {
+ //TODO
+ };
+
+ class SignatureCheckException : public FileCheckException
+ {
+ //TODO
+ };
+
+ /**
+ * Built in file checkers
+ */
+
+ /**
+ * \short Checks for a valid checksum and interacts with the user.
+ */
+ class ChecksumFileChecker
+ {
+ public:
+ /**
+ * Constructor.
+ * \param checksum Checksum that validates the file
+ */
+ ChecksumFileChecker( const CheckSum &checksum );
+ /**
+ * \short Try to validate the file
+ * \param file File to validate.
+ *
+ * \throws CheckSumCheckException if validation fails
+ */
+ void operator()( const Pathname &file ) const;
+ private:
+ CheckSum _checksum;
+ };
+
+ /**
+ * \short Checks for the validity of a signature
+ */
+ class SignatureFileChecker
+ {
+ public:
+ /**
+ * Constructor.
+ * \param signature Signature that validates the file
+ */
+ SignatureFileChecker( const Pathname &signature );
+
+ /**
+ * Default Constructor.
+ * \short Signature for unsigned files
+ * Use it when you dont have a signature but you want
+ * to check the user to accept an unsigned file.
+ */
+ SignatureFileChecker();
+
+
+ /**
+ * add a public key to the list of known keys
+ */
+ void addPublicKey( const Pathname &publickey );
+ /**
+ * \short Try to validate the file
+ * \param file File to validate.
+ *
+ * \throws SignatureCheckException if validation fails
+ */
+ void operator()( const Pathname &file ) const;
+
+ private:
+ Pathname _signature;
+ };
+
+ /**
+ * \short Checks for nothing
+ * Used as the default checker
+ */
+ class NullFileChecker
+ {
+ public:
+ void operator()( const Pathname &file ) const;
+ };
+
+ /**
+ * \short Checker composed of more checkers.
+ *
+ * Allows to create a checker composed of various
+ * checkers altothether. It will only
+ * validate if all the checkers validate.
+ *
+ * \code
+ * CompositeFileChecker com;
+ * com.add(checker1);
+ * com.add(checker2);
+ * fetcher.enqueue(location, com);
+ * \endcode
+ */
+ class CompositeFileChecker
+ {
+ public:
+ void add( const FileChecker &checker );
+ /**
+ * \throws FileCheckException if validation fails
+ */
+ void operator()( const Pathname &file ) const;
+ private:
+ std::list<FileChecker> _checkers;
+ };
+
+ /** \relates FileChecker Stream output */
+ std::ostream & operator<<( std::ostream & str, const FileChecker & obj );
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_FILECHECKER_H
Modified: trunk/libzypp/zypp/source/yum/YUMDownloader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMDownl…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMDownloader.cc (original)
+++ trunk/libzypp/zypp/source/yum/YUMDownloader.cc Tue May 22 18:04:20 2007
@@ -45,6 +45,14 @@
bool YUMDownloader::repomd_Callback( const OnMediaLocation &loc, const YUMResourceType &dtype )
{
MIL << dtype << " : " << loc << endl;
+
+ // skip other
+ if ( dtype == YUMResourceType::OTHER )
+ {
+ MIL << "Skipping other.xml" << endl;
+ return true;
+ }
+
_fetcher.enqueueDigested(loc);
// We got a patches file we need to read, to add patches listed
@@ -56,6 +64,7 @@
// now the patches.xml file must exists
PatchesFileReader( _dest_dir + loc.filename(), bind( &YUMDownloader::patches_Callback, this, _1, _2));
}
+
return true;
}
@@ -75,10 +84,10 @@
_fetcher.start( dest_dir, _media );
- Fetcher::SignatureFileChecker sigchecker;
+ SignatureFileChecker sigchecker;
if ( PathInfo( dest_dir + sigpath ).isExist() )
- sigchecker = Fetcher::SignatureFileChecker(dest_dir + sigpath);
+ sigchecker = SignatureFileChecker(dest_dir + sigpath);
if ( PathInfo( dest_dir + keypath ).isExist() )
sigchecker.addPublicKey(dest_dir + keypath );
Modified: trunk/libzypp/zypp/source/yum/YUMResourceType.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.h (original)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.h Tue May 22 18:04:20 2007
@@ -10,9 +10,9 @@
#ifndef YUMRESOURCETYPE_H_
#define YUMRESOURCETYPE_H_
+#include <iosfwd>
#include<string>
-
namespace zypp
{
namespace source
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5586 - in /trunk/updater-kde/updater: UpdaterApplication.cpp zypp/ZYppUpdater.cpp
by tgoettlicher@svn.opensuse.org 22 May '07
by tgoettlicher@svn.opensuse.org 22 May '07
22 May '07
Author: tgoettlicher
Date: Tue May 22 16:54:10 2007
New Revision: 5586
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5586&view=rev
Log:
Fix doesn't refresh (to no updated needed) after update installed (#227795)
Modified:
trunk/updater-kde/updater/UpdaterApplication.cpp
trunk/updater-kde/updater/zypp/ZYppUpdater.cpp
Modified: trunk/updater-kde/updater/UpdaterApplication.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/UpdaterAppli…
==============================================================================
--- trunk/updater-kde/updater/UpdaterApplication.cpp (original)
+++ trunk/updater-kde/updater/UpdaterApplication.cpp Tue May 22 16:54:10 2007
@@ -37,7 +37,6 @@
, _main(0L), _updater(0L)
{
-
_main = new MainWindow();
setMainWidget(_main);
@@ -47,7 +46,10 @@
connectToPlugin();
- _main->setUpdaterCapabilities(_updater->capabilities());
+ if (_updater)
+ {
+ _main->setUpdaterCapabilities(_updater->capabilities());
+ }
}
void UpdaterApplication::connectToPlugin()
Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpd…
==============================================================================
--- trunk/updater-kde/updater/zypp/ZYppUpdater.cpp (original)
+++ trunk/updater-kde/updater/zypp/ZYppUpdater.cpp Tue May 22 16:54:10 2007
@@ -145,7 +145,12 @@
_buffer.truncate(0);
if ( ! _list_view )
+ {
+ kdDebug() << " ! _list_view " << endl;
return;
+ }
+
+ _list_view->clear();
kdDebug() << "populating... " << _patches.count() << " patches" << endl;
for ( QPtrList<ZYppPatch>::const_iterator it = _patches.begin(); it != _patches.end(); ++it )
@@ -176,7 +181,7 @@
_error_message_buffer.truncate(0);
}
- _list_view = 0L;
+// _list_view = 0L;
emit(populateDone());
}
@@ -298,7 +303,7 @@
{
kdDebug() << "error launching zypp-checkpatches-wrapper..." << endl;
emit(updateAppletError(i18n("Can't launch zypp-checkpatches-wrapper helper program. Make sure zypper package is installed and working.")));
- _list_view = 0L;
+// _list_view = 0L;
delete _process;
_process = 0L;
emit(populateDone());
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0