Zypp Commits
Threads by month
- ----- 2024 -----
- 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] r5645 - in /trunk/libzypp/zypp/parser/yum: RepomdFileReader.cc RepomdFileReader.h schema/repomd.rnc schema/repomd.rng
by jkupec@svn.opensuse.org 30 May '07
by jkupec@svn.opensuse.org 30 May '07
30 May '07
Author: jkupec
Date: Wed May 30 15:18:43 2007
New Revision: 5645
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5645&view=rev
Log:
comments
Modified:
trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
trunk/libzypp/zypp/parser/yum/RepomdFileReader.h
trunk/libzypp/zypp/parser/yum/schema/repomd.rnc
trunk/libzypp/zypp/parser/yum/schema/repomd.rng
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFi…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc Wed May 30 15:18:43 2007
@@ -77,7 +77,7 @@
/** Type of metadata file. */
source::yum::YUMResourceType _type;
- /** Function for processing collected data. Passed in through constructor. */
+ /** Function for processing collected data. Passed-in through constructor. */
ProcessResource _callback;
/** Checksum of metadata file */
@@ -103,29 +103,46 @@
// --------------------------------------------------------------------------
+ /*
+ * 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 RepomdFileReader::Impl::consumeNode( Reader & reader_r )
{
- //MIL << reader_r->name() << endl;
- std::string data_type;
if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT )
{
+ // xpath: /repomd
if ( reader_r->name() == "repomd" )
{
_tag = tag_Repomd;
return true;
}
+
+ // xpath: /repomd/data
if ( reader_r->name() == "data" )
{
_tag = tag_Data;
_type = YUMResourceType(reader_r->getAttribute("type").asString());
return true;
}
+
+ // xpath: /repomd/location
if ( reader_r->name() == "location" )
{
_tag = tag_Location;
_location.filename( reader_r->getAttribute("href").asString() );
+ // ignoring attribute xml:base
return true;
}
+
+ // xpath: /repomd/checksum
if ( reader_r->name() == "checksum" )
{
_tag = tag_CheckSum;
@@ -134,19 +151,29 @@
_location.checksum( CheckSum( checksum_type, checksum_vaue ) );
return true;
}
+
+ // xpath: /repomd/timestamp
if ( reader_r->name() == "timestamp" )
{
// ignore it
return true;
}
+
+ // xpath: /repomd/open-checksum (?)
}
+
else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
{
- //MIL << "end element" << endl;
+ // xpath: /repomd/data
if ( reader_r->name() == "data" )
- _callback( _location, _type );
- return true;
+ {
+ if (_callback)
+ _callback( _location, _type );
+
+ return true;
+ }
}
+
return true;
}
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFi…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.h Wed May 30 15:18:43 2007
@@ -78,10 +78,10 @@
};
- }
- }
-}
-
-#endif
+ } // ns yum
+ } // ns parser
+} // ns zypp
+#endif /*zypp_source_yum_RepomdFileReader_H*/
+// vim: set ts=2 sts=2 sw=2 et ai:
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 Wed May 30 15:18:43 2007
@@ -1,3 +1,24 @@
+# YUM repository index file schema.
+#
+# Upstream version: http://linux.duke.edu/projects/metadata/dtd/repomd.dtd
+#
+# Elements:
+#
+# repomd
+# Root element. May contain text (e.g. repository description?).
+# "patches", "patterns", and "products" are SUSE extensions to the upstream schema.
+# data
+# Repository file data. Contains location, checksum, timestamp of the metadata file.
+# location
+# Location of the metadata file. 'href' attribute contains path of the file, relative
+# to the repository root. 'xml:base' attribute seems to be unused.
+# checksum
+# Type and value of checksum of the metadata file.
+# timestamp
+# Timestamp of the metadata file in the repository.
+# open-checksum
+# ?
+
default namespace = "http://linux.duke.edu/metadata/repo"
element repomd {
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 Wed May 30 15:18:43 2007
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ YUM repository index file schema.
+
+ Upstream version: http://linux.duke.edu/projects/metadata/dtd/repomd.dtd
+
+ Elements:
+
+ repomd
+ Root element. May contain text (e.g. repository description?).
+ "patches", "patterns", and "products" are SUSE extensions to the upstream schema.
+ data
+ Repository file data. Contains location, checksum, timestamp of the metadata file.
+ location
+ Location of the metadata file. 'href' attribute contains path of the file, relative
+ to the repository root. 'xml:base' attribute seems to be unused.
+ checksum
+ Type and value of checksum of the metadata file.
+ timestamp
+ Timestamp of the metadata file in the repository.
+ open-checksum
+ ?
+-->
<element name="repomd" ns="http://linux.duke.edu/metadata/repo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<interleave>
<oneOrMore>
--
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] r5644 - in /trunk/libzypp/tests: ./ cache/ parser/yum/ repository/ repository/yum/ source/ zypp/ zypp/data/FileChecker/
by dmacvicar@svn.opensuse.org 30 May '07
by dmacvicar@svn.opensuse.org 30 May '07
30 May '07
Author: dmacvicar
Date: Wed May 30 15:18:12 2007
New Revision: 5644
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5644&view=rev
Log:
- move source -> repository tests
- fix YUM tests to compile
- test for FileChecker (wow found 2 bugs with it)
Added:
trunk/libzypp/tests/repository/
- copied from r5632, trunk/libzypp/tests/source/
trunk/libzypp/tests/repository/CMakeLists.txt
- copied unchanged from r5642, trunk/libzypp/tests/source/CMakeLists.txt
trunk/libzypp/tests/repository/yum/
- copied from r5642, trunk/libzypp/tests/source/yum/
trunk/libzypp/tests/zypp/FileChecker_test.cc
trunk/libzypp/tests/zypp/KeyRingTestReceiver.h
trunk/libzypp/tests/zypp/data/FileChecker/
trunk/libzypp/tests/zypp/data/FileChecker/hello.txt
trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.asc
trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.key
trunk/libzypp/tests/zypp/data/FileChecker/hello2.txt
Removed:
trunk/libzypp/tests/source/
Modified:
trunk/libzypp/tests/CMakeLists.txt
trunk/libzypp/tests/cache/CMakeLists.txt
trunk/libzypp/tests/cache/CacheQuery_test.cc
trunk/libzypp/tests/parser/yum/RepomdFileReader_test.cc
trunk/libzypp/tests/zypp/CMakeLists.txt
trunk/libzypp/tests/zypp/KeyRing.cc
Modified: trunk/libzypp/tests/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/CMakeLists.txt?rev…
==============================================================================
--- trunk/libzypp/tests/CMakeLists.txt (original)
+++ trunk/libzypp/tests/CMakeLists.txt Wed May 30 15:18:12 2007
@@ -7,4 +7,4 @@
#ADD_SUBDIRECTORY( media )
ADD_SUBDIRECTORY( zypp )
ADD_SUBDIRECTORY( parser )
-ADD_SUBDIRECTORY( source )
+ADD_SUBDIRECTORY( repository )
Modified: trunk/libzypp/tests/cache/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CMakeLists.t…
==============================================================================
--- trunk/libzypp/tests/cache/CMakeLists.txt (original)
+++ trunk/libzypp/tests/cache/CMakeLists.txt Wed May 30 15:18:12 2007
@@ -17,7 +17,9 @@
ADD_TEST(CacheInitializer ${CMAKE_CURRENT_BINARY_DIR}/CacheInitializer ${CMAKE_CURRENT_SOURCE_DIR}/data )
ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_CURRENT_SOURCE_DIR}/data )
-ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_CURRENT_SOURCE_DIR}/data )
+
+# run this test against a YUM repo
+ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_SOURCE_DIR}/tests/repository/yum/data/10.2-updates-subset )
Modified: trunk/libzypp/tests/cache/CacheQuery_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/cache/CacheQuery_t…
==============================================================================
--- trunk/libzypp/tests/cache/CacheQuery_test.cc (original)
+++ trunk/libzypp/tests/cache/CacheQuery_test.cc Wed May 30 15:18:12 2007
@@ -14,11 +14,9 @@
#include "zypp/TmpPath.h"
#include "zypp2/cache/CacheStore.h"
-#include "zypp2/cache/CapabilityQuery.h"
#include "zypp/data/ResolvableData.h"
#include "zypp2/cache/ResolvableQuery.h"
-
-#include "SimplePackagesParser.h"
+#include "zypp2/parser/yum/YUMParser.h"
using namespace std;
using namespace zypp;
@@ -26,6 +24,7 @@
using namespace zypp::capability;
using namespace zypp::filesystem;
using namespace zypp::cache;
+using namespace zypp::parser::yum;
using namespace boost::unit_test;
bool result(const data::RecordId &id, data::ResObject_Ptr ptr )
@@ -36,14 +35,6 @@
void resolvable_query_test(const string &dir)
{
- Pathname nvra_list = Pathname(dir) + "package-set.txt.gz";
-
- MIL << "parsing " << nvra_list << endl;
-
- list<MiniResolvable> res_list;
-
- parse_mini_file( nvra_list, res_list );
-
filesystem::TmpDir tmpdir;
// let the store go out of scope to drop the connection
{
@@ -51,20 +42,15 @@
data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://novell.com"), "/");
- zypp::debug::Measure cap_parse_timer("store resolvables");
- for ( list<MiniResolvable>::iterator it = res_list.begin(); it != res_list.end(); it++)
- {
- data::RecordId id = store.appendResolvable( repository_id,
- ResTraits<Package>::kind,
- (*it).nvra,
- (*it).deps );
- }
-
- MIL << "packages writen to store" << endl;
+ YUMParser parser( repository_id, store );
+ parser.parse(dir);
+ store.commit();
}
ResolvableQuery query(tmpdir.path() );
query.query(10, &result);
+
+ MIL << query.queryTranslatedStringAttribute( 10, "ResObject", "summary" ).text() << endl;
}
test_suite*
@@ -74,7 +60,7 @@
if (argc < 2)
{
datadir = TESTS_SRC_DIR;
- datadir = (Pathname(datadir) + "/cache/data").asString();
+ datadir = (Pathname(datadir) + "/repository/yum/data/10.2-updates-subset").asString();
cout << "CacheStore_test:"
" path to directory with test data required as parameter. Using " << datadir << endl;
//return (test_suite *)0;
Modified: trunk/libzypp/tests/parser/yum/RepomdFileReader_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/parser/yum/RepomdF…
==============================================================================
--- trunk/libzypp/tests/parser/yum/RepomdFileReader_test.cc (original)
+++ trunk/libzypp/tests/parser/yum/RepomdFileReader_test.cc Wed May 30 15:18:12 2007
@@ -11,9 +11,7 @@
#include "zypp/Url.h"
#include "zypp/PathInfo.h"
-using std::cout;
-using std::endl;
-using std::string;
+using namespace std;
using namespace zypp;
using namespace boost::unit_test;
Modified: trunk/libzypp/tests/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/CMakeLists.tx…
==============================================================================
--- trunk/libzypp/tests/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/tests/zypp/CMakeLists.txt Wed May 30 15:18:12 2007
@@ -45,6 +45,9 @@
ADD_EXECUTABLE( Fetcher Fetcher_test.cc )
TARGET_LINK_LIBRARIES( Fetcher zypp boost_unit_test_framework )
+ADD_EXECUTABLE( FileChecker FileChecker_test.cc )
+TARGET_LINK_LIBRARIES( FileChecker zypp boost_unit_test_framework )
+
ADD_TEST(ArchTest ${CMAKE_CURRENT_BINARY_DIR}/Arch)
ADD_TEST(UrlTest ${CMAKE_CURRENT_BINARY_DIR}/Url)
ADD_TEST(Edition ${CMAKE_CURRENT_BINARY_DIR}/Edition)
@@ -58,4 +61,5 @@
ADD_TEST(Signature ${CMAKE_CURRENT_BINARY_DIR}/Signature)
ADD_TEST(KeyRingTest ${CMAKE_CURRENT_BINARY_DIR}/KeyRing)
ADD_TEST(MediaSetAccessTest ${CMAKE_CURRENT_BINARY_DIR}/MediaSetAccess ${CMAKE_CURRENT_SOURCE_DIR}/data/mediasetaccess)
+ADD_TEST(FileCheckerTest ${CMAKE_CURRENT_BINARY_DIR}/FileChecker ${CMAKE_CURRENT_SOURCE_DIR}/data/FileChecker)
ADD_TEST(FetcherTest ${CMAKE_CURRENT_BINARY_DIR}/Fetcher)
Added: trunk/libzypp/tests/zypp/FileChecker_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/FileChecker_t…
==============================================================================
--- trunk/libzypp/tests/zypp/FileChecker_test.cc (added)
+++ trunk/libzypp/tests/zypp/FileChecker_test.cc Wed May 30 15:18:12 2007
@@ -0,0 +1,118 @@
+
+#include <iostream>
+#include <fstream>
+#include <list>
+#include <string>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+#include "zypp/KeyRing.h"
+#include "zypp/PublicKey.h"
+#include "zypp/TmpPath.h"
+
+#include "zypp/FileChecker.h"
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/parameterized_test.hpp>
+#include <boost/test/unit_test_log.hpp>
+
+#include "KeyRingTestReceiver.h"
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
+using namespace boost::unit_test::log;
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::filesystem;
+
+void keyring_test( const string &dir )
+{
+ Pathname file( Pathname(dir) + "hello.txt" );
+ Pathname file2( Pathname(dir) + "hello2.txt" );
+ Pathname pubkey( Pathname(dir) + "hello.txt.key" );
+ Pathname signature( Pathname(dir) + "hello.txt.asc" );
+
+ /**
+ * 1st scenario, the signature does
+ * match
+ */
+ {
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
+
+ keyring_callbacks.answerTrustKey(true);
+ SignatureFileChecker sigchecker( signature );
+ sigchecker.addPublicKey(pubkey);
+ sigchecker(file);
+ }
+
+ /**
+ * second scenario, the signature does not
+ * match, an exception has to be thrown
+ */
+ {
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
+
+ keyring_callbacks.answerTrustKey(true);
+ SignatureFileChecker sigchecker( signature );
+ sigchecker.addPublicKey(pubkey);
+
+ BOOST_CHECK_THROW( sigchecker(file2), zypp::Exception );
+
+ }
+
+}
+
+void checksum_test( const string &dir )
+{
+ Pathname file( Pathname(dir) + "hello.txt" );
+ Pathname file2( Pathname(dir) + "hello2.txt" );
+ Pathname pubkey( Pathname(dir) + "hello.txt.key" );
+ Pathname signature( Pathname(dir) + "hello.txt.asc" );
+
+ /**
+ * 1st scenario, checksum matches
+ */
+ {
+ ChecksumFileChecker checker( CheckSum("sha1", "f2105202a0f017ab818b670d04982a89f55f090b") );
+ checker(file);
+ }
+
+ /**
+ * 1st scenario, checksum does not matches
+ */
+ {
+ ChecksumFileChecker checker( CheckSum("sha1", "f2105202a0f017ab818b670d04982a89f55f090b") );
+ BOOST_CHECK_THROW( checker(file2), zypp::FileCheckException );
+ }
+}
+
+test_suite*
+init_unit_test_suite( int argc, char* argv[] )
+{
+ string datadir;
+ if (argc < 2)
+ {
+ datadir = TESTS_SRC_DIR;
+ datadir = (Pathname(datadir) + "/zypp/data/FileChecker").asString();
+ cout << "filechecker_test:"
+ " path to directory with test data required as parameter. Using " << datadir << endl;
+ //return (test_suite *)0;
+ }
+ else
+ {
+ datadir = argv[1];
+ }
+
+ std::string const params[] = { datadir };
+ //set_log_stream( std::cout );
+ test_suite* test= BOOST_TEST_SUITE( "FileCheckerTest" );
+ test->add(BOOST_PARAM_TEST_CASE( &keyring_test,
+ (std::string const*)params, params+1));
+ test->add(BOOST_PARAM_TEST_CASE( &checksum_test,
+ (std::string const*)params, params+1));
+ return test;
+}
+
Modified: trunk/libzypp/tests/zypp/KeyRing.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/KeyRing.cc?re…
==============================================================================
--- trunk/libzypp/tests/zypp/KeyRing.cc (original)
+++ trunk/libzypp/tests/zypp/KeyRing.cc Wed May 30 15:18:12 2007
@@ -14,6 +14,8 @@
#include <boost/test/parameterized_test.hpp>
#include <boost/test/unit_test_log.hpp>
+#include "KeyRingTestReceiver.h"
+
using boost::unit_test::test_suite;
using boost::unit_test::test_case;
using namespace boost::unit_test::log;
@@ -22,154 +24,6 @@
using namespace zypp;
using namespace zypp::filesystem;
-/**
- * Keyring Callback Receiver with some features
- * Allows to simulate and configure user answer
- * Can record which callbacks were called
- */
-struct KeyRingReceive : public zypp::callback::ReceiveReport<zypp::KeyRingReport>
-{
- KeyRingReceive()
- {
- reset();
- connect();
- }
-
- void reset()
- {
- _answer_accept_unknown_key = false;
- _answer_trust_key = false;
- _answer_import_key = false;
- _answer_ver_failed = false;
- _answer_accept_unsigned_file = false;
- _asked_user_to_accept_unknown_key = false;
- _asked_user_to_trust_key = false;
- _asked_user_to_import_key = false;
- _asked_user_to_accept_ver_failed = false;
- _asked_user_to_accept_unsigned_file = false;
- }
-
- ~KeyRingReceive()
- {
- disconnect();
- }
-
- void answerAcceptVerFailed( bool answer )
- { _answer_ver_failed = answer; }
-
- bool askedAcceptVerFailed() const
- { return _asked_user_to_accept_ver_failed; }
-
- void answerAcceptUnknownKey( bool answer )
- { _answer_accept_unknown_key = answer; }
-
- bool askedAcceptUnknownKey() const
- { return _asked_user_to_accept_unknown_key; }
-
- void answerTrustKey( bool answer )
- { _answer_trust_key = answer; }
-
- bool askedTrustKey() const
- { return _asked_user_to_trust_key; }
-
- void answerImportKey( bool answer )
- { _answer_import_key = answer; }
-
- bool askedImportKey() const
- { return _asked_user_to_import_key; }
-
- void answerAcceptUnsignedFile( bool answer )
- { _answer_accept_unsigned_file = answer; }
-
- bool askedAcceptUnsignedFile() const
- { return _asked_user_to_accept_unsigned_file; }
-
- virtual bool askUserToAcceptUnsignedFile( const std::string &file )
- {
- MIL << std::endl;
- _asked_user_to_accept_unsigned_file = true;
- return _answer_accept_unsigned_file;
- }
-
- virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id )
- {
- MIL << std::endl;
- _asked_user_to_accept_unknown_key = true;
- return _answer_accept_unknown_key;
- }
-
- virtual bool askUserToImportKey( const PublicKey &key )
- {
- MIL << std::endl;
- _asked_user_to_import_key = true;
- return _answer_import_key;
- }
-
- virtual bool askUserToTrustKey( const PublicKey &key )
- {
- MIL << std::endl;
- _asked_user_to_trust_key = true;
- return _answer_trust_key;
- }
- virtual bool askUserToAcceptVerificationFailed( const std::string &file, const PublicKey &key )
- {
- MIL << std::endl;
- _asked_user_to_accept_ver_failed = true;
- return _answer_ver_failed;
- }
-
- // how to answer
- bool _answer_accept_unknown_key;
- bool _answer_trust_key;
- bool _answer_import_key;
- bool _answer_ver_failed;
- bool _answer_accept_unsigned_file;
-
- // we use this variables to check that the
- // callbacks were called
- bool _asked_user_to_accept_unknown_key;
- bool _asked_user_to_trust_key;
- bool _asked_user_to_import_key;
- bool _asked_user_to_accept_ver_failed;
- bool _asked_user_to_accept_unsigned_file;
-};
-
-/**
- * Keyring Signal Receiver with some features
- * Allows to simulate and configure user answer
- * Can record which callbacks were called
- */
-struct KeyRingSignalReceiver : callback::ReceiveReport<KeyRingSignals>
-{
- KeyRingSignalReceiver(/*RpmDb &rpmdb*/)
- : _trusted_key_added_called(false)
- {
- MIL << "KeyRing signals enabled" << endl;
- connect();
- }
-
- ~KeyRingSignalReceiver()
- {
- disconnect();
- }
-
- virtual void trustedKeyAdded( const PublicKey &key )
- {
- MIL << "TEST: trusted key added to zypp Keyring. Syncronizing keys with fake rpm keyring" << std::endl;
- _trusted_key_added_called = true;
- //std::cout << "trusted key added to zypp Keyring. Syncronizing keys with rpm keyring" << std::endl;
- //_rpmdb.importZyppKeyRingTrustedKeys();
- //_rpmdb.exportTrustedKeysInZyppKeyRing();
- }
-
- virtual void trustedKeyRemoved( const PublicKey &key )
- {
- }
-
- bool _trusted_key_added_called;
-
-};
-
void keyring_test( const string &dir )
{
PublicKey key( Pathname(dir) + "public.asc" );
@@ -181,8 +35,8 @@
* ask for import, answer no
*/
{
- KeyRingReceive keyring_callbacks;
- KeyRingSignalReceiver receiver;
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
// base sandbox for playing
TmpDir tmp_dir;
KeyRing keyring( tmp_dir.path() );
@@ -218,8 +72,8 @@
* vorrupt the file and check
*/
{
- KeyRingReceive keyring_callbacks;
- KeyRingSignalReceiver receiver;
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
// base sandbox for playing
TmpDir tmp_dir;
KeyRing keyring( tmp_dir.path() );
@@ -252,8 +106,8 @@
* check without signature
*/
{
- KeyRingReceive keyring_callbacks;
- KeyRingSignalReceiver receiver;
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
// base sandbox for playing
TmpDir tmp_dir;
KeyRing keyring( tmp_dir.path() );
@@ -280,8 +134,8 @@
* answer no
*/
{
- KeyRingReceive keyring_callbacks;
- KeyRingSignalReceiver receiver;
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
// base sandbox for playing
TmpDir tmp_dir;
KeyRing keyring( tmp_dir.path() );
@@ -303,8 +157,8 @@
* should emit signal
*/
{
- KeyRingReceive keyring_callbacks;
- KeyRingSignalReceiver receiver;
+ KeyRingTestReceiver keyring_callbacks;
+ KeyRingTestSignalReceiver receiver;
// base sandbox for playing
TmpDir tmp_dir;
KeyRing keyring( tmp_dir.path() );
Added: trunk/libzypp/tests/zypp/KeyRingTestReceiver.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/KeyRingTestRe…
==============================================================================
--- trunk/libzypp/tests/zypp/KeyRingTestReceiver.h (added)
+++ trunk/libzypp/tests/zypp/KeyRingTestReceiver.h Wed May 30 15:18:12 2007
@@ -0,0 +1,157 @@
+
+#ifndef _ZYPP_KEYRING_TEST_RECEIVER_H
+#define _ZYPP_KEYRING_TEST_RECEIVER_H
+
+#include "zypp/Callback.h"
+#include "zypp/KeyRing.h"
+#include "zypp/PublicKey.h"
+
+/**
+ * Keyring Callback Receiver with some features
+ * Allows to simulate and configure user answer
+ * Can record which callbacks were called
+ */
+struct KeyRingTestReceiver : public zypp::callback::ReceiveReport<zypp::KeyRingReport>
+{
+ KeyRingTestReceiver()
+ {
+ reset();
+ connect();
+ }
+
+ void reset()
+ {
+ _answer_accept_unknown_key = false;
+ _answer_trust_key = false;
+ _answer_import_key = false;
+ _answer_ver_failed = false;
+ _answer_accept_unsigned_file = false;
+ _asked_user_to_accept_unknown_key = false;
+ _asked_user_to_trust_key = false;
+ _asked_user_to_import_key = false;
+ _asked_user_to_accept_ver_failed = false;
+ _asked_user_to_accept_unsigned_file = false;
+ }
+
+ ~KeyRingTestReceiver()
+ {
+ disconnect();
+ }
+
+ void answerAcceptVerFailed( bool answer )
+ { _answer_ver_failed = answer; }
+
+ bool askedAcceptVerFailed() const
+ { return _asked_user_to_accept_ver_failed; }
+
+ void answerAcceptUnknownKey( bool answer )
+ { _answer_accept_unknown_key = answer; }
+
+ bool askedAcceptUnknownKey() const
+ { return _asked_user_to_accept_unknown_key; }
+
+ void answerTrustKey( bool answer )
+ { _answer_trust_key = answer; }
+
+ bool askedTrustKey() const
+ { return _asked_user_to_trust_key; }
+
+ void answerImportKey( bool answer )
+ { _answer_import_key = answer; }
+
+ bool askedImportKey() const
+ { return _asked_user_to_import_key; }
+
+ void answerAcceptUnsignedFile( bool answer )
+ { _answer_accept_unsigned_file = answer; }
+
+ bool askedAcceptUnsignedFile() const
+ { return _asked_user_to_accept_unsigned_file; }
+
+ virtual bool askUserToAcceptUnsignedFile( const std::string &file )
+ {
+ MIL << std::endl;
+ _asked_user_to_accept_unsigned_file = true;
+ return _answer_accept_unsigned_file;
+ }
+
+ virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id )
+ {
+ MIL << std::endl;
+ _asked_user_to_accept_unknown_key = true;
+ return _answer_accept_unknown_key;
+ }
+
+ virtual bool askUserToImportKey( const zypp::PublicKey &key )
+ {
+ MIL << std::endl;
+ _asked_user_to_import_key = true;
+ return _answer_import_key;
+ }
+
+ virtual bool askUserToTrustKey( const zypp::PublicKey &key )
+ {
+ MIL << std::endl;
+ _asked_user_to_trust_key = true;
+ return _answer_trust_key;
+ }
+ virtual bool askUserToAcceptVerificationFailed( const std::string &file, const zypp::PublicKey &key )
+ {
+ MIL << std::endl;
+ _asked_user_to_accept_ver_failed = true;
+ return _answer_ver_failed;
+ }
+
+ // how to answer
+ bool _answer_accept_unknown_key;
+ bool _answer_trust_key;
+ bool _answer_import_key;
+ bool _answer_ver_failed;
+ bool _answer_accept_unsigned_file;
+
+ // we use this variables to check that the
+ // callbacks were called
+ bool _asked_user_to_accept_unknown_key;
+ bool _asked_user_to_trust_key;
+ bool _asked_user_to_import_key;
+ bool _asked_user_to_accept_ver_failed;
+ bool _asked_user_to_accept_unsigned_file;
+};
+
+/**
+ * Keyring Signal Receiver with some features
+ * Allows to simulate and configure user answer
+ * Can record which callbacks were called
+ */
+struct KeyRingTestSignalReceiver : zypp::callback::ReceiveReport<zypp::KeyRingSignals>
+{
+ KeyRingTestSignalReceiver(/*RpmDb &rpmdb*/)
+ : _trusted_key_added_called(false)
+ {
+ MIL << "KeyRing signals enabled" << std::endl;
+ connect();
+ }
+
+ ~KeyRingTestSignalReceiver()
+ {
+ disconnect();
+ }
+
+ virtual void trustedKeyAdded( const zypp::PublicKey &key )
+ {
+ MIL << "TEST: trusted key added to zypp Keyring. Syncronizing keys with fake rpm keyring" << std::endl;
+ _trusted_key_added_called = true;
+ //std::cout << "trusted key added to zypp Keyring. Syncronizing keys with rpm keyring" << std::endl;
+ //_rpmdb.importZyppKeyRingTrustedKeys();
+ //_rpmdb.exportTrustedKeysInZyppKeyRing();
+ }
+
+ virtual void trustedKeyRemoved( const zypp::PublicKey &key )
+ {
+ }
+
+ bool _trusted_key_added_called;
+
+};
+
+#endif
Added: trunk/libzypp/tests/zypp/data/FileChecker/hello.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/FileChec…
==============================================================================
--- trunk/libzypp/tests/zypp/data/FileChecker/hello.txt (added)
+++ trunk/libzypp/tests/zypp/data/FileChecker/hello.txt Wed May 30 15:18:12 2007
@@ -0,0 +1 @@
+hello this is a test
Added: trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.asc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/FileChec…
==============================================================================
--- trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.asc (added)
+++ trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.asc Wed May 30 15:18:12 2007
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQBGXW7Gm+zCtd2wN1YRAuAXAJ9e2obl0RWM9eBQz8dmPdQjclmamQCfRnJS
+XFIPNZAA1XeQL/Dvi51EIwc=
+=3TuF
+-----END PGP SIGNATURE-----
Added: trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.key
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/FileChec…
==============================================================================
--- trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.key (added)
+++ trunk/libzypp/tests/zypp/data/FileChecker/hello.txt.key Wed May 30 15:18:12 2007
@@ -0,0 +1,214 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+mQGiBDsj/RYRBACQD/DCxkMgmEjBNYh53AfsV+zcMaz4nDmeEElANfHrVzVGx33N
+Siiqs33RIjV35Gd8OH1iSnbA7ef0gWELgVSToK2ydv/3X5Cbcb1MOWYQKJE1dQz7
+fw7Ic9nP7NieM18YMsOYEmCvyL4sLZviQIlb3caP+OpI/GAoNINY8m9yowCgxgx1
+L+jnJznXyKy7v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HhkR9H9Rig4wOrrz
+wBsYjjfXvwCguQ1PQ6+UQgL8STVqNaNnlVYzzUUD/336IftwogH/tKp6dV/FYP/V
+pLHXtwFee0vcCh5FwcKP0vYo9NIfB6CR2g0pyYsHBWbheMWXRVTlCaUVOhaycd+D
+XoyKl3FcxL61OD0F/feg2UEqH7n1csGV2MDGlqXsF5urKdPYcBRG56ynlWXs3W7D
+zu9JN8skhWSnXdtBFa3BBACo+CAXSzLJnFrG7kg8AYT+0k+kTS/UydwAr57QSLUc
+/blXR6seNd+TM4Kwj4Ij2pNL/LpZyzVrDS9BWNZHq3bQnERPrfXpK5XWX0quZn8z
+g1ImFwxmJduHKmtyyxNjjPR1SUFzD1EXpPfCYgRL6kU4OflbgGoL2YpmgHO6LQ/O
+GrQyb3BlblNVU0UgQnVpbGQgU2VydmljZSA8YnVpbGRzZXJ2aWNlQG9wZW5zdXNl
+Lm9yZz6IZAQTEQIAJAUCRHRQtwIbAwUJA8JnAAYLCQgHAwIDFQIDAxYCAQIeAQIX
+gAAKCRA7MBG3a51lI/ewAJkB4psDm44RckrzyMyjXEKBYXYKXQCcCLBW95t7ooAI
+yqfsg94RICpbr50=
+=NAat
+-----END PGP PUBLIC KEY BLOCK-----
Added: trunk/libzypp/tests/zypp/data/FileChecker/hello2.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/data/FileChec…
==============================================================================
--- trunk/libzypp/tests/zypp/data/FileChecker/hello2.txt (added)
+++ trunk/libzypp/tests/zypp/data/FileChecker/hello2.txt Wed May 30 15:18:12 2007
@@ -0,0 +1,2 @@
+this is another text
+
--
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] r5643 - /trunk/updater-kde/updater/MainWindow.cpp
by tgoettlicher@svn.opensuse.org 30 May '07
by tgoettlicher@svn.opensuse.org 30 May '07
30 May '07
Author: tgoettlicher
Date: Wed May 30 15:06:48 2007
New Revision: 5643
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5643&view=rev
Log:
Customized config dialog
Modified:
trunk/updater-kde/updater/MainWindow.cpp
Modified: trunk/updater-kde/updater/MainWindow.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.c…
==============================================================================
--- trunk/updater-kde/updater/MainWindow.cpp (original)
+++ trunk/updater-kde/updater/MainWindow.cpp Wed May 30 15:06:48 2007
@@ -286,7 +286,9 @@
if (KConfigDialog::showDialog("settings"))
return;
- configDialog = new KConfigDialog(this, "settings", UpdaterSettings::self() );
+ configDialog = new KConfigDialog(this, "settings", UpdaterSettings::self(),
+ KDialogBase::Plain, KDialogBase::Ok | KDialogBase::Cancel );
+
configDialog->setHelp(QString::null);
confWidget = new ConfigWidget(0, "settings");
--
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] r5642 - in /trunk/updater-kde/updater: CMakeLists.txt MainWindow.cpp MainWindow.h
by tgoettlicher@svn.opensuse.org 30 May '07
by tgoettlicher@svn.opensuse.org 30 May '07
30 May '07
Author: tgoettlicher
Date: Wed May 30 12:24:59 2007
New Revision: 5642
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5642&view=rev
Log:
Added use of KDE ConnectionManager.
Modified:
trunk/updater-kde/updater/CMakeLists.txt
trunk/updater-kde/updater/MainWindow.cpp
trunk/updater-kde/updater/MainWindow.h
Modified: trunk/updater-kde/updater/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/CMakeLists.t…
==============================================================================
--- trunk/updater-kde/updater/CMakeLists.txt (original)
+++ trunk/updater-kde/updater/CMakeLists.txt Wed May 30 12:24:59 2007
@@ -14,7 +14,7 @@
KDE3_AUTOMOC(${opensuseupdater_LIB_SRCS})
ADD_LIBRARY(opensuseupdater SHARED ${opensuseupdater_LIB_SRCS})
SET_TARGET_PROPERTIES(opensuseupdater PROPERTIES VERSION 4.2.0 SOVERSION 4 )
-TARGET_LINK_LIBRARIES(opensuseupdater ${QT_AND_KDECORE_LIBS} kdeui )
+TARGET_LINK_LIBRARIES(opensuseupdater ${QT_AND_KDECORE_LIBS} kdeui connectionmanager )
INSTALL(TARGETS opensuseupdater DESTINATION ${KDE3_LIB_INSTALL_DIR} )
@@ -23,7 +23,7 @@
SET(opensuseupdater_SRCS main.cpp UpdaterApplication.cpp MainWindow.cpp ConfigWidget.h ConfigWidgetUI.h ConfigWidgetUI.ui )
KDE3_AUTOMOC(${opensuseupdater_SRCS})
KDE3_ADD_EXECUTABLE(opensuseupdater-kde ${opensuseupdater_SRCS})
-TARGET_LINK_LIBRARIES(opensuseupdater-kde opensuseupdater ${QT_AND_KDECORE_LIBS} kdeui kio )
+TARGET_LINK_LIBRARIES(opensuseupdater-kde opensuseupdater ${QT_AND_KDECORE_LIBS} kdeui kio connectionmanager )
INSTALL_TARGETS(/bin opensuseupdater-kde )
Modified: trunk/updater-kde/updater/MainWindow.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.c…
==============================================================================
--- trunk/updater-kde/updater/MainWindow.cpp (original)
+++ trunk/updater-kde/updater/MainWindow.cpp Wed May 30 12:24:59 2007
@@ -32,7 +32,8 @@
#include <ktextedit.h>
#include <kpushbutton.h>
#include <kapplication.h>
-#include <dcopclient.h>
+#include <connectionmanager.h>
+#include <networkstatuscommon.h>
#include <qlistview.h>
#include <qlabel.h>
@@ -353,79 +354,29 @@
updateButtons();
}
-int MainWindow::getNetworkStatus() const
-{
- //enum EnumStatus { NoNetworks = 1, Unreachable, OfflineDisconnected, OfflineFailed, ShuttingDown, Offline, Establishing, Online };
+void MainWindow::checkUpdates() {
- int online = 1;
- if ( kapp->dcopClient()->isApplicationRegistered( "kded" ) )
- {
- QByteArray data, replyData;
-
- QDataStream arg(data, IO_WriteOnly);
- arg << QString("www.novell.com");
-
- QCString replyType;
- if ( !kapp->dcopClient()->call( "kded", "networkstatus", "status(QString)",
- data, replyType, replyData ) )
- {
- kdError() << "DCOP error." << endl;
- }
- else
- {
- QDataStream reply(replyData, IO_ReadOnly);
- if (replyType == "int") reply >> online;
- else kdDebug() << "DCOP: unexpected return type." << endl;
- }
- }
-
- return online;
-}
+ slotAppletState(APPLET_CHECKING, 0);
+
+
+ // Check whether network is avaiable:
+ // If no network is available let ConnectionManager call this
+ // function again when network ist connected
+ if (ConnectionManager::self()->status() != NetworkStatus::Online &&
+ ConnectionManager::self()->status() != NetworkStatus::NoNetworks )
+ {
+ ConnectionManager::self()->registerConnectSlot(this,SLOT(checkUpdates()));
+ kdDebug() << "No network available" << endl;
+ kdDebug() << "Waiting for network connection..." << endl;
+ return;
+ }
+ ConnectionManager::self()->forgetConnectSlot();
+ kdDebug() << "Network connection available." << endl;
-void MainWindow::checkAgainUpdates() {
- checkUpdates(true);
-}
-
-void MainWindow::checkUpdates(bool lastAttempt) {
-
- kdDebug() << "MainWindow::checkUpdates" << endl;
-
- kdDebug() << "Checking network connection..." << endl;
- switch (getNetworkStatus())
- {
- // Network connection is available => go on
- case 1: // NoNetworks
- case 8: // Online
- kdDebug() << "Network available." << endl;
- break;
-
-
- // No network connection is avaiable => return
- case 2: // Unreachable
- case 3: // OfflineDisconnected
- case 4: // OfflineFailed
- case 5: // ShuttingDown
- case 6: // Offline
- emit(updateAppletError("TODO No Network Error Msg"));
- kdDebug() << "No network, skipping check..." << endl;
- return;
-
-
- // Network connection being established.
- // We do two attempts:
- // When the fist fails we try again after 1 minute
- // When the second fails we give up.
- case 7: // Establishing
- if (!lastAttempt)
- {
- kdDebug() << "Network connection being established. Will try again in 1 minute..." << endl;
- QTimer::singleShot( 1*60*1000, this, SLOT(slotCheckAgainUpdates()) );
- }
- return;
- }
+ kdDebug() << "Checking for updates..." << endl;
//Clear the list and fire the update signal to the backend
Modified: trunk/updater-kde/updater/MainWindow.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/MainWindow.h…
==============================================================================
--- trunk/updater-kde/updater/MainWindow.h (original)
+++ trunk/updater-kde/updater/MainWindow.h Wed May 30 12:24:59 2007
@@ -174,13 +174,7 @@
/**
Tells the backend to repopulate our list.
*/
- void checkUpdates(bool lastAttempt=false);
-
- /**
- Slot which gets called 1 minute after CheckForUpdates
- has detected "network connection being established"
- */
- void checkAgainUpdates();
+ void checkUpdates();
/**
react to value changes
--
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] r5641 - in /trunk/libzypp: zypp/parser/yum/FilelistsFileReader.cc zypp/parser/yum/OtherFileReader.cc zypp/parser/yum/PrimaryFileReader.cc zypp2/parser/yum/YUMParser.cc
by jkupec@svn.opensuse.org 30 May '07
by jkupec@svn.opensuse.org 30 May '07
30 May '07
Author: jkupec
Date: Wed May 30 10:54:29 2007
New Revision: 5641
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5641&view=rev
Log:
support for user abort request added
Modified:
trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc
trunk/libzypp/zypp/parser/yum/OtherFileReader.cc
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
trunk/libzypp/zypp2/parser/yum/YUMParser.cc
Modified: trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/Filelist…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc Wed May 30 10:54:29 2007
@@ -11,6 +11,7 @@
*/
#include "zypp/base/Logger.h"
#include "zypp/parser/xml/Reader.h"
+#include "zypp/base/UserRequestException.h"
#include "zypp/parser/yum/FilelistsFileReader.h"
@@ -160,7 +161,8 @@
if (_callback && !_filenames.empty())
_callback(handoutResolvable(), _filenames);
- _ticks.incr();
+ if (!_ticks.incr())
+ ZYPP_THROW(AbortRequestException());
return true;
}
Modified: trunk/libzypp/zypp/parser/yum/OtherFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/OtherFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/OtherFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/OtherFileReader.cc Wed May 30 10:54:29 2007
@@ -13,6 +13,7 @@
#include "zypp/parser/xml/Reader.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/Changelog.h"
+#include "zypp/base/UserRequestException.h"
#include "zypp/parser/yum/OtherFileReader.h"
@@ -164,7 +165,8 @@
if (_callback && !_changelog.empty())
_callback(handoutResolvable(), _changelog);
- _ticks.incr();
+ if (!_ticks.incr())
+ ZYPP_THROW(AbortRequestException());
return true;
}
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc Wed May 30 10:54:29 2007
@@ -13,6 +13,7 @@
#include "zypp/parser/xml/Reader.h"
#include "zypp/data/ResolvableData.h"
+#include "zypp/base/UserRequestException.h"
#include "zypp/parser/yum/FileReaderBaseImpl.h"
#include "zypp/parser/yum/PrimaryFileReader.h"
@@ -138,7 +139,8 @@
if (_package && _callback)
_callback(handoutPackage());
- _ticks.incr();
+ if (!_ticks.incr())
+ ZYPP_THROW(AbortRequestException());
toParentTag();
return true;
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 Wed May 30 10:54:29 2007
@@ -14,6 +14,7 @@
#include "zypp/ZConfig.h"
#include "zypp/base/Logger.h"
+#include "zypp/base/UserRequestException.h"
#include "zypp/source/yum/YUMResourceType.h"
#include "zypp/parser/yum/RepomdFileReader.h"
@@ -405,7 +406,8 @@
}
}
- _ticks.incr();
+ if (!_ticks.incr())
+ ZYPP_THROW(AbortRequestException());
}
}
--
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] r5640 - in /trunk/updater-kde: ./ cmake/modules/ package/ po/ updater/
by dmacvicar@svn.opensuse.org 29 May '07
by dmacvicar@svn.opensuse.org 29 May '07
29 May '07
Author: dmacvicar
Date: Tue May 29 14:52:50 2007
New Revision: 5640
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5640&view=rev
Log:
-create rpm package
-rename to opensuse-updater-kde
Added:
trunk/updater-kde/cmake/modules/FindGettext.cmake
trunk/updater-kde/package/opensuse-updater-kde.changes
- copied unchanged from r5637, trunk/updater-kde/package/opensuse-updater.changes
Removed:
trunk/updater-kde/package/opensuse-updater.changes
Modified:
trunk/updater-kde/CMakeLists.txt
trunk/updater-kde/opensuse-updater-kde.spec.in
trunk/updater-kde/po/CMakeLists.txt
trunk/updater-kde/updater/CMakeLists.txt
Modified: trunk/updater-kde/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/CMakeLists.txt?rev=5…
==============================================================================
--- trunk/updater-kde/CMakeLists.txt (original)
+++ trunk/updater-kde/CMakeLists.txt Tue May 29 14:52:50 2007
@@ -28,7 +28,11 @@
)
INCLUDE(CPack)
+
+# dont et cmake detect Qt4 uic as Qt3 uic:
+SET(ENV{QTDIR} /usr/lib/qt3)
FIND_PACKAGE(KDE3 REQUIRED)
+FIND_PACKAGE(Gettext REQUIRED)
# Library
IF ( DEFINED LIB )
@@ -58,6 +62,7 @@
set(KDE3_XDG_APPS_DIR ${CMAKE_INSTALL_PREFIX}/share/applications/kde)
set(KDE3_LIB_INSTALL_DIR ${LIB_INSTALL_DIR} )
set(KDE3_PLUGIN_INSTALL_DIR ${KDE3_LIB_INSTALL_DIR}/kde3)
+set(KDE_UIC_EXECUTABLE /usr/lib/qt3/bin/uic)
# tell cmake where to search for libraries:
link_directories(${KDE3_LIB_DIR})
@@ -68,7 +73,7 @@
ADD_SUBDIRECTORY( images )
#ADD_SUBDIRECTORY( kxmlrpcclient )
#ADD_SUBDIRECTORY( kzmdauthutil )
-ADD_SUBDIRECTORY( po )
+ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL )
#ADD_SUBDIRECTORY( udshttp )
ADD_SUBDIRECTORY( updater )
Added: trunk/updater-kde/cmake/modules/FindGettext.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/cmake/modules/FindGe…
==============================================================================
--- trunk/updater-kde/cmake/modules/FindGettext.cmake (added)
+++ trunk/updater-kde/cmake/modules/FindGettext.cmake Tue May 29 14:52:50 2007
@@ -0,0 +1,63 @@
+# - Find GNU gettext tools
+# This module looks for the GNU gettext tools. This module defines the
+# following values:
+# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
+# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
+# GETTEXT_FOUND: True if gettext has been found.
+#
+# Additionally it provides the following macros:
+# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
+# This will create a target "translations" which will convert the
+# given input po files into the binary output mo file. If the
+# ALL option is used, the translations will also be created when
+# building the default target.
+
+FIND_PROGRAM(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
+
+FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
+
+MACRO(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFile)
+
+ SET(_gmoFiles)
+ GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
+ GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
+
+#MESSAGE( STATUS "pot: ${_potFile} converted to ${_potBasename}")
+
+ SET(_addToAll)
+ IF(${_firstPoFile} STREQUAL "ALL")
+ SET(_addToAll "ALL")
+ SET(_firstPoFile)
+ ENDIF(${_firstPoFile} STREQUAL "ALL")
+
+ FOREACH (_currentPoFile ${ARGN})
+ GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
+ GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE)
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_gmoFile}
+#COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+#DEPENDS ${_absPotFile} ${_absFile}
+ DEPENDS ${_absFile}
+ )
+
+ INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
+ SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
+
+ ENDFOREACH (_currentPoFile )
+
+ ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
+
+ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
+
+IF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
+ SET(GETTEXT_FOUND TRUE)
+ELSE (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
+ SET(GETTEXT_FOUND FALSE)
+ IF (GetText_REQUIRED)
+ MESSAGE(FATAL_ERROR "GetText not found")
+ ENDIF (GetText_REQUIRED)
+ENDIF (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
\ No newline at end of file
Modified: trunk/updater-kde/opensuse-updater-kde.spec.in
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/opensuse-updater-kde…
==============================================================================
--- trunk/updater-kde/opensuse-updater-kde.spec.in (original)
+++ trunk/updater-kde/opensuse-updater-kde.spec.in Tue May 29 14:52:50 2007
@@ -8,17 +8,19 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
-Name: opensuse-updater
+Name: @PACKAGE@
BuildRequires: kdelibs3-devel update-desktop-files
License: GPL
Group: System/Management
Summary: KDE updater applet for OpenSUSE
-Version: @VERSION
+Version: @VERSION@
Release: 1
URL: http://en.opensuse.org/KDE_Updater_Applet
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: opensuseupdater-%{version}.tar.bz2
+Source0: %{name}-%{version}.tar.bz2
Requires: zypper >= 0.5.3
+Obsoletes: opensuse-updater
+Conflicts: opensuse-updater
%description
KDE updater applet for OpenSUSE
@@ -30,7 +32,7 @@
Martin Vidner <mvidner(a)novell.com>
%prep
-%setup -q -n opensuseupdater-%{version}
+%setup -q -n %{name}-%{version}
. /etc/opt/kde3/common_options
%build
@@ -50,6 +52,10 @@
. /etc/opt/kde3/common_options
cd build
make DESTDIR=$RPM_BUILD_ROOT $INSTALL_TARGET
+rm -rf $RPM_BUILD_ROOT/opt/kde3/include
+
+%suse_update_desktop_file opensuseupdater
+#%find_lang opensuseupdater
%post
%run_ldconfig
@@ -60,23 +66,22 @@
%clean
rm -rf $RPM_BUILD_ROOT
-%files -f opensuseupdater.lang
+#%files -f opensuseupdater.lang
+%files
%defattr(-,root,root)
/opt/kde3/bin/*
-%dir /opt/kde3/share/apps/opensuseupdater/
-%dir /opt/kde3/share/apps/opensuseupdater/pics
-/opt/kde3/share/apps/opensuseupdater/pics/*
/opt/kde3/share/apps/opensuseupdater
/opt/kde3/share/icons/hicolor/*
/opt/kde3/share/applnk/*
/opt/kde3/share/autostart/*.desktop
+/opt/kde3/share/servicetypes/*
/opt/kde3/share/applications/kde/opensuseupdater.desktop
/opt/kde3/%{_lib}/*
-/opt/kde3/share/doc/*
/opt/kde3/share/services/*
/opt/kde3/share/config.kcfg/opensuseupdater_settings.kcfg
+#/opt/kde3/share/doc/*
-%changelog -n opensuse-updater
+%changelog -n opensuse-updater-kde
* Wed Aug 30 2006 - stbinner(a)suse.de
- fix build
* Tue Aug 29 2006 - dmacvicar(a)suse.de
Modified: trunk/updater-kde/po/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/po/CMakeLists.txt?re…
==============================================================================
--- trunk/updater-kde/po/CMakeLists.txt (original)
+++ trunk/updater-kde/po/CMakeLists.txt Tue May 29 14:52:50 2007
@@ -1,11 +1,2 @@
-INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR} )
-
-
-########### install files ###############
-
-
-
-
-#original Makefile.am contents follow:
-
-#POFILES = AUTO
+FILE( GLOB UPDATERKDE_PO_FILES ${CMAKE_SOURCE_DIR}/po/*.po )
+GETTEXT_CREATE_TRANSLATIONS( "${CMAKE_SOURCE_DIR}/po/opensuseupdater.pot" ${UPDATERKDE} )
\ No newline at end of file
Modified: trunk/updater-kde/updater/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/CMakeLists.t…
==============================================================================
--- trunk/updater-kde/updater/CMakeLists.txt (original)
+++ trunk/updater-kde/updater/CMakeLists.txt Tue May 29 14:52:50 2007
@@ -33,5 +33,6 @@
INSTALL_FILES( /share/servicetypes FILES opensuseupdater_backend.desktop )
INSTALL_FILES( /bin FILES opensuseupdater-su )
INSTALL_FILES( /share/applnk/Utilities FILES opensuseupdater.desktop )
+INSTALL_FILES( /share/autostart FILES opensusestart.desktop )
KDE3_INSTALL_ICONS( hicolor )
--
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] r5639 - in /trunk/updater-kde: CMakeLists.txt VERSION.cmake cmake/modules/kde3init_dummy.cpp.in cmake/modules/kde3uic.cmake opensuse-updater-kde.spec.in opensuse-updater.spec.in
by dmacvicar@svn.opensuse.org 29 May '07
by dmacvicar@svn.opensuse.org 29 May '07
29 May '07
Author: dmacvicar
Date: Tue May 29 12:50:48 2007
New Revision: 5639
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5639&view=rev
Log:
fix build
Added:
trunk/updater-kde/VERSION.cmake
trunk/updater-kde/cmake/modules/kde3init_dummy.cpp.in
trunk/updater-kde/cmake/modules/kde3uic.cmake
trunk/updater-kde/opensuse-updater-kde.spec.in
- copied unchanged from r5638, trunk/updater-kde/opensuse-updater.spec.in
Removed:
trunk/updater-kde/opensuse-updater.spec.in
Modified:
trunk/updater-kde/CMakeLists.txt
Modified: trunk/updater-kde/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/CMakeLists.txt?rev=5…
==============================================================================
--- trunk/updater-kde/CMakeLists.txt (original)
+++ trunk/updater-kde/CMakeLists.txt Tue May 29 12:50:48 2007
@@ -1,4 +1,4 @@
-SET(PACKAGE "opensuseupdater-kde")
+SET(PACKAGE "opensuse-updater-kde")
PROJECT(${PACKAGE})
SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
Added: trunk/updater-kde/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/VERSION.cmake?rev=56…
==============================================================================
--- trunk/updater-kde/VERSION.cmake (added)
+++ trunk/updater-kde/VERSION.cmake Tue May 29 12:50:48 2007
@@ -0,0 +1,3 @@
+SET(VERSION_MAJOR "0")
+SET(VERSION_MINOR "5")
+SET(VERSION_PATCH "0")
\ No newline at end of file
Added: trunk/updater-kde/cmake/modules/kde3init_dummy.cpp.in
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/cmake/modules/kde3in…
==============================================================================
--- trunk/updater-kde/cmake/modules/kde3init_dummy.cpp.in (added)
+++ trunk/updater-kde/cmake/modules/kde3init_dummy.cpp.in Tue May 29 12:50:48 2007
@@ -0,0 +1,6 @@
+
+/* used by KDE3Macros.cmake */
+
+extern "C" int kdemain(int argc, char* argv[]);
+extern "C" int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
+int main(int argc, char* argv[]) { return kdemain(argc,argv); }
Added: trunk/updater-kde/cmake/modules/kde3uic.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/cmake/modules/kde3ui…
==============================================================================
--- trunk/updater-kde/cmake/modules/kde3uic.cmake (added)
+++ trunk/updater-kde/cmake/modules/kde3uic.cmake Tue May 29 12:50:48 2007
@@ -0,0 +1,20 @@
+
+
+# used internally by KDE3Macros.cmake
+# neundorf(a)kde.org
+
+
+EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE}
+ -L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n
+ -impl ${KDE_UIC_H_FILE}
+ ${KDE_UIC_FILE}
+ OUTPUT_VARIABLE _uic_CONTENTS
+ ERROR_QUIET
+ )
+
+STRING(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
+STRING(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
+
+FILE(WRITE ${KDE_UIC_CPP_FILE} "#include <kdialog.h>\n#include <klocale.h>\n\n")
+FILE(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}")
+
--
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] r5638 - in /trunk/updater-kde: CMakeLists.txt cmake/ cmake/modules/ cmake/modules/FindKDE3.cmake cmake/modules/KDE3Macros.cmake opensuse-updater.spec.in
by dmacvicar@svn.opensuse.org 29 May '07
by dmacvicar@svn.opensuse.org 29 May '07
29 May '07
Author: dmacvicar
Date: Tue May 29 12:47:17 2007
New Revision: 5638
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5638&view=rev
Log:
- Fork KDE3 support, because it is broken upstream.
- try to build package from cmake
Added:
trunk/updater-kde/cmake/
trunk/updater-kde/cmake/modules/
trunk/updater-kde/cmake/modules/FindKDE3.cmake
trunk/updater-kde/cmake/modules/KDE3Macros.cmake
Modified:
trunk/updater-kde/CMakeLists.txt
trunk/updater-kde/opensuse-updater.spec.in
Modified: trunk/updater-kde/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/CMakeLists.txt?rev=5…
==============================================================================
--- trunk/updater-kde/CMakeLists.txt (original)
+++ trunk/updater-kde/CMakeLists.txt Tue May 29 12:47:17 2007
@@ -1,5 +1,33 @@
-PROJECT(opensuseupdater-kde)
+SET(PACKAGE "opensuseupdater-kde")
+PROJECT(${PACKAGE})
+SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
+
+INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
+SET ( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
+#SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "")
+SET(CPACK_PACKAGE_VENDOR "Novell Inc.")
+#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
+#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
+
+SET( CPACK_GENERATOR "TBZ2")
+SET( CPACK_SOURCE_GENERATOR "TBZ2")
+SET( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" )
+
+# The following components are regex's to match anywhere (unless anchored)
+# in absolute path + filename to find files or directories to be excluded
+# from source tarball.
+SET (CPACK_SOURCE_IGNORE_FILES
+"/CVS/;/.svn/;/.libs/;/.deps/;.swp$;.#;/#;/build/"
+"~$"
+"\\\\.cvsignore$"
+"/package"
+"Makefile\\\\.in$"
+)
+INCLUDE(CPack)
FIND_PACKAGE(KDE3 REQUIRED)
# Library
@@ -46,3 +74,25 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR} )
+MESSAGE(STATUS "Writing spec file...")
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${PACKAGE}.spec.in ${CMAKE_BINARY_DIR}/package/${PACKAGE}.spec @ONLY)
+
+ADD_CUSTOM_TARGET( svncheck
+ COMMAND cd $(CMAKE_SOURCE_DIR) && ! LC_ALL=C svn status --show-updates --quiet | grep -v '^Status against revision'
+)
+
+SET( AUTOBUILD_COMMAND
+ COMMAND ${CMAKE_MAKE_PROGRAM} package_source
+ COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package
+ COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/${PACKAGE}.changes" "${CMAKE_BINARY_DIR}/package/${PACKAGE}.changes"
+)
+
+ADD_CUSTOM_TARGET( autobuild_local
+ ${AUTOBUILD_COMMAND}
+)
+
+ADD_CUSTOM_TARGET( autobuild
+ COMMAND ${CMAKE_MAKE_PROGRAM} svncheck
+ ${AUTOBUILD_COMMAND}
+)
\ No newline at end of file
Added: trunk/updater-kde/cmake/modules/FindKDE3.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/cmake/modules/FindKD…
==============================================================================
--- trunk/updater-kde/cmake/modules/FindKDE3.cmake (added)
+++ trunk/updater-kde/cmake/modules/FindKDE3.cmake Tue May 29 12:47:17 2007
@@ -0,0 +1,263 @@
+# - Find the KDE3 include and library dirs, KDE preprocessors and define a some macros
+#
+# This module defines the following variables:
+# KDE3_DEFINITIONS - compiler definitions required for compiling KDE software
+# KDE3_INCLUDE_DIR - the KDE include directory
+# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES()
+# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES()
+# QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library
+# KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable
+# KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable
+# KDE3_KCFGC_EXECUTABLE - the kconfig_compiler executable
+# KDE3_FOUND - set to TRUE if all of the above has been found
+#
+# The following user adjustable options are provided:
+#
+# KDE3_ENABLE_FINAL - enable this for KDE-style enable-final all-in-one compilation
+# KDE3_BUILD_TESTS - enable this to build KDE testcases
+#
+#
+# It also adds the following macros (from KDE3Macros.cmake)
+# SRCS_VAR is always the variable which contains the list of source files for your application or library.
+#
+# KDE3_AUTOMOC(file1 ... fileN)
+# Call this if you want to have automatic moc file handling.
+# This means if you include "foo.moc" in the source file foo.cpp
+# a moc file for the header foo.h will be created automatically.
+# You can set the property SKIP_AUTOMAKE using SET_SOURCE_FILES_PROPERTIES()
+# to exclude some files in the list from being processed.
+#
+# KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN )
+# If you don't use the KDE3_AUTOMOC() macro, for the files
+# listed here moc files will be created (named "foo.moc.cpp")
+#
+# KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h ... headerN.h )
+# Use this to generate DCOP skeletions from the listed headers.
+#
+# KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h ... headerN.h )
+# Use this to generate DCOP stubs from the listed headers.
+#
+# KDE3_ADD_UI_FILES(SRCS_VAR file1.ui ... fileN.ui )
+# Use this to add the Qt designer ui files to your application/library.
+#
+# KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc )
+# Use this to add KDE kconfig compiler files to your application/library.
+#
+# KDE3_INSTALL_LIBTOOL_FILE(target)
+# This will create and install a simple libtool file for the given target.
+#
+# KDE3_ADD_EXECUTABLE(name file1 ... fileN )
+# Equivalent to ADD_EXECUTABLE(), but additionally supports KDE3_ENABLE_FINAL
+#
+# KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN )
+# Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
+# It supports KDE3_ENABLE_FINAL
+# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.
+# It creates and installs an appropriate libtool la-file.
+#
+# KDE3_ADD_KDEINIT_EXECUTABLE(name file1 ... fileN )
+# Create a KDE application in the form of a module loadable via kdeinit.
+# A library named kdeinit_<name> will be created and a small executable which links to it.
+# It supports KDE3_ENABLE_FINAL
+#
+# Author: Alexander Neundorf <neundorf(a)kde.org>
+
+IF(NOT UNIX)
+ MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported")
+ENDIF(NOT UNIX)
+
+
+SET(QT_MT_REQUIRED TRUE)
+#SET(QT_MIN_VERSION "3.0.0")
+
+#this line includes FindQt.cmake, which searches the Qt library and headers
+FIND_PACKAGE(Qt3 REQUIRED)
+FIND_PACKAGE(X11 REQUIRED)
+
+
+SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} kdecore)
+
+#add some KDE specific stuff
+SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE)
+
+#only on linux, but NOT e.g. on FreeBSD:
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+ SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common")
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
+# works on FreeBSD, NOT tested on NetBSD and OpenBSD
+IF (CMAKE_SYSTEM_NAME MATCHES BSD)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
+ SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD)
+
+# if no special buildtype is selected, add -O2 as default optimization
+IF (NOT CMAKE_BUILD_TYPE)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
+ SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+ENDIF (NOT CMAKE_BUILD_TYPE)
+
+
+#SET(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined")
+#SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
+#SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc")
+
+# all calls to FIND_PROGRAM/PATH/LIBRARY() follow the same scheme:
+# at first try some special paths with the argument "NO_DEFAULT_PATH"
+# so only these paths are checked
+# this is followed by a second call to FIND_PROGRAM/PATH/LIBRARY()
+# but this time without any paths and without NO_DEFAULT_PATH
+# this second call will do nothing if the first call already found
+# what it was looking for, if not, it will search only in the default
+# directories (/usr, /usr/local, etc.)
+
+#now try to find some kde stuff
+FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config PATHS
+ $ENV{KDEDIR}/bin
+ /opt/kde3/bin
+ /opt/kde/bin
+ NO_DEFAULT_PATH
+ )
+
+
+FIND_PROGRAM(KDECONFIG_EXECUTABLE kde-config)
+
+
+SET(KDE3PREFIX)
+IF(KDECONFIG_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version
+ OUTPUT_VARIABLE kde_config_version )
+
+ STRING(REGEX MATCH "KDE: .\\." kde_version ${kde_config_version})
+ IF (${kde_version} MATCHES "KDE: 3\\.")
+ EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix
+ OUTPUT_VARIABLE kdedir )
+ STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}")
+
+ ENDIF (${kde_version} MATCHES "KDE: 3\\.")
+ENDIF(KDECONFIG_EXECUTABLE)
+
+
+
+# at first the KDE include direcory
+# kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore
+FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h
+ $ENV{KDEDIR}/include
+ ${KDE3PREFIX}/include
+ /opt/kde3/include
+ /opt/kde/include
+ /usr/include/kde
+ /usr/local/include/kde
+ NO_DEFAULT_PATH
+ )
+
+FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h)
+
+#now the KDE library directory
+FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore
+ PATHS
+ $ENV{KDEDIR}/lib
+ ${KDE3PREFIX}/lib
+ /opt/kde3/lib
+ /opt/kde/lib
+ NO_DEFAULT_PATH
+)
+
+FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore)
+
+GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH )
+
+#now search for the dcop utilities
+FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl PATHS
+ $ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ /opt/kde3/bin
+ /opt/kde/bin
+ NO_DEFAULT_PATH
+ )
+
+FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl)
+
+FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp PATHS
+ $ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ /opt/kde3/bin
+ /opt/kde/bin
+ NO_DEFAULT_PATH
+ )
+
+FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp)
+
+FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler PATHS
+ $ENV{KDEDIR}/bin
+ ${KDE3PREFIX}/bin
+ /opt/kde3/bin
+ /opt/kde/bin
+ NO_DEFAULT_PATH
+ )
+
+FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler)
+
+# KDE3Macros.cmake contains all the KDE specific macros
+INCLUDE(KDE3Macros)
+
+
+#SET KDE3_FOUND
+IF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE)
+ SET(KDE3_FOUND TRUE)
+ELSE (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE)
+ SET(KDE3_FOUND FALSE)
+ENDIF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE)
+
+
+MACRO (KDE3_PRINT_RESULTS)
+ IF(KDE3_INCLUDE_DIR)
+ MESSAGE(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}")
+ ELSE(KDE3_INCLUDE_DIR)
+ MESSAGE(STATUS "Didn't find KDE3 headers")
+ ENDIF(KDE3_INCLUDE_DIR)
+
+ IF(KDE3_LIB_DIR)
+ MESSAGE(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}")
+ ELSE(KDE3_LIB_DIR)
+ MESSAGE(STATUS "Didn't find KDE3 core library")
+ ENDIF(KDE3_LIB_DIR)
+
+ IF(KDE3_DCOPIDL_EXECUTABLE)
+ MESSAGE(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}")
+ ELSE(KDE3_DCOPIDL_EXECUTABLE)
+ MESSAGE(STATUS "Didn't find the KDE3 dcopidl preprocessor")
+ ENDIF(KDE3_DCOPIDL_EXECUTABLE)
+
+ IF(KDE3_DCOPIDL2CPP_EXECUTABLE)
+ MESSAGE(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}")
+ ELSE(KDE3_DCOPIDL2CPP_EXECUTABLE)
+ MESSAGE(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor")
+ ENDIF(KDE3_DCOPIDL2CPP_EXECUTABLE)
+
+ IF(KDE3_KCFGC_EXECUTABLE)
+ MESSAGE(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}")
+ ELSE(KDE3_KCFGC_EXECUTABLE)
+ MESSAGE(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor")
+ ENDIF(KDE3_KCFGC_EXECUTABLE)
+
+ENDMACRO (KDE3_PRINT_RESULTS)
+
+
+IF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND)
+ #bail out if something wasn't found
+ KDE3_PRINT_RESULTS()
+ MESSAGE(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs")
+
+ENDIF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND)
+
+
+IF (NOT KDE3_FIND_QUIETLY)
+ KDE3_PRINT_RESULTS()
+ENDIF (NOT KDE3_FIND_QUIETLY)
+
+#add the found Qt and KDE include directories to the current include path
+SET(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR})
+
Added: trunk/updater-kde/cmake/modules/KDE3Macros.cmake
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/cmake/modules/KDE3Ma…
==============================================================================
--- trunk/updater-kde/cmake/modules/KDE3Macros.cmake (added)
+++ trunk/updater-kde/cmake/modules/KDE3Macros.cmake Tue May 29 12:47:17 2007
@@ -0,0 +1,393 @@
+#
+
+# See FindKDE3.cmake for documentation.
+#
+# this file contains the following macros:
+# KDE3_ADD_DCOP_SKELS
+# KDE3_ADD_DCOP_STUBS
+# KDE3_ADD_MOC_FILES
+# KDE3_ADD_UI_FILES
+# KDE3_ADD_KCFG_FILES
+# KDE3_AUTOMOC
+# KDE3_INSTALL_LIBTOOL_FILE
+# KDE3_CREATE_FINAL_FILE
+# KDE3_ADD_KPART
+# KDE3_ADD_KDEINIT_EXECUTABLE
+# KDE3_ADD_EXECUTABLE
+
+
+#neundorf(a)kde.org
+
+INCLUDE(AddFileDependencies)
+
+#create the kidl and skeletion file for dcop stuff
+#usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers})
+MACRO(KDE3_ADD_DCOP_SKELS _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+
+ SET(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp)
+ SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)
+
+ IF (NOT HAVE_${_basename}_KIDL_RULE)
+ SET(HAVE_${_basename}_KIDL_RULE ON)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
+ COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
+ ARGS ${_tmp_FILE} > ${_kidl}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
+
+ IF (NOT HAVE_${_basename}_SKEL_RULE)
+ SET(HAVE_${_basename}_SKEL_RULE ON)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_skel}
+ COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
+ ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl}
+ DEPENDS ${_kidl}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_SKEL_RULE)
+
+ SET(${_sources} ${${_sources}} ${_skel})
+
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_ADD_DCOP_SKELS)
+
+
+MACRO(KDE3_ADD_DCOP_STUBS _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+
+ SET(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp)
+ SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl)
+
+ IF (NOT HAVE_${_basename}_KIDL_RULE)
+ SET(HAVE_${_basename}_KIDL_RULE ON)
+
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_kidl}
+ COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
+ ARGS ${_tmp_FILE} > ${_kidl}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_KIDL_RULE)
+
+
+ IF (NOT HAVE_${_basename}_STUB_RULE)
+ SET(HAVE_${_basename}_STUB_RULE ON)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_stub_CPP}
+ COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
+ ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl}
+ DEPENDS ${_kidl}
+ )
+
+ ENDIF (NOT HAVE_${_basename}_STUB_RULE)
+
+ SET(${_sources} ${${_sources}} ${_stub_CPP})
+
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_ADD_DCOP_STUBS)
+
+
+MACRO(KDE3_ADD_KCFG_FILES _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+
+ FILE(READ ${_tmp_FILE} _contents)
+ STRING(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}")
+
+ SET(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+ SET(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_src_FILE}
+ COMMAND ${KDE3_KCFGC_EXECUTABLE}
+ ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE}
+ DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} )
+
+ SET(${_sources} ${${_sources}} ${_src_FILE})
+
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_ADD_KCFG_FILES)
+
+
+#create the moc files and add them to the list of sources
+#usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers})
+MACRO(KDE3_ADD_MOC_FILES _sources)
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${_tmp_FILE} -o ${_moc}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ SET(${_sources} ${${_sources}} ${_moc})
+
+ ENDFOREACH (_current_FILE)
+ENDMACRO(KDE3_ADD_MOC_FILES)
+
+
+GET_FILENAME_COMPONENT( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+#create the implementation files from the ui files and add them to the list of sources
+#usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files})
+MACRO(KDE3_ADD_UI_FILES _sources )
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE)
+
+ GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE)
+ SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+ SET(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_header}
+ COMMAND ${QT_UIC_EXECUTABLE}
+ ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_src}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS
+ -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer
+ -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
+ -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
+ -DKDE_UIC_CPP_FILE:FILEPATH=${_src}
+ -DKDE_UIC_H_FILE:FILEPATH=${_header}
+ -P ${KDE3_MODULE_DIR}/kde3uic.cmake
+ DEPENDS ${_header}
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${_header} -o ${_moc}
+ DEPENDS ${_header}
+ )
+
+ SET(${_sources} ${${_sources}} ${_src} ${_moc} )
+
+ ENDFOREACH (_current_FILE)
+ENDMACRO(KDE3_ADD_UI_FILES)
+
+
+MACRO(KDE3_AUTOMOC)
+ SET(_matching_FILES )
+ FOREACH (_current_FILE ${ARGN})
+
+ GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
+
+ # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
+ # here. this is required to make bouic work correctly:
+ # we need to add generated .cpp files to the sources (to compile them),
+ # but we cannot let automoc handle them, as the .cpp files don't exist yet when
+ # cmake is run for the very first time on them -> however the .cpp files might
+ # exist at a later run. at that time we need to skip them, so that we don't add two
+ # different rules for the same moc file
+ GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
+
+ IF (EXISTS ${_abs_FILE} AND NOT _skip)
+
+ FILE(READ ${_abs_FILE} _contents)
+
+ GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
+
+ STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
+ IF(_match)
+ FOREACH (_current_MOC_INC ${_match})
+ STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
+
+ GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
+# SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
+ SET(_header ${_abs_PATH}/${_basename}.h)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${_header} -o ${_moc}
+ DEPENDS ${_header}
+ )
+
+ ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
+
+ ENDFOREACH (_current_MOC_INC)
+ ENDIF(_match)
+
+ ENDIF (EXISTS ${_abs_FILE} AND NOT _skip)
+ ENDFOREACH (_current_FILE)
+ENDMACRO(KDE3_AUTOMOC)
+
+# only used internally by KDE3_INSTALL_ICONS
+MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME)
+
+ # if the string doesn't match the pattern, the result is the full string, so all three have the same content
+ IF (NOT ${_group} STREQUAL ${_install_NAME} )
+ SET(_icon_GROUP "actions")
+
+ IF (${_group} STREQUAL "mime")
+ SET(_icon_GROUP "mimetypes")
+ ENDIF (${_group} STREQUAL "mime")
+
+ IF (${_group} STREQUAL "filesys")
+ SET(_icon_GROUP "filesystems")
+ ENDIF (${_group} STREQUAL "filesys")
+
+ IF (${_group} STREQUAL "device")
+ SET(_icon_GROUP "devices")
+ ENDIF (${_group} STREQUAL "device")
+
+ IF (${_group} STREQUAL "app")
+ SET(_icon_GROUP "apps")
+ ENDIF (${_group} STREQUAL "app")
+
+ IF (${_group} STREQUAL "action")
+ SET(_icon_GROUP "actions")
+ ENDIF (${_group} STREQUAL "action")
+
+# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
+ INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} )
+ ENDIF (NOT ${_group} STREQUAL ${_install_NAME} )
+
+ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE)
+
+
+MACRO (KDE3_INSTALL_ICONS _theme )
+ SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons")
+ # first the png icons
+ FILE(GLOB _icons *.png)
+ FOREACH (_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
+ _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
+ ${_defaultpath}/${_theme}/${_size}x${_size}
+ ${_group} ${_current_ICON} ${_name})
+ ENDFOREACH (_current_ICON)
+
+ # and now the svg icons
+ FILE(GLOB _icons *.svgz)
+ FOREACH (_current_ICON ${_icons} )
+ STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}")
+ STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}")
+ _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
+ ${_defaultpath}/${_theme}/scalable
+ ${_group} ${_current_ICON} ${_name})
+ ENDFOREACH (_current_ICON)
+
+ENDMACRO (KDE3_INSTALL_ICONS)
+
+MACRO(KDE3_INSTALL_LIBTOOL_FILE _target)
+ GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
+
+ GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
+ GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
+ SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la)
+
+ FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
+ FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
+ FILE(APPEND ${_laname} "dlname='${_soname}'\n")
+ FILE(APPEND ${_laname} "# Names of this library\n")
+ FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n")
+ FILE(APPEND ${_laname} "# The name of the static archive\n")
+ FILE(APPEND ${_laname} "old_library=''\n")
+ FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
+ FILE(APPEND ${_laname} "dependency_libs=''\n")
+# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n")
+ FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n")
+ FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n")
+ FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n")
+ FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n")
+ FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
+ FILE(APPEND ${_laname} "libdir='${LIB_INSTALL_DIR}/kde3'\n")
+
+ INSTALL_FILES(/${LIB}/kde3 FILES ${_laname})
+ENDMACRO(KDE3_INSTALL_LIBTOOL_FILE)
+
+
+MACRO(KDE3_CREATE_FINAL_FILE _filename)
+ FILE(WRITE ${_filename} "//autogenerated file\n")
+ FOREACH (_current_FILE ${ARGN})
+ FILE(APPEND ${_filename} "#include \"${_current_FILE}\"\n")
+ ENDFOREACH (_current_FILE)
+
+ENDMACRO(KDE3_CREATE_FINAL_FILE)
+
+
+OPTION(KDE3_ENABLE_FINAL "Enable final all-in-one compilation")
+OPTION(KDE3_BUILD_TESTS "Build the tests")
+
+
+MACRO(KDE3_ADD_KPART _target_NAME _with_PREFIX)
+#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty
+ IF (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+ SET(_first_SRC)
+ ELSE (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+ SET(_first_SRC ${_with_PREFIX})
+ ENDIF (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+
+ IF (KDE3_ENABLE_FINAL)
+ KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN})
+ ADD_LIBRARY(${_target_NAME} MODULE ${_target_NAME}_final.cpp)
+ ELSE (KDE3_ENABLE_FINAL)
+ ADD_LIBRARY(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
+ ENDIF (KDE3_ENABLE_FINAL)
+
+ IF(_first_SRC)
+ SET_TARGET_PROPERTIES(${_target_NAME} PROPERTIES PREFIX "")
+ ENDIF(_first_SRC)
+
+ KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME})
+
+ENDMACRO(KDE3_ADD_KPART)
+
+
+MACRO(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME )
+
+ IF (KDE3_ENABLE_FINAL)
+ KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
+ ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp)
+ ELSE (KDE3_ENABLE_FINAL)
+ ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${ARGN} )
+ ENDIF (KDE3_ENABLE_FINAL)
+
+ CONFIGURE_FILE(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
+
+ ADD_EXECUTABLE( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp )
+ TARGET_LINK_LIBRARIES( ${_target_NAME} kdeinit_${_target_NAME} )
+
+ENDMACRO(KDE3_ADD_KDEINIT_EXECUTABLE)
+
+
+MACRO(KDE3_ADD_EXECUTABLE _target_NAME )
+
+ IF (KDE3_ENABLE_FINAL)
+ KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN})
+ ADD_EXECUTABLE(${_target_NAME} ${_target_NAME}_final.cpp)
+ ELSE (KDE3_ENABLE_FINAL)
+ ADD_EXECUTABLE(${_target_NAME} ${ARGN} )
+ ENDIF (KDE3_ENABLE_FINAL)
+
+ENDMACRO(KDE3_ADD_EXECUTABLE)
+
+
Modified: trunk/updater-kde/opensuse-updater.spec.in
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/opensuse-updater.spe…
==============================================================================
--- trunk/updater-kde/opensuse-updater.spec.in (original)
+++ trunk/updater-kde/opensuse-updater.spec.in Tue May 29 12:47:17 2007
@@ -13,7 +13,7 @@
License: GPL
Group: System/Management
Summary: KDE updater applet for OpenSUSE
-Version: 0.4
+Version: @VERSION
Release: 1
URL: http://en.opensuse.org/KDE_Updater_Applet
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -32,19 +32,24 @@
%prep
%setup -q -n opensuseupdater-%{version}
. /etc/opt/kde3/common_options
-update_admin --no-unsermake
%build
. /etc/opt/kde3/common_options
-./configure $configkde --disable-final
+mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=/opt/kde3 \
+ -DLIB=%{_lib} \
+ -DCMAKE_C_FLAGS="%{optflags}" \
+ -DCMAKE_CXX_FLAGS="%{optflags}" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_SKIP_RPATH=1 \
+ ..
make
%install
. /etc/opt/kde3/common_options
+cd build
make DESTDIR=$RPM_BUILD_ROOT $INSTALL_TARGET
-rm -rf $RPM_BUILD_ROOT/opt/kde3/include
-%suse_update_desktop_file opensuseupdater
-%find_lang opensuseupdater
%post
%run_ldconfig
--
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] r5637 - in /trunk/libzypp/zypp/parser/yum: FilelistsFileReader.cc FilelistsFileReader.h OtherFileReader.cc OtherFileReader.h PatternFileReader.h RepomdFileReader.cc RepomdFileReader.h
by jkupec@svn.opensuse.org 29 May '07
by jkupec@svn.opensuse.org 29 May '07
29 May '07
Author: jkupec
Date: Tue May 29 11:42:55 2007
New Revision: 5637
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5637&view=rev
Log:
Hiding YUM parser implementation.
Modified:
trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc
trunk/libzypp/zypp/parser/yum/FilelistsFileReader.h
trunk/libzypp/zypp/parser/yum/OtherFileReader.cc
trunk/libzypp/zypp/parser/yum/OtherFileReader.h
trunk/libzypp/zypp/parser/yum/PatternFileReader.h
trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
trunk/libzypp/zypp/parser/yum/RepomdFileReader.h
Modified: trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/Filelist…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/FilelistsFileReader.cc Tue May 29 11:42:55 2007
@@ -6,8 +6,11 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
-#include <fstream>
+/** \file zypp/parser/yum/FilelistsFileReader.cc
+ * Implementation of filelists.xml.gz file reader.
+ */
+#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
#include "zypp/parser/yum/FilelistsFileReader.h"
@@ -25,21 +28,59 @@
{
- // --------------------------------------------------------------------------
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : FilelistsFileReader::Impl
+ //
+ class FilelistsFileReader::Impl : private base::NonCopyable
+ {
+ public:
+ Impl(
+ const Pathname & filelists_file,
+ const ProcessPackage & callback,
+ const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc());
- /*
- * 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'.
- */
+ public:
- // --------------------------------------------------------------------------
+ /**
+ * Callback provided to the XML parser.
+ */
+ bool consumeNode(xml::Reader & reader_r);
+
+ /**
+ * Creates a new \ref data::Resolvable_Ptr, swaps its contents with
+ * \ref _resolvable and returns it. Used to hand-out the data object to its consumer
+ * (a \ref ProcessPackage function) after it has been read.
+ */
+ data::Resolvable_Ptr handoutResolvable();
+
+ private:
+
+ /**
+ * Pointer to the \ref zypp::data::Resolvable object for storing the NVRA
+ * data.
+ */
+ zypp::data::Resolvable_Ptr _resolvable;
+
+ /**
+ * Changelog of \ref _resolvable.
+ */
+ data::Filenames _filenames;
+
+ /**
+ * Callback for processing package metadata. Passed in through constructor.
+ */
+ ProcessPackage _callback;
+
+ /**
+ * Progress reporting object.
+ */
+ ProgressData _ticks;
+ };
+ ///////////////////////////////////////////////////////////////////////
- FilelistsFileReader::FilelistsFileReader(
- const Pathname & filelist_file,
+ FilelistsFileReader::Impl::Impl(
+ const Pathname & filelists_file,
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress)
:
@@ -48,14 +89,26 @@
_ticks.sendTo(progress);
_ticks.name("filelist.xml.gz");
- Reader reader(filelist_file);
- MIL << "Reading " << filelist_file << endl;
- reader.foreachNode(bind(&FilelistsFileReader::consumeNode, this, _1));
+ Reader reader(filelists_file);
+ MIL << "Reading " << filelists_file << endl;
+ reader.foreachNode(bind(&FilelistsFileReader::Impl::consumeNode, this, _1));
}
// --------------------------------------------------------------------------
- bool FilelistsFileReader::consumeNode(Reader & reader_r)
+ /*
+ * 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 FilelistsFileReader::Impl::consumeNode(Reader & reader_r)
{
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
@@ -125,7 +178,7 @@
// --------------------------------------------------------------------------
- data::Resolvable_Ptr FilelistsFileReader::handoutResolvable()
+ data::Resolvable_Ptr FilelistsFileReader::Impl::handoutResolvable()
{
data::Resolvable_Ptr ret;
ret.swap(_resolvable);
@@ -133,9 +186,26 @@
}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : FilelistsFileReader
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ FilelistsFileReader::FilelistsFileReader(
+ const Pathname & filelists_file,
+ const ProcessPackage & callback,
+ const ProgressData::ReceiverFnc & progress)
+ :
+ _pimpl(new Impl(filelists_file, callback, progress))
+ {}
+
+ FilelistsFileReader::~FilelistsFileReader()
+ {}
+
+
} // ns yum
} // ns parser
} // ns zypp
// vim: set ts=2 sts=2 sw=2 et ai:
-
Modified: trunk/libzypp/zypp/parser/yum/FilelistsFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/Filelist…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FilelistsFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/FilelistsFileReader.h Tue May 29 11:42:55 2007
@@ -6,14 +6,17 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
+/** \file zypp/parser/yum/FilelistsFileReader.h
+ * Interface of filelists.xml.gz file reader.
+ */
+#ifndef ZYPP_PARSER_YUM_FILELISTFILEREADER_H_
+#define ZYPP_PARSER_YUM_FILELISTFILEREADER_H_
-#ifndef FILELISTFILEREADER_H_
-#define FILELISTFILEREADER_H_
-
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
#include "zypp/base/Function.h"
-#include "zypp/base/Logger.h"
-#include "zypp/parser/xml/Reader.h"
#include "zypp/data/ResolvableData.h"
+
#include "zypp/ProgressData.h"
namespace zypp
@@ -39,7 +42,7 @@
* bind(&SomeClass::callbackfunc, &SomeClassInstance, _1, _2));
* \endcode
*/
- class FilelistsFileReader
+ class FilelistsFileReader : private base::NonCopyable
{
public:
/**
@@ -48,7 +51,8 @@
typedef function<bool(const data::Resolvable_Ptr &, const data::Filenames &)> ProcessPackage;
/**
- * Constructor
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
* \param filelists_file the filelists.xml.gz file you want to read
* \param callback function to process \ref _resolvable data.
* \param progress progress reporting object
@@ -60,42 +64,14 @@
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc());
- private:
-
- /**
- * Callback provided to the XML parser.
- */
- bool consumeNode(xml::Reader & reader_r);
-
/**
- * Creates a new \ref data::Resolvable_Ptr, swaps its contents with
- * \ref _resolvable and returns it. Used to hand-out the data object to its consumer
- * (a \ref ProcessPackage function) after it has been read.
+ * DTOR.
*/
- data::Resolvable_Ptr handoutResolvable();
+ ~FilelistsFileReader();
private:
-
- /**
- * Pointer to the \ref zypp::data::Resolvable object for storing the NVRA
- * data.
- */
- zypp::data::Resolvable_Ptr _resolvable;
-
- /**
- * Changelog of \ref _resolvable.
- */
- data::Filenames _filenames;
-
- /**
- * Callback for processing package metadata passed in through constructor.
- */
- ProcessPackage _callback;
-
- /**
- * Progress reporting object.
- */
- ProgressData _ticks;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
@@ -103,6 +79,6 @@
} // ns parser
} // ns yum
-#endif /*FILELISTFILEREADER_H_*/
+#endif /*ZYPP_PARSER_YUM_FILELISTFILEREADER_H_*/
// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp/parser/yum/OtherFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/OtherFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/OtherFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/OtherFileReader.cc Tue May 29 11:42:55 2007
@@ -6,8 +6,13 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
-#include <fstream>
+/** \file zypp/parser/yum/OtherFileReader.cc
+ * Implementation of other.xml.gz file reader.
+ */
+#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/Changelog.h"
#include "zypp/parser/yum/OtherFileReader.h"
@@ -25,20 +30,58 @@
{
- // --------------------------------------------------------------------------
-
- /*
- * 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'.
- */
-
- // --------------------------------------------------------------------------
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : OtherFileReader::Impl
+ //
+ class OtherFileReader::Impl : private base::NonCopyable
+ {
+ public:
+ Impl(
+ const Pathname & other_file,
+ const ProcessPackage & callback,
+ const ProgressData::ReceiverFnc & progress);
+
+ public:
+
+ /**
+ * Callback provided to the XML parser.
+ */
+ bool consumeNode(xml::Reader & reader_r);
+
+ /**
+ * Creates a new \ref data::Resolvable_Ptr, swaps its contents with
+ * \ref _resolvable and returns it. Used to hand-out the data object to its consumer
+ * (a \ref ProcessPackage function) after it has been read.
+ */
+ data::Resolvable_Ptr handoutResolvable();
+
+ private:
+
+ /**
+ * Pointer to the \ref zypp::data::Resolvable object for storing the NVRA
+ * data.
+ */
+ zypp::data::Resolvable_Ptr _resolvable;
+
+ /**
+ * Changelog of \ref _resolvable.
+ */
+ Changelog _changelog;
+
+ /**
+ * Callback for processing package metadata passed in through constructor.
+ */
+ ProcessPackage _callback;
+
+ /**
+ * Progress reporting object.
+ */
+ ProgressData _ticks;
+ };
+ ///////////////////////////////////////////////////////////////////////
- OtherFileReader::OtherFileReader(
+ OtherFileReader::Impl::Impl(
const Pathname & other_file,
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress)
@@ -50,12 +93,23 @@
Reader reader(other_file);
MIL << "Reading " << other_file << endl;
- reader.foreachNode(bind(&OtherFileReader::consumeNode, this, _1));
+ reader.foreachNode(bind(&OtherFileReader::Impl::consumeNode, this, _1));
}
// --------------------------------------------------------------------------
- bool OtherFileReader::consumeNode(Reader & reader_r)
+ /*
+ * 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 OtherFileReader::Impl::consumeNode(Reader & reader_r)
{
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
@@ -128,7 +182,7 @@
// --------------------------------------------------------------------------
- data::Resolvable_Ptr OtherFileReader::handoutResolvable()
+ data::Resolvable_Ptr OtherFileReader::Impl::handoutResolvable()
{
data::Resolvable_Ptr ret;
ret.swap(_resolvable);
@@ -136,6 +190,24 @@
}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : OtherFileReader
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ OtherFileReader::OtherFileReader(
+ const Pathname & other_file,
+ const ProcessPackage & callback,
+ const ProgressData::ReceiverFnc & progress)
+ :
+ _pimpl(new Impl(other_file, callback, progress))
+ {}
+
+ OtherFileReader::~OtherFileReader()
+ {}
+
+
} // ns yum
} // ns parser
} // ns zypp
Modified: trunk/libzypp/zypp/parser/yum/OtherFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/OtherFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/OtherFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/OtherFileReader.h Tue May 29 11:42:55 2007
@@ -6,16 +6,18 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/OtherFileReader.h
+ * Interface of other.xml.gz file reader.
+ */
#ifndef OTHERFILEREADER_H_
#define OTHERFILEREADER_H_
-#include "zypp/base/Function.h"
-#include "zypp/base/Logger.h"
-#include "zypp/parser/xml/Reader.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
#include "zypp/data/ResolvableData.h"
+#include "zypp/base/Function.h"
+
#include "zypp/ProgressData.h"
-#include "zypp/Changelog.h"
namespace zypp
{
@@ -27,7 +29,7 @@
/**
* Reads through a other.xml file and collects additional package data
- * (currently only changelogs).
+ * (changelogs).
*
* After a package is read, a \ref data::Resolvable
* and \ref Changelog is prepared and \ref _callback
@@ -37,10 +39,10 @@
*
* \code
* OtherFileReader reader(other_file,
- * bind(&SomeClass::callbackfunc, &object, _1));
+ * bind(&SomeClass::callbackfunc, &SomeClassInstance, _1, _2));
* \endcode
*/
- class OtherFileReader
+ class OtherFileReader : private base::NonCopyable
{
public:
/**
@@ -49,7 +51,8 @@
typedef function<bool(const data::Resolvable_Ptr &, const Changelog)> ProcessPackage;
/**
- * Constructor
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
* \param other_file the other.xml.gz file you want to read
* \param callback function to process \ref _resolvable data.
* \param progress progress reporting object
@@ -60,43 +63,15 @@
const Pathname & other_file,
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc());
-
- private:
-
+
/**
- * Callback provided to the XML parser.
+ * DTOR
*/
- bool consumeNode(xml::Reader & reader_r);
-
- /**
- * Creates a new \ref data::Resolvable_Ptr, swaps its contents with
- * \ref _resolvable and returns it. Used to hand-out the data object to its consumer
- * (a \ref ProcessPackage function) after it has been read.
- */
- data::Resolvable_Ptr handoutResolvable();
+ ~OtherFileReader();
private:
-
- /**
- * Pointer to the \ref zypp::data::Resolvable object for storing the NVRA
- * data.
- */
- zypp::data::Resolvable_Ptr _resolvable;
-
- /**
- * Changelog of \ref _resolvable.
- */
- Changelog _changelog;
-
- /**
- * Callback for processing package metadata passed in through constructor.
- */
- ProcessPackage _callback;
-
- /**
- * Progress reporting object.
- */
- ProgressData _ticks;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
Modified: 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 (original)
+++ trunk/libzypp/zypp/parser/yum/PatternFileReader.h Tue May 29 11:42:55 2007
@@ -7,10 +7,10 @@
| |
\---------------------------------------------------------------------*/
/** \file zypp/parser/yum/PatternFileReader.h
- *
+ * Interface of patterns.xml file reader.
*/
-#ifndef PATTERNFILEREADER_H_
-#define PATTERNFILEREADER_H_
+#ifndef ZYPP_PARSER_YUM_PATTERNFILEREADER_H_
+#define ZYPP_PARSER_YUM_PATTERNFILEREADER_H_
#include "zypp/parser/yum/FileReaderBase.h"
@@ -70,4 +70,4 @@
} // ns parser
} // ns zypp
-#endif /*PATTERNFILEREADER_H_*/
+#endif /*ZYPP_PARSER_YUM_PATTERNFILEREADER_H_*/
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFi…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc Tue May 29 11:42:55 2007
@@ -6,73 +6,169 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
-#include <fstream>
+/** \file zypp/parser/yum/RepomdFileReader.cc
+ * Implementation of repomd.xml file reader.
+ */
#include "zypp/base/String.h"
#include "zypp/base/Logger.h"
-#include "zypp/parser/yum/RepomdFileReader.h"
+#include "zypp/Date.h"
+#include "zypp/CheckSum.h"
+#include "zypp/parser/xml/Reader.h"
+
+#include "zypp/parser/yum/RepomdFileReader.h"
using namespace std;
using namespace zypp::xml;
using zypp::source::yum::YUMResourceType;
-namespace zypp { namespace parser { namespace yum {
-
-RepomdFileReader::RepomdFileReader( const Pathname &repomd_file, ProcessResource callback )
- : _tag(tag_NONE), _type(YUMResourceType::NONE_e), _callback(callback)
-{
- Reader reader( repomd_file );
- MIL << "Reading " << repomd_file << endl;
- reader.foreachNode( bind( &RepomdFileReader::consumeNode, this, _1 ) );
-}
-
-bool RepomdFileReader::consumeNode( Reader & reader_r )
+namespace zypp
{
- //MIL << reader_r->name() << endl;
- std::string data_type;
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT )
+ namespace parser
{
- if ( reader_r->name() == "repomd" )
+ namespace yum
{
- _tag = tag_Repomd;
- return true;
- }
- if ( reader_r->name() == "data" )
- {
- _tag = tag_Data;
- _type = YUMResourceType(reader_r->getAttribute("type").asString());
- return true;
- }
- if ( reader_r->name() == "location" )
+
+
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : RepomdFileReader::Impl
+ //
+ class RepomdFileReader::Impl : private base::NonCopyable
+ {
+ public:
+
+ /**
+ * Enumeration of repomd.xml tags.
+ * \see _tag
+ */
+ enum Tag
{
- _tag = tag_Location;
- _location.filename( reader_r->getAttribute("href").asString() );
- return true;
- }
- if ( reader_r->name() == "checksum" )
+ tag_NONE,
+ tag_Repomd,
+ tag_Data,
+ tag_Location,
+ tag_CheckSum,
+ tag_Timestamp,
+ tag_OpenCheckSum
+ };
+
+ public:
+ /**
+ * CTOR
+ *
+ * \see RepomdFileReader::RepomdFileReader(Pathname,ProcessResource)
+ */
+ Impl(const Pathname &repomd_file, const ProcessResource & callback);
+
+ /**
+ * Callback provided to the XML parser.
+ */
+ bool consumeNode( Reader & reader_r );
+
+
+ private:
+ /** Location of metadata file. */
+ OnMediaLocation _location;
+
+ /** Used to remember currently processed tag */
+ Tag _tag;
+
+ /** Type of metadata file. */
+ source::yum::YUMResourceType _type;
+
+ /** Function for processing collected data. Passed in through constructor. */
+ ProcessResource _callback;
+
+ /** Checksum of metadata file */
+ CheckSum _checksum;
+
+ /** Type of checksum of metadata file */
+ std::string _checksum_type;
+
+ /** Metadata file time-stamp. */
+ Date _timestamp;
+ };
+ ///////////////////////////////////////////////////////////////////////
+
+ RepomdFileReader::Impl::Impl(
+ const Pathname &repomd_file, const ProcessResource & callback)
+ :
+ _tag(tag_NONE), _type(YUMResourceType::NONE_e), _callback(callback)
+ {
+ Reader reader( repomd_file );
+ MIL << "Reading " << repomd_file << endl;
+ reader.foreachNode( bind( &RepomdFileReader::Impl::consumeNode, this, _1 ) );
+ }
+
+ // --------------------------------------------------------------------------
+
+ bool RepomdFileReader::Impl::consumeNode( Reader & reader_r )
+ {
+ //MIL << reader_r->name() << endl;
+ std::string data_type;
+ if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT )
{
- _tag = tag_CheckSum;
- string checksum_type = reader_r->getAttribute("type").asString() ;
- string checksum_vaue = reader_r.nodeText().asString();
- _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
- return true;
+ if ( reader_r->name() == "repomd" )
+ {
+ _tag = tag_Repomd;
+ return true;
+ }
+ if ( reader_r->name() == "data" )
+ {
+ _tag = tag_Data;
+ _type = YUMResourceType(reader_r->getAttribute("type").asString());
+ return true;
+ }
+ if ( reader_r->name() == "location" )
+ {
+ _tag = tag_Location;
+ _location.filename( reader_r->getAttribute("href").asString() );
+ return true;
+ }
+ if ( reader_r->name() == "checksum" )
+ {
+ _tag = tag_CheckSum;
+ string checksum_type = reader_r->getAttribute("type").asString() ;
+ string checksum_vaue = reader_r.nodeText().asString();
+ _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
+ return true;
+ }
+ if ( reader_r->name() == "timestamp" )
+ {
+ // ignore it
+ return true;
+ }
}
- if ( reader_r->name() == "timestamp" )
+ else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
{
- // ignore it
+ //MIL << "end element" << endl;
+ if ( reader_r->name() == "data" )
+ _callback( _location, _type );
return true;
}
- }
- else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
- {
- //MIL << "end element" << endl;
- if ( reader_r->name() == "data" )
- _callback( _location, _type );
return true;
}
- return true;
-}
-} } } //ns zypp::source::yum
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : RepomdFileReader
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ RepomdFileReader::RepomdFileReader(
+ const Pathname & repomd_file, const ProcessResource & callback)
+ :
+ _pimpl(new Impl(repomd_file, callback))
+ {}
+
+ RepomdFileReader::~RepomdFileReader()
+ {}
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFi…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.h Tue May 29 11:42:55 2007
@@ -6,19 +6,18 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/RepomdFileReader.h
+ * Interface of repomd.xml file reader.
+ */
#ifndef zypp_source_yum_RepomdFileReader_H
#define zypp_source_yum_RepomdFileReader_H
-#include "zypp/Date.h"
-#include "zypp/CheckSum.h"
-#include "zypp/OnMediaLocation.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
#include "zypp/base/Function.h"
-#include "zypp/parser/xml/Reader.h"
-#include "zypp/source/yum/YUMResourceType.h"
-using namespace std;
-using namespace zypp::xml;
+#include "zypp/OnMediaLocation.h"
+#include "zypp/source/yum/YUMResourceType.h"
namespace zypp
{
@@ -26,64 +25,59 @@
{
namespace yum
{
+
+
+ /**
+ * Reads through a repomd.xml file and collects type, location, checksum and
+ * other data about metadata files to be processed.
+ *
+ * After each package is read, a \ref OnMediaLocation
+ * and \ref source::yum::YUMResourceType is prepared and \ref _callback
+ * is called with these two objects passed in.
+ *
+ * The \ref _callback is provided on construction.
+ *
+ *
+ * \code
+ * RepomdFileReader reader(repomd_file,
+ * bind( &SomeClass::callbackfunc, &SomeClassInstance, _1, _2 ) );
+ * \endcode
+ */
+ class RepomdFileReader
+ {
+ public:
+ /**
+ * Callback definition.
+ * First parameter is a \ref OnMediaLocation object with the resource
+ * second parameter is the resource type.
+ */
+ typedef function< bool(
+ const OnMediaLocation &,
+ const source::yum::YUMResourceType &)>
+ ProcessResource;
+
+ /**
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
+ * \param repomd_file is the repomd.xml file you want to read
+ * \param callback is a function.
+ *
+ * \see RepomdFileReader::ProcessResource
+ */
+ RepomdFileReader(
+ const Pathname & repomd_file, const ProcessResource & callback);
- /**
- * Iterates through a repomd.xml file giving on each iteration
- * a \ref OnMediaLocation object with the resource and its
- * type ( primary, patches, filelists, etc ).
- * The iteration is done via a callback provided on
- * construction.
- *
- * \code
- * RepomdFileReader reader(repomd_file,
- * bind( &SomeClass::callbackfunc, &object, _1, _2 ) );
- * \endcode
- */
- class RepomdFileReader
- {
- public:
- /**
- * Callback definition
- * first parameter is a \ref OnMediaLocation object with the resource
- * second parameter is the resource type
- */
- typedef function< bool(
- const OnMediaLocation &,
- const source::yum::YUMResourceType & )>
- ProcessResource;
-
- enum Tag
- {
- tag_NONE,
- tag_Repomd,
- tag_Data,
- tag_Location,
- tag_CheckSum,
- tag_Timestamp,
- tag_OpenCheckSum
- };
-
- /**
- * Constructor
- * \param repomd_file is the repomd.xml file you want to read
- * \param callback is a function. \see RepomdFileReader::ProcessResource
- */
- RepomdFileReader( const Pathname &repomd_file, ProcessResource callback );
-
- /**
- * Callback provided to the XML parser. Don't use it.
- */
- bool consumeNode( Reader & reader_r );
-
- private:
- OnMediaLocation _location;
- Tag _tag;
- source::yum::YUMResourceType _type;
- ProcessResource _callback;
- CheckSum _checksum;
- std::string _checksum_type;
- Date _timestamp;
- };
+ /**
+ * DTOR
+ */
+ ~RepomdFileReader();
+
+ private:
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
+ };
+
+
}
}
}
--
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] r5636 - in /trunk/libzypp: devel/devel.jkupec/ devel/devel.jkupec/bridge/ devel/devel.jkupec/yum/ zypp/ zypp/parser/yum/ zypp2/parser/yum/
by jkupec@svn.opensuse.org 28 May '07
by jkupec@svn.opensuse.org 28 May '07
28 May '07
Author: jkupec
Date: Mon May 28 16:17:38 2007
New Revision: 5636
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5636&view=rev
Log:
Hiding YUMParser implementation.
Added:
trunk/libzypp/devel/devel.jkupec/bridge/
trunk/libzypp/devel/devel.jkupec/bridge/Base.h
trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.cc
trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.h
trunk/libzypp/devel/devel.jkupec/bridge/Derived.cc
trunk/libzypp/devel/devel.jkupec/bridge/Derived.h
trunk/libzypp/devel/devel.jkupec/bridge/bridge.cc
trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h
Removed:
trunk/libzypp/zypp/parser/yum/FileReaderBase.cc
Modified:
trunk/libzypp/devel/devel.jkupec/CMakeLists.txt
trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc
trunk/libzypp/devel/devel.jkupec/yum/products-example.xml
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/parser/yum/FileReaderBase.h
trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
trunk/libzypp/zypp/parser/yum/PatchFileReader.h
trunk/libzypp/zypp/parser/yum/PatternFileReader.cc
trunk/libzypp/zypp/parser/yum/PatternFileReader.h
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h
trunk/libzypp/zypp/parser/yum/ProductFileReader.cc
trunk/libzypp/zypp/parser/yum/ProductFileReader.h
trunk/libzypp/zypp2/parser/yum/YUMParser.cc
trunk/libzypp/zypp2/parser/yum/YUMParser.h
Modified: trunk/libzypp/devel/devel.jkupec/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/CMake…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.jkupec/CMakeLists.txt Mon May 28 16:17:38 2007
@@ -5,5 +5,23 @@
#ADD_EXECUTABLE(sourcedownload sourcedownload.cc)
#TARGET_LINK_LIBRARIES(sourcedownload zypp zypp2)
+
+
+SET( bridge_SRCS
+ bridge/bridge.cc
+ bridge/BaseImpl.cc
+ bridge/Derived.cc
+)
+
+SET( bridge_HEADERS
+ bridge/Base.h
+ bridge/BaseImpl.h
+ bridge/Derived.h
+)
+
ADD_EXECUTABLE( yumparsertest YUMParser_test.cc )
TARGET_LINK_LIBRARIES(yumparsertest zypp zypp2)
+
+ADD_EXECUTABLE( bridge ${bridge_SRCS} )
+TARGET_LINK_LIBRARIES( bridge zypp zypp2)
+
Modified: trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMPa…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc (original)
+++ trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc Mon May 28 16:17:38 2007
@@ -6,7 +6,6 @@
#include "zypp2/cache/CacheStore.h"
#include "zypp2/parser/yum/YUMParser.h"
-
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "yumparsertest"
@@ -47,7 +46,8 @@
Measure parse_primary_timer("primary.xml.gz parsing");
parser::yum::YUMParser parser( repository_id, store, &progress_function);
- parser.start(argv[1]);
+ parser.parse(argv[1]);
+
store.commit();
parse_primary_timer.stop();
Added: trunk/libzypp/devel/devel.jkupec/bridge/Base.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/bridg…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/bridge/Base.h (added)
+++ trunk/libzypp/devel/devel.jkupec/bridge/Base.h Mon May 28 16:17:38 2007
@@ -0,0 +1,23 @@
+#ifndef JK_BASE_H_
+#define JK_BASE_H_
+
+#include "zypp/base/NonCopyable.h"
+
+namespace jk
+{
+
+
+ class Base : private zypp::base::NonCopyable
+ {
+ protected:
+ class BaseImpl;
+ };
+
+
+} // ns jk
+
+
+#endif /*JK_BASE_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
+
Added: trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/bridg…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.cc (added)
+++ trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.cc Mon May 28 16:17:38 2007
@@ -0,0 +1,16 @@
+#include "BaseImpl.h"
+
+using namespace std;
+
+namespace jk
+{
+
+
+ Base::BaseImpl::BaseImpl()
+ {}
+
+
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
+
Added: trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/bridg…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.h (added)
+++ trunk/libzypp/devel/devel.jkupec/bridge/BaseImpl.h Mon May 28 16:17:38 2007
@@ -0,0 +1,23 @@
+#ifndef JK_BASEIMPL_H_
+#define JK_BASEIMPL_H_
+
+#include "zypp/base/NonCopyable.h"
+#include "Base.h"
+
+namespace jk
+{
+
+
+ class Base::BaseImpl : private zypp::base::NonCopyable
+ {
+ public:
+ BaseImpl();
+ };
+
+
+} // ns jk
+
+#endif /*JK_BASEIMPL_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
+
Added: trunk/libzypp/devel/devel.jkupec/bridge/Derived.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/bridg…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/bridge/Derived.cc (added)
+++ trunk/libzypp/devel/devel.jkupec/bridge/Derived.cc Mon May 28 16:17:38 2007
@@ -0,0 +1,28 @@
+#include "BaseImpl.h"
+#include "Derived.h"
+
+namespace jk
+{
+
+
+ class Derived::Impl : public BaseImpl
+ {
+ public:
+ Impl();
+ };
+
+ Derived::Impl::Impl()
+ {}
+
+
+ Derived::Derived() : _pimpl(new Impl())
+ {}
+
+ Derived::~Derived()
+ {}
+
+
+} // ns jk
+
+// vim: set ts=2 sts=2 sw=2 et ai:
+
Added: trunk/libzypp/devel/devel.jkupec/bridge/Derived.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/bridg…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/bridge/Derived.h (added)
+++ trunk/libzypp/devel/devel.jkupec/bridge/Derived.h Mon May 28 16:17:38 2007
@@ -0,0 +1,26 @@
+#ifndef JK_DERIVED_H_
+#define JK_DERIVED_H_
+
+#include "zypp/base/PtrTypes.h"
+#include "Base.h"
+
+namespace jk
+{
+
+
+ class Derived : public Base
+ {
+ public:
+ Derived();
+ ~Derived();
+
+ private:
+ class Impl;
+ zypp::RW_pointer<Impl,zypp::rw_pointer::Scoped<Impl> > _pimpl;
+ };
+
+
+
+} // ns jk
+
+#endif /*JK_DERIVED_H_*/
Added: trunk/libzypp/devel/devel.jkupec/bridge/bridge.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/bridg…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/bridge/bridge.cc (added)
+++ trunk/libzypp/devel/devel.jkupec/bridge/bridge.cc Mon May 28 16:17:38 2007
@@ -0,0 +1,26 @@
+#include<iostream>
+
+#include "zypp/base/Exception.h"
+
+#include "Derived.h"
+
+
+using namespace std;
+using namespace jk;
+using namespace zypp;
+
+int main(int argc, char **argv)
+{
+ try
+ {
+ Derived d;
+ }
+ 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/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 (original)
+++ trunk/libzypp/devel/devel.jkupec/yum/products-example.xml Mon May 28 16:17:38 2007
@@ -12,7 +12,7 @@
<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="ackage" 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>
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 Mon May 28 16:17:38 2007
@@ -552,7 +552,7 @@
parser/yum/YUMPrimaryParser.cc
parser/yum/YUMProductParser.cc
parser/yum/YUMRepomdParser.cc
- parser/yum/FileReaderBase.cc
+ parser/yum/FileReaderBaseImpl.cc
parser/yum/RepomdFileReader.cc
parser/yum/PatchesFileReader.cc
parser/yum/PrimaryFileReader.cc
@@ -576,6 +576,7 @@
parser/yum/YUMProductParser.h
parser/yum/YUMRepomdParser.h
parser/yum/FileReaderBase.h
+ parser/yum/FileReaderBaseImpl.h
parser/yum/RepomdFileReader.h
parser/yum/PatchesFileReader.h
parser/yum/PrimaryFileReader.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 Mon May 28 16:17:38 2007
@@ -6,14 +6,14 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/FileReaderBase.h
+ *
+ */
#ifndef ZYPP_PARSER_YUM_FILEREADERBASE_H_
#define ZYPP_PARSER_YUM_FILEREADERBASE_H_
+#include "zypp/base/PtrTypes.h"
#include "zypp/base/NonCopyable.h"
-#include "zypp/parser/xml/Reader.h"
-#include "zypp/data/ResolvableData.h"
-
namespace zypp
{
@@ -24,130 +24,14 @@
/**
- * Class implementing parsing methods for common metadata.
+ * Base for yum::*FileReaders. Implements parsing methods for common metadata.
*/
class FileReaderBase : private base::NonCopyable
{
- public:
-
- /**
- * Enumeration of some YUM metadata xml tags.
- */
- enum Tag
- {
- tag_NONE,
- tag_package,
- tag_format,
- tag_patch,
- tag_atoms,
- tag_script,
- tag_message,
- tag_pkgfiles,
- tag_deltarpm,
- tag_patchrpm,
- tag_pattern,
- tag_product
- };
-
- /**
- * Lightweight object for remembering currently processed tag.
- *
- * Usage:
- *
- * - call \ref append() on opening tag
- * - use \ref contains() to check if the given tag is being processed
- * - call \ref remove() on closing tag
- *
- * \note the above works only if the path elements are unique. To support
- * also non-unique elements, an equals() method will need to be implemented
- * and used instead of \ref contains().
- *
- * \note tags you want to use with TagPath must be enumerated in \ref Tag
- * enum.
- */
- struct TagPath
- {
- typedef std::list<Tag> TagList;
-
- void append(const Tag tag) { path.push_back(tag); }
- void remove() { if (!path.empty()) path.pop_back(); }
- unsigned depth() const { return path.size(); }
- Tag currentTag() const
- {
- if (!path.empty()) return path.back();
- return tag_NONE;
- }
- bool contains(const Tag tag) const
- {
- TagList::const_iterator result = find(path.begin(), path.end(), tag);
- return result != path.end();
- }
-
- TagList path;
- };
-
- public:
-
- FileReaderBase();
-
- /**
- * Process package node and its subtree.
- * This method can be extended for specific implementations.
- *
- * \return true if the package node or current subnode has been consumed
- * (no further processing is required), false otherwise.
- */
- bool consumePackageNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr);
-
- /**
- * Function for processing all <code>format</code> tag subtree nodes.
- *
- * \return true if the package node or current subnode has been consumed
- * (no further processing is required), false otherwise.
- */
- bool consumeFormatNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr);
-
- /**
- * Processes RPM dependency tags (rpm:entry, rpm:requires, ...).
- *
- * \return true if a dependency tag has been encountered, false otherwise.
- */
- bool consumeDependency(xml::Reader & reader_r, data::Dependencies & deps_r);
-
-
- public:
- /** Appends \a tag to \ref _tagpath. */
- void tag(const Tag tag) { _tagpath.append(tag); }
-
- /** Check whether we are currently processing given \a tag. */
- bool isBeingProcessed(Tag tag) const { return _tagpath.contains(tag); }
-
- /** Move to parent tag in the \ref _tagpath. */
- void toParentTag() { _tagpath.remove(); }
-
- const TagPath & tagPath() const { return _tagpath; }
-
-
- private:
-
- /** Used to remember the tag beeing currently processed. */
- TagPath _tagpath;
-
- /**
- * Used to remember whether we are expecting an rpm:entry tag
- * e.g. for rpm:requires
- */
- bool _expect_rpm_entry;
-
- /**
- * Type of dependecy beeing processed.
- */
- Dep _dtype;
+ protected:
+ class BaseImpl;
};
- /** \relates FileReaderBase::TagPath */
- std::ostream & operator << (std::ostream & out, const FileReaderBase::TagPath & obj);
-
} // ns yum
} // ns parser
@@ -155,3 +39,5 @@
#endif /*ZYPP_PARSER_YUM_FILEREADERBASE_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileRead…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc (added)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.cc Mon May 28 16:17:38 2007
@@ -0,0 +1,372 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/yum/FileReaderBaseImpl.cc
+ * Implementation of shared code for yum::*FileReaders.
+ */
+//#include <iostream>
+#include <sstream>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Function.h"
+#include "zypp/Arch.h"
+#include "zypp/Edition.h"
+#include "zypp/TranslatedText.h"
+#include "zypp/ByteCount.h"
+
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
+
+using namespace std;
+using namespace zypp::xml;
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ FileReaderBase::BaseImpl::BaseImpl()
+ : _expect_rpm_entry(false), _dtype(zypp::Dep::REQUIRES)
+ {}
+
+ // --------------------------------------------------------------------------
+
+ bool FileReaderBase::BaseImpl::consumePackageNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr)
+ {
+ //DBG << "**node: " << reader_r->name() << " (" << reader_r->nodeType() << ") tagpath = " << _tagpath << endl;
+ if (isBeingProcessed(tag_format) && consumeFormatNode(reader_r, package_ptr))
+ return true;
+
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ if (reader_r->name() == "name")
+ {
+ package_ptr->name = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "arch")
+ {
+ //if (arch == "src" || arch == "nosrc") arch = "noarch";
+ package_ptr->arch = Arch(reader_r.nodeText().asString());
+ return true;
+ }
+
+ if (reader_r->name() == "version")
+ {
+ package_ptr->edition = Edition(reader_r->getAttribute("ver").asString(),
+ reader_r->getAttribute("rel").asString(),
+ reader_r->getAttribute("epoch").asString());
+ return true;
+ }
+
+ if (reader_r->name() == "checksum")
+ {
+ package_ptr->repositoryLocation.fileChecksum = CheckSum(
+ reader_r->getAttribute("type").asString(),
+ reader_r.nodeText().asString());
+ // ignoring pkgid attribute
+ return true;
+ }
+
+ if (reader_r->name() == "summary")
+ {
+ package_ptr->summary.setText(
+ reader_r.nodeText().asString(),
+ Locale(reader_r->getAttribute("lang").asString()));
+ return true;
+ }
+
+ if (reader_r->name() == "description")
+ {
+ package_ptr->description.setText(
+ reader_r.nodeText().asString(),
+ Locale(reader_r->getAttribute("lang").asString()));
+ return true;
+ }
+
+ if (reader_r->name() == "packager")
+ {
+ package_ptr->packager = reader_r.nodeText().asString();
+// DBG << "packager: " << package_ptr->packager << endl;
+ return true;
+ }
+
+ if (reader_r->name() == "url")
+ {
+// DBG << "url: " << reader_r.nodeText().asString() << endl;
+ package_ptr->url = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "time")
+ {
+ package_ptr->buildTime = reader_r->getAttribute("build").asString();
+ // ignoring reader_r->getAttribute("file").asString(); (rpm file timestamp)
+ return true;
+ }
+
+ if (reader_r->name() == "size")
+ {
+ // ???
+ // reader_r->getAttribute("archive").asString();
+
+ // installed size
+ package_ptr->installedSize = str::strtonum<ByteCount::SizeType>( reader_r->getAttribute("installed").asString() );
+
+ // rpm package size
+ package_ptr->repositoryLocation.fileSize = str::strtonum<ByteCount::SizeType>( reader_r->getAttribute("package").asString() );
+
+ return true;
+ }
+
+ if (reader_r->name() == "location")
+ {
+ package_ptr->repositoryLocation.filePath = reader_r->getAttribute("href").asString();
+ return true;
+ }
+
+ if (reader_r->name() == "format")
+ {
+ tag(tag_format);
+ return true;
+ }
+ }
+
+ else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
+ {
+ if (reader_r->name() == "package")
+ {
+ // indicate that further processing is required
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+ // --------------( consume <format> tag )------------------------------------
+
+ bool FileReaderBase::BaseImpl::consumeFormatNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr)
+ {
+ if (consumeDependency(reader_r, package_ptr->deps))
+ // this node has been a dependency, which has been handled by
+ // consumeDependency(), so return right away.
+ return true;
+
+// DBG << "format subtag: " << reader_r->name() << endl;
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ if (reader_r->name() == "rpm:license")
+ {
+ package_ptr->license = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:vendor")
+ {
+ package_ptr->vendor = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:group")
+ {
+ package_ptr->group = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:buildhost")
+ {
+ package_ptr->buildhost = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:sourcerpm")
+ {
+ //package->source = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:header-range")
+ {
+ //reader_r->getAttribute("start").asString(),
+ //reader_r->getAttribute("end").asString(),
+ return true;
+ }
+
+ if (reader_r->name() == "file")
+ {
+ // TODO figure out how to read files
+ // file = reader_r.nodeText().asString();
+ // type = reader_r->getAttribute("type").asString();
+ return true;
+ }
+ }
+ else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
+ {
+ if (reader_r->name() == "format")
+ {
+ toParentTag();
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ // --------------------------------------------------------------------------
+
+ bool FileReaderBase::BaseImpl::consumeDependency(xml::Reader & reader_r, data::Dependencies & deps_r)
+ {
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ if (reader_r->name() == "rpm:entry")
+ {
+ if (!_expect_rpm_entry)
+ {
+ // TODO make this a ParseException (once created/taken out of tagfile ns?)
+ ZYPP_THROW(Exception("rpm:entry found when not expected"));
+ }
+
+ Edition edition(
+ reader_r->getAttribute("ver").asString(),
+ 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 << " (" << kind << ")" << endl;
+*/
+ deps_r[_dtype].insert(
+ zypp::capability::parse(
+ kind,
+ reader_r->getAttribute("name").asString(),
+ Rel(reader_r->getAttribute("flags").asString()),
+ edition
+ )
+ );
+ }
+
+ if (reader_r->name() == "rpm:provides")
+ {
+ _dtype = zypp::Dep::PROVIDES;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:conflicts")
+ {
+ _dtype = zypp::Dep::CONFLICTS;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:obsoletes")
+ {
+ _dtype = zypp::Dep::OBSOLETES;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:requires")
+ {
+ _dtype = zypp::Dep::REQUIRES;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:recommends")
+ {
+ _dtype = zypp::Dep::RECOMMENDS;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:enhances")
+ {
+ _dtype = zypp::Dep::ENHANCES;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:supplements")
+ {
+ _dtype = zypp::Dep::SUPPLEMENTS;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:suggests")
+ {
+ _dtype = zypp::Dep::SUGGESTS;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ if (reader_r->name() == "rpm:suggests")
+ {
+ _dtype = zypp::Dep::SUGGESTS;
+ _expect_rpm_entry = true;
+ return true;
+ }
+ }
+ else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
+ {
+ if (reader_r->name() == "rpm:requires"
+ || reader_r->name() == "rpm:provides"
+ || reader_r->name() == "rpm:conflicts"
+ || reader_r->name() == "rpm:obsoletes"
+ || reader_r->name() == "rpm:recommends"
+ || reader_r->name() == "rpm:enhances"
+ || reader_r->name() == "rpm:supplements"
+ || reader_r->name() == "rpm:suggests")
+ {
+ _expect_rpm_entry = false;
+ return true;
+ }
+ }
+
+ // tell the caller this has not been a dependency tag (i.e. not processed)
+ return false;
+ }
+
+ // --------------------------------------------------------------------------
+
+ string FileReaderBase::BaseImpl::TagPath::asString()
+ {
+ ostringstream s;
+
+ s << "(";
+
+ if (depth())
+ {
+ TagList::const_iterator p = path.begin();
+ s << *p;
+ ++p;
+
+ for (; p != path.end(); ++p)
+ s << "," << *p;
+ }
+ else
+ s << "empty";
+
+ s << ")";
+
+ return s.str();
+ }
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/FileRead…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h (added)
+++ trunk/libzypp/zypp/parser/yum/FileReaderBaseImpl.h Mon May 28 16:17:38 2007
@@ -0,0 +1,156 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/yum/FileReaderBaseImpl.h
+ * Implementation interface of shared code for yum::*FileReaders.
+ */
+#ifndef ZYPP_PARSER_YUM_FILEREADERBASEIMPL_H_
+#define ZYPP_PARSER_YUM_FILEREADERBASEIMPL_H_
+
+#include "zypp/data/ResolvableData.h"
+#include "zypp/parser/xml/Reader.h"
+
+#include "zypp/parser/yum/FileReaderBase.h"
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ class FileReaderBase::BaseImpl : private base::NonCopyable
+ {
+ public:
+
+ /**
+ * Enumeration of some YUM metadata xml tags.
+ */
+ enum Tag
+ {
+ tag_NONE,
+ tag_package,
+ tag_format,
+ tag_patch,
+ tag_atoms,
+ tag_script,
+ tag_message,
+ tag_pkgfiles,
+ tag_deltarpm,
+ tag_patchrpm,
+ tag_pattern,
+ tag_product
+ };
+
+ /**
+ * Lightweight object for remembering currently processed tag.
+ *
+ * Usage:
+ *
+ * - call \ref append() on opening tag
+ * - use \ref contains() to check if the given tag is being processed
+ * - call \ref remove() on closing tag
+ *
+ * \note the above works only if the path elements are unique. To support
+ * also non-unique elements, an equals() method will need to be implemented
+ * and used instead of \ref contains().
+ *
+ * \note tags you want to use with TagPath must be enumerated in \ref Tag
+ * enum.
+ */
+ struct TagPath
+ {
+ typedef std::list<Tag> TagList;
+
+ void append(const Tag tag) { path.push_back(tag); }
+ void remove() { if (!path.empty()) path.pop_back(); }
+ unsigned depth() const { return path.size(); }
+ Tag currentTag() const
+ {
+ if (!path.empty()) return path.back();
+ return tag_NONE;
+ }
+ bool contains(const Tag tag) const
+ {
+ TagList::const_iterator result = find(path.begin(), path.end(), tag);
+ return result != path.end();
+ }
+ std::string asString();
+
+ TagList path;
+ };
+
+
+ public:
+ /** CTOR */
+ BaseImpl();
+
+ /**
+ * Process package node and its subtree.
+ * This method can be extended for specific implementations.
+ *
+ * \return true if the package node or current subnode has been consumed
+ * (no further processing is required), false otherwise.
+ */
+ bool consumePackageNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr);
+
+ /**
+ * Function for processing all <code>format</code> tag subtree nodes.
+ *
+ * \return true if the package node or current subnode has been consumed
+ * (no further processing is required), false otherwise.
+ */
+ bool consumeFormatNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr);
+
+ /**
+ * Processes RPM dependency tags (rpm:entry, rpm:requires, ...).
+ *
+ * \return true if a dependency tag has been encountered, false otherwise.
+ */
+ bool consumeDependency(xml::Reader & reader_r, data::Dependencies & deps_r);
+
+
+ public:
+ /** Appends \a tag to \ref _tagpath. */
+ void tag(const Tag tag) { _tagpath.append(tag); }
+
+ /** Check whether we are currently processing given \a tag. */
+ bool isBeingProcessed(Tag tag) const { return _tagpath.contains(tag); }
+
+ /** Move to parent tag in the \ref _tagpath. */
+ void toParentTag() { _tagpath.remove(); }
+
+ /** Getter of the tagpath object. */
+ const TagPath & tagPath() const { return _tagpath; }
+
+
+ private:
+ /** Used to remember the tag beeing currently processed. */
+ TagPath _tagpath;
+
+ /**
+ * Used to remember whether we are expecting an rpm:entry tag
+ * e.g. for rpm:requires
+ */
+ bool _expect_rpm_entry;
+
+ /**
+ * Type of dependecy beeing processed.
+ */
+ Dep _dtype;
+ };
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+#endif /*ZYPP_PARSER_YUM_FILEREADERBASEIMPL_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
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 Mon May 28 16:17:38 2007
@@ -6,9 +6,16 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PatchFileReader.cc
+ * Implementation of patch XML file reader.
+ */
#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/data/ResolvableData.h"
+
#include "zypp/parser/yum/PatchFileReader.h"
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
+
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
@@ -24,12 +31,139 @@
{
- PatchFileReader::PatchFileReader(const Pathname & patch_file, ProcessPatch callback)
- : _callback(callback)
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatchFileReader::Impl
+ //
+ class PatchFileReader::Impl : public BaseImpl
+ {
+ public:
+ /** CTOR */
+ Impl(const Pathname & patch_file,
+ const ProcessPatch & callback);
+
+ /**
+ * 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);
+
+ /**
+ * Process <tt>atoms</tt> node and all of its children.
+ *
+ * \param reader_r XML file reader reading the patch file.
+ * \return true if current node has been completely processed, false
+ * if additional processing is required outside of the method.
+ */
+ bool consumeAtomsNode(xml::Reader & reader_r);
+
+ /**
+ * Process <tt>package</tt> node and all of its children. This method
+ * uses \ref FileReaderBase::consumePackageNode(xml::Reader,data::Package_Ptr)
+ * method and adds <tt>pkgfiles</tt> element processing.
+ *
+ * \param reader_r XML file reader reading the patch file.
+ * \return true if current node has been completely processed, false
+ * if additional processing is required outside of the method.
+ */
+ bool consumePackageNode(xml::Reader & reader_r);
+
+ /**
+ * Process <tt>patchrpm</tt> node and all of its children.
+ *
+ * \param reader_r XML file reader reading the patch file.
+ * \return true if current node has been completely processed, false
+ * if additional processing is required outside of the method.
+ */
+ bool consumePatchrpmNode(xml::Reader & reader_r);
+
+ /**
+ * Process <tt>deltarpm</tt> node and all of its children.
+ *
+ * \param reader_r XML file reader reading the patch file.
+ * \return true if current node has been completely processed, false
+ * if additional processing is required outside of the method.
+ */
+ bool consumeDeltarpmNode(xml::Reader & reader_r);
+
+ /**
+ * Process <tt>message</tt> node and all of its children.
+ *
+ * \param reader_r XML file reader reading the patch file.
+ * \return true if current node has been completely processed, false
+ * if additional processing is required outside of the method.
+ */
+ bool consumeMessageNode(xml::Reader & reader_r);
+
+ /**
+ * Process <tt>script</tt> node and all of its children.
+ *
+ * \param reader_r XML file reader reading the patch file.
+ * \return true if current node has been completely processed, false
+ * if additional processing is required outside of the method.
+ */
+ bool consumeScriptNode(xml::Reader & reader_r);
+
+ /**
+ * Creates a new \ref data::Patch_Ptr, swaps its contents with \ref _patch
+ * and returns it. Used to hand-out the data object to its consumer
+ * (a \ref ProcessPatch function) after it has been read.
+ */
+ data::Patch_Ptr handoutPatch();
+
+ /**
+ * Creates a new \ref data::ResObject_Ptr, swap its contents with
+ * \ref _tmpResObj and inserts it into <tt>_patch.atoms</tt>. Used
+ * after an atom is read.
+ */
+ void saveAtomInPatch();
+
+ /**
+ *
+ */
+ void copyPackageAtomFromTmpObj(data::Atom_Ptr & atom_ptr) const;
+
+ private:
+ /**
+ * Callback for processing patch metadata passed in through constructor.
+ */
+ ProcessPatch _callback;
+
+ /**
+ * Pointer to the \ref zypp::data::Patch object for storing the patch
+ * metada (except of depencencies).
+ */
+ data::Patch_Ptr _patch;
+
+ /**
+ * Pointer to an atom currently being read. This can be either
+ * a \ref data::PackageAtom, \ref data::Message, or \ref data::Script.
+ *
+ * \see data::Patch::atoms
+ */
+ data::ResObject_Ptr _tmpResObj;
+
+ /** Data object for storing patchrpm data */
+ data::PatchRpm_Ptr _patchrpm;
+
+ /** Data object for storing deltarpm data */
+ data::DeltaRpm_Ptr _deltarpm;
+ };
+ ///////////////////////////////////////////////////////////////////////////
+
+ PatchFileReader::Impl::Impl(
+ const Pathname & patch_file,
+ const ProcessPatch & callback)
+ :
+ _callback(callback)
{
Reader reader(patch_file);
MIL << "Reading " << patch_file << endl;
- reader.foreachNode(bind(&PatchFileReader::consumeNode, this, _1));
+ reader.foreachNode(bind(&PatchFileReader::Impl::consumeNode, this, _1));
}
// --------------------------------------------------------------------------
@@ -45,7 +179,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumeNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumeNode(Reader & reader_r)
{
if (isBeingProcessed(tag_atoms) && consumeAtomsNode(reader_r))
return true;
@@ -170,7 +304,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumeAtomsNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumeAtomsNode(Reader & reader_r)
{
// consumePackageNode
if (isBeingProcessed(tag_package) && consumePackageNode(reader_r))
@@ -265,7 +399,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumePackageNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumePackageNode(Reader & reader_r)
{
if (isBeingProcessed(tag_patchrpm) && consumePatchrpmNode(reader_r))
return true;
@@ -357,7 +491,7 @@
{
// xpath: /patch/atoms/package/* (except pkgfiles/* and license-to-confirm) (*)
if (isBeingProcessed(tag_package))
- return FileReaderBase::consumePackageNode(reader_r, package_ptr);
+ return FileReaderBase::BaseImpl::consumePackageNode(reader_r, package_ptr);
}
else
{
@@ -369,7 +503,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumePatchrpmNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumePatchrpmNode(Reader & reader_r)
{
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
@@ -445,7 +579,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumeDeltarpmNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumeDeltarpmNode(Reader & reader_r)
{
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
@@ -529,7 +663,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumeMessageNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumeMessageNode(Reader & reader_r)
{
if (consumeDependency(reader_r, _tmpResObj->deps))
return true;
@@ -578,7 +712,7 @@
// --------------------------------------------------------------------------
- bool PatchFileReader::consumeScriptNode(Reader & reader_r)
+ bool PatchFileReader::Impl::consumeScriptNode(Reader & reader_r)
{
if (consumeDependency(reader_r, _tmpResObj->deps))
return true;
@@ -677,7 +811,7 @@
// --------------------------------------------------------------------------
- data::Patch_Ptr PatchFileReader::handoutPatch()
+ data::Patch_Ptr PatchFileReader::Impl::handoutPatch()
{
data::Patch_Ptr ret;
ret.swap(_patch);
@@ -686,7 +820,7 @@
// --------------------------------------------------------------------------
- void PatchFileReader::saveAtomInPatch()
+ void PatchFileReader::Impl::saveAtomInPatch()
{
data::ResObject_Ptr tmp;
tmp.swap(_tmpResObj);
@@ -694,6 +828,20 @@
}
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatchFileReader::Impl
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ PatchFileReader::PatchFileReader(const Pathname & patch_file, ProcessPatch callback)
+ : _pimpl(new PatchFileReader::Impl(patch_file, callback))
+ {}
+
+ PatchFileReader::~PatchFileReader()
+ {}
+
+
} // ns yum
} // ns parser
} // ns zypp
Modified: trunk/libzypp/zypp/parser/yum/PatchFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/PatchFileReader.h Mon May 28 16:17:38 2007
@@ -6,17 +6,25 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PatchFileReader.h
+ * Interface definition of patch XML file reader.
+ */
#ifndef PATCHFILEREADER_H_
#define PATCHFILEREADER_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 data
+ {
+ class Patch;
+ DEFINE_PTR_TYPE(Patch);
+ } // ns data
+
+
namespace parser
{
namespace yum
@@ -24,8 +32,8 @@
/**
- * Reader of patch.xml files conforming to RNC/RNG definition located
- * in zypp/parser/yum/schema/patch.rn(c|g).
+ * Reader of patch.xml files conforming to schema definition located
+ * at zypp/parser/yum/schema/patch.rnc.
*
* \see zypp::data::Patch
* \see zypp::parser::xml::Reader
@@ -48,118 +56,14 @@
*/
PatchFileReader(const Pathname & patch_file, ProcessPatch 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);
-
- /**
- * Process <tt>atoms</tt> node and all of its children.
- *
- * \param reader_r XML file reader reading the patch file.
- * \return true if current node has been completely processed, false
- * if additional processing is required outside of the method.
- */
- bool consumeAtomsNode(xml::Reader & reader_r);
-
- /**
- * Process <tt>package</tt> node and all of its children. This method
- * uses \ref FileReaderBase::consumePackageNode(xml::Reader,data::Package_Ptr)
- * method and adds <tt>pkgfiles</tt> element processing.
- *
- * \param reader_r XML file reader reading the patch file.
- * \return true if current node has been completely processed, false
- * if additional processing is required outside of the method.
- */
- bool consumePackageNode(xml::Reader & reader_r);
-
- /**
- * Process <tt>patchrpm</tt> node and all of its children.
- *
- * \param reader_r XML file reader reading the patch file.
- * \return true if current node has been completely processed, false
- * if additional processing is required outside of the method.
- */
- bool consumePatchrpmNode(xml::Reader & reader_r);
-
- /**
- * Process <tt>deltarpm</tt> node and all of its children.
- *
- * \param reader_r XML file reader reading the patch file.
- * \return true if current node has been completely processed, false
- * if additional processing is required outside of the method.
- */
- bool consumeDeltarpmNode(xml::Reader & reader_r);
-
/**
- * Process <tt>message</tt> node and all of its children.
- *
- * \param reader_r XML file reader reading the patch file.
- * \return true if current node has been completely processed, false
- * if additional processing is required outside of the method.
+ * DTOR.
*/
- bool consumeMessageNode(xml::Reader & reader_r);
-
- /**
- * Process <tt>script</tt> node and all of its children.
- *
- * \param reader_r XML file reader reading the patch file.
- * \return true if current node has been completely processed, false
- * if additional processing is required outside of the method.
- */
- bool consumeScriptNode(xml::Reader & reader_r);
-
- /**
- * Creates a new \ref data::Patch_Ptr, swaps its contents with \ref _patch
- * and returns it. Used to hand-out the data object to its consumer
- * (a \ref ProcessPatch function) after it has been read.
- */
- data::Patch_Ptr handoutPatch();
-
- /**
- * Creates a new \ref data::ResObject_Ptr, swap its contents with
- * \ref _tmpResObj and inserts it into <tt>_patch.atoms</tt>. Used
- * after an atom is read.
- */
- void saveAtomInPatch();
-
- /**
- *
- */
- void copyPackageAtomFromTmpObj(data::Atom_Ptr & atom_ptr) const;
+ ~PatchFileReader();
private:
- /**
- * Callback for processing patch metadata passed in through constructor.
- */
- ProcessPatch _callback;
-
- /**
- * Pointer to the \ref zypp::data::Patch object for storing the patch
- * metada (except of depencencies).
- */
- data::Patch_Ptr _patch;
-
- /**
- * Pointer to an atom currently being read. This can be either
- * a \ref data::PackageAtom, \ref data::Message, or \ref data::Script.
- *
- * \see data::Patch::atoms
- */
- data::ResObject_Ptr _tmpResObj;
-
- /** Data object for storing patchrpm data */
- data::PatchRpm_Ptr _patchrpm;
-
- /** Data object for storing deltarpm data */
- data::DeltaRpm_Ptr _deltarpm;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
Modified: 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 (original)
+++ trunk/libzypp/zypp/parser/yum/PatternFileReader.cc Mon May 28 16:17:38 2007
@@ -6,8 +6,14 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PatternFileReader.cc
+ * Implementation of patterns.xml file reader.
+ */
#include "zypp/base/Logger.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/parser/xml/Reader.h"
+
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
#include "zypp/parser/yum/PatternFileReader.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
@@ -24,12 +30,56 @@
{
- PatternFileReader::PatternFileReader(const Pathname & pattern_file, ProcessPattern callback)
- : _callback(callback)
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatternFileReader::Impl
+ //
+ class PatternFileReader::Impl : public BaseImpl
+ {
+ public:
+ Impl(const Pathname & pattern_file,
+ const ProcessPattern & callback);
+
+ /**
+ * 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;
+ };
+ //////////////////////////////////////////////////////////////////////////
+
+ PatternFileReader::Impl::Impl(
+ const Pathname & pattern_file,
+ const ProcessPattern & callback)
+ :
+ _callback(callback)
{
Reader reader(pattern_file);
MIL << "Reading " << pattern_file << endl;
- reader.foreachNode(bind(&PatternFileReader::consumeNode, this, _1));
+ reader.foreachNode(bind(&PatternFileReader::Impl::consumeNode, this, _1));
}
// --------------------------------------------------------------------------
@@ -45,7 +95,7 @@
// --------------------------------------------------------------------------
- bool PatternFileReader::consumeNode(Reader & reader_r)
+ bool PatternFileReader::Impl::consumeNode(Reader & reader_r)
{
// dependency block nodes
if (consumeDependency(reader_r, _pattern->deps))
@@ -139,13 +189,27 @@
// --------------------------------------------------------------------------
- data::Pattern_Ptr PatternFileReader::handoutPattern()
+ data::Pattern_Ptr PatternFileReader::Impl::handoutPattern()
{
data::Pattern_Ptr ret;
ret.swap(_pattern);
return ret;
}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatternFileReader
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ PatternFileReader::PatternFileReader(const Pathname & pattern_file, ProcessPattern callback)
+ : _pimpl(new PatternFileReader::Impl(pattern_file, callback))
+ {}
+
+
+ PatternFileReader::~PatternFileReader()
+ {}
+
} // ns yum
} // ns parser
Modified: 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 (original)
+++ trunk/libzypp/zypp/parser/yum/PatternFileReader.h Mon May 28 16:17:38 2007
@@ -6,17 +6,24 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PatternFileReader.h
+ *
+ */
#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 data
+ {
+ class Pattern;
+ DEFINE_PTR_TYPE(Pattern);
+ } // ns data
+
+
namespace parser
{
namespace yum
@@ -24,8 +31,8 @@
/**
- * Reader of pattern.xml files conforming to RNC/RNG definition located
- * in zypp/parser/yum/schema/pattern.rn(c|g).
+ * Reader of patterns.xml file conforming to schema definition located
+ * at zypp/parser/yum/schema/patterns.rnc.
*
* \see zypp::data::Pattern
* \see zypp::parser::xml::Reader
@@ -47,37 +54,15 @@
* \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)
+ * DTOR.
*/
- 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();
+ ~PatternFileReader();
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;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc Mon May 28 16:17:38 2007
@@ -6,9 +6,15 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PrimaryFileReader.cc
+ * Implementation of primary.xml.gz file reader.
+ */
#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/data/ResolvableData.h"
+
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
#include "zypp/parser/yum/PrimaryFileReader.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
@@ -25,7 +31,63 @@
{
- PrimaryFileReader::PrimaryFileReader(
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PrimaryFileReader::Impl
+ //
+ class PrimaryFileReader::Impl : public BaseImpl
+ {
+ public:
+ /** CTOR */
+ Impl(const Pathname & primary_file,
+ const ProcessPackage & callback,
+ const ProgressData::ReceiverFnc & progress);
+
+ /**
+ * Callback provided to the XML reader.
+ *
+ * This is the main parsing method which gets envoked by the \ref xml::Reader
+ * to process each node, one at a time. It is responsible for parsing the
+ * node and calling all other consume* methods.
+ *
+ * \param the xml reader object reading the file
+ * \return true to tell the reader to continue, false to tell it to stop
+ *
+ * \note Semantics of this method's return value also differs from other
+ * consume* methods. While this method's return value tells the the
+ * xml reader to continue or stop, return value of the rest tells
+ * their callers if further
+ */
+ bool consumeNode(xml::Reader & reader_r);
+
+ private:
+ /**
+ * Creates a new \ref data::Package_Ptr, swaps its contents with \ref
+ * _package and returns it. Used to hand-out the data object to its consumer
+ * (a \ref ProcessPackage function) after it has been read.
+ */
+ data::Package_Ptr handoutPackage();
+
+ private:
+ /**
+ * Callback for processing package metadata passed in through constructor.
+ */
+ ProcessPackage _callback;
+
+ /**
+ * \ref zypp::data::Package object for storing the package metada
+ */
+ data::Package_Ptr _package;
+
+ /**
+ * Progress reporting object.
+ */
+ ProgressData _ticks;
+ };
+ ///////////////////////////////////////////////////////////////////////////
+
+
+ PrimaryFileReader::Impl::Impl(
const Pathname & primary_file,
const ProcessPackage & callback,
const ProgressData::ReceiverFnc & progress)
@@ -36,12 +98,12 @@
Reader reader(primary_file);
MIL << "Reading " << primary_file << endl;
- reader.foreachNode(bind( &PrimaryFileReader::consumeNode, this, _1 ));
+ reader.foreachNode(bind( &PrimaryFileReader::Impl::consumeNode, this, _1 ));
}
// --------------------------------------------------------------------------
- bool PrimaryFileReader::consumeNode(Reader & reader_r)
+ bool PrimaryFileReader::Impl::consumeNode(Reader & reader_r)
{
// DBG << "**node: " << reader_r->name() << " (" << reader_r->nodeType() << ")" << endl;
if (isBeingProcessed(tag_package) && consumePackageNode(reader_r, _package))
@@ -94,13 +156,30 @@
// --------------------------------------------------------------------------
- data::Package_Ptr PrimaryFileReader::handoutPackage()
+ data::Package_Ptr PrimaryFileReader::Impl::handoutPackage()
{
data::Package_Ptr ret;
ret.swap(_package);
return ret;
}
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PrimaryFileReader
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ PrimaryFileReader::PrimaryFileReader(
+ const Pathname & primary_file,
+ const ProcessPackage & callback,
+ const ProgressData::ReceiverFnc & progress)
+ : _pimpl(new PrimaryFileReader::Impl(primary_file, callback, progress))
+ {}
+
+
+ PrimaryFileReader::~PrimaryFileReader()
+ {}
+
} // ns yum
} // ns parser
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h Mon May 28 16:17:38 2007
@@ -6,26 +6,33 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PrimaryFileReader.h
+ * Interface definition of primary.xml.gz file reader.
+ */
#ifndef ZYPP_PARSER_YUM_PRIMARYFILEPARSER_H
#define ZYPP_PARSER_YUM_PRIMARYFILEPARSER_H
-#include "zypp/base/Function.h"
-#include "zypp/parser/xml/Reader.h"
-#include "zypp/parser/yum/FileReaderBase.h"
-#include "zypp/data/ResolvableData.h"
#include "zypp/ProgressData.h"
+#include "zypp/parser/yum/FileReaderBase.h"
namespace zypp
{
+
+ namespace data
+ {
+ class Package;
+ DEFINE_PTR_TYPE(Package);
+ } // ns data
+
+
namespace parser
{
namespace yum
{
/**
- * Reads through a primary.xml file and collects package data including
+ * Reads through a primary.xml.gz file and collects package data including
* dependencies.
*
* After a package is read, a \ref zypp::data::Package object is prepared
@@ -47,7 +54,8 @@
typedef function<bool(const data::Package_Ptr &)> ProcessPackage;
/**
- * Constructor
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
* \param primary_file the primary.xml.gz file you want to read
* \param callback function to process \ref _package data.
* \param progress progress reporting function
@@ -60,45 +68,13 @@
const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc());
/**
- * Callback provided to the XML reader.
- *
- * This is the main parsing method which gets envoked by the \ref xml::Reader
- * to process each node, one at a time. It is responsible for parsing the
- * node and calling all other consume* methods.
- *
- * \param the xml reader object reading the file
- * \return true to tell the reader to continue, false to tell it to stop
- *
- * \note Semantics of this method's return value also differs from other
- * consume* methods. While this method's return value tells the the
- * xml reader to continue or stop, return value of the rest tells
- * their callers if further
+ * DTOR.
*/
- bool consumeNode(xml::Reader & reader_r);
+ ~PrimaryFileReader();
private:
- /**
- * Creates a new \ref data::Package_Ptr, swaps its contents with \ref
- * _package and returns it. Used to hand-out the data object to its consumer
- * (a \ref ProcessPackage function) after it has been read.
- */
- data::Package_Ptr handoutPackage();
-
- private:
- /**
- * Callback for processing package metadata passed in through constructor.
- */
- ProcessPackage _callback;
-
- /**
- * \ref zypp::data::Package object for storing the package metada
- */
- data::Package_Ptr _package;
-
- /**
- * Progress reporting object.
- */
- ProgressData _ticks;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
Modified: 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 (original)
+++ trunk/libzypp/zypp/parser/yum/ProductFileReader.cc Mon May 28 16:17:38 2007
@@ -8,6 +8,10 @@
\---------------------------------------------------------------------*/
#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/data/ResolvableData.h"
+
+#include "zypp/parser/yum/FileReaderBaseImpl.h"
#include "zypp/parser/yum/ProductFileReader.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
@@ -24,12 +28,56 @@
{
- ProductFileReader::ProductFileReader(const Pathname & product_file, ProcessProduct callback)
- : _callback(callback)
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ProductFileReader::Impl
+ //
+ class ProductFileReader::Impl : public BaseImpl
{
- Reader reader(product_file);
- MIL << "Reading " << product_file << endl;
- reader.foreachNode(bind(&ProductFileReader::consumeNode, this, _1));
+ public:
+ Impl(const Pathname & products_file,
+ const ProcessProduct & callback);
+
+ /**
+ * 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;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ ProductFileReader::Impl::Impl(
+ const Pathname & products_file,
+ const ProcessProduct & callback)
+ :
+ _callback(callback)
+ {
+ Reader reader(products_file);
+ MIL << "Reading " << products_file << endl;
+ reader.foreachNode(bind(&ProductFileReader::Impl::consumeNode, this, _1));
}
// --------------------------------------------------------------------------
@@ -45,7 +93,7 @@
// --------------------------------------------------------------------------
- bool ProductFileReader::consumeNode(Reader & reader_r)
+ bool ProductFileReader::Impl::consumeNode(Reader & reader_r)
{
// dependency block nodes
if (_product && consumeDependency(reader_r, _product->deps))
@@ -128,13 +176,27 @@
// --------------------------------------------------------------------------
- data::Product_Ptr ProductFileReader::handoutProduct()
+ data::Product_Ptr ProductFileReader::Impl::handoutProduct()
{
data::Product_Ptr ret;
ret.swap(_product);
return ret;
}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ProductFileReader
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ProductFileReader::ProductFileReader(const Pathname & product_file, ProcessProduct callback)
+ : _pimpl(new ProductFileReader::Impl(product_file, callback))
+ {}
+
+
+ ProductFileReader::~ProductFileReader()
+ {}
+
} // ns yum
} // ns parser
Modified: 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 (original)
+++ trunk/libzypp/zypp/parser/yum/ProductFileReader.h Mon May 28 16:17:38 2007
@@ -10,13 +10,18 @@
#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 data
+ {
+ class Product;
+ DEFINE_PTR_TYPE(Product);
+ } // ns data
+
+
namespace parser
{
namespace yum
@@ -25,7 +30,7 @@
/**
* Reader of products.xml file conforming to RNC definition located
- * in zypp/parser/yum/schema/products.rnc
+ * at zypp/parser/yum/schema/products.rnc.
*
* \see zypp::data::Product
* \see zypp::parser::xml::Reader
@@ -47,37 +52,15 @@
* \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.
+ * DTOR.
*/
- data::Product_Ptr handoutProduct();
+ ~ProductFileReader();
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;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
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 Mon May 28 16:17:38 2007
@@ -6,10 +6,16 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp2/parser/yum/YUMParser.cc
+ * YUM parser implementation.
+ */
#include <iostream>
+
+#include "zypp/ZConfig.h"
#include "zypp/base/Logger.h"
+#include "zypp/source/yum/YUMResourceType.h"
+
#include "zypp/parser/yum/RepomdFileReader.h"
#include "zypp/parser/yum/PrimaryFileReader.h"
#include "zypp/parser/yum/PatchesFileReader.h"
@@ -25,6 +31,8 @@
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+using zypp::source::yum::YUMResourceType;
+
namespace zypp
{
namespace parser
@@ -32,7 +40,8 @@
namespace yum
{
- // TODO make this through ZYppCallbacks.h
+
+ /** \todo make this through ZYppCallbacks.h */
bool progress_function(ProgressData::value_type p)
{
std::cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
@@ -41,12 +50,140 @@
}
- YUMParser::YUMParser(
+ /**
+ * Structure encapsulating YUM parser data type and filename.
+ */
+ struct YUMParserJob
+ {
+ YUMParserJob(const Pathname & filename, const YUMResourceType & type)
+ : _filename(filename), _type(type) {}
+
+ const Pathname & filename() const { return _filename; }
+ const YUMResourceType & type() const { return _type; }
+
+ private:
+ /** File to be processed */
+ Pathname _filename;
+ /** Type of YUM file */
+ YUMResourceType _type;
+ };
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : YUMParser::Impl
+ //
+ class YUMParser::Impl : private base::NonCopyable
+ {
+ public:
+ /** CTOR */
+ Impl(
+ const data::RecordId & repository_id,
+ data::ResolvableDataConsumer & consumer,
+ const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc()
+ );
+
+ /** Implementation of \ref YUMParser::parse(Pathname) */
+ void parse(const Pathname &cache_dir);
+
+ /**
+ * Iterates through parser \ref _jobs and executes them using
+ * *FileReader classes.
+ *
+ * \param path location of the raw repository cache
+ */
+ void doJobs(const Pathname & path);
+
+ /**
+ * Callback for processing data returned from \ref RepomdFileReader.
+ * Adds returned files to parser job list (\ref _jobs).
+ *
+ * \param loc location of discovered data file
+ * \param dtype YUM data type
+ */
+ bool repomd_CB(const OnMediaLocation & loc, const YUMResourceType & dtype);
+
+ /**
+ * Callback for processing packages returned from \ref PrimaryFileReader.
+ * Uses \ref _consumer to process read package data.
+ *
+ * \param package_r pointer to package data
+ */
+ bool primary_CB(const data::Package_Ptr & package_r);
+
+ /**
+ * Callback for processing data returned from \ref PatchesFileReader.
+ * Adds discovered patch*.xml files to parser \ref _jobs.
+ *
+ * \param loc location of discovered patch file
+ * \param patch_id (not used so far)
+ */
+ bool patches_CB(const OnMediaLocation &loc, const std::string & patch_id);
+
+ /**
+ * Callback for processing data returned from \ref PatchFileReader.
+ * Uses \ref _consumer to process read patch data.
+ *
+ * \param patch pointer to patch data
+ */
+ bool patch_CB(const data::Patch_Ptr & patch);
+
+ /**
+ * Callback for processing data returned from \ref OtherFileReader.
+ * Uses \ref _consumer to process read changelog data.
+ *
+ * \param res_ptr resolvable to which the changelog belongs
+ * \param changelog read changelog
+ */
+ bool other_CB(const data::Resolvable_Ptr & res_ptr, const Changelog & changelog);
+
+ /**
+ * Callback for processing data returned from \ref FilelistsFileReader.
+ * Uses \ref _consumer to process read filelist.
+ *
+ * \param res_ptr resolvable to which the filelist belongs.
+ * \param filenames the read filelist
+ */
+ 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);
+
+ /**
+ * 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:
+ /** ID of the repository record in the DB (repositories.id) */
+ data::RecordId _repository_id;
+
+ /** Object for processing the read data */
+ data::ResolvableDataConsumer & _consumer;
+
+ /** List of parser jobs read from repomd.xml and patches.xml files. */
+ std::list<YUMParserJob> _jobs;
+
+ /** Progress reporting object for overall YUM parser progress. */
+ ProgressData _ticks;
+ };
+ ///////////////////////////////////////////////////////////////////////////
+
+
+ YUMParser::Impl::Impl(
const data::RecordId & repository_id,
data::ResolvableDataConsumer & consumer,
const ProgressData::ReceiverFnc & progress)
:
- _consumer(consumer), _repository_id(repository_id)
+ _repository_id(repository_id), _consumer(consumer)
{
_ticks.name("YUMParser");
_ticks.sendTo(progress);
@@ -54,7 +191,7 @@
// -------------------------------------------------------------------------
- bool YUMParser::repomd_CB(
+ bool YUMParser::Impl::repomd_CB(
const OnMediaLocation & loc, const YUMResourceType & dtype)
{
DBG << "Adding " << dtype
@@ -67,7 +204,7 @@
// -------------------------------------------------------------------------
- bool YUMParser::primary_CB(const data::Package_Ptr & package_r)
+ bool YUMParser::Impl::primary_CB(const data::Package_Ptr & package_r)
{
_consumer.consumePackage( _repository_id, package_r );
@@ -83,11 +220,11 @@
// -------------------------------------------------------------------------
- bool YUMParser::patches_CB(
+ bool YUMParser::Impl::patches_CB(
const OnMediaLocation & loc, const string & patch_id)
{
DBG << "Adding patch " << loc.filename() << " to YUMParser jobs " << endl;
-
+
_jobs.push_back(YUMParserJob(loc.filename(), YUMResourceType::PATCH));
return true;
@@ -95,7 +232,7 @@
// -------------------------------------------------------------------------
- bool YUMParser::patch_CB(const data::Patch_Ptr & patch)
+ bool YUMParser::Impl::patch_CB(const data::Patch_Ptr & patch)
{
_consumer.consumePatch( _repository_id, patch );
@@ -109,7 +246,7 @@
// -------------------------------------------------------------------------
- bool YUMParser::other_CB(
+ bool YUMParser::Impl::other_CB(
const data::Resolvable_Ptr & res_ptr, const Changelog & changelog)
{
_consumer.consumeChangelog(_repository_id, res_ptr, changelog);
@@ -126,7 +263,7 @@
// -------------------------------------------------------------------------
- bool YUMParser::filelist_CB(
+ bool YUMParser::Impl::filelist_CB(
const data::Resolvable_Ptr & res_ptr, const data::Filenames & filenames)
{
_consumer.consumeFilelist(_repository_id, res_ptr, filenames);
@@ -141,9 +278,9 @@
return true;
}
- // -------------------------------------------------------------------------
+ // --------------------------------------------------------------------------
- bool YUMParser::pattern_CB(const data::Pattern_Ptr & product_ptr)
+ bool YUMParser::Impl::pattern_CB(const data::Pattern_Ptr & product_ptr)
{
_consumer.consumePattern(_repository_id, product_ptr);
@@ -152,9 +289,9 @@
return true;
}
- // -------------------------------------------------------------------------
+ // --------------------------------------------------------------------------
- bool YUMParser::product_CB(const data::Product_Ptr & product_ptr)
+ bool YUMParser::Impl::product_CB(const data::Product_Ptr & product_ptr)
{
_consumer.consumeProduct(_repository_id, product_ptr);
@@ -164,13 +301,13 @@
return true;
}
- // -------------------------------------------------------------------------
+ // --------------------------------------------------------------------------
- void YUMParser::start(const Pathname &cache_dir)
+ void YUMParser::Impl::parse(const Pathname &cache_dir)
{
zypp::parser::yum::RepomdFileReader(
cache_dir + "/repodata/repomd.xml",
- bind(&YUMParser::repomd_CB, this, _1, _2));
+ bind(&YUMParser::Impl::repomd_CB, this, _1, _2));
_ticks.range(_jobs.size());
@@ -181,9 +318,9 @@
_ticks.toMax();
}
- // -------------------------------------------------------------------------
+ // --------------------------------------------------------------------------
- void YUMParser::doJobs(const Pathname &cache_dir)
+ void YUMParser::Impl::doJobs(const Pathname &cache_dir)
{
for(list<YUMParserJob>::const_iterator it = _jobs.begin();
it != _jobs.end(); ++it)
@@ -199,7 +336,7 @@
{
zypp::parser::yum::PrimaryFileReader(
cache_dir + job.filename(),
- bind(&YUMParser::primary_CB, this, _1),
+ bind(&YUMParser::Impl::primary_CB, this, _1),
&progress_function);
break;
}
@@ -208,7 +345,7 @@
{
zypp::source::yum::PatchesFileReader(
cache_dir + job.filename(),
- bind(&YUMParser::patches_CB, this, _1, _2));
+ bind(&YUMParser::Impl::patches_CB, this, _1, _2));
// reset progress reporter max value (number of jobs changed if
// there are patches to parse)
_ticks.range(_jobs.size());
@@ -219,7 +356,7 @@
{
zypp::parser::yum::PatchFileReader(
cache_dir + job.filename(),
- bind(&YUMParser::patch_CB, this, _1));
+ bind(&YUMParser::Impl::patch_CB, this, _1));
break;
}
@@ -227,7 +364,7 @@
{
WAR << "ignoring other.xml.gz for now..." << endl;
/*
- zypp::parser::yum::OtherFileReader(
+ zypp::parser::yum::Impl::OtherFileReader(
cache_dir + job.filename(),
bind(&YUMParser::other_CB, this, _1, _2),
&progress_function);
@@ -239,7 +376,7 @@
{
zypp::parser::yum::FilelistsFileReader(
cache_dir + job.filename(),
- bind(&YUMParser::filelist_CB, this, _1, _2),
+ bind(&YUMParser::Impl::filelist_CB, this, _1, _2),
&progress_function);
break;
}
@@ -248,7 +385,7 @@
{
zypp::parser::yum::PatternFileReader(
cache_dir + job.filename(),
- bind(&YUMParser::pattern_CB, this, _1));
+ bind(&YUMParser::Impl::pattern_CB, this, _1));
break;
}
@@ -256,7 +393,7 @@
{
zypp::parser::yum::ProductFileReader(
cache_dir + job.filename(),
- bind(&YUMParser::product_CB, this, _1));
+ bind(&YUMParser::Impl::product_CB, this, _1));
break;
}
@@ -273,9 +410,33 @@
}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS : YUMParser
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ YUMParser::YUMParser(
+ const data::RecordId & repository_id,
+ data::ResolvableDataConsumer & consumer,
+ const ProgressData::ReceiverFnc & progress)
+ :
+ _pimpl(new Impl(repository_id, consumer, progress))
+ {}
+
+
+ YUMParser::~YUMParser()
+ {}
+
+
+ void YUMParser::parse(const Pathname & cache_dir)
+ {
+ _pimpl->parse(cache_dir);
+ }
+
+
} // ns yum
} // ns parser
} // ns zypp
// vim: set ts=2 sts=2 sw=2 et ai:
-
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 Mon May 28 16:17:38 2007
@@ -6,19 +6,21 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp2/parser/yum/YUMParser.h
+ *
+ * YUM parser public API definition.
+ */
#ifndef YUMPARSER_H_
#define YUMPARSER_H_
-#include "zypp/base/Logger.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
+
+#include "zypp/data/RecordId.h"
#include "zypp/data/ResolvableDataConsumer.h"
-#include "zypp/data/ResolvableData.h"
-#include "zypp/source/yum/YUMResourceType.h"
-#include "zypp/ProgressData.h"
-#include "zypp/Changelog.h"
+#include "zypp/ProgressData.h"
-using zypp::source::yum::YUMResourceType;
namespace zypp
{
@@ -29,25 +31,6 @@
/**
- * Structure encapsulating YUM parser data type and filename.
- */
- struct YUMParserJob
- {
- YUMParserJob(const Pathname & filename, const YUMResourceType & type)
- : _filename(filename), _type(type) {}
-
- const Pathname & filename() const { return _filename; }
- const YUMResourceType & type() const { return _type; }
-
- private:
- /** File to be processed */
- Pathname _filename;
- /** Type of YUM file */
- YUMResourceType _type;
- };
-
-
- /**
* YUM metada parser.
*
* Reads repomd.xml file to get the list of files to parse and enques them
@@ -57,24 +40,24 @@
*
*
* \code
- *
+ *
* cache::CacheStore store(dbdir);
* data::RecordId repository_id = store.lookupOrAppendRepository(sourceurl, "/");
*
* YUMParser parser(repository_id, store, &progress_function);
- * parser.start(source_cache_dir);
+ * parser.parse(source_cache_dir);
*
* store.commit();
*
* \code
*
- * TODO make the parser configurable, e.g. exclude(FILELISTS_e)?
+ * \todo make the parser configurable, e.g. exclude(FILELISTS_e)?
*
* \see RepomdFileReader, PrimaryFileReader, OtherFileReader
* \see FilelistsFileReader, PatchesFileReader, PatchFileReader
* \see PatternFileReader, ProductFileReader
*/
- class YUMParser
+ class YUMParser : private base::NonCopyable
{
public:
@@ -90,106 +73,25 @@
data::ResolvableDataConsumer & consumer,
const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc()
);
+
+ /**
+ * DTOR
+ */
+ ~YUMParser();
/**
* Starts parsing of repository cache dir located at \a path.
*
* This method uses RepomdFileReader to get a list of parser jobs
- * and calls \ref doJobs(Pathname) to do them.
- *
- * \param path location of the raw repository cache
- */
- void start(const Pathname & path);
-
- private:
- /**
- * Iterates through parser \ref _jobs and executes them using
- * *FileReader classes.
+ * and calls \ref Impl::doJobs(Pathname) to do them.
*
* \param path location of the raw repository cache
*/
- void doJobs(const Pathname & path);
-
- /**
- * Callback for processing data returned from \ref RepomdFileReader.
- * Adds returned files to parser job list (\ref _jobs).
- *
- * \param loc location of discovered data file
- * \param dtype YUM data type
- */
- bool repomd_CB(const OnMediaLocation & loc, const YUMResourceType & dtype);
-
- /**
- * Callback for processing packages returned from \ref PrimaryFileReader.
- * Uses \ref _consumer to process read package data.
- *
- * \param package_r pointer to package data
- */
- bool primary_CB(const data::Package_Ptr & package_r);
-
- /**
- * Callback for processing data returned from \ref PatchesFileReader.
- * Adds discovered patch*.xml files to parser \ref _jobs.
- *
- * \param loc location of discovered patch file
- * \param patch_id (not used so far)
- */
- bool patches_CB(const OnMediaLocation &loc, const std::string & patch_id);
-
- /**
- * Callback for processing data returned from \ref PatchFileReader.
- * Uses \ref _consumer to process read patch data.
- *
- * \param patch pointer to patch data
- */
- bool patch_CB(const data::Patch_Ptr & patch);
-
- /**
- * Callback for processing data returned from \ref OtherFileReader.
- * Uses \ref _consumer to process read changelog data.
- *
- * \param res_ptr resolvable to which the changelog belongs
- * \param changelog read changelog
- */
- bool other_CB(const data::Resolvable_Ptr & res_ptr, const Changelog & changelog);
-
- /**
- * Callback for processing data returned from \ref FilelistsFileReader.
- * Uses \ref _consumer to process read filelist.
- *
- * \param res_ptr resolvable to which the filelist belongs.
- * \param filenames the read filelist
- */
- 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);
-
- /**
- * 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);
+ void parse(const Pathname & path);
private:
- /** Object for processing the read data */
- data::ResolvableDataConsumer & _consumer;
-
- /** ID of the repository record in the DB (repositories.id) */
- data::RecordId _repository_id;
-
- /** List of parser jobs read from repomd.xml and patches.xml files. */
- std::list<YUMParserJob> _jobs;
-
- /** Progress reporting object for overall YUM parser progress. */
- ProgressData _ticks;
+ class Impl;
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
@@ -200,4 +102,3 @@
#endif /*YUMPARSER_H_*/
// vim: set ts=2 sts=2 sw=2 et ai:
-
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0