Author: mlandres
Date: Mon Apr 14 12:02:20 2008
New Revision: 9603
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9603&view=rev
Log:
Enable evaluation of hardware dependencies.
Modified:
trunk/libzypp/devel/devel.ma/NewPool.cc
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/sat/detail/PoolImpl.cc
trunk/libzypp/zypp/sat/detail/PoolImpl.h
trunk/libzypp/zypp/target/modalias/Modalias.cc
trunk/libzypp/zypp/target/modalias/Modalias.h
Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.cc?rev=9603&r1=9602&r2=9603&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Mon Apr 14 12:02:20 2008
@@ -637,12 +637,12 @@
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- {
+ if ( 0 ) {
Measure x( "PROCXY" );
pool.proxy();
}
- {
+ if ( 0 ) {
Measure x( "ALL PATTERNS" );
for_( it, pool.byKindBegin<Pattern>(), pool.byKindEnd<Pattern>() )
@@ -661,7 +661,7 @@
}
}
- if ( 0 )
+ if ( 1 )
{
PoolItem pi ( getPi<Package>("amarok") );
MIL << pi << endl;
@@ -670,8 +670,8 @@
pi.status().setTransact( true, ResStatus::USER );
solve();
vdumpPoolStats( USR << "Transacting:"<< endl,
- make_filter_beginresfilter::ByTransact(pool),
- make_filter_endresfilter::ByTransact(pool) ) << endl;
+ make_filter_beginresfilter::ByTransact(pool),
+ make_filter_endresfilter::ByTransact(pool) ) << endl;
}
}
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=9603&r1=9602&r2=9603&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Mon Apr 14 12:02:20 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Apr 14 12:01:13 CEST 2008 - ma@suse.de
+
+- Enable evaluation of hardware dependencies.
+- revision 9603
+
+-------------------------------------------------------------------
Sun Apr 13 02:17:25 CEST 2008 - jkupec@suse.cz
- RawMetadataRefreshPolicy: CheckIfNeededIgnoreDelay added
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl.cc?rev=9603&r1=9602&r2=9603&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.cc (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.cc Mon Apr 14 12:02:20 2008
@@ -25,6 +25,8 @@
#include "zypp/Capability.h"
#include "zypp/Locale.h"
+#include "zypp/target/modalias/Modalias.h"
+
using std::endl;
#undef ZYPP_BASE_LOGGER_LOGGROUP
@@ -67,15 +69,40 @@
}
}
- detail::IdType PoolImpl::nsCallback( struct _Pool *, void *data, detail::IdType lhs, detail::IdType rhs )
+ detail::IdType PoolImpl::nsCallback( struct _Pool *, void * data, detail::IdType lhs, detail::IdType rhs )
{
- if ( lhs == NAMESPACE_LANGUAGE )
+ // lhs: the namespace identifier, e.g. NAMESPACE:MODALIAS
+ // rhs: the value, e.g. pci:v0000104Cd0000840[01]sv*sd*bc*sc*i*
+ // return: 0 if not supportded
+ // 1 if supported by the system
+ // -1 AFAIK it's also possible to return a list of solvables that support it, but don't know how.
+
+ static const detail::IdType RET_unsupported = 0;
+ static const detail::IdType RET_systemProperty = 1;
+ switch ( lhs )
{
- const std::tr1::unordered_set<IdString> & locale2Solver( reinterpret_cast(data)->_locale2Solver );
- return locale2Solver.find( IdString(rhs) ) == locale2Solver.end() ? 0 : 1;
+ case NAMESPACE_LANGUAGE:
+ {
+ const std::tr1::unordered_set<IdString> & locale2Solver( reinterpret_cast(data)->_locale2Solver );
+ return locale2Solver.find( IdString(rhs) ) == locale2Solver.end() ? RET_unsupported : RET_systemProperty;
+ }
+ break;
+
+ case NAMESPACE_MODALIAS:
+ {
+ return target::Modalias::instance().query( IdString(rhs) ) ? RET_systemProperty : RET_unsupported;
+ }
+ break;
+
+ case NAMESPACE_FILESYSTEM:
+ {
+
+ }
+ break;
}
- DBG << Capability( lhs ) << " vs. " << Capability( rhs ) << endl;
- return 0;
+
+ INT << "Unhandled " << Capability( lhs ) << " vs. " << Capability( rhs ) << endl;
+ return RET_unsupported;
}
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl.h?rev=9603&r1=9602&r2=9603&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.h (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.h Mon Apr 14 12:02:20 2008
@@ -78,6 +78,7 @@
*/
void depSetDirty( const char * a1 = 0, const char * a2 = 0, const char * a3 = 0 );
+ /** Callback to resolve namespace dependencies (language, modalias, filesystem, etc.). */
static detail::IdType nsCallback( ::_Pool *, void * data, detail::IdType lhs, detail::IdType rhs );
public:
Modified: trunk/libzypp/zypp/target/modalias/Modalias.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/modalias/Modalias.cc?rev=9603&r1=9602&r2=9603&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/modalias/Modalias.cc (original)
+++ trunk/libzypp/zypp/target/modalias/Modalias.cc Mon Apr 14 12:02:20 2008
@@ -9,25 +9,29 @@
/** \file zypp/target/modalias/Modalias.cc
*
*/
-#include <iostream>
-
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "MODALIAS"
-#include "zypp/base/Logger.h"
-
-#include "zypp/target/modalias/Modalias.h"
-
-#include <cstdlib>
-#include
+extern "C"
+{
#include
#include
#include
#include
#include
#include
+}
+#include <cstdlib>
+#include <cstdio>
#include <cstring>
#include <cerrno>
+#include <iostream>
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "MODALIAS"
+#include "zypp/base/Logger.h"
+
+#include "zypp/target/modalias/Modalias.h"
+
+
using std::endl;
using std::string;
@@ -39,7 +43,7 @@
namespace target
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- namespace modalias
+ namespace
{ /////////////////////////////////////////////////////////////////
/*
@@ -49,7 +53,7 @@
* If FUNC returns a non-zero return value, stop reading the directory
* and return that value. Returns -1 if an error occurs.
*/
-static int
+int
foreach_file(const char *path, int (*func)(const char *, const char *, void *),
void *arg)
{
@@ -81,7 +85,7 @@
* If DIR/FILE/modalias exists, remember this modalias on the linked modalias list
* passed in in ARG. Never returns an error.
*/
-static int
+int
read_modalias(const char *dir, const char *file, void *arg)
{
char path[PATH_MAX];
@@ -120,7 +124,7 @@
* and remembers all module aliases for those devices on
* the linked modalias list passed in in ARG.
*/
-static int
+int
iterate_bus(const char *dir, const char *file, void *arg)
{
char path[PATH_MAX];
@@ -136,7 +140,7 @@
* and remembers all module aliases for those devices on
* the linked modalias list passed in in ARG.
*/
-static int
+int
iterate_class(const char *dir, const char *file, void *arg)
{
char path[PATH_MAX];
@@ -147,6 +151,10 @@
return 0;
}
+ /////////////////////////////////////////////////////////////////
+ } // namespace
+ ///////////////////////////////////////////////////////////////////
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Modalias::Impl
@@ -186,82 +194,31 @@
}
}
- /**
- * query for modalias capability present
- */
-
- bool query( const std::string & cap_r ) const
- { return query( cap_r, Rel::ANY, std::string() ); }
-
- /**
- * query for modalias capability having a specific value
+ /*
+ * Check if a device on the system matches a modalias PATTERN.
+ *
+ * Returns NULL if no matching device is found, and the modalias
+ * of the first matching device otherwise. (More than one device
+ * may match a given pattern.)
+ *
+ * On a system that has the following device,
+ *
+ * pci:v00008086d0000265Asv00008086sd00004556bc0Csc03i00
+ *
+ * modalias_matches("pci:v00008086d0000265Asv*sd*bc*sc*i*") will
+ * return a non-NULL value.
*/
- bool query( const std::string & cap_r,
- Rel op_r,
- const std::string & val_r ) const
+ bool query( const char * cap_r ) const
{
-
- /*
- * Check if a device on the system matches a modalias PATTERN.
- *
- * Returns NULL if no matching device is found, and the modalias
- * of the first matching device otherwise. (More than one device
- * may match a given pattern.)
- *
- * On a system that has the following device,
- *
- * pci:v00008086d0000265Asv00008086sd00004556bc0Csc03i00
- *
- * modalias_matches("pci:v00008086d0000265Asv*sd*bc*sc*i*") will
- * return a non-NULL value.
- */
-
- struct modalias_list *l;
- for (l = _modaliases; l; l = l->next) {
- if ( fnmatch( cap_r.c_str(), l->modalias, 0 ) == 0 )
- return true;
- }
- return false;
-
-#if 0 // once we get a capabilities values, we can compare it ...
- if (value) {
- string lhs (value);
- int cmp = (lhs != rhs) ? ((lhs < rhs) ? -1 : 1) : 0;
-
- switch ( relation.inSwitch() )
- {
- case Rel::EQ_e:
- res = (cmp == 0);
- break;
- case Rel::NE_e:
- res = (cmp != 0);
- break;
- case Rel::LT_e:
- res = (cmp == -1);
- break;
- case Rel::LE_e:
- res = (cmp != 1);
- break;
- case Rel::GT_e:
- res = (cmp == 1);
- break;
- case Rel::GE_e:
- res = (cmp != -1);
- break;
- case Rel::ANY_e:
- res = true;
- break;
- case Rel::NONE_e:
- res = false;
- break;
- default:
- // We shouldn't get here.
- INT << "Unknown relational opertor '" << relation << "' treated as 'NONE'" << endl;
- break;
- }
- }
-#endif
-
+ if ( cap_r )
+ {
+ struct modalias_list *l;
+ for (l = _modaliases; l; l = l->next) {
+ if ( fnmatch( cap_r, l->modalias, 0 ) == 0 )
+ return true;
+ }
+ }
+ return false;
}
public:
@@ -323,14 +280,9 @@
// Foreward to implenemtation
///////////////////////////////////////////////////////////////////
-bool Modalias::query( const std::string & cap_r ) const
+bool Modalias::query( const char * cap_r ) const
{ return _pimpl->query( cap_r ); }
-bool Modalias::query( const std::string & cap_r,
- Rel op_r,
- const std::string & val_r ) const
-{ return _pimpl->query( cap_r, op_r, val_r ); }
-
/******************************************************************
**
** FUNCTION NAME : operator<<
@@ -341,9 +293,6 @@
return str << *obj._pimpl;
}
-/////////////////////////////////////////////////////////////////
- } // namespace modalias
- ///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace target
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/target/modalias/Modalias.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/modalias/Modalias.h?rev=9603&r1=9602&r2=9603&view=diff
==============================================================================
--- trunk/libzypp/zypp/target/modalias/Modalias.h (original)
+++ trunk/libzypp/zypp/target/modalias/Modalias.h Mon Apr 14 12:02:20 2008
@@ -16,7 +16,7 @@
#include <string>
#include "zypp/base/PtrTypes.h"
-#include "zypp/Rel.h"
+#include "zypp/IdString.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -24,20 +24,16 @@
///////////////////////////////////////////////////////////////////
namespace target
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace modalias
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : Modalias
- //
- /** Hardware abstaction layer.
- * Singleton.
- */
- class Modalias
- {
- friend std::ostream & operator<<( std::ostream & str, const Modalias & obj );
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : Modalias
+ //
+ /** Hardware abstaction layer singleton.
+ */
+ class Modalias
+ {
+ friend std::ostream & operator<<( std::ostream & str, const Modalias & obj );
public:
/** Implementation */
@@ -52,13 +48,28 @@
public:
- /** */
- bool query( const std::string & cap_r ) const;
-
- /** */
- bool query( const std::string & cap_r,
- Rel op_r,
- const std::string & val_r ) const;
+ /** Checks if a device on the system matches a modalias pattern.
+ *
+ * Returns \c false if no matching device is found, and the modalias
+ * of the first matching device otherwise. (More than one device
+ * may match a given pattern.)
+ *
+ * On a system that has the following device,
+ * \code
+ * pci:v00008086d0000265Asv00008086sd00004556bc0Csc03i00
+ * \endcode
+ * the following query will return \c true:
+ * \code
+ * modalias_matches("pci:v00008086d0000265Asv*sd*bc*sc*i*")
+ * \endcode
+ */
+ bool query( IdString cap_r ) const
+ { return query( cap_r.c_str() ); }
+ /** \overload */
+ bool query( const char * cap_r ) const;
+ /** \overload */
+ bool query( const std::string & cap_r ) const
+ { return query( cap_r.c_str() ); }
private:
/** Singleton ctor. */
@@ -66,15 +77,12 @@
/** Pointer to implementation */
RW_pointer<Impl> _pimpl;
- };
- ///////////////////////////////////////////////////////////////////
+ };
+ ///////////////////////////////////////////////////////////////////
- /** \relates Modalias Stream output */
- std::ostream & operator<<( std::ostream & str, const Modalias & obj );
+ /** \relates Modalias Stream output */
+ std::ostream & operator<<( std::ostream & str, const Modalias & obj );
- /////////////////////////////////////////////////////////////////
- } // namespace modalias
- ///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace target
///////////////////////////////////////////////////////////////////
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org